{"id":20440254,"url":"https://github.com/strainer/trigfills","last_synced_at":"2025-10-09T05:06:36.510Z","repository":{"id":57379899,"uuid":"90043540","full_name":"strainer/trigfills","owner":"strainer","description":"Sin, cos, tan, asin...  polyfills for when cross browser consistency is desired.","archived":false,"fork":false,"pushed_at":"2021-08-06T12:20:08.000Z","size":44,"stargazers_count":16,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-06T01:39:56.584Z","etag":null,"topics":["javascript","math","polyfills","trigonometric-functions"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/strainer.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-02T14:36:34.000Z","updated_at":"2025-06-04T23:38:16.000Z","dependencies_parsed_at":"2022-09-05T14:30:42.191Z","dependency_job_id":null,"html_url":"https://github.com/strainer/trigfills","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/strainer/trigfills","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strainer%2Ftrigfills","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strainer%2Ftrigfills/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strainer%2Ftrigfills/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strainer%2Ftrigfills/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/strainer","download_url":"https://codeload.github.com/strainer/trigfills/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strainer%2Ftrigfills/sbom","scorecard":{"id":854616,"data":{"date":"2025-08-11","repo":{"name":"github.com/strainer/trigfills","commit":"ede956a3f80d12a3c63ec07a2208d16ba29f927f"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/14 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-23T23:32:18.453Z","repository_id":57379899,"created_at":"2025-08-23T23:32:18.453Z","updated_at":"2025-08-23T23:32:18.453Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000741,"owners_count":26082933,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","math","polyfills","trigonometric-functions"],"created_at":"2024-11-15T09:23:12.930Z","updated_at":"2025-10-09T05:06:36.490Z","avatar_url":"https://github.com/strainer.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Trigfills\n=========\n\nSin, cos, tan, asin, acos atan atan2 polyfills for cross browser consistency.\n\n## Reason\n\nDifferences in trig function output between firefox and chrome, caused [strainer/fancy](github.com/strainer/fancy) simulations to run differently on the different browsers. Substituting the functions fixed this. \n\nThese replacements do not have the full accuracy which browser math functions have however they have about 10 decimal digits accuracy, provide consistency across browsers and even tend to run a little quicker.\n\n## Usage\n\n```javascript\n//require or import trigfills.js\n  \n  Trgf=require('./pathto/trigfills.js')\n\n//sin, cos, tan, asin, acos and atan methods\n//are all available on the object.\n\n  eg=Trgf.cos(rads)\n\n//run setmaths() to override Math.cos ,Math.sin etc...\n\n  Trgf.setmaths() \n\n//then Math trig functions are replaced with Trigfills:\n\n  Math.cos = Trgf.cos\n  Math.atan = Trgf.atan //etc... \n  Math.hasTrigfills = \"version string\"\n\n```\n\n## Algorithm/Developement\n\n[www.mathonweb.com](http://www.mathonweb.com/help_ebook/calc_funcs.htm) has well described and good algorithms for these math functions. I extended the minimum precision of these from about 6 digits to about 10, by extending a little the talyor series which were given, and then by mining tweaked factors (non-exhaustively).\n\n\n## Tests\n\n`drafts/test_node.log` contains nodes test output and `test_moz.log` a firefox output. \n\n#### Example Precision \u0026 Speed % :\n```javascript\nMath.tan(0.123)  // 0.1236240658 6927442   \nTrgf.tan(0.123)  // 0.1236240658 8797101  135% \nMath.sin(0.123)  // 0.12269009002 431533   \nTrgf.sin(0.123)  // 0.12269009002 68945   130%\nMath.cos(0.123)  // 0.99244503213 51935    \nTrgf.cos(0.123)  // 0.99244503213 90508   135% \nMath.atan(0.123) // 0.1223852814 7180266   \nTrgf.atan(0.123) // 0.1223852814 6213824  200% \nMath.atan2(1,23) // 0.043450895391 53084    \nTrgf.atan2(1,23) // 0.043450895391 40537  250% \nMath.asin(0.123) // 0.1233122751918 7199   \nTrgf.asin(0.123) // 0.1233122751818 901   130%\nMath.acos(0.123) // 1.447484051 6030247    \nTrgf.acos(0.123) // 1.447484051 6130065   100%\n```\n\n#### Foibles\n\n* Math.sin(Math.PI) returns `1.2246467991473532e-16` rather than 0 because `Math.PI` is a smidgen less that the true value of PI. This is explained in this [SO Topic](http://stackoverflow.com/questions/38295501/is-there-special-significance-to-16331239353195370-0) Trigfill's sin and cos do not follow this specification as the value is far below their noise floor. Math.sin(0) does return 0.\n\n* Math.tan(Math.PI/2) does not return Infinity because of the same idea. Trigfill's tan does comply with this, it does not return Infinity as this result could bug calculations not expecting it.  \n\n\nVersion\n=======\n 0.9.5 - Add atan2\n 0.9.4 - Minor speed tweaks\n 0.9.3 - Minor speed tweaks\n 0.9.2 - Working release candidate","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstrainer%2Ftrigfills","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstrainer%2Ftrigfills","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstrainer%2Ftrigfills/lists"}