Debian Codegraph @

gcc/ada/libgnat/s-powlfl.ads

raw
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- S Y S T E M . P O W T E N _ L 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_LFlt is
35 pragma Pure;
36
37 Maxpow_Exact : constant := 22;
38 -- Largest power of five exactly representable with Long_Float. It is equal
39 -- to floor (M * log 2 / log 5), where M is the size of the mantissa (53).
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 Long_Float
44
45 Powfive : constant array (0 .. Maxpow, 1 .. 2) of Long_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, 0.0],
58 12 => [5.0**12, 0.0],
59 13 => [5.0**13, 0.0],
60 14 => [5.0**14, 0.0],
61 15 => [5.0**15, 0.0],
62 16 => [5.0**16, 0.0],
63 17 => [5.0**17, 0.0],
64 18 => [5.0**18, 0.0],
65 19 => [5.0**19, 0.0],
66 20 => [5.0**20, 0.0],
67 21 => [5.0**21, 0.0],
68 22 => [5.0**22, 0.0],
69 23 => [5.0**23, 5.0**23 - Long_Float'Machine (5.0**23)],
70 24 => [5.0**24, 5.0**24 - Long_Float'Machine (5.0**24)],
71 25 => [5.0**25, 5.0**25 - Long_Float'Machine (5.0**25)],
72 26 => [5.0**26, 5.0**26 - Long_Float'Machine (5.0**26)],
73 27 => [5.0**27, 5.0**27 - Long_Float'Machine (5.0**27)],
74 28 => [5.0**28, 5.0**28 - Long_Float'Machine (5.0**28)],
75 29 => [5.0**29, 5.0**29 - Long_Float'Machine (5.0**29)],
76 30 => [5.0**30, 5.0**30 - Long_Float'Machine (5.0**30)],
77 31 => [5.0**31, 5.0**31 - Long_Float'Machine (5.0**31)],
78 32 => [5.0**32, 5.0**32 - Long_Float'Machine (5.0**32)],
79 33 => [5.0**33, 5.0**33 - Long_Float'Machine (5.0**33)],
80 34 => [5.0**34, 5.0**34 - Long_Float'Machine (5.0**34)],
81 35 => [5.0**35, 5.0**35 - Long_Float'Machine (5.0**35)],
82 36 => [5.0**36, 5.0**36 - Long_Float'Machine (5.0**36)],
83 37 => [5.0**37, 5.0**37 - Long_Float'Machine (5.0**37)],
84 38 => [5.0**38, 5.0**38 - Long_Float'Machine (5.0**38)],
85 39 => [5.0**39, 5.0**39 - Long_Float'Machine (5.0**39)],
86 40 => [5.0**40, 5.0**40 - Long_Float'Machine (5.0**40)],
87 41 => [5.0**41, 5.0**41 - Long_Float'Machine (5.0**41)],
88 42 => [5.0**42, 5.0**42 - Long_Float'Machine (5.0**42)],
89 43 => [5.0**43, 5.0**43 - Long_Float'Machine (5.0**43)],
90 44 => [5.0**44, 5.0**44 - Long_Float'Machine (5.0**44)]];
91
92 Powfive_100 : constant array (1 .. 2) of Long_Float :=
93 [5.0**100, 5.0**100 - Long_Float'Machine (5.0**100)];
94
95 Powfive_200 : constant array (1 .. 2) of Long_Float :=
96 [5.0**200, 5.0**200 - Long_Float'Machine (5.0**200)];
97
98 Powfive_300 : constant array (1 .. 2) of Long_Float :=
99 [5.0**300, 5.0**300 - Long_Float'Machine (5.0**300)];
100
101 Powten : constant array (0 .. Maxpow, 1 .. 2) of Long_Float :=
102 [00 => [1.0E+00, 0.0],
103 01 => [1.0E+01, 0.0],
104 02 => [1.0E+02, 0.0],
105 03 => [1.0E+03, 0.0],
106 04 => [1.0E+04, 0.0],
107 05 => [1.0E+05, 0.0],
108 06 => [1.0E+06, 0.0],
109 07 => [1.0E+07, 0.0],
110 08 => [1.0E+08, 0.0],
111 09 => [1.0E+09, 0.0],
112 10 => [1.0E+10, 0.0],
113 11 => [1.0E+11, 0.0],
114 12 => [1.0E+12, 0.0],
115 13 => [1.0E+13, 0.0],
116 14 => [1.0E+14, 0.0],
117 15 => [1.0E+15, 0.0],
118 16 => [1.0E+16, 0.0],
119 17 => [1.0E+17, 0.0],
120 18 => [1.0E+18, 0.0],
121 19 => [1.0E+19, 0.0],
122 20 => [1.0E+20, 0.0],
123 21 => [1.0E+21, 0.0],
124 22 => [1.0E+22, 0.0],
125 23 => [1.0E+23, 1.0E+23 - Long_Float'Machine (1.0E+23)],
126 24 => [1.0E+24, 1.0E+24 - Long_Float'Machine (1.0E+24)],
127 25 => [1.0E+25, 1.0E+25 - Long_Float'Machine (1.0E+25)],
128 26 => [1.0E+26, 1.0E+26 - Long_Float'Machine (1.0E+26)],
129 27 => [1.0E+27, 1.0E+27 - Long_Float'Machine (1.0E+27)],
130 28 => [1.0E+28, 1.0E+28 - Long_Float'Machine (1.0E+28)],
131 29 => [1.0E+29, 1.0E+29 - Long_Float'Machine (1.0E+29)],
132 30 => [1.0E+30, 1.0E+30 - Long_Float'Machine (1.0E+30)],
133 31 => [1.0E+31, 1.0E+31 - Long_Float'Machine (1.0E+31)],
134 32 => [1.0E+32, 1.0E+32 - Long_Float'Machine (1.0E+32)],
135 33 => [1.0E+33, 1.0E+33 - Long_Float'Machine (1.0E+33)],
136 34 => [1.0E+34, 1.0E+34 - Long_Float'Machine (1.0E+34)],
137 35 => [1.0E+35, 1.0E+35 - Long_Float'Machine (1.0E+35)],
138 36 => [1.0E+36, 1.0E+36 - Long_Float'Machine (1.0E+36)],
139 37 => [1.0E+37, 1.0E+37 - Long_Float'Machine (1.0E+37)],
140 38 => [1.0E+38, 1.0E+38 - Long_Float'Machine (1.0E+38)],
141 39 => [1.0E+39, 1.0E+39 - Long_Float'Machine (1.0E+39)],
142 40 => [1.0E+40, 1.0E+40 - Long_Float'Machine (1.0E+40)],
143 41 => [1.0E+41, 1.0E+41 - Long_Float'Machine (1.0E+41)],
144 42 => [1.0E+42, 1.0E+42 - Long_Float'Machine (1.0E+42)],
145 43 => [1.0E+43, 1.0E+43 - Long_Float'Machine (1.0E+43)],
146 44 => [1.0E+44, 1.0E+44 - Long_Float'Machine (1.0E+44)]];
147
148 end System.Powten_LFlt;