comp.lang.ada
 help / color / mirror / Atom feed
From: "Peter C. Chapin" <chapinp@acm.org>
Subject: Re: simple question on long_float/short_float
Date: Thu, 30 Sep 2010 09:30:25 -0400
Date: 2010-09-30T09:30:25-04:00	[thread overview]
Message-ID: <4ca491aa$0$2444$4d3efbfe@news.sover.net> (raw)
In-Reply-To: <i81iob$pjr$1@speranza.aioe.org>

On 2010-09-30 04:45, Nasser M. Abbasi wrote:

> So Ada has
> 
> Float,
> long_float,
> short_float,
> Interfaces.Fortran.Reals
> Interfaces.Fortran.Double_Precision

A common recommendation is to avoid using the built-in types directly.
Instead define your own:

type My_Floating_Type is digits 12;

If the implementation has a floating point type with at least 12 decimal
digits of precision it will use it as the base type for My_Floating_Type
and all will be well. If the implementation can't handle that much
precision in any of its built-in types you will get a compile time
error. For example you could try

type My_Floating_Type is digits 350;

But I doubt if there is any implementation that will honor that.

The types in Interfaces.Fortran are intended for the case where you are
exchanging data with a corresponding Fortran compiler. It sounds like
you might, in fact, be doing that.

Peter



  parent reply	other threads:[~2010-09-30 13:30 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 [this message]
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
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