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 previous message
koldo is currently offline  koldo
Messages: 3365
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
 
Read Message
Read Message
Read Message
Previous Topic: AMap::GetPut (k, v)
Next Topic: GLCtrl switch between perspective and ortho mode
Goto Forum:
  


Current Time: Sat May 18 04:59:36 CEST 2024

Total time taken to generate the page: 0.03392 seconds