{"id":13561829,"url":"https://github.com/myrho/elm-round","last_synced_at":"2026-02-18T20:32:00.301Z","repository":{"id":12649988,"uuid":"72452211","full_name":"myrho/elm-round","owner":"myrho","description":"Round floats (mathematically/commercially) to a given number of decimal places","archived":false,"fork":false,"pushed_at":"2022-11-18T11:06:45.000Z","size":50,"stargazers_count":47,"open_issues_count":3,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-30T12:00:29.352Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://package.elm-lang.org/packages/myrho/elm-round/latest","language":"Elm","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/myrho.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":"2016-10-31T15:52:12.000Z","updated_at":"2025-09-22T20:40:42.000Z","dependencies_parsed_at":"2023-01-13T17:03:42.748Z","dependency_job_id":null,"html_url":"https://github.com/myrho/elm-round","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/myrho/elm-round","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myrho%2Felm-round","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myrho%2Felm-round/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myrho%2Felm-round/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myrho%2Felm-round/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/myrho","download_url":"https://codeload.github.com/myrho/elm-round/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myrho%2Felm-round/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29181268,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-06T23:15:33.022Z","status":"ssl_error","status_checked_at":"2026-02-06T23:15:09.128Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2024-08-01T13:01:01.754Z","updated_at":"2026-02-18T20:32:00.277Z","avatar_url":"https://github.com/myrho.png","language":"Elm","funding_links":[],"categories":["Elm"],"sub_categories":[],"readme":"# elm-round \n\nThis library converts a `Float` to a `String` with ultimate \ncontrol how many digits after the decimal point are shown and how the remaining \ndigits are rounded. It rounds, floors and ceils the \"common\" way (ie. [half \nup](https://en.wikipedia.org/wiki/Rounding#Round_half_up)) or the \"commercial\" \nway (ie. [half away from \nzero](https://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero)). \n\nExample:\n\n```elm\nx = 3.141592653589793\n\nround 2 x -- \"3.14\"\nround 4 x -- \"3.1416\"\n\nceiling 2 x -- \"3.15\"\nfloor 4 x -- \"3.1415\"\n```\n\nThe given number of digits after decimal point can also be negative.\n\n```elm\nx = 213.14\n\nround -2 x -- \"200\"\nround -1 x -- \"210\"\n\nceiling -2 x -- \"300\"\nfloor -3 x -- \"0\"\n```\n\n[Commercial \nrounding](https://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero) \nmeans that negative and positive numbers are treated symmetrically. It affects \nnumbers whose last digit equals 5. For example:\n\n```elm\nx = -0.5\n\nround 0 x -- \"0\"\nroundCom 0 x -- \"-1\"\n\nfloor 0 x -- \"-1\"\nfloorCom 0 x -- \"0\"\n\nceiling 0 x -- \"0\"\nceilingCom 0 x -- \"-1\"\n```\n\nHave a look at the tests for more examples!\n\nWhy couldn't you just do `x * 1000 |\u003e round |\u003e toFloat |\u003e (flip (/)) 1000` in \norder to round to 3 digits after comma? Due to floating point \narithmetic it might happen that it results into someting like \n`3.1416000000001`, \nalthough we just wanted `3.1416`. \n\nUnder the hood this library converts the `Float` into a `String` and rounds it \nchar-wise. Hence it's safe from floating point arithmetic weirdness.\n\n## Installation\n\nFrom the root of your [Elm](http://elm-lang.org) project run\n\n    elm install myrho/elm-round\n\nImport it in your Elm modules:\n\n```elm\nimport Round \n```\n\n## Releases\n\n| Version | Notes |\n| ------- | ----- |\n| 1.0.4   | Upgrade to Elm 0.19 |\n| 1.0.3   | Fix issues with number in scientific notation, complete rewrite. |\n| 1.0.2   | Given number of digits after decimal point can be negative. |\n| 1.0.1   | Upgrade to Elm 0.18 |\n| 1.0.0   | First official release, streamlined API and tests, docs added |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmyrho%2Felm-round","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmyrho%2Felm-round","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmyrho%2Felm-round/lists"}