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 » U++ Library support » U++ Core » FormatE() with 0.0
FormatE() with 0.0 [message #60065] Tue, 01 August 2023 08:35 Go to next message
koldo is currently offline  koldo
Messages: 3358
Registered: August 2008
Senior Veteran
Hi to all

When using FormatE() with a 0, the function seems to avoid considering some formatting flags, like FD_CAP_E and FD_MINIMAL_EXP.
An example:
Cout() << FormatE(0.0,  2, FD_CAP_E | FD_EXP | FD_MINIMAL_EXP); // 0.00e+00
Cout() << FormatE(1234, 2, FD_CAP_E | FD_EXP | FD_MINIMAL_EXP); // 1.23E3

In CvFlt.cpp, line 292, FormatE() function does this (the comments are added):
char *FormatE(char *t, double x, int precision, dword flags)
{
	...
	if(!x) {	// Value is zero
		*t++ = '0';
		if(precision) {
			do_point(t, flags);
			tCat(t, '0', precision);
		}
		tCat(t, "e+00", 4);	// The "e+00" is forced
	}
	...


Best regards
Iñaki
Re: FormatE() with 0.0 [message #60068 is a reply to message #60065] Wed, 02 August 2023 11:44 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Thanks, will be fixed tomorrow.
Re: FormatE() with 0.0 [message #60069 is a reply to message #60068] Thu, 03 August 2023 11:19 Go to previous message
koldo is currently offline  koldo
Messages: 3358
Registered: August 2008
Senior Veteran
Thank you!

Best regards
Iñaki
Previous Topic: AMap::GetPut (k, v)
Next Topic: GLCtrl switch between perspective and ortho mode
Goto Forum:
  


Current Time: Fri May 03 23:32:05 CEST 2024

Total time taken to generate the page: 0.01964 seconds