comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: simple question on long_float/short_float
Date: Sat, 02 Oct 2010 09:52:43 -0700
Date: 2010-10-02T09:52:43-07:00	[thread overview]
Message-ID: <i87ot3$c9q$1@tornado.tornevall.net> (raw)
In-Reply-To: <i86svu$6ki$1@speranza.aioe.org>

On 10/02/2010 02:11 AM, Nasser M. Abbasi wrote:
>
> 1) So, it seems to me that Ada did use Fortran double in v1. since
> output is different than in v2. Unless I made a mistake in v2. Hence, I
> do not understand why the webpage above said that Gnat would use the
> same types. Can I change v2 to make it output the same as Fortran? I
> assume not, since it is not double to start with.

Sure. Try

type My_Float is digits Interfaces.Fortran.Double_Precision'digits;

or

type My_Float is digits Long_Float'digits;

or even

type My_Float is digits 15;

all of which give My_Float the same "digits 15" declaration as Double_Precision 
and Long_Float.

> I also need to study more about Ada floats and how they work. What I do
> not understand yet, does Ada does use IEEE754 for its floats? Assuming
> it does, then it must do something additional at run-time to obtain the
> result it needs when one uses DIGITS nnn in the type definition for Ada
> float.

Ada compilers typically use an underlying hardware floating-point type to 
implement floating-point type declarations. That is IEEE-754 on many platforms, 
but not all.

-- 
Jeff Carter
"So if I understand 'The Matrix Reloaded' correctly, the Matrix is
basically a Microsoft operating system--it runs for a while and
then crashes and reboots. By design, no less. Neo is just a
memory leak that's too hard to fix, so they left him in ... The
users don't complain because they're packed in slush and kept
sedated."
Marin D. Condic
65



  parent reply	other threads:[~2010-10-02 16:52 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-30  6:17 simple question on long_float/short_float Nasser M. Abbasi
2010-09-30  6:58 ` J-P. Rosen
2010-09-30  8:31   ` Nasser M. Abbasi
2010-09-30  8:45     ` Nasser M. Abbasi
2010-09-30  9:59       ` Mark Lorenzen
2010-09-30 13:30       ` Peter C. Chapin
2010-09-30  8:46     ` AdaMagica
2010-09-30 10:02     ` Georg Bauhaus
2010-09-30 15:37     ` Jeffrey Carter
2010-09-30 18:22       ` Nasser M. Abbasi
2010-09-30 21:21       ` Peter C. Chapin
2010-10-01  0:29         ` Nasser M. Abbasi
2010-10-01 11:13           ` Peter C. Chapin
2010-10-02 19:57         ` Simon Wright
2010-09-30 15:56     ` Adam Beneschan
2010-10-02  9:11 ` Nasser M. Abbasi
2010-10-02  9:48   ` Dmitry A. Kazakov
2010-10-02 20:09     ` Simon Wright
2010-10-02  9:56   ` Nasser M. Abbasi
2010-10-02 10:45   ` cjpsimon
2010-10-02 16:52   ` Jeffrey Carter [this message]
2010-10-02 20:01     ` Georg Bauhaus
replies disabled

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