{"id":15373035,"url":"https://github.com/vi/float-pretty-print","last_synced_at":"2025-04-15T12:31:40.838Z","repository":{"id":57630475,"uuid":"185311050","full_name":"vi/float-pretty-print","owner":"vi","description":"Format f64 in Rust with minimum and maximum width, auto switching between scientific and normal representation","archived":false,"fork":false,"pushed_at":"2021-10-02T21:48:49.000Z","size":49,"stargazers_count":10,"open_issues_count":1,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-28T21:12:10.546Z","etag":null,"topics":["f64","float","format","human-readable","pretty-print","print","rust","string"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-07T03:04:54.000Z","updated_at":"2023-06-13T04:29:33.000Z","dependencies_parsed_at":"2022-09-26T20:11:30.321Z","dependency_job_id":null,"html_url":"https://github.com/vi/float-pretty-print","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vi%2Ffloat-pretty-print","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vi%2Ffloat-pretty-print/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vi%2Ffloat-pretty-print/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vi%2Ffloat-pretty-print/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vi","download_url":"https://codeload.github.com/vi/float-pretty-print/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248741189,"owners_count":21154255,"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":["f64","float","format","human-readable","pretty-print","print","rust","string"],"created_at":"2024-10-01T13:54:08.394Z","updated_at":"2025-04-15T12:31:40.592Z","avatar_url":"https://github.com/vi.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# float-pretty-print\n\nRound and format f64 number for showing it to humans, with configurable minimum and maximum width.\nIt automatically switches between exponential and usual forms as it sees fit.\n\nIt works by trying usual `format!`, possibly multiple times and inspecting the resulting string.\n\nOnly two formatting parameters are supported:\n\n* width is minimum width\n* precision is maximum width\n\n`###` is printed if it can't output the number with given constraint.\n\nExample:\n\n```rust\n  use float_pretty_print::PrettyPrintFloat;\n  assert_eq!(format!(\"{}\", PrettyPrintFloat(3.45)), \"3.45\");\n  assert_eq!(format!(\"{}\", PrettyPrintFloat(12.0)), \"12.0\");\n  assert_eq!(format!(\"{}\", PrettyPrintFloat(120000000.0)), \"1.2e8\");\n  assert_eq!(format!(\"{:5.5}\", PrettyPrintFloat(12345.0)), \"12345\");\n  assert_eq!(format!(\"{:5.5}\", PrettyPrintFloat(12.345)), \"12.35\");\n  assert_eq!(format!(\"{:5.5}\", PrettyPrintFloat(0.12345)), \"0.123\");\n  assert_eq!(format!(\"{:5.5}\", PrettyPrintFloat(1234500000.0)), \"1.2e9\");\n  assert_eq!(format!(\"{:5.5}\", PrettyPrintFloat(12345.0e-19)), \"1e-15\");\n  assert_eq!(format!(\"{:5.5}\", PrettyPrintFloat(12345.0e-100)), \"1e-96\");\n  assert_eq!(format!(\"{:5.5}\", PrettyPrintFloat(12345.0e-130)), \"    0\");\n  assert_eq!(format!(\"{:5.5}\", PrettyPrintFloat(12345.0e+130)), \"1e134\");\n  assert_eq!(format!(\"{:4.4}\", PrettyPrintFloat(12345.0e+130)), \"####\");\n  assert_eq!(format!(\"{:6.6}\", PrettyPrintFloat(12345.0e-130)), \"1e-126\");\n```\n\nSupports even Rust 1.23\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvi%2Ffloat-pretty-print","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvi%2Ffloat-pretty-print","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvi%2Ffloat-pretty-print/lists"}