Debian Codegraph @

gcc/ada/libgnat/s-powflt.ads

raw
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- S Y S T E M . P O W T E N _ F L T --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 2020-2025, Free Software Foundation, Inc. --
10 -- --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
17 -- --
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
19 -- additional permissions described in the GCC Runtime Library Exception, --
20 -- version 3.1, as published by the Free Software Foundation. --
21 -- --
22 -- You should have received a copy of the GNU General Public License and --
23 -- a copy of the GCC Runtime Library Exception along with this program; --
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
25 -- <http://www.gnu.org/licenses/>. --
26 -- --
27 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
29 -- --
30 ------------------------------------------------------------------------------
31
32 -- This package provides tables of powers used for real conversions
33
34 package System.Powten_Flt is
35 pragma Pure;
36
37 Maxpow_Exact : constant := 10;
38 -- Largest power of five exactly representable with Float. It is equal to
39 -- floor (M * log 2 / log 5), where M is the size of the mantissa (24).
40 -- It also works for any number of the form 5*(2**N) and in particular 10.
41
42 Maxpow : constant := Maxpow_Exact * 2;
43 -- Largest power of five exactly representable with double Float
44
45 Powfive : constant array (0 .. Maxpow, 1 .. 2) of Float :=
46 [00 => [5.0**00, 0.0],
47 01 => [5.0**01, 0.0],
48 02 => [5.0**02, 0.0],
49 03 => [5.0**03, 0.0],
50 04 => [5.0**04, 0.0],
51 05 => [5.0**05, 0.0],
52 06 => [5.0**06, 0.0],
53 07 => [5.0**07, 0.0],
54 08 => [5.0**08, 0.0],
55 09 => [5.0**09, 0.0],
56 10 => [5.0**10, 0.0],
57 11 => [5.0**11, 5.0**11 - Float'Machine (5.0**11)],
58 12 => [5.0**12, 5.0**12 - Float'Machine (5.0**12)],
59 13 => [5.0**13, 5.0**13 - Float'Machine (5.0**13)],
60 14 => [5.0**14, 5.0**14 - Float'Machine (5.0**14)],
61 15 => [5.0**15, 5.0**15 - Float'Machine (5.0**15)],
62 16 => [5.0**16, 5.0**16 - Float'Machine (5.0**16)],
63 17 => [5.0**17, 5.0**17 - Float'Machine (5.0**17)],
64 18 => [5.0**18, 5.0**18 - Float'Machine (5.0**18)],
65 19 => [5.0**19, 5.0**19 - Float'Machine (5.0**19)],
66 20 => [5.0**20, 5.0**20 - Float'Machine (5.0**20)]];
67
68 Powten : constant array (0 .. Maxpow, 1 .. 2) of Float :=
69 [00 => [1.0E+00, 0.0],
70 01 => [1.0E+01, 0.0],
71 02 => [1.0E+02, 0.0],
72 03 => [1.0E+03, 0.0],
73 04 => [1.0E+04, 0.0],
74 05 => [1.0E+05, 0.0],
75 06 => [1.0E+06, 0.0],
76 07 => [1.0E+07, 0.0],
77 08 => [1.0E+08, 0.0],
78 09 => [1.0E+09, 0.0],
79 10 => [1.0E+10, 0.0],
80 11 => [1.0E+11, 1.0E+11 - Float'Machine (1.0E+11)],
81 12 => [1.0E+12, 1.0E+12 - Float'Machine (1.0E+12)],
82 13 => [1.0E+13, 1.0E+13 - Float'Machine (1.0E+13)],
83 14 => [1.0E+14, 1.0E+14 - Float'Machine (1.0E+14)],
84 15 => [1.0E+15, 1.0E+15 - Float'Machine (1.0E+15)],
85 16 => [1.0E+16, 1.0E+16 - Float'Machine (1.0E+16)],
86 17 => [1.0E+17, 1.0E+17 - Float'Machine (1.0E+17)],
87 18 => [1.0E+18, 1.0E+18 - Float'Machine (1.0E+18)],
88 19 => [1.0E+19, 1.0E+19 - Float'Machine (1.0E+19)],
89 20 => [1.0E+20, 1.0E+20 - Float'Machine (1.0E+20)]];
90
91 end System.Powten_Flt;