Article View: alt.comp.lang.learn.c-c++
Article #69Re: Floating point equal to Integer Value ?
From: Richard Harter
Date: Wed, 11 Jul 2001 09:09
Date: Wed, 11 Jul 2001 09:09
27 lines
2540 bytes
2540 bytes
On Tue, 10 Jul 2001 14:01:37 +0300, "Alya Al Omrani" <alomrani@emirates.net.ae> wrote: >Hi, how can i check if a floating point value is equal to integer value ? >I tried looking of there is a function that does so but there isn't [snip code with problems] Your question might mean one of two things: (a) Is a particular floating point value, call it x, actually an integer expressed in floating point form? (b) Is a particular floating point value x equal to some integer y? If we can answer (a) then it is trivial to answer (b). Let us suppose we have two functions, float and int. Then, provided that x is in normal form, then x is an integer in floating point form if x .bweq. float(int(x)) where .bweq. denotes bitwise equality, i.e., x and float(int(x)) have the same bit pattern. Richard Harter, cri@tiac.net, http://www.tiac.net/users/cri, http://www.varinoma.com It is unfortunate that the dishonest politicians give the remaining one percent of their profession a bad name.
Technical Details
Message-ID:
<3b4c158b.40970002@news.SullyButtes.net>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!isdnet!howland.erols.net!newsfeed.wirehub.nl!newsfeed.frii.net!easynews!e420r-sjo4.usenetserver.com!newsfeed.usenetserver.com!e420r-sjo2.usenetserver.com.POSTED!not-for-mailReferences:
<9iejot$4an2@news.emirates.net.ae>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10d4ba,dbd8a1f951d6b446 X-Google-Attributes: gid10d4ba,public X-Google-Thread: 114592,dbd8a1f951d6b446 X-Google-Attributes: gid114592,public X-Google-Thread: 10b1c0,dbd8a1f951d6b446 X-Google-Attributes: gid10b1c0,public X-Google-Thread: 108717,dbd8a1f951d6b446 X-Google-Attributes: gid108717,public X-Google-Thread: 108b44,dbd8a1f951d6b446 X-Google-Attributes: gid108b44,public X-Google-Thread: 109fba,dbd8a1f951d6b446 X-Google-Attributes: gid109fba,public X-Google-ArrivalTime: 2001-07-11 02:10:52 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!isdnet!howland.erols.net!newsfeed.wirehub.nl!newsfeed.frii.net!easynews!e420r-sjo4.usenetserver.com!newsfeed.usenetserver.com!e420r-sjo2.usenetserver.com.POSTED!not-for-mail From: cri@tiac.net (Richard Harter) Newsgroups: alt.comp.lang.learn.c-c++,att.lang.c++,comp.lang.c++,comp.programming,comp.sys.lang.c++,csugrad.programming.c Subject: Re: Floating point equal to Integer Value ? Message-ID: <3b4c158b.40970002@news.SullyButtes.net> References: <9iejot$4an2@news.emirates.net.ae> X-Newsreader: Forte Free Agent 1.1/32.230 Lines: 27 X-Complaints-To: abuse@usenetserver.com X-Abuse-Info: Please be sure to forward a copy of ALL headers X-Abuse-Info: Otherwise we will be unable to process your complaint properly. NNTP-Posting-Date: Wed, 11 Jul 2001 05:20:58 EDT Organization: WebUseNet Corp. - ReInventing The UseNet Date: Wed, 11 Jul 2001 09:09:14 GMT