Re: Reading Float Data from a binary file into ada
- From: Martin Dowie <martin.dowie@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 30 Jan 2007 20:23:20 +0000
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
.
- References:
- Reading Float Data from a binary file into ada
- From: frikk
- Re: Reading Float Data from a binary file into ada
- From: Martin Dowie
- Re: Reading Float Data from a binary file into ada
- From: frikk
- Reading Float Data from a binary file into ada
- Prev by Date: Re: Easy question about Character manipulation
- Next by Date: Re: Easy question about Character manipulation
- Previous by thread: Re: Reading Float Data from a binary file into ada
- Next by thread: Re: Reading Float Data from a binary file into ada
- Index(es):
Relevant Pages
|