Home » U++ Library support » U++ Core » FormatE() with 0.0
FormatE() with 0.0 [message #60065] |
Tue, 01 August 2023 08:35  |
 |
koldo
Messages: 3432 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
|
|
|
|
|
Goto Forum:
Current Time: Fri Apr 25 12:08:19 CEST 2025
Total time taken to generate the page: 0.00968 seconds
|