Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Boolean operation and arithmetic operation

Reply
Thread Tools

Boolean operation and arithmetic operation

 
 
Alexander Bartolich
Guest
Posts: n/a
 
      08-12-2009
Pete Becker wrote:
> Alexander Bartolich wrote:
>> [...]
>> Applying bitwise operations to all bits of a floating point expression
>> generally makes no sense.

>
> Umm, that's exactly how many operations that fiddle with floating-point
> values are implemented. Granted, it's not for beginners. But it often
> does make sense.


The binary representation of an IEEE floating point number comprises
sign, exponent, and fraction. Meaningful manipulation of these parts
involves masking them out with »&«, right shift, doing some integer
math, left shift, and pasting them in again with »|«. This is completely
different from expressions like »3.141 & 2.718«.

>> Applying logical operations to a floating point expression involves
>> exact comparison to 0. Because of the fuzziness of floating point
>> values you should rather check for a epsilon-neighborhood.

>
> Sigh. This is, as always, dead wrong. Floating-point values are not
> fuzzy, they are exact.


http://www.parashift.com/c++-faq-lit...html#faq-29.17

--
Brüder, in die Tonne die Freiheit,
Brüder, ein Stoppschild davor.
Egal was die Schwarzen Verlangen
Rufen wir: Ja! Brav im Chor.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Arithmetic with Boolean values John Ladasky Python 15 08-14-2012 04:32 PM
Subtle difference between boolean value and boolean comparison? Metre Meter Javascript 7 08-06-2010 08:40 PM
difference between 'boolean' and 'java.lang.Boolean' J Leonard Java 4 01-19-2008 02:56 AM
Usual Arithmetic Conversions-arithmetic expressions joshc C Programming 5 03-31-2005 02:23 AM
variadic arithmetic, boolean operators Trent Buck C Programming 3 01-02-2005 02:47 PM



Advertisments