Jump to content
  • Advertisement


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


Is there a fast function isFloatValid(float f) ?

This topic is 5583 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
I think an invalid float in the FPU was called a Nan.. it''s been awhile. check the processor manuals at www.x86.org

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!