comp.lang.ada
 help / color / mirror / Atom feed
* precision
@ 2003-02-20  8:50 prashna
  2003-02-23 12:50 ` precision Martin Krischik
  0 siblings, 1 reply; 4+ messages in thread
From: prashna @ 2003-02-20  8:50 UTC (permalink / raw)


What is precision of float means?
My understanding is that if precision is 6 digits then 1.0 and
1.0000001 are same!!! Please let me know whether my understanding is
right.If not then what it means?

Thanks



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: precision
@ 2003-02-20  9:35 Grein, Christoph
  2003-02-20 10:27 ` precision Peter Hermann
  0 siblings, 1 reply; 4+ messages in thread
From: Grein, Christoph @ 2003-02-20  9:35 UTC (permalink / raw)
  To: comp.lang.ada

> What is precision of float means?
> My understanding is that if precision is 6 digits then 1.0 and
> 1.0000001 are same!!! Please let me know whether my understanding is
> right.If not then what it means?

Approximately. For exact information, see RM 3.5.7.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: precision
  2003-02-20  9:35 precision Grein, Christoph
@ 2003-02-20 10:27 ` Peter Hermann
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Hermann @ 2003-02-20 10:27 UTC (permalink / raw)


>> What is precision of float means?
>> My understanding is that if precision is 6 digits then 1.0 and
>> 1.0000001 are same!!! Please let me know whether my understanding is
   1 23456 = decimal position
>> right.If not then what it means?
> Approximately. For exact information, see RM 3.5.7.

and more (-:
The compiler is required to map the mantissa to AT LEAST 10 decimal 
digits, which means for binary representation a binary mantissa
of at least 6/lg2 = 6/0.301... = 19.93... giving AT LEAST 
20 binary digits.
However the chosen mantissa length depends very much on the implementation.
On 32bit floating point you may have a 23 or 24 bit mantissa where as
on a 60 or 64 bit smallest floating point (e.g. CDC, Cray)
your smallest mantissa has 48 bits.
In this case 1.0 and 1.0000001 will be "different" :-)

-- 
--Peter Hermann(49)0711-685-3611 fax3758 ica2ph@csv.ica.uni-stuttgart.de
--Pfaffenwaldring 27 Raum 114, D-70569 Stuttgart Uni Computeranwendungen
--http://www.csv.ica.uni-stuttgart.de/homes/ph/
--Team Ada: "C'mon people let the world begin" (Paul McCartney)



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: precision
  2003-02-20  8:50 precision prashna
@ 2003-02-23 12:50 ` Martin Krischik
  0 siblings, 0 replies; 4+ messages in thread
From: Martin Krischik @ 2003-02-23 12:50 UTC (permalink / raw)


On Thu, 20 Feb 2003 00:50:24 +0000, prashna wrote:

> What is precision of float means?
> My understanding is that if precision is 6 digits then 1.0 and
> 1.0000001 are same!!! Please let me know whether my understanding is
> right.If not then what it means?

My understanding that you get a minimum of 6 digits. The compiler might
(have to) give you more.

I it like a range 0 .. 100. Since there are no half bits the compilter need
at least 7 Bits to fullfill your request and 7 bits goes up to 127. 

With Regards

Martin
-- 
Martin Krischik
mailto://Martin@krischik.com
http://www.ada.krischik.com




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-02-23 12:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-20  8:50 precision prashna
2003-02-23 12:50 ` precision Martin Krischik
  -- strict thread matches above, loose matches on Subject: below --
2003-02-20  9:35 precision Grein, Christoph
2003-02-20 10:27 ` precision Peter Hermann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox