Hacker News new | past | comments | ask | show | jobs | submit login

Input and output of floating point involves a decent amount of bigint math to do correctly. It's not surprising to me that it is slow -- doing it quickly is still an active area of research.

Writing a bit about that is still on my todo list.




I remember reading, years ago, a paper which provided an algorithm for converting an IEEE 754 into a string using only a fixed number machine word length scalars—but I certainly can't find it now.


I think you are looking for "Printing floating-point numbers quickly and accurately with integers (2010)".

http://dl.acm.org/citation.cfm?id=1806623

The title is play on "Printing floating-point numbers quickly and accurately (1996)", which in turn is play on "How to print floating-point numbers accurately (1990)".

http://dl.acm.org/citation.cfm?id=231397 http://dl.acm.org/citation.cfm?id=93559


I wonder if any C standard libraries have implemented this.


I understand that v8 is using this algorithm, and Julia also now uses it thanks to work by Jacob Quinn https://github.com/JuliaLang/julia/tree/master/base/grisu


Rust also now uses this algorithm, thanks to Kang Seonghoon: https://github.com/rust-lang/rust/tree/master/src/libcore/nu...

Rust implementation is heavily commented with beautiful ASCII diagrams.


Agreed, but it's mostly unnecessary on the logic side, maybe communicating through binary forms to avoid transcoding costs.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: