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 » Double formatting bug?
Re: Double formatting bug? [message #6601 is a reply to message #6593] Mon, 20 November 2006 10:12 Go to previous messageGo to previous message
rylek is currently offline  rylek
Messages: 79
Registered: November 2005
Member
Hello!

I think that is not a bug. FD_FIX, just as FD_EXP, are bit-coded option flags for the FormatDouble function affecting the choice of number output format. When you use, e.g.,

FormatDouble(32.5, 3, FD_FIX)

it always gets formatted in the "traditional" way (as 32.5). On the other hand, calling

FormatDouble(32.5, 3, FD_EXP)

causes the number to be always formatted in the scientific exponential notation (3.25e1). If neither of the option flags are used, FormatDouble selects the appropriate format automatically based on magnitude of the number being formatted (the code within the if-block).

I believe that these three variants (traditional output notation, exponential output notation, autoselect based on magnitude) correspond to the NFormat specifiers %nf, %ne, and %n, respectively. However the formatting function (RealFormatter) directly calls the appropriate formatting functions as necessary (FormatDoubleExp / FormatDoubleFix) so that the call to FormatDouble is used only exactly to invoke the magnitude-based format autoselection mechanism, so neither FD_FIX nor FD_EXP is used there.

Regards

Tomas
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Beginners Question: How to return "NULL"
Next Topic: GetExeFilePath() in Linux
Goto Forum:
  


Current Time: Tue Jun 18 05:40:59 CEST 2024

Total time taken to generate the page: 0.01893 seconds