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 previous 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
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Format new double formatter(s)
Next Topic: 32 bit wchar - for now in branch
Goto Forum:
  


Current Time: Sat Apr 27 17:23:32 CEST 2024

Total time taken to generate the page: 0.02003 seconds