1 with Ada
.Unchecked_Conversion
;
3 package body Inline2_Pkg
is
5 type Ieee_Short_Real
is
7 Mantisse_Sign
: Integer range 0 .. 1;
8 Exponent
: Integer range 0 .. 2 ** 8 - 1;
9 Mantisse
: Integer range 0 .. 2 ** 23 - 1;
12 for Ieee_Short_Real
use
14 Mantisse_Sign
at 0 range 31 .. 31;
15 Exponent
at 0 range 23 .. 30;
16 Mantisse
at 0 range 0 .. 22;
19 function Valid_Real
(Number
: Float) return Boolean is
20 function To_Ieee_Short_Real
is
21 new Ada
.Unchecked_Conversion
(Float, Ieee_Short_Real
);
23 return To_Ieee_Short_Real
(Number
).Exponent
/= 255;
26 function Invalid_Real
return Float is
28 new Ada
.Unchecked_Conversion
(Ieee_Short_Real
, Float);
30 return To_Float
(Ieee_Short_Real
'(Mantisse_Sign => 0,
31 Exponent => 255, Mantisse => 0));