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 #58810 is a reply to message #58808] Thu, 08 September 2022 14:49 Go to previous message
jimlef is currently offline  jimlef
Messages: 90
Registered: September 2020
Location: US
Member
Yes Cool That would be it I'm thinking

Thank you!

Jim

Oblivion wrote on Tue, 06 September 2022 16:42
Hello jimlef,

Do you mean this?

	RLOG(Format(
		"Pi(2): %.02f\n"
		"PI(4): %.04f\n"
		"PI(8): %.08f\n",
		roundr(M_PI, 2),
		roundr(M_PI, 4),
		roundr(M_PI, 8)
		));

	double tax = 0.0800000000123;
	String stax = FormatG(tax, 3);
	RLOG("Formatted tax: " << stax);
	RLOG("Scanned   tax: " << ScanDouble(stax));

	Json jtax_r("tax-rounded", roundr(tax, 2));
	Json jtax_n("tax", tax);

	RDUMP(jtax_r);
	RDUMP(jtax_n);



Pi(2): 3.10
PI(4): 3.1420
PI(8): 3.14159270

Formatted tax: 0.08
Scanned   tax: 0.08
jtax_r = {"tax-rounded":0.08}
jtax_n = {"tax":0.0800000000123}


[Edit: Code updated.]

Best regards,
Oblivion

 
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:10:35 CEST 2025

Total time taken to generate the page: 0.00443 seconds