check if a double is odd or not

U

user923005

pow(10,25)+1 is an odd value.  What will your fmod() expression
evaluate to?

It will be an even number on any system for which DBL_DIG is less than
25 (as well it should be).

I don't think that should surprise anybody. The long long type won't
fare any better there, either, unless your long long holds more than
18 digits (I guess there could be some systems with 256 bit long
long).
 
L

lawrence.jones

Barry Schwarz said:
pow(10,25)+1 is an odd value.

Not in most floating-point implementations. Sufficiently large
floating-point values are always even.

-- Larry Jones

Who, ME? Who?! Me?? WHO... Me?! Who, me??? -- Calvin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top