Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: zsh converts a floating-point number to string with too much precision



2019-12-21 17:56:18 +0000, Stephane Chazelas:
> 2019-12-21 10:43:43 +0100, Roman Perepelitsa:
> [...]
> > There is no simple algorithm that achieves this. I recall reading long
> > papers a few years back that were describing various inventions in
> > this field. They were pretty scary.
> 
> https://github.com/openjdk/jdk/blob/f4af0eadb6eaf9d9614431110ab7fc9c1588966d/src/java.base/share/classes/jdk/internal/math/FloatingDecimal.java#L424
> is not exactly trivial. I enjoyed reading the comments even if I
> have not clue what the the code is doing.
[...]

Microsoft's STL implementation (to_chars) looks about as hairy:
https://github.com/microsoft/STL/blob/264b0d4a167daa9e5499af6d783c9ff22f7af03f/stl/inc/charconv

-- 
Stephane



Messages sorted by: Reverse Date, Date, Thread, Author