|
From: axtens on 3 Dec 2007 05:03 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.
From: Ludovic Brenta on 3 Dec 2007 05:18 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.
From: Martin on 3 Dec 2007 06:23 On 3 Dec, 10:18, Ludovic Brenta <ludo...(a)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
From: anon on 3 Dec 2007 07:53 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(a)s36g2000prg.googlegroups.com>, axtens <Bruce.Axtens(a)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.
From: axtens on 3 Dec 2007 22:22
On Dec 3, 9:53 pm, a...(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. |