comp.lang.ada
 help / color / mirror / Atom feed
* Question about Float
@ 2007-12-03 10:03 axtens
  2007-12-03 10:18 ` Ludovic Brenta
  2007-12-03 12:53 ` anon
  0 siblings, 2 replies; 8+ messages in thread
From: axtens @ 2007-12-03 10:03 UTC (permalink / raw)


G'day everyone,

What is the size/precision of a Float in Ada? Under GNAT/GCC it
appears to be equivalent to a VB6 Single. Under ObjectAda is appears
to be a full 8 byter, similar to VB6's Double. But is it?

I'm confused.

Kind regards,
Bruce.



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

* Re: Question about Float
  2007-12-03 10:03 Question about Float axtens
@ 2007-12-03 10:18 ` Ludovic Brenta
  2007-12-03 11:23   ` Martin
  2007-12-03 12:53 ` anon
  1 sibling, 1 reply; 8+ messages in thread
From: Ludovic Brenta @ 2007-12-03 10:18 UTC (permalink / raw)


axtens writes:
> G'day everyone,
>
> What is the size/precision of a Float in Ada? Under GNAT/GCC it
> appears to be equivalent to a VB6 Single. Under ObjectAda is appears
> to be a full 8 byter, similar to VB6's Double. But is it?
>
> I'm confused.

The range and precision of Float are implementation-defined and change
between e.g. 32-bit, 64-bit platforms and Intel platforms where there
is a 80-bit floating-point type and PowerPC that has a 128-bit
floating-point type.  Therefore you should not use Float.  Define your
own floating-point type such that its representation matches that of
Visual Basic.

-- 
Ludovic Brenta.



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

* Re: Question about Float
  2007-12-03 10:18 ` Ludovic Brenta
@ 2007-12-03 11:23   ` Martin
  2007-12-04  9:31     ` Georg Bauhaus
  0 siblings, 1 reply; 8+ messages in thread
From: Martin @ 2007-12-03 11:23 UTC (permalink / raw)


On 3 Dec, 10:18, Ludovic Brenta <ludo...@ludovic-brenta.org> wrote:
> axtens writes:
> > G'day everyone,
>
> > What is the size/precision of a Float in Ada? Under GNAT/GCC it
> > appears to be equivalent to a VB6 Single. Under ObjectAda is appears
> > to be a full 8 byter, similar to VB6's Double. But is it?
>
> > I'm confused.
>
> The range and precision of Float are implementation-defined and change
> between e.g. 32-bit, 64-bit platforms and Intel platforms where there
> is a 80-bit floating-point type and PowerPC that has a 128-bit
> floating-point type.  Therefore you should not use Float.  Define your
> own floating-point type such that its representation matches that of
> Visual Basic.

Surely you mean " Define your own floating-point type such that its
accuracy requirements are met"? e.g.

type Real is digits 7;  -- or 8 or 10 or whatever your app requires?

If you are interfacing with an 'outside world' (e.g. a .dll) you can
define wrappers in terms of types defined in standard "package
Interfaces".

Cheers
-- Martin



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

* Re: Question about Float
  2007-12-03 10:03 Question about Float axtens
  2007-12-03 10:18 ` Ludovic Brenta
@ 2007-12-03 12:53 ` anon
  2007-12-04  3:22   ` axtens
  1 sibling, 1 reply; 8+ messages in thread
From: anon @ 2007-12-03 12:53 UTC (permalink / raw)


For default see package "Standard.ads"

In GNAT this package is built into the compiler 
but you can use command:
         gnat standard >standard.ads

then edit or print the file: "standard.ads"

As for Intel x86, GNAT uses:
	Float => 32 bits
	Long_Float => 64 bits
	Long_Long_Float => 96 bits (fpu based)



In <f3c0fcc4-3ed2-45aa-8810-2223cbc50dd5@s36g2000prg.googlegroups.com>, axtens <Bruce.Axtens@gmail.com> writes:
>G'day everyone,
>
>What is the size/precision of a Float in Ada? Under GNAT/GCC it
>appears to be equivalent to a VB6 Single. Under ObjectAda is appears
>to be a full 8 byter, similar to VB6's Double. But is it?
>
>I'm confused.
>
>Kind regards,
>Bruce.




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

* Re: Question about Float
  2007-12-03 12:53 ` anon
@ 2007-12-04  3:22   ` axtens
  0 siblings, 0 replies; 8+ messages in thread
From: axtens @ 2007-12-04  3:22 UTC (permalink / raw)


On Dec 3, 9:53 pm, a...@anon.org (anon) wrote:

> As for Intel x86, GNAT uses:
>         Float => 32 bits
>         Long_Float => 64 bits
>         Long_Long_Float => 96 bits (fpu based)

Perfect. Thanks very much.

Kind regards,
Bruce.



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

* Re: Question about Float
  2007-12-03 11:23   ` Martin
@ 2007-12-04  9:31     ` Georg Bauhaus
  2007-12-05  5:47       ` axtens
  0 siblings, 1 reply; 8+ messages in thread
From: Georg Bauhaus @ 2007-12-04  9:31 UTC (permalink / raw)


Martin wrote:

> Surely you mean " Define your own floating-point type such that its
> accuracy requirements are met"? e.g.
> 

When interfacing to VB, the accuracy is usually determined
by "Get Something Done 'Quickly, easy to use, no useless complexity";
a most likely issue is being able to choose either one of the two
(yes, two) floating point data types. You find the two FPT types
used in SQL-RDB tables and almost everywhere else. There has
to be a good, affordable reason to put more effort into FPT.
Not much use for more accuracy in a VB programming setting, or when
accuracy-aware computing can be outsourced to the Ada programmer.



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

* Re: Question about Float
  2007-12-04  9:31     ` Georg Bauhaus
@ 2007-12-05  5:47       ` axtens
  2007-12-07 10:38         ` amado.alves
  0 siblings, 1 reply; 8+ messages in thread
From: axtens @ 2007-12-05  5:47 UTC (permalink / raw)


Is it the nature of the beast that ObjectAda 7.2.2 knows nothing about
Long_Long_Float?

Kind regards,
bruce.





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

* Re: Question about Float
  2007-12-05  5:47       ` axtens
@ 2007-12-07 10:38         ` amado.alves
  0 siblings, 0 replies; 8+ messages in thread
From: amado.alves @ 2007-12-07 10:38 UTC (permalink / raw)


On 5 Dez, 05:47, axtens <Bruce.Axt...@gmail.com> wrote:
> Is it the nature of the beast that ObjectAda 7.2.2 knows nothing about
> Long_Long_Float?
>
> Kind regards,
> bruce.

Long_Float, Long_Long_Float, etc. are not required to exist (but,
existing, they must meet certain rqmts) §3.5.7 (14-16)



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

end of thread, other threads:[~2007-12-07 10:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-03 10:03 Question about Float axtens
2007-12-03 10:18 ` Ludovic Brenta
2007-12-03 11:23   ` Martin
2007-12-04  9:31     ` Georg Bauhaus
2007-12-05  5:47       ` axtens
2007-12-07 10:38         ` amado.alves
2007-12-03 12:53 ` anon
2007-12-04  3:22   ` axtens

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