Jump to content

How to generate a true ?


Recommended Posts

I'm refactoring an application made a few years ago by someone who is no longer in my company and here is a funny bit of code I wanted to share :

post-7452-1210066930.png?width=400

/pedantic

Am I bigger than someone smaller than me AND smaller than someone bigger than me ? :rolleyes:

How good is that !

pedantic/

Ok.. lots of us - crazy coffee drinkers - happen to wire too fast sometimes, but still... it's better to laugh about that !

Link to comment

QUOTE (Antoine @ May 6 2008, 11:48 AM)

Am I bigger than someone smaller than me AND smaller than someone bigger than me ? :rolleyes:

In fact this is NOT always TRUE !!!

Nan = FALSE,

-Inf = FALSE,

Inf = FALSE

Happy wiring,

TNT

Link to comment

QUOTE (Antoine @ May 6 2008, 05:48 AM)

/pedantic

Am I bigger than someone smaller than me AND smaller than someone bigger than me ? :rolleyes:

How good is that !

pedantic/

Or am I taller than myself when I where thick soled shoes and shorter when I take them off.

Bruce

Link to comment

QUOTE (bmoyer @ May 6 2008, 01:53 PM)

Or am I taller than myself when I where thick soled shoes and shorter when I take them off.

Bruce

What happens if the precision available for the datatype doesn't allow the addition or subtraction of 0.2. Can't this happen when a DBL number is really large. 15 significant digits I believe. So if the number's large, won't the +_ 0.2 have basically no effect on the number?

Could it be a somewhat crpytical "available precision" check?

Shane

PS Just thinking out loud, I didn't program it!!!

Link to comment

QUOTE (Aristos Queue @ May 6 2008, 05:40 PM)

The check for NAN and the check for precision are interesting ideas. The precision test seems most reasonable because otherwise, why pick 0.2 as your split? It's a fairly arbitrary value.

That's what I thought. I reckon the 0.2 has some significance (no pun intended).

I've fallen into floating point traps often enough to have the ins and outs of floating point precision more or less burned into my brain. I think there are pages from the LabVIEW manual visible on my CAT Scans......

Hope I don't get sued for copyright Infringement..... :P

Shane

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.