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 » Developing U++ » U++ Developers corner » Value with type float
Re: Value with type float [message #58231 is a reply to message #58227] Fri, 01 April 2022 11:03 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14256
Registered: November 2005
Ultimate Member
abductee23 wrote on Thu, 31 March 2022 11:51

having a flot in memory - writing it out through value/json , then reading it again incurs a conversion and its not the same number - ( i guess on a personal level i am probably puzzled how this is not bothering you - but thats beside the point)


But that is altogether different issue! Converting float or double to decimal text and back involves completely different set of problems.

Frankly, current "stable" version (2021.1) has this botched up a bit. Here the IEEE standard states that 15 digit double numbers must be converted from text and back without a change. We were short on this promise, but this is hopefully fixed in the upcoming version.

Anyway, conversion from float to double is basically only adding zeroes to mantissa, converting from double back to float involves in most cases (*) just rounding the same additional bits (if they are zero, rounding is obviously down).

(*) - there is of course issue of range (float is about e-38 to e+38 while double e-308 to e-308) and denormals, but that is in most cases bedides the point..

Mirek
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Build U++ with CMake and Clang Example
Next Topic: A temporary solution to garbled code in U++applications built through MSVC
Goto Forum:
  


Current Time: Thu May 01 05:56:54 CEST 2025

Total time taken to generate the page: 0.01169 seconds