5 ms·
I still have these problems > - programming language I decided to not use C, because it is unsafe, and write all my code in Pascal. Now the FreePascal double
by benibela 5y ago
I still have these problems
> - programming language
I decided to not use C, because it is unsafe, and write all my code in Pascal.
Now the FreePascal double parsing does not work correctly
For one, it always uses 80-bit float. Even if parsing a double, then it rounds the 80-bit float to double after parsing, so the last bit is usually wrongly rounded.
They refuse to fix it, because it is easier to maintain just one 80-bit float parsing function than multiple parsing functions for different types.
>- libraries used and their versions
So I moved to someone's double parsing library.
It just did not work. It simply lacked the algorithms required for full double precision parsing
But they were happy to fix it
>- FPU flags
After fixing it, that double parsing library still did not work ... on 32-bit
Although the library was implementing the correct operations. Turned out FreePascal compiles 64-bit using SSE, and 32-bit using FPU which was set to 80-bit precision
In reverse, formatting the double as string is also hard and ambiguous. FreePascal usually prints two decimal digits more than required (in the new implementation. They still had a broken implementation a handful years ago). I wrote my own implementation that prints the shortest decimal using arbitrary precision arithmetic, but that is really slow.
(I tried to use a library, but that did not have enough precision, and after they tried to fix it, it is completely broken.)