Article View: comp.std.c
Article #4384Re: converting int to float (or double)
From: Dik T. Winter
Date: Thu, 23 Nov 1995 00:51
Date: Thu, 23 Nov 1995 00:51
21 lines
1267 bytes
1267 bytes
In article <48sms5$rba@sparcserver.lrz-muenchen.de> ua302aa@sun2.lrz-muenchen.de (Kurt Watzka) writes: > dallaire@megatoon.com (Guy Dallaire) writes: ... > > int i=3; > > float f; > > double d; > > a=i; > > b=i; ... > Maybe you wanted to know whether they will be stored in f and d > exactly? Making that assumption, I do not think that the standard has any requirements on the precision of the conversion. So even if 3.0 would fit in a float or a double, there is no guarantee that the result will be that value. (And you may be in for some surprises, there have been machines were 0.0 was not a valid floating point number, *all* floating point numbers were non-zero.) -- dik t. winter, cwi, kruislaan 413, 1098 sj amsterdam, nederland, +31205924098 home: bovenover 215, 1025 jn amsterdam, nederland; http://www.cwi.nl/~dik/
Technical Details
Message-ID:
<DIH11r.BKE@cwi.nl>Path:
arc1-ca.pugleaf.net!cwi.nl!dikReferences:
<48r7sm$3hf@jersey.megatoon.com> <48sms5$rba@sparcserver.lrz-muenchen.de>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c Path: arc1-ca.pugleaf.net!cwi.nl!dik From: dik@cwi.nl (Dik T. Winter) Subject: Re: converting int to float (or double) Message-ID: <DIH11r.BKE@cwi.nl> Sender: news@cwi.nl (The Daily Dross) Nntp-Posting-Host: chrysant.cwi.nl Organization: CWI, Amsterdam References: <48r7sm$3hf@jersey.megatoon.com> <48sms5$rba@sparcserver.lrz-muenchen.de> Date: Thu, 23 Nov 1995 00:51:26 GMT