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?
Double formatting bug? [message #6593] Sun, 19 November 2006 22:48 Go to previous message
zsolt is currently offline  zsolt
Messages: 697
Registered: December 2005
Location: Budapest, Hungary
Contributor
I'm using "%0nl" formatting. This is formatting double values as fixed point (integer) number in most cases. But with very large or small numbers (e.g. 1e-16) it shows the floating point number (e.g. 1e-16). This is what I don't need.

I have checked the formatting function:
String FormatDouble(double d, int digits, int flags, int pad_exp)
{
	if(IsNull(d))
		return Null;

	double ad = fabs(d);
	bool is_exp = (flags & FD_EXP);
	if(!(flags & FD_FIX))
	{
		is_exp = ad && (ad <= 1e-15 || ad >= 1e15);
		if(flags & FD_REL)
		{
			double bd = ipow10(2 * digits);
			if(ad && (ad * bd <= 1 || ad >= bd))
				is_exp = true;
		}
	}
	if(is_exp)
		return FormatDoubleExp(d, digits, flags, pad_exp);
	else
		return FormatDoubleFix(d, digits, flags);
}


The problem is the "if(!(flags & FD_FIX))" block. I searched for FD_FIX in upp sources and I was unable to find any other references to it. Is something missing from parser or is this "if" block absolutely unneeded?
Or how can I enforce fixed point language based formatting?
 
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: Sat Apr 27 18:02:45 CEST 2024

Total time taken to generate the page: 1.01892 seconds