{"id":21419349,"url":"https://github.com/konstantin8105/pow","last_synced_at":"2025-07-14T06:31:07.053Z","repository":{"id":57481250,"uuid":"163608342","full_name":"Konstantin8105/pow","owner":"Konstantin8105","description":"replace golang math.Pow to optimal","archived":false,"fork":false,"pushed_at":"2023-05-13T16:28:49.000Z","size":6,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-17T12:16:50.011Z","etag":null,"topics":["bench","golang","pow","power-method"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Konstantin8105.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-12-30T18:20:15.000Z","updated_at":"2023-05-13T16:28:53.000Z","dependencies_parsed_at":"2024-06-20T05:45:36.575Z","dependency_job_id":"157bb497-f610-4079-a4a4-c89af9a1552a","html_url":"https://github.com/Konstantin8105/pow","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Konstantin8105%2Fpow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Konstantin8105%2Fpow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Konstantin8105%2Fpow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Konstantin8105%2Fpow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Konstantin8105","download_url":"https://codeload.github.com/Konstantin8105/pow/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225957049,"owners_count":17551318,"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","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":["bench","golang","pow","power-method"],"created_at":"2024-11-22T19:40:09.931Z","updated_at":"2024-11-22T19:40:10.603Z","avatar_url":"https://github.com/Konstantin8105.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pow\nreplace golang math.Pow to optimal\n\n#### godoc\n\n```\nFUNCTIONS\n\nfunc E2(x float64) float64\n    E2 function replace `math.Pow(x,2.0)`\n\nfunc E3(x float64) float64\n    E3 function replace `math.Pow(x,3.0)`\n\nfunc E4(x float64) float64\n    E4 function replace `math.Pow(x,4.0)`\n\nfunc En(x float64, e int) float64\n    En function replace `math.Pow(x,e)`\n```\n\n#### benchmark\n\n```\ngo test -bench=. -count=5 \u003e bench.txt\nbenchstat bench.txt \n```\n```\nname                time/op\n/math.Pow2-4        41.7ns ±11%\n/pow.E2-4           0.60ns ± 9%\n/pow.En2-4          6.88ns ± 1%\n\n/math.Pow3-4        39.1ns ± 1%\n/pow.E3-4           0.59ns ± 2%\n/pow.En3-4          7.80ns ± 2%\n\n/math.Pow4-4        42.8ns ± 2%\n/pow.E4-4           0.58ns ± 0%\n/pow.En4-4          7.76ns ± 3%\n\n/math.Pow(x,_51)-4  46.3ns ± 0%\n/pow.En(x,_51)-4    16.8ns ± 0%\n```\n\nSo, that package is more optimal at more 30 times.\n\n#### example\n\n```golang\nfunc Example() {\n\tx := 2.0\n\tr2 := pow.E2(x) // math.Pow(x, 2.0)\n\tr3 := pow.E3(x) // math.Pow(x, 3.0)\n\tfmt.Fprintf(os.Stdout, \"%.4f\\n\", r2)\n\tfmt.Fprintf(os.Stdout, \"%.4f\\n\", r3)\n\t// Output:\n\t// 4.0000\n\t// 8.0000\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkonstantin8105%2Fpow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkonstantin8105%2Fpow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkonstantin8105%2Fpow/lists"}