Re: Reading Float Data from a binary file into ada



frikk wrote:
[snip]
Niklas - I think this is exactly what I need to do.

Martin - Thank you for the example. I will go through that and see what I can use - it looks very useful though. May I get some clarification on exactly what this line does:
type FP is delta FP_Delta range -2.0**15 .. 2.0**15-FP_Delta;
for FP'Small use FP_Delta;
for FP'Size use 32;

What is the delta used for?

The delta means the type is a 'fixed point' type (a real but not a 'float'). It's an abstraction of an integer with a fractional LSB.

See http://www.adapower.com/rm95.php for a technical specification, or see http://www.adapower.com/launch.php?URL=http%3A%2F%2Fwww.it.bton.ac.uk%2Fstaff%2Fje%2Fadacraft%2F for an introduction to then.

With the 'delta' you specify the minimum "LSB" your willing to accept in terms of accuracy - the compiler is free to give you better! In practice the 'delta' is best defined as a power-of-2 (and a compiler isn't likely to change that!).

If you need an "LSB" that's a power-of-10, use a 'decimal type'. All covered in John's book.
Cheers
-- Martin
.



Relevant Pages

  • Re: pointers?
    ... int a; ... Well, not a bug IMO, but yes, that's what I'm talking about. ... Foo is called with delta as parameter, ... compiler "optimizes" b away, therefore the compiler has a bug. ...
    (comp.lang.forth)
  • Re: Ada decimal types
    ... Simon Wright wrote: ... power-of-2 as the delta? ... The LRM 3.5.10is a good deal less than informative as to what this ...
    (comp.lang.ada)
  • Re: Ada decimal types
    ... power-of-2 as the delta? ... The LRM 3.5.10is a good deal less than informative as to what this ... And if you did the same for a GNAT Duration'-- remember, ...
    (comp.lang.ada)
  • Re: Borland kills another developer tool
    ... they rely on the ILASM compiler to do that part. ... Delta Forth generates true .NET executables and they ...
    (borland.public.delphi.non-technical)
  • Re: POSIX reserved identifiers
    ... > enum stat {UNIFORM, GAUSSIAN, PULSE, DELTA}; ... > gcc had no problem with it, but another compiler I am ... Apparently, that compiler automatically includes ...
    (comp.unix.programmer)