ulfjack / ryu

Converts floating point numbers to decimal strings
Apache License 2.0
1.2k stars 100 forks source link

Is there a Bug in Master? #82

Closed alex-ilin closed 5 years ago

alex-ilin commented 5 years ago

In commit 388280c65c0f7e5d039cf8ce3fbb4acbf224fb6f the comment is "add comprehensive tests, finding a core algorithm bug." That commit is only included in the generate-full-output branch.

Does it mean that there was a bug discovered in the Ryu algorithm, which is currently not fixed in master?

I'm asking, because I'm porting Ryu into a different language, and would like to understand the current state.

Thank you!

ulfjack commented 5 years ago

The generate-full-output branch adds support for printf %e and %f formats (core Ryu only supports generating shortest round-trip-safe output, which has no direct relationship with printf), and there was a bug in an earlier version, which I've fixed as of commit 471e583518f5b31eafb392c15c9f62e69b16a056. I still need to reorganize the code a bit (and maybe add more tests) before merging the branch into master. I have a paper which explains the algorithmic differences from core Ryu, which is currently in double-blind review (so don't tell anyone :-).

ulfjack commented 5 years ago

The short answer is no, there are no known issues in the C implementation of Ryu. There is a known issue in the Java implementation, which doesn't round correctly to two digits in some cases - see #83.

There are no known issues in the new code at head (which only has a C implementation).

alex-ilin commented 5 years ago

Cool stuff, I'll keep my mouth shut! Thanks for all the great work! I've just finished porting Ryu to Factor. The last test ran successfully for the first time a few minutes ago. I'll send you the pull request to list the implementation in the readme, OK?

ulfjack commented 5 years ago

Sure!