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 #58807 is a reply to message #58151] Tue, 06 September 2022 01:41 Go to previous messageGo to previous message
jimlef is currently offline  jimlef
Messages: 90
Registered: September 2020
Location: US
Member
Related to all this, the innacuracies due to the way the pc handles float/double numbers have been ... irking me as well. I was thinking of float instead of double, but that doesn't fix the issue (and there isn't any json support for float anyway). In my case, I just want sales tax to be 0.08 (or whatever, it's stored in json) - not 0.080000000000000002. I've tried to utilize FormatG and round functions to no joy. My solution has been to store and use ints instead of floating point, and do conversions in the program where needed. It handles positive and negative values effectively enough for my needs, and my little app was trivial to rework. Anyone wishing to torture themselves with my coding can view it at https://github.com/phoenixjim/Invoices Laughing . Some relevant portions are in config.cpp/h and the report files (In the reports folder) regarding how this is used. Convert.h/cpp has a few altered convert functions to match...

It's great how supportive the folks on this forum are - I hope this helps someone else Smile
 
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 01:21:15 CEST 2025

Total time taken to generate the page: 0.01264 seconds