authorgravatar for bratishkaerik@getgoogleoff.meEric Joldasov <bratishkaerik@getgoogleoff.me> 2023-06-04 23:09:17+06:00
committergravatar for bratishkaerik@getgoogleoff.meEric Joldasov <bratishkaerik@getgoogleoff.me> 2023-06-13 23:45:12+06:00
logd04a262a3d7e68920dec2a6becc86bf79d81452c
tree7b839339d5a11e493cb6ffb58626005f94e98ea2
parenteb4439f1e4e617247bffff13478a9fa57160c507
signaturelock-open Commit is signed but in an unrecognized format.

std.math: hard deprecate obsolete constants (soft deprecated in 0.10)

Followup to 5b8ac9821dd25c3e5282130b4d93d6c5b7debb08. Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>

5 files changed, 361 insertions(+), 273 deletions(-)

lib/compiler_rt/powiXf2_test.zig+235-230
...@@ -32,17 +32,18 @@ fn test__powixf2(a: f80, b: i32, expected: f80) !void {...@@ -32,17 +32,18 @@ fn test__powixf2(a: f80, b: i32, expected: f80) !void {
32}32}
3333
34test "powihf2" {34test "powihf2" {
35 const inf_f16 = math.inf(f16);
35 try test__powisf2(0, 0, 1);36 try test__powisf2(0, 0, 1);
36 try test__powihf2(1, 0, 1);37 try test__powihf2(1, 0, 1);
37 try test__powihf2(1.5, 0, 1);38 try test__powihf2(1.5, 0, 1);
38 try test__powihf2(2, 0, 1);39 try test__powihf2(2, 0, 1);
39 try test__powihf2(math.inf_f16, 0, 1);40 try test__powihf2(inf_f16, 0, 1);
4041
41 try test__powihf2(-0.0, 0, 1);42 try test__powihf2(-0.0, 0, 1);
42 try test__powihf2(-1, 0, 1);43 try test__powihf2(-1, 0, 1);
43 try test__powihf2(-1.5, 0, 1);44 try test__powihf2(-1.5, 0, 1);
44 try test__powihf2(-2, 0, 1);45 try test__powihf2(-2, 0, 1);
45 try test__powihf2(-math.inf_f16, 0, 1);46 try test__powihf2(-inf_f16, 0, 1);
4647
47 try test__powihf2(0, 1, 0);48 try test__powihf2(0, 1, 0);
48 try test__powihf2(0, 2, 0);49 try test__powihf2(0, 2, 0);
...@@ -65,35 +66,35 @@ test "powihf2" {...@@ -65,35 +66,35 @@ test "powihf2" {
65 try test__powihf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFE)), 1);66 try test__powihf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFE)), 1);
66 try test__powihf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFF)), 1);67 try test__powihf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFF)), 1);
6768
68 try test__powihf2(math.inf_f16, 1, math.inf_f16);69 try test__powihf2(inf_f16, 1, inf_f16);
69 try test__powihf2(math.inf_f16, 2, math.inf_f16);70 try test__powihf2(inf_f16, 2, inf_f16);
70 try test__powihf2(math.inf_f16, 3, math.inf_f16);71 try test__powihf2(inf_f16, 3, inf_f16);
71 try test__powihf2(math.inf_f16, 4, math.inf_f16);72 try test__powihf2(inf_f16, 4, inf_f16);
72 try test__powihf2(math.inf_f16, @bitCast(i32, @as(u32, 0x7FFFFFFE)), math.inf_f16);73 try test__powihf2(inf_f16, @bitCast(i32, @as(u32, 0x7FFFFFFE)), inf_f16);
73 try test__powihf2(math.inf_f16, @bitCast(i32, @as(u32, 0x7FFFFFFF)), math.inf_f16);74 try test__powihf2(inf_f16, @bitCast(i32, @as(u32, 0x7FFFFFFF)), inf_f16);
7475
75 try test__powihf2(-math.inf_f16, 1, -math.inf_f16);76 try test__powihf2(-inf_f16, 1, -inf_f16);
76 try test__powihf2(-math.inf_f16, 2, math.inf_f16);77 try test__powihf2(-inf_f16, 2, inf_f16);
77 try test__powihf2(-math.inf_f16, 3, -math.inf_f16);78 try test__powihf2(-inf_f16, 3, -inf_f16);
78 try test__powihf2(-math.inf_f16, 4, math.inf_f16);79 try test__powihf2(-inf_f16, 4, inf_f16);
79 try test__powihf2(-math.inf_f16, @bitCast(i32, @as(u32, 0x7FFFFFFE)), math.inf_f16);80 try test__powihf2(-inf_f16, @bitCast(i32, @as(u32, 0x7FFFFFFE)), inf_f16);
80 try test__powihf2(-math.inf_f16, @bitCast(i32, @as(u32, 0x7FFFFFFF)), -math.inf_f16);81 try test__powihf2(-inf_f16, @bitCast(i32, @as(u32, 0x7FFFFFFF)), -inf_f16);
81 //82 //
82 try test__powihf2(0, -1, math.inf_f16);83 try test__powihf2(0, -1, inf_f16);
83 try test__powihf2(0, -2, math.inf_f16);84 try test__powihf2(0, -2, inf_f16);
84 try test__powihf2(0, -3, math.inf_f16);85 try test__powihf2(0, -3, inf_f16);
85 try test__powihf2(0, -4, math.inf_f16);86 try test__powihf2(0, -4, inf_f16);
86 try test__powihf2(0, @bitCast(i32, @as(u32, 0x80000002)), math.inf_f16); // 0 ^ anything = +inf87 try test__powihf2(0, @bitCast(i32, @as(u32, 0x80000002)), inf_f16); // 0 ^ anything = +inf
87 try test__powihf2(0, @bitCast(i32, @as(u32, 0x80000001)), math.inf_f16);88 try test__powihf2(0, @bitCast(i32, @as(u32, 0x80000001)), inf_f16);
88 try test__powihf2(0, @bitCast(i32, @as(u32, 0x80000000)), math.inf_f16);89 try test__powihf2(0, @bitCast(i32, @as(u32, 0x80000000)), inf_f16);
8990
90 try test__powihf2(-0.0, -1, -math.inf_f16);91 try test__powihf2(-0.0, -1, -inf_f16);
91 try test__powihf2(-0.0, -2, math.inf_f16);92 try test__powihf2(-0.0, -2, inf_f16);
92 try test__powihf2(-0.0, -3, -math.inf_f16);93 try test__powihf2(-0.0, -3, -inf_f16);
93 try test__powihf2(-0.0, -4, math.inf_f16);94 try test__powihf2(-0.0, -4, inf_f16);
94 try test__powihf2(-0.0, @bitCast(i32, @as(u32, 0x80000002)), math.inf_f16); // -0 ^ anything even = +inf95 try test__powihf2(-0.0, @bitCast(i32, @as(u32, 0x80000002)), inf_f16); // -0 ^ anything even = +inf
95 try test__powihf2(-0.0, @bitCast(i32, @as(u32, 0x80000001)), -math.inf_f16); // -0 ^ anything odd = -inf96 try test__powihf2(-0.0, @bitCast(i32, @as(u32, 0x80000001)), -inf_f16); // -0 ^ anything odd = -inf
96 try test__powihf2(-0.0, @bitCast(i32, @as(u32, 0x80000000)), math.inf_f16);97 try test__powihf2(-0.0, @bitCast(i32, @as(u32, 0x80000000)), inf_f16);
9798
98 try test__powihf2(1, -1, 1);99 try test__powihf2(1, -1, 1);
99 try test__powihf2(1, -2, 1);100 try test__powihf2(1, -2, 1);
...@@ -103,21 +104,21 @@ test "powihf2" {...@@ -103,21 +104,21 @@ test "powihf2" {
103 try test__powihf2(1, @bitCast(i32, @as(u32, 0x80000001)), 1);104 try test__powihf2(1, @bitCast(i32, @as(u32, 0x80000001)), 1);
104 try test__powihf2(1, @bitCast(i32, @as(u32, 0x80000000)), 1);105 try test__powihf2(1, @bitCast(i32, @as(u32, 0x80000000)), 1);
105106
106 try test__powihf2(math.inf_f16, -1, 0);107 try test__powihf2(inf_f16, -1, 0);
107 try test__powihf2(math.inf_f16, -2, 0);108 try test__powihf2(inf_f16, -2, 0);
108 try test__powihf2(math.inf_f16, -3, 0);109 try test__powihf2(inf_f16, -3, 0);
109 try test__powihf2(math.inf_f16, -4, 0);110 try test__powihf2(inf_f16, -4, 0);
110 try test__powihf2(math.inf_f16, @bitCast(i32, @as(u32, 0x80000002)), 0);111 try test__powihf2(inf_f16, @bitCast(i32, @as(u32, 0x80000002)), 0);
111 try test__powihf2(math.inf_f16, @bitCast(i32, @as(u32, 0x80000001)), 0);112 try test__powihf2(inf_f16, @bitCast(i32, @as(u32, 0x80000001)), 0);
112 try test__powihf2(math.inf_f16, @bitCast(i32, @as(u32, 0x80000000)), 0);113 try test__powihf2(inf_f16, @bitCast(i32, @as(u32, 0x80000000)), 0);
113 //114 //
114 try test__powihf2(-math.inf_f16, -1, -0.0);115 try test__powihf2(-inf_f16, -1, -0.0);
115 try test__powihf2(-math.inf_f16, -2, 0);116 try test__powihf2(-inf_f16, -2, 0);
116 try test__powihf2(-math.inf_f16, -3, -0.0);117 try test__powihf2(-inf_f16, -3, -0.0);
117 try test__powihf2(-math.inf_f16, -4, 0);118 try test__powihf2(-inf_f16, -4, 0);
118 try test__powihf2(-math.inf_f16, @bitCast(i32, @as(u32, 0x80000002)), 0);119 try test__powihf2(-inf_f16, @bitCast(i32, @as(u32, 0x80000002)), 0);
119 try test__powihf2(-math.inf_f16, @bitCast(i32, @as(u32, 0x80000001)), -0.0);120 try test__powihf2(-inf_f16, @bitCast(i32, @as(u32, 0x80000001)), -0.0);
120 try test__powihf2(-math.inf_f16, @bitCast(i32, @as(u32, 0x80000000)), 0);121 try test__powihf2(-inf_f16, @bitCast(i32, @as(u32, 0x80000000)), 0);
121122
122 try test__powihf2(2, 10, 1024.0);123 try test__powihf2(2, 10, 1024.0);
123 try test__powihf2(-2, 10, 1024.0);124 try test__powihf2(-2, 10, 1024.0);
...@@ -128,8 +129,8 @@ test "powihf2" {...@@ -128,8 +129,8 @@ test "powihf2" {
128 try test__powihf2(-2, 14, 16384.0);129 try test__powihf2(-2, 14, 16384.0);
129 try test__powihf2(2, 15, 32768.0);130 try test__powihf2(2, 15, 32768.0);
130 try test__powihf2(-2, 15, -32768.0);131 try test__powihf2(-2, 15, -32768.0);
131 try test__powihf2(2, 16, math.inf_f16);132 try test__powihf2(2, 16, inf_f16);
132 try test__powihf2(-2, 16, math.inf_f16);133 try test__powihf2(-2, 16, inf_f16);
133134
134 try test__powihf2(2, -13, 1.0 / 8192.0);135 try test__powihf2(2, -13, 1.0 / 8192.0);
135 try test__powihf2(-2, -13, -1.0 / 8192.0);136 try test__powihf2(-2, -13, -1.0 / 8192.0);
...@@ -140,17 +141,18 @@ test "powihf2" {...@@ -140,17 +141,18 @@ test "powihf2" {
140}141}
141142
142test "powisf2" {143test "powisf2" {
144 const inf_f32 = math.inf(f32);
143 try test__powisf2(0, 0, 1);145 try test__powisf2(0, 0, 1);
144 try test__powisf2(1, 0, 1);146 try test__powisf2(1, 0, 1);
145 try test__powisf2(1.5, 0, 1);147 try test__powisf2(1.5, 0, 1);
146 try test__powisf2(2, 0, 1);148 try test__powisf2(2, 0, 1);
147 try test__powisf2(math.inf_f32, 0, 1);149 try test__powisf2(inf_f32, 0, 1);
148150
149 try test__powisf2(-0.0, 0, 1);151 try test__powisf2(-0.0, 0, 1);
150 try test__powisf2(-1, 0, 1);152 try test__powisf2(-1, 0, 1);
151 try test__powisf2(-1.5, 0, 1);153 try test__powisf2(-1.5, 0, 1);
152 try test__powisf2(-2, 0, 1);154 try test__powisf2(-2, 0, 1);
153 try test__powisf2(-math.inf_f32, 0, 1);155 try test__powisf2(-inf_f32, 0, 1);
154156
155 try test__powisf2(0, 1, 0);157 try test__powisf2(0, 1, 0);
156 try test__powisf2(0, 2, 0);158 try test__powisf2(0, 2, 0);
...@@ -173,35 +175,35 @@ test "powisf2" {...@@ -173,35 +175,35 @@ test "powisf2" {
173 try test__powisf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFE)), 1);175 try test__powisf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFE)), 1);
174 try test__powisf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFF)), 1);176 try test__powisf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFF)), 1);
175177
176 try test__powisf2(math.inf_f32, 1, math.inf_f32);178 try test__powisf2(inf_f32, 1, inf_f32);
177 try test__powisf2(math.inf_f32, 2, math.inf_f32);179 try test__powisf2(inf_f32, 2, inf_f32);
178 try test__powisf2(math.inf_f32, 3, math.inf_f32);180 try test__powisf2(inf_f32, 3, inf_f32);
179 try test__powisf2(math.inf_f32, 4, math.inf_f32);181 try test__powisf2(inf_f32, 4, inf_f32);
180 try test__powisf2(math.inf_f32, @bitCast(i32, @as(u32, 0x7FFFFFFE)), math.inf_f32);182 try test__powisf2(inf_f32, @bitCast(i32, @as(u32, 0x7FFFFFFE)), inf_f32);
181 try test__powisf2(math.inf_f32, @bitCast(i32, @as(u32, 0x7FFFFFFF)), math.inf_f32);183 try test__powisf2(inf_f32, @bitCast(i32, @as(u32, 0x7FFFFFFF)), inf_f32);
182184
183 try test__powisf2(-math.inf_f32, 1, -math.inf_f32);185 try test__powisf2(-inf_f32, 1, -inf_f32);
184 try test__powisf2(-math.inf_f32, 2, math.inf_f32);186 try test__powisf2(-inf_f32, 2, inf_f32);
185 try test__powisf2(-math.inf_f32, 3, -math.inf_f32);187 try test__powisf2(-inf_f32, 3, -inf_f32);
186 try test__powisf2(-math.inf_f32, 4, math.inf_f32);188 try test__powisf2(-inf_f32, 4, inf_f32);
187 try test__powisf2(-math.inf_f32, @bitCast(i32, @as(u32, 0x7FFFFFFE)), math.inf_f32);189 try test__powisf2(-inf_f32, @bitCast(i32, @as(u32, 0x7FFFFFFE)), inf_f32);
188 try test__powisf2(-math.inf_f32, @bitCast(i32, @as(u32, 0x7FFFFFFF)), -math.inf_f32);190 try test__powisf2(-inf_f32, @bitCast(i32, @as(u32, 0x7FFFFFFF)), -inf_f32);
189191
190 try test__powisf2(0, -1, math.inf_f32);192 try test__powisf2(0, -1, inf_f32);
191 try test__powisf2(0, -2, math.inf_f32);193 try test__powisf2(0, -2, inf_f32);
192 try test__powisf2(0, -3, math.inf_f32);194 try test__powisf2(0, -3, inf_f32);
193 try test__powisf2(0, -4, math.inf_f32);195 try test__powisf2(0, -4, inf_f32);
194 try test__powisf2(0, @bitCast(i32, @as(u32, 0x80000002)), math.inf_f32);196 try test__powisf2(0, @bitCast(i32, @as(u32, 0x80000002)), inf_f32);
195 try test__powisf2(0, @bitCast(i32, @as(u32, 0x80000001)), math.inf_f32);197 try test__powisf2(0, @bitCast(i32, @as(u32, 0x80000001)), inf_f32);
196 try test__powisf2(0, @bitCast(i32, @as(u32, 0x80000000)), math.inf_f32);198 try test__powisf2(0, @bitCast(i32, @as(u32, 0x80000000)), inf_f32);
197199
198 try test__powisf2(-0.0, -1, -math.inf_f32);200 try test__powisf2(-0.0, -1, -inf_f32);
199 try test__powisf2(-0.0, -2, math.inf_f32);201 try test__powisf2(-0.0, -2, inf_f32);
200 try test__powisf2(-0.0, -3, -math.inf_f32);202 try test__powisf2(-0.0, -3, -inf_f32);
201 try test__powisf2(-0.0, -4, math.inf_f32);203 try test__powisf2(-0.0, -4, inf_f32);
202 try test__powisf2(-0.0, @bitCast(i32, @as(u32, 0x80000002)), math.inf_f32);204 try test__powisf2(-0.0, @bitCast(i32, @as(u32, 0x80000002)), inf_f32);
203 try test__powisf2(-0.0, @bitCast(i32, @as(u32, 0x80000001)), -math.inf_f32);205 try test__powisf2(-0.0, @bitCast(i32, @as(u32, 0x80000001)), -inf_f32);
204 try test__powisf2(-0.0, @bitCast(i32, @as(u32, 0x80000000)), math.inf_f32);206 try test__powisf2(-0.0, @bitCast(i32, @as(u32, 0x80000000)), inf_f32);
205207
206 try test__powisf2(1, -1, 1);208 try test__powisf2(1, -1, 1);
207 try test__powisf2(1, -2, 1);209 try test__powisf2(1, -2, 1);
...@@ -211,21 +213,21 @@ test "powisf2" {...@@ -211,21 +213,21 @@ test "powisf2" {
211 try test__powisf2(1, @bitCast(i32, @as(u32, 0x80000001)), 1);213 try test__powisf2(1, @bitCast(i32, @as(u32, 0x80000001)), 1);
212 try test__powisf2(1, @bitCast(i32, @as(u32, 0x80000000)), 1);214 try test__powisf2(1, @bitCast(i32, @as(u32, 0x80000000)), 1);
213215
214 try test__powisf2(math.inf_f32, -1, 0);216 try test__powisf2(inf_f32, -1, 0);
215 try test__powisf2(math.inf_f32, -2, 0);217 try test__powisf2(inf_f32, -2, 0);
216 try test__powisf2(math.inf_f32, -3, 0);218 try test__powisf2(inf_f32, -3, 0);
217 try test__powisf2(math.inf_f32, -4, 0);219 try test__powisf2(inf_f32, -4, 0);
218 try test__powisf2(math.inf_f32, @bitCast(i32, @as(u32, 0x80000002)), 0);220 try test__powisf2(inf_f32, @bitCast(i32, @as(u32, 0x80000002)), 0);
219 try test__powisf2(math.inf_f32, @bitCast(i32, @as(u32, 0x80000001)), 0);221 try test__powisf2(inf_f32, @bitCast(i32, @as(u32, 0x80000001)), 0);
220 try test__powisf2(math.inf_f32, @bitCast(i32, @as(u32, 0x80000000)), 0);222 try test__powisf2(inf_f32, @bitCast(i32, @as(u32, 0x80000000)), 0);
221223
222 try test__powisf2(-math.inf_f32, -1, -0.0);224 try test__powisf2(-inf_f32, -1, -0.0);
223 try test__powisf2(-math.inf_f32, -2, 0);225 try test__powisf2(-inf_f32, -2, 0);
224 try test__powisf2(-math.inf_f32, -3, -0.0);226 try test__powisf2(-inf_f32, -3, -0.0);
225 try test__powisf2(-math.inf_f32, -4, 0);227 try test__powisf2(-inf_f32, -4, 0);
226 try test__powisf2(-math.inf_f32, @bitCast(i32, @as(u32, 0x80000002)), 0);228 try test__powisf2(-inf_f32, @bitCast(i32, @as(u32, 0x80000002)), 0);
227 try test__powisf2(-math.inf_f32, @bitCast(i32, @as(u32, 0x80000001)), -0.0);229 try test__powisf2(-inf_f32, @bitCast(i32, @as(u32, 0x80000001)), -0.0);
228 try test__powisf2(-math.inf_f32, @bitCast(i32, @as(u32, 0x80000000)), 0);230 try test__powisf2(-inf_f32, @bitCast(i32, @as(u32, 0x80000000)), 0);
229231
230 try test__powisf2(2.0, 10, 1024.0);232 try test__powisf2(2.0, 10, 1024.0);
231 try test__powisf2(-2, 10, 1024.0);233 try test__powisf2(-2, 10, 1024.0);
...@@ -244,17 +246,18 @@ test "powisf2" {...@@ -244,17 +246,18 @@ test "powisf2" {
244}246}
245247
246test "powidf2" {248test "powidf2" {
249 const inf_f64 = math.inf(f64);
247 try test__powidf2(0, 0, 1);250 try test__powidf2(0, 0, 1);
248 try test__powidf2(1, 0, 1);251 try test__powidf2(1, 0, 1);
249 try test__powidf2(1.5, 0, 1);252 try test__powidf2(1.5, 0, 1);
250 try test__powidf2(2, 0, 1);253 try test__powidf2(2, 0, 1);
251 try test__powidf2(math.inf_f64, 0, 1);254 try test__powidf2(inf_f64, 0, 1);
252255
253 try test__powidf2(-0.0, 0, 1);256 try test__powidf2(-0.0, 0, 1);
254 try test__powidf2(-1, 0, 1);257 try test__powidf2(-1, 0, 1);
255 try test__powidf2(-1.5, 0, 1);258 try test__powidf2(-1.5, 0, 1);
256 try test__powidf2(-2, 0, 1);259 try test__powidf2(-2, 0, 1);
257 try test__powidf2(-math.inf_f64, 0, 1);260 try test__powidf2(-inf_f64, 0, 1);
258261
259 try test__powidf2(0, 1, 0);262 try test__powidf2(0, 1, 0);
260 try test__powidf2(0, 2, 0);263 try test__powidf2(0, 2, 0);
...@@ -277,35 +280,35 @@ test "powidf2" {...@@ -277,35 +280,35 @@ test "powidf2" {
277 try test__powidf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFE)), 1);280 try test__powidf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFE)), 1);
278 try test__powidf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFF)), 1);281 try test__powidf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFF)), 1);
279282
280 try test__powidf2(math.inf_f64, 1, math.inf_f64);283 try test__powidf2(inf_f64, 1, inf_f64);
281 try test__powidf2(math.inf_f64, 2, math.inf_f64);284 try test__powidf2(inf_f64, 2, inf_f64);
282 try test__powidf2(math.inf_f64, 3, math.inf_f64);285 try test__powidf2(inf_f64, 3, inf_f64);
283 try test__powidf2(math.inf_f64, 4, math.inf_f64);286 try test__powidf2(inf_f64, 4, inf_f64);
284 try test__powidf2(math.inf_f64, @bitCast(i32, @as(u32, 0x7FFFFFFE)), math.inf_f64);287 try test__powidf2(inf_f64, @bitCast(i32, @as(u32, 0x7FFFFFFE)), inf_f64);
285 try test__powidf2(math.inf_f64, @bitCast(i32, @as(u32, 0x7FFFFFFF)), math.inf_f64);288 try test__powidf2(inf_f64, @bitCast(i32, @as(u32, 0x7FFFFFFF)), inf_f64);
286289
287 try test__powidf2(-math.inf_f64, 1, -math.inf_f64);290 try test__powidf2(-inf_f64, 1, -inf_f64);
288 try test__powidf2(-math.inf_f64, 2, math.inf_f64);291 try test__powidf2(-inf_f64, 2, inf_f64);
289 try test__powidf2(-math.inf_f64, 3, -math.inf_f64);292 try test__powidf2(-inf_f64, 3, -inf_f64);
290 try test__powidf2(-math.inf_f64, 4, math.inf_f64);293 try test__powidf2(-inf_f64, 4, inf_f64);
291 try test__powidf2(-math.inf_f64, @bitCast(i32, @as(u32, 0x7FFFFFFE)), math.inf_f64);294 try test__powidf2(-inf_f64, @bitCast(i32, @as(u32, 0x7FFFFFFE)), inf_f64);
292 try test__powidf2(-math.inf_f64, @bitCast(i32, @as(u32, 0x7FFFFFFF)), -math.inf_f64);295 try test__powidf2(-inf_f64, @bitCast(i32, @as(u32, 0x7FFFFFFF)), -inf_f64);
293296
294 try test__powidf2(0, -1, math.inf_f64);297 try test__powidf2(0, -1, inf_f64);
295 try test__powidf2(0, -2, math.inf_f64);298 try test__powidf2(0, -2, inf_f64);
296 try test__powidf2(0, -3, math.inf_f64);299 try test__powidf2(0, -3, inf_f64);
297 try test__powidf2(0, -4, math.inf_f64);300 try test__powidf2(0, -4, inf_f64);
298 try test__powidf2(0, @bitCast(i32, @as(u32, 0x80000002)), math.inf_f64);301 try test__powidf2(0, @bitCast(i32, @as(u32, 0x80000002)), inf_f64);
299 try test__powidf2(0, @bitCast(i32, @as(u32, 0x80000001)), math.inf_f64);302 try test__powidf2(0, @bitCast(i32, @as(u32, 0x80000001)), inf_f64);
300 try test__powidf2(0, @bitCast(i32, @as(u32, 0x80000000)), math.inf_f64);303 try test__powidf2(0, @bitCast(i32, @as(u32, 0x80000000)), inf_f64);
301304
302 try test__powidf2(-0.0, -1, -math.inf_f64);305 try test__powidf2(-0.0, -1, -inf_f64);
303 try test__powidf2(-0.0, -2, math.inf_f64);306 try test__powidf2(-0.0, -2, inf_f64);
304 try test__powidf2(-0.0, -3, -math.inf_f64);307 try test__powidf2(-0.0, -3, -inf_f64);
305 try test__powidf2(-0.0, -4, math.inf_f64);308 try test__powidf2(-0.0, -4, inf_f64);
306 try test__powidf2(-0.0, @bitCast(i32, @as(u32, 0x80000002)), math.inf_f64);309 try test__powidf2(-0.0, @bitCast(i32, @as(u32, 0x80000002)), inf_f64);
307 try test__powidf2(-0.0, @bitCast(i32, @as(u32, 0x80000001)), -math.inf_f64);310 try test__powidf2(-0.0, @bitCast(i32, @as(u32, 0x80000001)), -inf_f64);
308 try test__powidf2(-0.0, @bitCast(i32, @as(u32, 0x80000000)), math.inf_f64);311 try test__powidf2(-0.0, @bitCast(i32, @as(u32, 0x80000000)), inf_f64);
309312
310 try test__powidf2(1, -1, 1);313 try test__powidf2(1, -1, 1);
311 try test__powidf2(1, -2, 1);314 try test__powidf2(1, -2, 1);
...@@ -315,21 +318,21 @@ test "powidf2" {...@@ -315,21 +318,21 @@ test "powidf2" {
315 try test__powidf2(1, @bitCast(i32, @as(u32, 0x80000001)), 1);318 try test__powidf2(1, @bitCast(i32, @as(u32, 0x80000001)), 1);
316 try test__powidf2(1, @bitCast(i32, @as(u32, 0x80000000)), 1);319 try test__powidf2(1, @bitCast(i32, @as(u32, 0x80000000)), 1);
317320
318 try test__powidf2(math.inf_f64, -1, 0);321 try test__powidf2(inf_f64, -1, 0);
319 try test__powidf2(math.inf_f64, -2, 0);322 try test__powidf2(inf_f64, -2, 0);
320 try test__powidf2(math.inf_f64, -3, 0);323 try test__powidf2(inf_f64, -3, 0);
321 try test__powidf2(math.inf_f64, -4, 0);324 try test__powidf2(inf_f64, -4, 0);
322 try test__powidf2(math.inf_f64, @bitCast(i32, @as(u32, 0x80000002)), 0);325 try test__powidf2(inf_f64, @bitCast(i32, @as(u32, 0x80000002)), 0);
323 try test__powidf2(math.inf_f64, @bitCast(i32, @as(u32, 0x80000001)), 0);326 try test__powidf2(inf_f64, @bitCast(i32, @as(u32, 0x80000001)), 0);
324 try test__powidf2(math.inf_f64, @bitCast(i32, @as(u32, 0x80000000)), 0);327 try test__powidf2(inf_f64, @bitCast(i32, @as(u32, 0x80000000)), 0);
325328
326 try test__powidf2(-math.inf_f64, -1, -0.0);329 try test__powidf2(-inf_f64, -1, -0.0);
327 try test__powidf2(-math.inf_f64, -2, 0);330 try test__powidf2(-inf_f64, -2, 0);
328 try test__powidf2(-math.inf_f64, -3, -0.0);331 try test__powidf2(-inf_f64, -3, -0.0);
329 try test__powidf2(-math.inf_f64, -4, 0);332 try test__powidf2(-inf_f64, -4, 0);
330 try test__powidf2(-math.inf_f64, @bitCast(i32, @as(u32, 0x80000002)), 0);333 try test__powidf2(-inf_f64, @bitCast(i32, @as(u32, 0x80000002)), 0);
331 try test__powidf2(-math.inf_f64, @bitCast(i32, @as(u32, 0x80000001)), -0.0);334 try test__powidf2(-inf_f64, @bitCast(i32, @as(u32, 0x80000001)), -0.0);
332 try test__powidf2(-math.inf_f64, @bitCast(i32, @as(u32, 0x80000000)), 0);335 try test__powidf2(-inf_f64, @bitCast(i32, @as(u32, 0x80000000)), 0);
333336
334 try test__powidf2(2, 10, 1024.0);337 try test__powidf2(2, 10, 1024.0);
335 try test__powidf2(-2, 10, 1024.0);338 try test__powidf2(-2, 10, 1024.0);
...@@ -348,17 +351,18 @@ test "powidf2" {...@@ -348,17 +351,18 @@ test "powidf2" {
348}351}
349352
350test "powitf2" {353test "powitf2" {
354 const inf_f128 = math.inf(f128);
351 try test__powitf2(0, 0, 1);355 try test__powitf2(0, 0, 1);
352 try test__powitf2(1, 0, 1);356 try test__powitf2(1, 0, 1);
353 try test__powitf2(1.5, 0, 1);357 try test__powitf2(1.5, 0, 1);
354 try test__powitf2(2, 0, 1);358 try test__powitf2(2, 0, 1);
355 try test__powitf2(math.inf_f128, 0, 1);359 try test__powitf2(inf_f128, 0, 1);
356360
357 try test__powitf2(-0.0, 0, 1);361 try test__powitf2(-0.0, 0, 1);
358 try test__powitf2(-1, 0, 1);362 try test__powitf2(-1, 0, 1);
359 try test__powitf2(-1.5, 0, 1);363 try test__powitf2(-1.5, 0, 1);
360 try test__powitf2(-2, 0, 1);364 try test__powitf2(-2, 0, 1);
361 try test__powitf2(-math.inf_f128, 0, 1);365 try test__powitf2(-inf_f128, 0, 1);
362366
363 try test__powitf2(0, 1, 0);367 try test__powitf2(0, 1, 0);
364 try test__powitf2(0, 2, 0);368 try test__powitf2(0, 2, 0);
...@@ -381,35 +385,35 @@ test "powitf2" {...@@ -381,35 +385,35 @@ test "powitf2" {
381 try test__powitf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFE)), 1);385 try test__powitf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFE)), 1);
382 try test__powitf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFF)), 1);386 try test__powitf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFF)), 1);
383387
384 try test__powitf2(math.inf_f128, 1, math.inf_f128);388 try test__powitf2(inf_f128, 1, inf_f128);
385 try test__powitf2(math.inf_f128, 2, math.inf_f128);389 try test__powitf2(inf_f128, 2, inf_f128);
386 try test__powitf2(math.inf_f128, 3, math.inf_f128);390 try test__powitf2(inf_f128, 3, inf_f128);
387 try test__powitf2(math.inf_f128, 4, math.inf_f128);391 try test__powitf2(inf_f128, 4, inf_f128);
388 try test__powitf2(math.inf_f128, @bitCast(i32, @as(u32, 0x7FFFFFFE)), math.inf_f128);392 try test__powitf2(inf_f128, @bitCast(i32, @as(u32, 0x7FFFFFFE)), inf_f128);
389 try test__powitf2(math.inf_f128, @bitCast(i32, @as(u32, 0x7FFFFFFF)), math.inf_f128);393 try test__powitf2(inf_f128, @bitCast(i32, @as(u32, 0x7FFFFFFF)), inf_f128);
390394
391 try test__powitf2(-math.inf_f128, 1, -math.inf_f128);395 try test__powitf2(-inf_f128, 1, -inf_f128);
392 try test__powitf2(-math.inf_f128, 2, math.inf_f128);396 try test__powitf2(-inf_f128, 2, inf_f128);
393 try test__powitf2(-math.inf_f128, 3, -math.inf_f128);397 try test__powitf2(-inf_f128, 3, -inf_f128);
394 try test__powitf2(-math.inf_f128, 4, math.inf_f128);398 try test__powitf2(-inf_f128, 4, inf_f128);
395 try test__powitf2(-math.inf_f128, @bitCast(i32, @as(u32, 0x7FFFFFFE)), math.inf_f128);399 try test__powitf2(-inf_f128, @bitCast(i32, @as(u32, 0x7FFFFFFE)), inf_f128);
396 try test__powitf2(-math.inf_f128, @bitCast(i32, @as(u32, 0x7FFFFFFF)), -math.inf_f128);400 try test__powitf2(-inf_f128, @bitCast(i32, @as(u32, 0x7FFFFFFF)), -inf_f128);
397401
398 try test__powitf2(0, -1, math.inf_f128);402 try test__powitf2(0, -1, inf_f128);
399 try test__powitf2(0, -2, math.inf_f128);403 try test__powitf2(0, -2, inf_f128);
400 try test__powitf2(0, -3, math.inf_f128);404 try test__powitf2(0, -3, inf_f128);
401 try test__powitf2(0, -4, math.inf_f128);405 try test__powitf2(0, -4, inf_f128);
402 try test__powitf2(0, @bitCast(i32, @as(u32, 0x80000002)), math.inf_f128);406 try test__powitf2(0, @bitCast(i32, @as(u32, 0x80000002)), inf_f128);
403 try test__powitf2(0, @bitCast(i32, @as(u32, 0x80000001)), math.inf_f128);407 try test__powitf2(0, @bitCast(i32, @as(u32, 0x80000001)), inf_f128);
404 try test__powitf2(0, @bitCast(i32, @as(u32, 0x80000000)), math.inf_f128);408 try test__powitf2(0, @bitCast(i32, @as(u32, 0x80000000)), inf_f128);
405409
406 try test__powitf2(-0.0, -1, -math.inf_f128);410 try test__powitf2(-0.0, -1, -inf_f128);
407 try test__powitf2(-0.0, -2, math.inf_f128);411 try test__powitf2(-0.0, -2, inf_f128);
408 try test__powitf2(-0.0, -3, -math.inf_f128);412 try test__powitf2(-0.0, -3, -inf_f128);
409 try test__powitf2(-0.0, -4, math.inf_f128);413 try test__powitf2(-0.0, -4, inf_f128);
410 try test__powitf2(-0.0, @bitCast(i32, @as(u32, 0x80000002)), math.inf_f128);414 try test__powitf2(-0.0, @bitCast(i32, @as(u32, 0x80000002)), inf_f128);
411 try test__powitf2(-0.0, @bitCast(i32, @as(u32, 0x80000001)), -math.inf_f128);415 try test__powitf2(-0.0, @bitCast(i32, @as(u32, 0x80000001)), -inf_f128);
412 try test__powitf2(-0.0, @bitCast(i32, @as(u32, 0x80000000)), math.inf_f128);416 try test__powitf2(-0.0, @bitCast(i32, @as(u32, 0x80000000)), inf_f128);
413417
414 try test__powitf2(1, -1, 1);418 try test__powitf2(1, -1, 1);
415 try test__powitf2(1, -2, 1);419 try test__powitf2(1, -2, 1);
...@@ -419,21 +423,21 @@ test "powitf2" {...@@ -419,21 +423,21 @@ test "powitf2" {
419 try test__powitf2(1, @bitCast(i32, @as(u32, 0x80000001)), 1);423 try test__powitf2(1, @bitCast(i32, @as(u32, 0x80000001)), 1);
420 try test__powitf2(1, @bitCast(i32, @as(u32, 0x80000000)), 1);424 try test__powitf2(1, @bitCast(i32, @as(u32, 0x80000000)), 1);
421425
422 try test__powitf2(math.inf_f128, -1, 0);426 try test__powitf2(inf_f128, -1, 0);
423 try test__powitf2(math.inf_f128, -2, 0);427 try test__powitf2(inf_f128, -2, 0);
424 try test__powitf2(math.inf_f128, -3, 0);428 try test__powitf2(inf_f128, -3, 0);
425 try test__powitf2(math.inf_f128, -4, 0);429 try test__powitf2(inf_f128, -4, 0);
426 try test__powitf2(math.inf_f128, @bitCast(i32, @as(u32, 0x80000002)), 0);430 try test__powitf2(inf_f128, @bitCast(i32, @as(u32, 0x80000002)), 0);
427 try test__powitf2(math.inf_f128, @bitCast(i32, @as(u32, 0x80000001)), 0);431 try test__powitf2(inf_f128, @bitCast(i32, @as(u32, 0x80000001)), 0);
428 try test__powitf2(math.inf_f128, @bitCast(i32, @as(u32, 0x80000000)), 0);432 try test__powitf2(inf_f128, @bitCast(i32, @as(u32, 0x80000000)), 0);
429433
430 try test__powitf2(-math.inf_f128, -1, -0.0);434 try test__powitf2(-inf_f128, -1, -0.0);
431 try test__powitf2(-math.inf_f128, -2, 0);435 try test__powitf2(-inf_f128, -2, 0);
432 try test__powitf2(-math.inf_f128, -3, -0.0);436 try test__powitf2(-inf_f128, -3, -0.0);
433 try test__powitf2(-math.inf_f128, -4, 0);437 try test__powitf2(-inf_f128, -4, 0);
434 try test__powitf2(-math.inf_f128, @bitCast(i32, @as(u32, 0x80000002)), 0);438 try test__powitf2(-inf_f128, @bitCast(i32, @as(u32, 0x80000002)), 0);
435 try test__powitf2(-math.inf_f128, @bitCast(i32, @as(u32, 0x80000001)), -0.0);439 try test__powitf2(-inf_f128, @bitCast(i32, @as(u32, 0x80000001)), -0.0);
436 try test__powitf2(-math.inf_f128, @bitCast(i32, @as(u32, 0x80000000)), 0);440 try test__powitf2(-inf_f128, @bitCast(i32, @as(u32, 0x80000000)), 0);
437441
438 try test__powitf2(2, 10, 1024.0);442 try test__powitf2(2, 10, 1024.0);
439 try test__powitf2(-2, 10, 1024.0);443 try test__powitf2(-2, 10, 1024.0);
...@@ -452,17 +456,18 @@ test "powitf2" {...@@ -452,17 +456,18 @@ test "powitf2" {
452}456}
453457
454test "powixf2" {458test "powixf2" {
459 const inf_f80 = math.inf(f80);
455 try test__powixf2(0, 0, 1);460 try test__powixf2(0, 0, 1);
456 try test__powixf2(1, 0, 1);461 try test__powixf2(1, 0, 1);
457 try test__powixf2(1.5, 0, 1);462 try test__powixf2(1.5, 0, 1);
458 try test__powixf2(2, 0, 1);463 try test__powixf2(2, 0, 1);
459 try test__powixf2(math.inf_f80, 0, 1);464 try test__powixf2(inf_f80, 0, 1);
460465
461 try test__powixf2(-0.0, 0, 1);466 try test__powixf2(-0.0, 0, 1);
462 try test__powixf2(-1, 0, 1);467 try test__powixf2(-1, 0, 1);
463 try test__powixf2(-1.5, 0, 1);468 try test__powixf2(-1.5, 0, 1);
464 try test__powixf2(-2, 0, 1);469 try test__powixf2(-2, 0, 1);
465 try test__powixf2(-math.inf_f80, 0, 1);470 try test__powixf2(-inf_f80, 0, 1);
466471
467 try test__powixf2(0, 1, 0);472 try test__powixf2(0, 1, 0);
468 try test__powixf2(0, 2, 0);473 try test__powixf2(0, 2, 0);
...@@ -485,35 +490,35 @@ test "powixf2" {...@@ -485,35 +490,35 @@ test "powixf2" {
485 try test__powixf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFE)), 1);490 try test__powixf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFE)), 1);
486 try test__powixf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFF)), 1);491 try test__powixf2(1, @bitCast(i32, @as(u32, 0x7FFFFFFF)), 1);
487492
488 try test__powixf2(math.inf_f80, 1, math.inf_f80);493 try test__powixf2(inf_f80, 1, inf_f80);
489 try test__powixf2(math.inf_f80, 2, math.inf_f80);494 try test__powixf2(inf_f80, 2, inf_f80);
490 try test__powixf2(math.inf_f80, 3, math.inf_f80);495 try test__powixf2(inf_f80, 3, inf_f80);
491 try test__powixf2(math.inf_f80, 4, math.inf_f80);496 try test__powixf2(inf_f80, 4, inf_f80);
492 try test__powixf2(math.inf_f80, @bitCast(i32, @as(u32, 0x7FFFFFFE)), math.inf_f80);497 try test__powixf2(inf_f80, @bitCast(i32, @as(u32, 0x7FFFFFFE)), inf_f80);
493 try test__powixf2(math.inf_f80, @bitCast(i32, @as(u32, 0x7FFFFFFF)), math.inf_f80);498 try test__powixf2(inf_f80, @bitCast(i32, @as(u32, 0x7FFFFFFF)), inf_f80);
494499
495 try test__powixf2(-math.inf_f80, 1, -math.inf_f80);500 try test__powixf2(-inf_f80, 1, -inf_f80);
496 try test__powixf2(-math.inf_f80, 2, math.inf_f80);501 try test__powixf2(-inf_f80, 2, inf_f80);
497 try test__powixf2(-math.inf_f80, 3, -math.inf_f80);502 try test__powixf2(-inf_f80, 3, -inf_f80);
498 try test__powixf2(-math.inf_f80, 4, math.inf_f80);503 try test__powixf2(-inf_f80, 4, inf_f80);
499 try test__powixf2(-math.inf_f80, @bitCast(i32, @as(u32, 0x7FFFFFFE)), math.inf_f80);504 try test__powixf2(-inf_f80, @bitCast(i32, @as(u32, 0x7FFFFFFE)), inf_f80);
500 try test__powixf2(-math.inf_f80, @bitCast(i32, @as(u32, 0x7FFFFFFF)), -math.inf_f80);505 try test__powixf2(-inf_f80, @bitCast(i32, @as(u32, 0x7FFFFFFF)), -inf_f80);
501506
502 try test__powixf2(0, -1, math.inf_f80);507 try test__powixf2(0, -1, inf_f80);
503 try test__powixf2(0, -2, math.inf_f80);508 try test__powixf2(0, -2, inf_f80);
504 try test__powixf2(0, -3, math.inf_f80);509 try test__powixf2(0, -3, inf_f80);
505 try test__powixf2(0, -4, math.inf_f80);510 try test__powixf2(0, -4, inf_f80);
506 try test__powixf2(0, @bitCast(i32, @as(u32, 0x80000002)), math.inf_f80);511 try test__powixf2(0, @bitCast(i32, @as(u32, 0x80000002)), inf_f80);
507 try test__powixf2(0, @bitCast(i32, @as(u32, 0x80000001)), math.inf_f80);512 try test__powixf2(0, @bitCast(i32, @as(u32, 0x80000001)), inf_f80);
508 try test__powixf2(0, @bitCast(i32, @as(u32, 0x80000000)), math.inf_f80);513 try test__powixf2(0, @bitCast(i32, @as(u32, 0x80000000)), inf_f80);
509514
510 try test__powixf2(-0.0, -1, -math.inf_f80);515 try test__powixf2(-0.0, -1, -inf_f80);
511 try test__powixf2(-0.0, -2, math.inf_f80);516 try test__powixf2(-0.0, -2, inf_f80);
512 try test__powixf2(-0.0, -3, -math.inf_f80);517 try test__powixf2(-0.0, -3, -inf_f80);
513 try test__powixf2(-0.0, -4, math.inf_f80);518 try test__powixf2(-0.0, -4, inf_f80);
514 try test__powixf2(-0.0, @bitCast(i32, @as(u32, 0x80000002)), math.inf_f80);519 try test__powixf2(-0.0, @bitCast(i32, @as(u32, 0x80000002)), inf_f80);
515 try test__powixf2(-0.0, @bitCast(i32, @as(u32, 0x80000001)), -math.inf_f80);520 try test__powixf2(-0.0, @bitCast(i32, @as(u32, 0x80000001)), -inf_f80);
516 try test__powixf2(-0.0, @bitCast(i32, @as(u32, 0x80000000)), math.inf_f80);521 try test__powixf2(-0.0, @bitCast(i32, @as(u32, 0x80000000)), inf_f80);
517522
518 try test__powixf2(1, -1, 1);523 try test__powixf2(1, -1, 1);
519 try test__powixf2(1, -2, 1);524 try test__powixf2(1, -2, 1);
...@@ -523,21 +528,21 @@ test "powixf2" {...@@ -523,21 +528,21 @@ test "powixf2" {
523 try test__powixf2(1, @bitCast(i32, @as(u32, 0x80000001)), 1);528 try test__powixf2(1, @bitCast(i32, @as(u32, 0x80000001)), 1);
524 try test__powixf2(1, @bitCast(i32, @as(u32, 0x80000000)), 1);529 try test__powixf2(1, @bitCast(i32, @as(u32, 0x80000000)), 1);
525530
526 try test__powixf2(math.inf_f80, -1, 0);531 try test__powixf2(inf_f80, -1, 0);
527 try test__powixf2(math.inf_f80, -2, 0);532 try test__powixf2(inf_f80, -2, 0);
528 try test__powixf2(math.inf_f80, -3, 0);533 try test__powixf2(inf_f80, -3, 0);
529 try test__powixf2(math.inf_f80, -4, 0);534 try test__powixf2(inf_f80, -4, 0);
530 try test__powixf2(math.inf_f80, @bitCast(i32, @as(u32, 0x80000002)), 0);535 try test__powixf2(inf_f80, @bitCast(i32, @as(u32, 0x80000002)), 0);
531 try test__powixf2(math.inf_f80, @bitCast(i32, @as(u32, 0x80000001)), 0);536 try test__powixf2(inf_f80, @bitCast(i32, @as(u32, 0x80000001)), 0);
532 try test__powixf2(math.inf_f80, @bitCast(i32, @as(u32, 0x80000000)), 0);537 try test__powixf2(inf_f80, @bitCast(i32, @as(u32, 0x80000000)), 0);
533538
534 try test__powixf2(-math.inf_f80, -1, -0.0);539 try test__powixf2(-inf_f80, -1, -0.0);
535 try test__powixf2(-math.inf_f80, -2, 0);540 try test__powixf2(-inf_f80, -2, 0);
536 try test__powixf2(-math.inf_f80, -3, -0.0);541 try test__powixf2(-inf_f80, -3, -0.0);
537 try test__powixf2(-math.inf_f80, -4, 0);542 try test__powixf2(-inf_f80, -4, 0);
538 try test__powixf2(-math.inf_f80, @bitCast(i32, @as(u32, 0x80000002)), 0);543 try test__powixf2(-inf_f80, @bitCast(i32, @as(u32, 0x80000002)), 0);
539 try test__powixf2(-math.inf_f80, @bitCast(i32, @as(u32, 0x80000001)), -0.0);544 try test__powixf2(-inf_f80, @bitCast(i32, @as(u32, 0x80000001)), -0.0);
540 try test__powixf2(-math.inf_f80, @bitCast(i32, @as(u32, 0x80000000)), 0);545 try test__powixf2(-inf_f80, @bitCast(i32, @as(u32, 0x80000000)), 0);
541546
542 try test__powixf2(2, 10, 1024.0);547 try test__powixf2(2, 10, 1024.0);
543 try test__powixf2(-2, 10, 1024.0);548 try test__powixf2(-2, 10, 1024.0);
lib/std/math.zig+121-38
...@@ -48,43 +48,41 @@ pub const floatMax = @import("math/float.zig").floatMax;...@@ -48,43 +48,41 @@ pub const floatMax = @import("math/float.zig").floatMax;
48pub const floatEps = @import("math/float.zig").floatEps;48pub const floatEps = @import("math/float.zig").floatEps;
49pub const inf = @import("math/float.zig").inf;49pub const inf = @import("math/float.zig").inf;
5050
51// TODO Replace with @compileError("deprecated for foobar") after 0.10.0 is released.51pub const f16_true_min = @compileError("Deprecated: use `floatTrueMin(f16)` instead");
52pub const f16_true_min: comptime_float = floatTrueMin(f16); // prev: 0.00000005960464477539062552pub const f32_true_min = @compileError("Deprecated: use `floatTrueMin(f32)` instead");
53pub const f32_true_min: comptime_float = floatTrueMin(f32); // prev: 1.40129846432481707092e-4553pub const f64_true_min = @compileError("Deprecated: use `floatTrueMin(f64)` instead");
54pub const f64_true_min: comptime_float = floatTrueMin(f64); // prev: 4.94065645841246544177e-32454pub const f80_true_min = @compileError("Deprecated: use `floatTrueMin(f80)` instead");
55pub const f80_true_min = floatTrueMin(f80); // prev: make_f80(.{ .fraction = 1, .exp = 0 })55pub const f128_true_min = @compileError("Deprecated: use `floatTrueMin(f128)` instead");
56pub const f128_true_min = floatTrueMin(f128); // prev: @bitCast(f128, @as(u128, 0x00000000000000000000000000000001))56pub const f16_min = @compileError("Deprecated: use `floatMin(f16)` instead");
57pub const f16_min: comptime_float = floatMin(f16); // prev: 0.0000610351562557pub const f32_min = @compileError("Deprecated: use `floatMin(f32)` instead");
58pub const f32_min: comptime_float = floatMin(f32); // prev: 1.17549435082228750797e-3858pub const f64_min = @compileError("Deprecated: use `floatMin(f64)` instead");
59pub const f64_min: comptime_float = floatMin(f64); // prev: 2.2250738585072014e-30859pub const f80_min = @compileError("Deprecated: use `floatMin(f80)` instead");
60pub const f80_min = floatMin(f80); // prev: make_f80(.{ .fraction = 0x8000000000000000, .exp = 1 })60pub const f128_min = @compileError("Deprecated: use `floatMin(f128)` instead");
61pub const f128_min = floatMin(f128); // prev: @bitCast(f128, @as(u128, 0x00010000000000000000000000000000))61pub const f16_max = @compileError("Deprecated: use `floatMax(f16)` instead");
62pub const f16_max: comptime_float = floatMax(f16); // prev: 6550462pub const f32_max = @compileError("Deprecated: use `floatMax(f32)` instead");
63pub const f32_max: comptime_float = floatMax(f32); // prev: 3.40282346638528859812e+3863pub const f64_max = @compileError("Deprecated: use `floatMax(f64)` instead");
64pub const f64_max: comptime_float = floatMax(f64); // prev: 1.79769313486231570815e+30864pub const f80_max = @compileError("Deprecated: use `floatMax(f80)` instead");
65pub const f80_max = floatMax(f80); // prev: make_f80(.{ .fraction = 0xFFFFFFFFFFFFFFFF, .exp = 0x7FFE })65pub const f128_max = @compileError("Deprecated: use `floatMax(f128)` instead");
66pub const f128_max = floatMax(f128); // prev: @bitCast(f128, @as(u128, 0x7FFEFFFFFFFFFFFFFFFFFFFFFFFFFFFF))66pub const f16_epsilon = @compileError("Deprecated: use `floatEps(f16)` instead");
67pub const f16_epsilon: comptime_float = floatEps(f16); // prev: 0.000976562567pub const f32_epsilon = @compileError("Deprecated: use `floatEps(f32)` instead");
68pub const f32_epsilon: comptime_float = floatEps(f32); // prev: 1.1920928955078125e-0768pub const f64_epsilon = @compileError("Deprecated: use `floatEps(f64)` instead");
69pub const f64_epsilon: comptime_float = floatEps(f64); // prev: 2.22044604925031308085e-1669pub const f80_epsilon = @compileError("Deprecated: use `floatEps(f80)` instead");
70pub const f80_epsilon = floatEps(f80); // prev: make_f80(.{ .fraction = 0x8000000000000000, .exp = 0x3FC0 })70pub const f128_epsilon = @compileError("Deprecated: use `floatEps(f128)` instead");
71pub const f128_epsilon = floatEps(f128); // prev: @bitCast(f128, @as(u128, 0x3F8F0000000000000000000000000000))71pub const f16_toint = @compileError("Deprecated: use `1.0 / floatEps(f16)` instead");
72pub const f16_toint: comptime_float = 1.0 / f16_epsilon; // same as before72pub const f32_toint = @compileError("Deprecated: use `1.0 / floatEps(f32)` instead");
73pub const f32_toint: comptime_float = 1.0 / f32_epsilon; // same as before73pub const f64_toint = @compileError("Deprecated: use `1.0 / floatEps(f64)` instead");
74pub const f64_toint: comptime_float = 1.0 / f64_epsilon; // same as before74pub const f80_toint = @compileError("Deprecated: use `1.0 / floatEps(f80)` instead");
75pub const f80_toint = 1.0 / f80_epsilon; // same as before75pub const f128_toint = @compileError("Deprecated: use `1.0 / floatEps(f128)` instead");
76pub const f128_toint = 1.0 / f128_epsilon; // same as before76pub const inf_u16 = @compileError("Deprecated: use `@bitCast(u16, inf(f16))` instead");
77pub const inf_u16 = @bitCast(u16, inf_f16); // prev: @as(u16, 0x7C00)77pub const inf_f16 = @compileError("Deprecated: use `inf(f16)` instead");
78pub const inf_f16 = inf(f16); // prev: @bitCast(f16, inf_u16)78pub const inf_u32 = @compileError("Deprecated: use `@bitCast(u32, inf(f32))` instead");
79pub const inf_u32 = @bitCast(u32, inf_f32); // prev: @as(u32, 0x7F800000)79pub const inf_f32 = @compileError("Deprecated: use `inf(f32)` instead");
80pub const inf_f32 = inf(f32); // prev: @bitCast(f32, inf_u32)80pub const inf_u64 = @compileError("Deprecated: use `@bitCast(u64, inf(f64))` instead");
81pub const inf_u64 = @bitCast(u64, inf_f64); // prev: @as(u64, 0x7FF << 52)81pub const inf_f64 = @compileError("Deprecated: use `inf(f64)` instead");
82pub const inf_f64 = inf(f64); // prev: @bitCast(f64, inf_u64)82pub const inf_f80 = @compileError("Deprecated: use `inf(f80)` instead");
83pub const inf_f80 = inf(f80); // prev: make_f80(F80{ .fraction = 0x8000000000000000, .exp = 0x7fff })83pub const inf_u128 = @compileError("Deprecated: use `@bitCast(u128, inf(f128))` instead");
84pub const inf_u128 = @bitCast(u128, inf_f128); // prev: @as(u128, 0x7fff0000000000000000000000000000)84pub const inf_f128 = @compileError("Deprecated: use `inf(f128)` instead");
85pub const inf_f128 = inf(f128); // prev: @bitCast(f128, inf_u128)85pub const epsilon = @compileError("Deprecated: use `floatEps` instead");
86pub const epsilon = floatEps;
87// End of "soft deprecated" section
8886
89pub const nan_u16 = @as(u16, 0x7C01);87pub const nan_u16 = @as(u16, 0x7C01);
90pub const nan_f16 = @bitCast(f16, nan_u16);88pub const nan_f16 = @bitCast(f16, nan_u16);
...@@ -329,7 +327,92 @@ pub const Complex = complex.Complex;...@@ -329,7 +327,92 @@ pub const Complex = complex.Complex;
329pub const big = @import("math/big.zig");327pub const big = @import("math/big.zig");
330328
331test {329test {
332 std.testing.refAllDecls(@This());330 _ = floatExponentBits;
331 _ = floatMantissaBits;
332 _ = floatFractionalBits;
333 _ = floatExponentMin;
334 _ = floatExponentMax;
335 _ = floatTrueMin;
336 _ = floatMin;
337 _ = floatMax;
338 _ = floatEps;
339 _ = inf;
340
341 _ = nan_u16;
342 _ = nan_f16;
343
344 _ = qnan_u16;
345 _ = qnan_f16;
346
347 _ = nan_u32;
348 _ = nan_f32;
349
350 _ = qnan_u32;
351 _ = qnan_f32;
352
353 _ = nan_u64;
354 _ = nan_f64;
355
356 _ = qnan_u64;
357 _ = qnan_f64;
358
359 _ = nan_f80;
360 _ = qnan_f80;
361
362 _ = nan_u128;
363 _ = nan_f128;
364
365 _ = qnan_u128;
366 _ = qnan_f128;
367
368 _ = nan;
369 _ = snan;
370
371 _ = isNan;
372 _ = isSignalNan;
373 _ = frexp;
374 _ = Frexp;
375 _ = modf;
376 _ = modf32_result;
377 _ = modf64_result;
378 _ = copysign;
379 _ = isFinite;
380 _ = isInf;
381 _ = isPositiveInf;
382 _ = isNegativeInf;
383 _ = isNormal;
384 _ = signbit;
385 _ = scalbn;
386 _ = ldexp;
387 _ = pow;
388 _ = powi;
389 _ = sqrt;
390 _ = cbrt;
391 _ = acos;
392 _ = asin;
393 _ = atan;
394 _ = atan2;
395 _ = hypot;
396 _ = expm1;
397 _ = ilogb;
398 _ = ln;
399 _ = log;
400 _ = log2;
401 _ = log10;
402 _ = log10_int;
403 _ = log1p;
404 _ = asinh;
405 _ = acosh;
406 _ = atanh;
407 _ = sinh;
408 _ = cosh;
409 _ = tanh;
410 _ = gcd;
411
412 _ = complex;
413 _ = Complex;
414
415 _ = big;
333}416}
334417
335/// Given two types, returns the smallest one which is capable of holding the418/// Given two types, returns the smallest one which is capable of holding the
lib/std/rand.zig+1-1
...@@ -410,7 +410,7 @@ pub const Random = struct {...@@ -410,7 +410,7 @@ pub const Random = struct {
410 r.uintLessThan(T, sum)410 r.uintLessThan(T, sum)
411 else if (comptime std.meta.trait.isFloat(T))411 else if (comptime std.meta.trait.isFloat(T))
412 // take care that imprecision doesn't lead to a value slightly greater than sum412 // take care that imprecision doesn't lead to a value slightly greater than sum
413 std.math.min(r.float(T) * sum, sum - std.math.epsilon(T))413 std.math.min(r.float(T) * sum, sum - std.math.floatEps(T))
414 else414 else
415 @compileError("weightedIndex does not support proportions of type " ++ @typeName(T));415 @compileError("weightedIndex does not support proportions of type " ++ @typeName(T));
416416
lib/std/testing.zig+1-1
...@@ -263,7 +263,7 @@ pub fn expectApproxEqRel(expected: anytype, actual: @TypeOf(expected), tolerance...@@ -263,7 +263,7 @@ pub fn expectApproxEqRel(expected: anytype, actual: @TypeOf(expected), tolerance
263263
264test "expectApproxEqRel" {264test "expectApproxEqRel" {
265 inline for ([_]type{ f16, f32, f64, f128 }) |T| {265 inline for ([_]type{ f16, f32, f64, f128 }) |T| {
266 const eps_value = comptime math.epsilon(T);266 const eps_value = comptime math.floatEps(T);
267 const sqrt_eps_value = comptime @sqrt(eps_value);267 const sqrt_eps_value = comptime @sqrt(eps_value);
268268
269 const pos_x: T = 12.0;269 const pos_x: T = 12.0;
test/behavior/pointers.zig+3-3
...@@ -357,9 +357,9 @@ test "pointer sentinel with +inf" {...@@ -357,9 +357,9 @@ test "pointer sentinel with +inf" {
357357
358 const S = struct {358 const S = struct {
359 fn doTheTest() !void {359 fn doTheTest() !void {
360 const inf = std.math.inf_f32;360 const inf_f32 = comptime std.math.inf(f32);
361 var ptr: [*:inf]const f32 = &[_:inf]f32{ 1.1, 2.2, 3.3, 4.4 };361 var ptr: [*:inf_f32]const f32 = &[_:inf_f32]f32{ 1.1, 2.2, 3.3, 4.4 };
362 try expect(ptr[4] == inf); // TODO this should be comptime try expect, see #3731362 try expect(ptr[4] == inf_f32); // TODO this should be comptime try expect, see #3731
363 }363 }
364 };364 };
365 try S.doTheTest();365 try S.doTheTest();