This topic is now archived and is closed to further replies.


Is there a fast function isFloatValid(float f) ?

Recommended Posts

Hi, Do you know of a fast function which checks whether a float is valid or not? 1.#INF0 would be an invalid value I found the following code:
	unsigned short int axreg;
		fld value		// load float value		

		fxam			// check it

		fstsw ax		// get status word		

		mov axreg,ax	// let us access in c++	

	if ((axreg&0x500)!=0x500)	// check for INF

Is this enough? Or can a flot have another invalid value? I always thought division by zero and overflow have distinct values. Thanks

Share this post

Link to post
Share on other sites