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 equals nothing
double equals nothing [message #26910] Tue, 08 June 2010 22:30 Go to next message
nixnixnix is currently offline  nixnixnix
Messages: 415
Registered: February 2007
Location: Kelowna, British Columbia
Senior Member
Hi,

I have a function that looks like this

double CUtils::LittleEndianDouble(char* p)
{
	double* pD;
	char cBuf[9];

	memcpy(cBuf,p,8);
	cBuf[8] = 0;
	pD = (double*)cBuf;

	return *pD;	
}


and I have come across a file which causes the output to become undefined. For instance, when I go to DUMP the result of initialising a Pointf object with two such doubles, I get

Quote:


ptr->pt = [, ]



and when I look at it in the debugger the value is also blank and gets copied as blank. If I can just detect this then I can deal with it. I have tried checking whether it equals NULL or IsNull but neither catch it.

I would have thought that any string cast to double would give some sort of recognisable result. Surely that is part of the strength of C++ ?

Nick

EDIT: not sure why it doesn't display but in fact the value was equal to FFFFFFFFFFFFEFFF which converts to -1.7976931348623157e+308 which I admit is a very silly number. It would still be good if this value showed in the debugger but I don't need it fixed now.



[Updated on: Tue, 08 June 2010 23:01]

Report message to a moderator

Re: double equals nothing [message #26911 is a reply to message #26910] Tue, 08 June 2010 23:15 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
nixnixnix wrote on Tue, 08 June 2010 16:30


EDIT: not sure why it doesn't display but in fact the value was equal to FFFFFFFFFFFFEFFF which converts to -1.7976931348623157e+308 which I admit is a very silly number. It would still be good if this value showed in the debugger but I don't need it fixed now.



Explanation: In U++, double values < -1.0E+307 are considered Null.

Null itself is defined as -1.0E+308. But to be sure about double equality issues, there is "less" instead of "equal" used. I believe that in practice, limiting double range to e+/-300 is non-issue.

Mirek
Previous Topic: BUG: Serious problem with Core/CharSet
Next Topic: Thread::ShutdownThreads not safe
Goto Forum:
  


Current Time: Tue Apr 16 06:22:39 CEST 2024

Total time taken to generate the page: 0.02187 seconds