{"id":18040599,"url":"https://github.com/overflowcat/sigfig","last_synced_at":"2026-01-29T07:01:38.580Z","repository":{"id":237324095,"uuid":"794290309","full_name":"OverflowCat/sigfig","owner":"OverflowCat","description":"Typst library for rounding numbers with significant figures and uncertainty","archived":false,"fork":false,"pushed_at":"2024-05-01T17:54:13.000Z","size":8,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"neko","last_synced_at":"2026-01-18T17:39:36.306Z","etag":null,"topics":["sigfig","typst","uncertainty"],"latest_commit_sha":null,"homepage":"","language":"Typst","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/OverflowCat.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,"zenodo":null}},"created_at":"2024-04-30T20:37:55.000Z","updated_at":"2025-12-17T11:23:06.000Z","dependencies_parsed_at":"2024-04-30T21:59:14.829Z","dependency_job_id":"f91640e3-ae61-497e-b8f3-8ae7a8664759","html_url":"https://github.com/OverflowCat/sigfig","commit_stats":null,"previous_names":["overflowcat/sigfig"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/OverflowCat/sigfig","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OverflowCat%2Fsigfig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OverflowCat%2Fsigfig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OverflowCat%2Fsigfig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OverflowCat%2Fsigfig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OverflowCat","download_url":"https://codeload.github.com/OverflowCat/sigfig/tar.gz/refs/heads/neko","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OverflowCat%2Fsigfig/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28868876,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-29T06:56:44.678Z","status":"ssl_error","status_checked_at":"2026-01-29T06:56:35.794Z","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":["sigfig","typst","uncertainty"],"created_at":"2024-10-30T15:07:03.266Z","updated_at":"2026-01-29T07:01:38.543Z","avatar_url":"https://github.com/OverflowCat.png","language":"Typst","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `sigfig`\r\n\r\n`sigfig` is a [Typst](https://typst.app/) library for rounding numbers with [significant figures](https://en.wikipedia.org/wiki/Significant_figures) and [measurement uncertainty](https://en.wikipedia.org/wiki/Measurement_uncertainty).\r\n\r\n## Overview\r\n\r\n```typ\r\n#import \"@preview/sigfig:0.1.0\": round, urounds\r\n#import \"@preview/unify:0.5.0\": num\r\n\r\n$ #num(round(98654, 3)) $\r\n$ #num(round(2.8977729e-3, 4)) $\r\n$ #num(round(-.0999, 2)) $\r\n$ #num(urounds(114514.19, 1.98)) $\r\n$ #num(urounds(1234.5678, 0.096)) $\r\n```\r\n\r\nyields\r\n\r\n\u003cimg src=\"https://github.com/typst/packages/assets/20166026/f3d69c3c-bc67-484f-81f9-80a10913fd11\" width=\"240px\"\u003e\r\n\r\n## Documentation\r\n\r\n### `round`\r\n\r\n`round` is similar to JavaScript's `Number.prototype.toPrecision()` ([ES spec](https://tc39.es/ecma262/multipage/numbers-and-dates.html#sec-number.prototype.toprecision)).\r\n\r\n```typ\r\n#assert(round(114514, 3) == \"1.15e5\")\r\n#assert(round(1, 5) == \"1.0000\")\r\n#assert(round(12345, 10) == \"12345.00000\")\r\n#assert(round(.00000002468, 3) == \"2.47e-8\")\r\n```\r\n\r\nNote that what is different from the ES spec is that there will be no sign ($+$) if the exponent after `e` is positive.\r\n\r\n### `uround`\r\n\r\n`uround` rounds a number with its uncertainty, and returns a string of both.\r\n\r\n```typ\r\n#assert(uround(114514, 1919) == \"1.15e5+-2e3\")\r\n#assert(uround(114514.0, 1.9) == \"114514+-2\")\r\n```\r\n\r\n### `urounds`\r\n\r\n`uround` rounds a number with its uncertainty, and returns a string of both with the same exponent, if any.\r\n\r\nYou can use `num` in `unify` to display the result.\r\n\r\n## License\r\n\r\nMIT © 2024 OverflowCat ([overflow.cat](https://about.overflow.cat)).\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foverflowcat%2Fsigfig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foverflowcat%2Fsigfig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foverflowcat%2Fsigfig/lists"}