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 #60197 is a reply to message #58503] Wed, 04 October 2023 09:55 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14256
Registered: November 2005
Ultimate Member
Just revisting this issue...

Tom1 wrote on Fri, 03 June 2022 12:03

- I can use Value with float as easily as with double without explicit type casts anywhere


Yes.

Quote:

- Assigning a float to Value reads back from Value exactly the same as it went in


If "reads back" means text output, then yes.

Quote:

- If EditFloat* is again replaced by EditDouble*, the behavior is exactly the same as it is now with EditFloat*


Should work.

Quote:

- float supports Null


No. Is that a problem?

Quote:

Maybe the precision hint you are suggesting could be automatically initialized in Value(double) / Value(float) constructors and assignment operators =(double) / =(float) to suit the assigned data type?


That was exactly the plan.

I think advantage of this solution is that it allows you to specify arbitrary precision for any double-holding Value. E.g.

	double x = 3.14159;
	Value json;
	json("pi") = Precision(x, 2); // Precision does not exist yet
	DDUMP(AsJSON(json));


{"pi":3.14}


Still an idea though.
 
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 07:42:54 CEST 2025

Total time taken to generate the page: 0.01017 seconds