Article View: alt.comp.lang.learn.c-c++
Article #64Floating point equal to Integer Value ?
From: Alya Al Omrani
Date: Tue, 10 Jul 2001 11:01
Date: Tue, 10 Jul 2001 11:01
25 lines
2046 bytes
2046 bytes
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
I tried doing the following
/* lets say those are my values */
int x=20;
float x=20.0, z;
z=(float)x;
/* I used a printf staetment to check that the value of x was assigned to z
and it worked ! */
printf("%f", z);
/* here i want to check */
if(z==x) /* at this instant it freezes */
printf("values are equal");
else
printf("they r not euqal");
///////////////
I sthere a substitue method that i can do so, i tried taking the % modulus
of both z and x to see if it will give zero but i got same erro, the program
wont compile
Technical Details
Message-ID:
<9iejot$4an2@news.emirates.net.ae>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!news.tele.dk!212.74.64.35!colt.net!nycmny1-snf1.gtei.net!news.gtei.net!news.emirates.net.ae!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 109fba,dbd8a1f951d6b446,start X-Google-Attributes: gid109fba,public X-Google-Thread: 10b1c0,dbd8a1f951d6b446,start X-Google-Attributes: gid10b1c0,public X-Google-Thread: 108b44,dbd8a1f951d6b446,start X-Google-Attributes: gid108b44,public X-Google-Thread: 114592,dbd8a1f951d6b446,start X-Google-Attributes: gid114592,public X-Google-Thread: 108717,dbd8a1f951d6b446,start X-Google-Attributes: gid108717,public X-Google-Thread: 10d4ba,dbd8a1f951d6b446,start X-Google-Attributes: gid10d4ba,public X-Google-ArrivalTime: 2001-07-10 03:01:21 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!news.tele.dk!212.74.64.35!colt.net!nycmny1-snf1.gtei.net!news.gtei.net!news.emirates.net.ae!not-for-mail From: "Alya Al Omrani" <alomrani@emirates.net.ae> Newsgroups: alt.comp.lang.learn.c-c++,att.lang.c++,comp.lang.c++,comp.programming,comp.sys.lang.c++,csugrad.programming.c Subject: Floating point equal to Integer Value ? Date: Tue, 10 Jul 2001 14:01:37 +0300 Organization: EIM Lines: 28 Message-ID: <9iejot$4an2@news.emirates.net.ae> NNTP-Posting-Host: 217.164.248.5 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2919.6600 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600