Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » U++ community news and announcements » text<->double conversions refactored
text<->double conversions refactored [message #57476] Sun, 29 August 2021 13:57 Go to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
After month of development I have today commited refactored text<->double conversion routines (FormatDouble, ScanDouble...)

New routines should(*) guarantee that

- ScanDouble(FormatDouble(x)) == x for all finite doubles
- FormatG(x, 17) returns the same text as printf("%.17g", x) for all doubles

New routines are in the same speed class as ryu, wich seems to be current performance standard (conversion in both directions is around 20ns on modern CPU). (well, I believe my algorithm would be actually faster than ryu if it was doing the same thing, but U++ provides a lot of options which slow it down a bit to basically "ryu equivalent speed").

(*) Well, the theory behind is a bit complicated and I am still ironing details, but from practical point of view I have tested it so far with 300 billions of random double numbers and continue to do so...

https://github.com/ultimatepp/ultimatepp/blob/420697e4630d89 2aaf61b0ab8ba797a810ab7e14/uppsrc/Core/CvFlt.cpp
Re: text<->double conversions refactored [message #57505 is a reply to message #57476] Sun, 12 September 2021 20:50 Go to previous messageGo to next message
zsolt is currently offline  zsolt
Messages: 693
Registered: December 2005
Location: Budapest, Hungary
Contributor
Thanks!
Re: text<->double conversions refactored [message #57671 is a reply to message #57476] Tue, 16 November 2021 09:44 Go to previous messageGo to next message
Tom1
Messages: 1212
Registered: March 2007
Senior Contributor
Hi Mirek,

Was it this change that caused compilation issue with my call:
FormatDoubleFix(value, 3, FD_SIGN|FD_ZEROS);

The compiler tells me the flags are not supported anymore.

How do I do get the same effect as with FD_SIGN|FD_ZEROS?

Best regards,

Tom

[Updated on: Tue, 16 November 2021 10:05]

Report message to a moderator

Re: text<->double conversions refactored [message #57672 is a reply to message #57671] Tue, 16 November 2021 10:03 Go to previous message
Tom1
Messages: 1212
Registered: March 2007
Senior Contributor
Nevermind, I found it. Now it's:
FormatF(value, 3, FD_ZEROS|FD_SIGN);

Best regards,

Tom
Previous Topic: Format new double formatter(s)
Next Topic: 32 bit wchar - for now in branch
Goto Forum:
  


Current Time: Thu Mar 28 13:00:10 CET 2024

Total time taken to generate the page: 0.01036 seconds