1 | #include this file into another test for subclass testing...
|
---|
2 |
|
---|
3 | ok ($class->config()->{lib},$CL);
|
---|
4 |
|
---|
5 | use strict;
|
---|
6 |
|
---|
7 | my $z;
|
---|
8 |
|
---|
9 | while (<DATA>)
|
---|
10 | {
|
---|
11 | chomp;
|
---|
12 | $_ =~ s/#.*$//; # remove comments
|
---|
13 | $_ =~ s/\s+$//; # trailing spaces
|
---|
14 | next if /^$/; # skip empty lines & comments
|
---|
15 | if (s/^&//)
|
---|
16 | {
|
---|
17 | $f = $_;
|
---|
18 | }
|
---|
19 | elsif (/^\$/)
|
---|
20 | {
|
---|
21 | $setup = $_; $setup =~ s/\$/\$${class}::/g; # round_mode, div_scale
|
---|
22 | #print "\$setup== $setup\n";
|
---|
23 | }
|
---|
24 | else
|
---|
25 | {
|
---|
26 | if (m|^(.*?):(/.+)$|)
|
---|
27 | {
|
---|
28 | $ans = $2;
|
---|
29 | @args = split(/:/,$1,99);
|
---|
30 | }
|
---|
31 | else
|
---|
32 | {
|
---|
33 | @args = split(/:/,$_,99); $ans = pop(@args);
|
---|
34 | }
|
---|
35 | $try = "\$x = $class->new(\"$args[0]\");";
|
---|
36 | if ($f eq "fnorm")
|
---|
37 | {
|
---|
38 | $try .= "\$x;";
|
---|
39 | } elsif ($f eq "finf") {
|
---|
40 | $try .= "\$x->finf('$args[1]');";
|
---|
41 | } elsif ($f eq "is_inf") {
|
---|
42 | $try .= "\$x->is_inf('$args[1]');";
|
---|
43 | } elsif ($f eq "fone") {
|
---|
44 | $try .= "\$x->bone('$args[1]');";
|
---|
45 | } elsif ($f eq "fstr") {
|
---|
46 | $try .= "\$x->accuracy($args[1]); \$x->precision($args[2]);";
|
---|
47 | $try .= '$x->fstr();';
|
---|
48 | } elsif ($f eq "parts") {
|
---|
49 | # ->bstr() to see if an object is returned
|
---|
50 | $try .= '($a,$b) = $x->parts(); $a = $a->bstr(); $b = $b->bstr();';
|
---|
51 | $try .= '"$a $b";';
|
---|
52 | } elsif ($f eq "exponent") {
|
---|
53 | # ->bstr() to see if an object is returned
|
---|
54 | $try .= '$x->exponent()->bstr();';
|
---|
55 | } elsif ($f eq "mantissa") {
|
---|
56 | # ->bstr() to see if an object is returned
|
---|
57 | $try .= '$x->mantissa()->bstr();';
|
---|
58 | } elsif ($f =~ /^(numify|length|as_number|as_hex|as_bin)$/) {
|
---|
59 | $try .= "\$x->$f();";
|
---|
60 | # some unary ops (test the fxxx form, since that is done by AUTOLOAD)
|
---|
61 | } elsif ($f =~ /^f(nan|sstr|neg|floor|ceil|abs)$/) {
|
---|
62 | $try .= "\$x->f$1();";
|
---|
63 | # some is_xxx test function
|
---|
64 | } elsif ($f =~ /^is_(zero|one|negative|positive|odd|even|nan|int)$/) {
|
---|
65 | $try .= "\$x->$f();";
|
---|
66 | } elsif ($f eq "finc") {
|
---|
67 | $try .= '++$x;';
|
---|
68 | } elsif ($f eq "fdec") {
|
---|
69 | $try .= '--$x;';
|
---|
70 | }elsif ($f eq "fround") {
|
---|
71 | $try .= "$setup; \$x->fround($args[1]);";
|
---|
72 | } elsif ($f eq "ffround") {
|
---|
73 | $try .= "$setup; \$x->ffround($args[1]);";
|
---|
74 | } elsif ($f eq "fsqrt") {
|
---|
75 | $try .= "$setup; \$x->fsqrt();";
|
---|
76 | } elsif ($f eq "ffac") {
|
---|
77 | $try .= "$setup; \$x->ffac();";
|
---|
78 | } elsif ($f eq "flog") {
|
---|
79 | if (defined $args[1] && $args[1] ne '')
|
---|
80 | {
|
---|
81 | $try .= "\$y = $class->new($args[1]);";
|
---|
82 | $try .= "$setup; \$x->flog(\$y);";
|
---|
83 | }
|
---|
84 | else
|
---|
85 | {
|
---|
86 | $try .= "$setup; \$x->flog();";
|
---|
87 | }
|
---|
88 | }
|
---|
89 | else
|
---|
90 | {
|
---|
91 | $try .= "\$y = $class->new(\"$args[1]\");";
|
---|
92 |
|
---|
93 | if ($f eq "bgcd")
|
---|
94 | {
|
---|
95 | if (defined $args[2])
|
---|
96 | {
|
---|
97 | $try .= " \$z = $class->new(\"$args[2]\"); ";
|
---|
98 | }
|
---|
99 | $try .= "$class\::bgcd(\$x, \$y";
|
---|
100 | $try .= ", \$z" if (defined $args[2]);
|
---|
101 | $try .= " );";
|
---|
102 | }
|
---|
103 | elsif ($f eq "blcm")
|
---|
104 | {
|
---|
105 | if (defined $args[2])
|
---|
106 | {
|
---|
107 | $try .= " \$z = $class->new(\"$args[2]\"); ";
|
---|
108 | }
|
---|
109 | $try .= "$class\::blcm(\$x, \$y";
|
---|
110 | $try .= ", \$z" if (defined $args[2]);
|
---|
111 | $try .= " );";
|
---|
112 | } elsif ($f eq "fcmp") {
|
---|
113 | $try .= '$x <=> $y;';
|
---|
114 | } elsif ($f eq "facmp") {
|
---|
115 | $try .= '$x->facmp($y);';
|
---|
116 | } elsif ($f eq "fpow") {
|
---|
117 | $try .= '$x ** $y;';
|
---|
118 | } elsif ($f eq "froot") {
|
---|
119 | $try .= "$setup; \$x->froot(\$y);";
|
---|
120 | } elsif ($f eq "fadd") {
|
---|
121 | $try .= '$x + $y;';
|
---|
122 | } elsif ($f eq "fsub") {
|
---|
123 | $try .= '$x - $y;';
|
---|
124 | } elsif ($f eq "fmul") {
|
---|
125 | $try .= '$x * $y;';
|
---|
126 | } elsif ($f eq "fdiv") {
|
---|
127 | $try .= "$setup; \$x / \$y;";
|
---|
128 | } elsif ($f eq "fdiv-list") {
|
---|
129 | $try .= "$setup; join(',',\$x->fdiv(\$y));";
|
---|
130 | } elsif ($f eq "frsft") {
|
---|
131 | $try .= '$x >> $y;';
|
---|
132 | } elsif ($f eq "flsft") {
|
---|
133 | $try .= '$x << $y;';
|
---|
134 | } elsif ($f eq "fmod") {
|
---|
135 | $try .= '$x % $y;';
|
---|
136 | } else { warn "Unknown op '$f'"; }
|
---|
137 | }
|
---|
138 | # print "# Trying: '$try'\n";
|
---|
139 | $ans1 = eval $try;
|
---|
140 | print "# Error: $@\n" if $@;
|
---|
141 | if ($ans =~ m|^/(.*)$|)
|
---|
142 | {
|
---|
143 | my $pat = $1;
|
---|
144 | if ($ans1 =~ /$pat/)
|
---|
145 | {
|
---|
146 | ok (1,1);
|
---|
147 | }
|
---|
148 | else
|
---|
149 | {
|
---|
150 | print "# '$try' expected: /$pat/ got: '$ans1'\n" if !ok(1,0);
|
---|
151 | }
|
---|
152 | }
|
---|
153 | else
|
---|
154 | {
|
---|
155 | if ($ans eq "")
|
---|
156 | {
|
---|
157 | ok_undef ($ans1);
|
---|
158 | }
|
---|
159 | else
|
---|
160 | {
|
---|
161 | print "# Tried: '$try'\n" if !ok ($ans1, $ans);
|
---|
162 | if (ref($ans1) eq "$class")
|
---|
163 | {
|
---|
164 | # float numbers are normalized (for now), so mantissa shouldn't have
|
---|
165 | # trailing zeros
|
---|
166 | #print $ans1->_trailing_zeros(),"\n";
|
---|
167 | print "# Has trailing zeros after '$try'\n"
|
---|
168 | if !ok ($CL->_zeros( $ans1->{_m}), 0);
|
---|
169 | }
|
---|
170 | }
|
---|
171 | } # end pattern or string
|
---|
172 | }
|
---|
173 | } # end while
|
---|
174 |
|
---|
175 | # check whether $class->new( Math::BigInt->new()) destroys it
|
---|
176 | # ($y == 12 in this case)
|
---|
177 | $x = Math::BigInt->new(1200); $y = $class->new($x);
|
---|
178 | ok ($y,1200); ok ($x,1200);
|
---|
179 |
|
---|
180 | ###############################################################################
|
---|
181 | # Really huge, big, ultra-mega-biggy-monster exponents
|
---|
182 | # Technically, the exponents should not be limited (they are BigInts), but
|
---|
183 | # practically there are a few places were they are limited to a Perl scalar.
|
---|
184 | # This is sometimes for speed, sometimes because otherwise the number wouldn't
|
---|
185 | # fit into your memory (just think of 1e123456789012345678901234567890 + 1!)
|
---|
186 | # anyway. We don't test everything here, but let's make sure it just basically
|
---|
187 | # works.
|
---|
188 |
|
---|
189 | my $monster = '1e1234567890123456789012345678901234567890';
|
---|
190 |
|
---|
191 | # new and exponent
|
---|
192 | ok ($class->new($monster)->bsstr(),
|
---|
193 | '1e+1234567890123456789012345678901234567890');
|
---|
194 | ok ($class->new($monster)->exponent(),
|
---|
195 | '1234567890123456789012345678901234567890');
|
---|
196 | # cmp
|
---|
197 | ok ($class->new($monster) > 0,1);
|
---|
198 |
|
---|
199 | # sub/mul
|
---|
200 | ok ($class->new($monster)->bsub( $monster),0);
|
---|
201 | ok ($class->new($monster)->bmul(2)->bsstr(),
|
---|
202 | '2e+1234567890123456789012345678901234567890');
|
---|
203 |
|
---|
204 | # mantissa
|
---|
205 | $monster = '1234567890123456789012345678901234567890e2';
|
---|
206 | ok ($class->new($monster)->mantissa(),
|
---|
207 | '123456789012345678901234567890123456789');
|
---|
208 |
|
---|
209 | ###############################################################################
|
---|
210 | # zero,inf,one,nan
|
---|
211 |
|
---|
212 | $x = $class->new(2); $x->fzero(); ok_undef ($x->{_a}); ok_undef ($x->{_p});
|
---|
213 | $x = $class->new(2); $x->finf(); ok_undef ($x->{_a}); ok_undef ($x->{_p});
|
---|
214 | $x = $class->new(2); $x->fone(); ok_undef ($x->{_a}); ok_undef ($x->{_p});
|
---|
215 | $x = $class->new(2); $x->fnan(); ok_undef ($x->{_a}); ok_undef ($x->{_p});
|
---|
216 |
|
---|
217 | ###############################################################################
|
---|
218 | # bone/binf etc as plain calls (Lite failed them)
|
---|
219 |
|
---|
220 | ok ($class->fzero(),0);
|
---|
221 | ok ($class->fone(),1);
|
---|
222 | ok ($class->fone('+'),1);
|
---|
223 | ok ($class->fone('-'),-1);
|
---|
224 | ok ($class->fnan(),'NaN');
|
---|
225 | ok ($class->finf(),'inf');
|
---|
226 | ok ($class->finf('+'),'inf');
|
---|
227 | ok ($class->finf('-'),'-inf');
|
---|
228 | ok ($class->finf('-inf'),'-inf');
|
---|
229 |
|
---|
230 | $class->accuracy(undef); $class->precision(undef); # reset
|
---|
231 |
|
---|
232 | ###############################################################################
|
---|
233 | # bug in bsstr()/numify() showed up in after-rounding in bdiv()
|
---|
234 |
|
---|
235 | $x = $class->new('0.008'); $y = $class->new(2);
|
---|
236 | $x->bdiv(3,$y);
|
---|
237 | ok ($x,'0.0027');
|
---|
238 |
|
---|
239 | ###############################################################################
|
---|
240 | # fsqrt() with set global A/P or A/P enabled on $x, also a test whether fsqrt()
|
---|
241 | # correctly modifies $x
|
---|
242 |
|
---|
243 |
|
---|
244 | $x = $class->new(12); $class->precision(-2); $x->fsqrt(); ok ($x,'3.46');
|
---|
245 |
|
---|
246 | $class->precision(undef);
|
---|
247 | $x = $class->new(12); $class->precision(0); $x->fsqrt(); ok ($x,'3');
|
---|
248 |
|
---|
249 | $class->precision(-3); $x = $class->new(12); $x->fsqrt(); ok ($x,'3.464');
|
---|
250 |
|
---|
251 | {
|
---|
252 | no strict 'refs';
|
---|
253 | # A and P set => NaN
|
---|
254 | ${${class}.'::accuracy'} = 4; $x = $class->new(12);
|
---|
255 | $x->fsqrt(3); ok ($x,'NaN');
|
---|
256 | # supplied arg overrides set global
|
---|
257 | $class->precision(undef); $x = $class->new(12); $x->fsqrt(3); ok ($x,'3.46');
|
---|
258 | $class->accuracy(undef); $class->precision(undef); # reset for further tests
|
---|
259 | }
|
---|
260 |
|
---|
261 | #############################################################################
|
---|
262 | # can we call objectify (broken until v1.52)
|
---|
263 |
|
---|
264 | {
|
---|
265 | no strict;
|
---|
266 | $try =
|
---|
267 | '@args' . " = $class" . "::objectify(2,$class,4,5);".'join(" ",@args);';
|
---|
268 | $ans = eval $try;
|
---|
269 | ok ($ans,"$class 4 5");
|
---|
270 | }
|
---|
271 |
|
---|
272 | #############################################################################
|
---|
273 | # is_one('-') (broken until v1.64)
|
---|
274 |
|
---|
275 | ok ($class->new(-1)->is_one(),0);
|
---|
276 | ok ($class->new(-1)->is_one('-'),1);
|
---|
277 |
|
---|
278 | #############################################################################
|
---|
279 | # bug 1/0.5 leaving 2e-0 instead of 2e0
|
---|
280 |
|
---|
281 | ok ($class->new(1)->fdiv('0.5')->bsstr(),'2e+0');
|
---|
282 |
|
---|
283 | ###############################################################################
|
---|
284 | # [perl #30609] bug with $x -= $x not beeing 0, but 2*$x
|
---|
285 |
|
---|
286 | $x = $class->new(3); $x -= $x; ok ($x, 0);
|
---|
287 | $x = $class->new(-3); $x -= $x; ok ($x, 0);
|
---|
288 | $x = $class->new(3); $x += $x; ok ($x, 6);
|
---|
289 | $x = $class->new(-3); $x += $x; ok ($x, -6);
|
---|
290 |
|
---|
291 | $x = $class->new('NaN'); $x -= $x; ok ($x->is_nan(), 1);
|
---|
292 | $x = $class->new('inf'); $x -= $x; ok ($x->is_nan(), 1);
|
---|
293 | $x = $class->new('-inf'); $x -= $x; ok ($x->is_nan(), 1);
|
---|
294 |
|
---|
295 | $x = $class->new('NaN'); $x += $x; ok ($x->is_nan(), 1);
|
---|
296 | $x = $class->new('inf'); $x += $x; ok ($x->is_inf(), 1);
|
---|
297 | $x = $class->new('-inf'); $x += $x; ok ($x->is_inf('-'), 1);
|
---|
298 |
|
---|
299 | $x = $class->new('3.14'); $x -= $x; ok ($x, 0);
|
---|
300 | $x = $class->new('-3.14'); $x -= $x; ok ($x, 0);
|
---|
301 | $x = $class->new('3.14'); $x += $x; ok ($x, '6.28');
|
---|
302 | $x = $class->new('-3.14'); $x += $x; ok ($x, '-6.28');
|
---|
303 |
|
---|
304 | $x = $class->new('3.14'); $x *= $x; ok ($x, '9.8596');
|
---|
305 | $x = $class->new('-3.14'); $x *= $x; ok ($x, '9.8596');
|
---|
306 | $x = $class->new('3.14'); $x /= $x; ok ($x, '1');
|
---|
307 | $x = $class->new('-3.14'); $x /= $x; ok ($x, '1');
|
---|
308 | $x = $class->new('3.14'); $x %= $x; ok ($x, '0');
|
---|
309 | $x = $class->new('-3.14'); $x %= $x; ok ($x, '0');
|
---|
310 |
|
---|
311 | ###############################################################################
|
---|
312 | # the following two were reported by "kenny" via hotmail.com:
|
---|
313 |
|
---|
314 | #perl -MMath::BigFloat -wle 'print Math::BigFloat->new(0)->bpow(".1")'
|
---|
315 | #Use of uninitialized value in numeric le (<=) at BigFloat.pm line 1851.
|
---|
316 |
|
---|
317 | $x = $class->new(0); $y = $class->new('0.1');
|
---|
318 | ok ($x ** $y, 0, 'no warnings and zero result');
|
---|
319 |
|
---|
320 | #perl -MMath::BigFloat -lwe 'print Math::BigFloat->new(".222222222222222222222222222222222222222222")->bceil()'
|
---|
321 | #Use of uninitialized value in numeric le (<=) at BigFloat.pm line 1851.
|
---|
322 |
|
---|
323 | $x = $class->new(".222222222222222222222222222222222222222222");
|
---|
324 | ok ($x->bceil(), 1, 'no warnings and one as result');
|
---|
325 |
|
---|
326 | ###############################################################################
|
---|
327 | # test **=, <<=, >>=
|
---|
328 |
|
---|
329 | # ((2^148)-1)/17
|
---|
330 | $x = $class->new(2); $x **= 148; $x++; $x->bdiv(17, 60)->bfloor(); $x->accuracy(undef);
|
---|
331 | ok ($x,"20988936657440586486151264256610222593863921");
|
---|
332 | ok ($x->length(),length "20988936657440586486151264256610222593863921");
|
---|
333 |
|
---|
334 | $x = $class->new('2');
|
---|
335 | my $y = $class->new('18');
|
---|
336 | ok ($x <<= $y, 2 << 18);
|
---|
337 | ok ($x, 2 << 18);
|
---|
338 | ok ($x >>= $y, 2);
|
---|
339 | ok ($x, 2);
|
---|
340 |
|
---|
341 | $x = $class->new('2');
|
---|
342 | $y = $class->new('18.2');
|
---|
343 | $x <<= $y; # 2 * (2 ** 18.2);
|
---|
344 |
|
---|
345 | ok ($x->copy()->bfround(-9), '602248.763144685');
|
---|
346 | ok ($x >>= $y, 2); # 2 * (2 ** 18.2) / (2 ** 18.2) => 2
|
---|
347 | ok ($x, 2);
|
---|
348 |
|
---|
349 | 1; # all done
|
---|
350 |
|
---|
351 | ###############################################################################
|
---|
352 | # Perl 5.005 does not like ok ($x,undef)
|
---|
353 |
|
---|
354 | sub ok_undef
|
---|
355 | {
|
---|
356 | my $x = shift;
|
---|
357 |
|
---|
358 | ok (1,1) and return if !defined $x;
|
---|
359 | ok ($x,'undef');
|
---|
360 | }
|
---|
361 |
|
---|
362 | __DATA__
|
---|
363 | &bgcd
|
---|
364 | inf:12:NaN
|
---|
365 | -inf:12:NaN
|
---|
366 | 12:inf:NaN
|
---|
367 | 12:-inf:NaN
|
---|
368 | inf:inf:NaN
|
---|
369 | inf:-inf:NaN
|
---|
370 | -inf:-inf:NaN
|
---|
371 | abc:abc:NaN
|
---|
372 | abc:+0:NaN
|
---|
373 | +0:abc:NaN
|
---|
374 | +0:+0:0
|
---|
375 | +0:+1:1
|
---|
376 | +1:+0:1
|
---|
377 | +1:+1:1
|
---|
378 | +2:+3:1
|
---|
379 | +3:+2:1
|
---|
380 | -3:+2:1
|
---|
381 | -3:-2:1
|
---|
382 | -144:-60:12
|
---|
383 | 144:-60:12
|
---|
384 | 144:60:12
|
---|
385 | 100:625:25
|
---|
386 | 4096:81:1
|
---|
387 | 1034:804:2
|
---|
388 | 27:90:56:1
|
---|
389 | 27:90:54:9
|
---|
390 | &blcm
|
---|
391 | abc:abc:NaN
|
---|
392 | abc:+0:NaN
|
---|
393 | +0:abc:NaN
|
---|
394 | +0:+0:NaN
|
---|
395 | +1:+0:0
|
---|
396 | +0:+1:0
|
---|
397 | +27:+90:270
|
---|
398 | +1034:+804:415668
|
---|
399 | $div_scale = 40;
|
---|
400 | &flog
|
---|
401 | 0::NaN
|
---|
402 | -1::NaN
|
---|
403 | -2::NaN
|
---|
404 | # base > 0, base != 1
|
---|
405 | 2:-1:NaN
|
---|
406 | 2:0:NaN
|
---|
407 | 2:1:NaN
|
---|
408 | # log(1) is always 1, regardless of $base
|
---|
409 | 1::0
|
---|
410 | 1:1:0
|
---|
411 | 1:2:0
|
---|
412 | 2::0.6931471805599453094172321214581765680755
|
---|
413 | 2.718281828::0.9999999998311266953289851340574956564911
|
---|
414 | $div_scale = 20;
|
---|
415 | 2.718281828::0.99999999983112669533
|
---|
416 | $div_scale = 15;
|
---|
417 | 123::4.81218435537242
|
---|
418 | 10::2.30258509299405
|
---|
419 | 1000::6.90775527898214
|
---|
420 | 100::4.60517018598809
|
---|
421 | 2::0.693147180559945
|
---|
422 | 3.1415::1.14470039286086
|
---|
423 | 12345::9.42100640177928
|
---|
424 | 0.001::-6.90775527898214
|
---|
425 | # bug until v1.71:
|
---|
426 | 10:10:1
|
---|
427 | 100:100:1
|
---|
428 | # reset for further tests
|
---|
429 | $div_scale = 40;
|
---|
430 | 1::0
|
---|
431 | &frsft
|
---|
432 | NaNfrsft:2:NaN
|
---|
433 | 0:2:0
|
---|
434 | 1:1:0.5
|
---|
435 | 2:1:1
|
---|
436 | 4:1:2
|
---|
437 | 123:1:61.5
|
---|
438 | 32:3:4
|
---|
439 | &flsft
|
---|
440 | NaNflsft:0:NaN
|
---|
441 | 2:1:4
|
---|
442 | 4:3:32
|
---|
443 | 5:3:40
|
---|
444 | 1:2:4
|
---|
445 | 0:5:0
|
---|
446 | &fnorm
|
---|
447 | 1:1
|
---|
448 | -0:0
|
---|
449 | fnormNaN:NaN
|
---|
450 | +inf:inf
|
---|
451 | -inf:-inf
|
---|
452 | 123:123
|
---|
453 | -123.4567:-123.4567
|
---|
454 | # invalid inputs
|
---|
455 | 1__2:NaN
|
---|
456 | 1E1__2:NaN
|
---|
457 | 11__2E2:NaN
|
---|
458 | .2E-3.:NaN
|
---|
459 | 1e3e4:NaN
|
---|
460 | # strange, but valid
|
---|
461 | .2E2:20
|
---|
462 | 1.E3:1000
|
---|
463 | # some inputs that result in zero
|
---|
464 | 0e0:0
|
---|
465 | +0e0:0
|
---|
466 | +0e+0:0
|
---|
467 | -0e+0:0
|
---|
468 | 0e-0:0
|
---|
469 | -0e-0:0
|
---|
470 | +0e-0:0
|
---|
471 | 000:0
|
---|
472 | 00e2:0
|
---|
473 | 00e02:0
|
---|
474 | 000e002:0
|
---|
475 | 000e1230:0
|
---|
476 | 00e-3:0
|
---|
477 | 00e+3:0
|
---|
478 | 00e-03:0
|
---|
479 | 00e+03:0
|
---|
480 | -000:0
|
---|
481 | -00e2:0
|
---|
482 | -00e02:0
|
---|
483 | -000e002:0
|
---|
484 | -000e1230:0
|
---|
485 | -00e-3:0
|
---|
486 | -00e+3:0
|
---|
487 | -00e-03:0
|
---|
488 | -00e+03:0
|
---|
489 | &as_number
|
---|
490 | 0:0
|
---|
491 | 1:1
|
---|
492 | 1.2:1
|
---|
493 | 2.345:2
|
---|
494 | -2:-2
|
---|
495 | -123.456:-123
|
---|
496 | -200:-200
|
---|
497 | # test for bug in brsft() not handling cases that return 0
|
---|
498 | 0.000641:0
|
---|
499 | 0.0006412:0
|
---|
500 | 0.00064123:0
|
---|
501 | 0.000641234:0
|
---|
502 | 0.0006412345:0
|
---|
503 | 0.00064123456:0
|
---|
504 | 0.000641234567:0
|
---|
505 | 0.0006412345678:0
|
---|
506 | 0.00064123456789:0
|
---|
507 | 0.1:0
|
---|
508 | 0.01:0
|
---|
509 | 0.001:0
|
---|
510 | 0.0001:0
|
---|
511 | 0.00001:0
|
---|
512 | 0.000001:0
|
---|
513 | 0.0000001:0
|
---|
514 | 0.00000001:0
|
---|
515 | 0.000000001:0
|
---|
516 | 0.0000000001:0
|
---|
517 | 0.00000000001:0
|
---|
518 | 0.12345:0
|
---|
519 | 0.123456:0
|
---|
520 | 0.1234567:0
|
---|
521 | 0.12345678:0
|
---|
522 | 0.123456789:0
|
---|
523 | &finf
|
---|
524 | 1:+:inf
|
---|
525 | 2:-:-inf
|
---|
526 | 3:abc:inf
|
---|
527 | &as_hex
|
---|
528 | +inf:inf
|
---|
529 | -inf:-inf
|
---|
530 | hexNaN:NaN
|
---|
531 | 0:0x0
|
---|
532 | 5:0x5
|
---|
533 | -5:-0x5
|
---|
534 | &as_bin
|
---|
535 | +inf:inf
|
---|
536 | -inf:-inf
|
---|
537 | hexNaN:NaN
|
---|
538 | 0:0b0
|
---|
539 | 5:0b101
|
---|
540 | -5:-0b101
|
---|
541 | &numify
|
---|
542 | # uses bsstr() so 5 => 5e+0 to be compatible w/ Perls output
|
---|
543 | 0:0e+1
|
---|
544 | +1:1e+0
|
---|
545 | 1234:1234e+0
|
---|
546 | NaN:NaN
|
---|
547 | +inf:inf
|
---|
548 | -inf:-inf
|
---|
549 | -5:-5e+0
|
---|
550 | 100:1e+2
|
---|
551 | -100:-1e+2
|
---|
552 | &fnan
|
---|
553 | abc:NaN
|
---|
554 | 2:NaN
|
---|
555 | -2:NaN
|
---|
556 | 0:NaN
|
---|
557 | &fone
|
---|
558 | 2:+:1
|
---|
559 | -2:-:-1
|
---|
560 | -2:+:1
|
---|
561 | 2:-:-1
|
---|
562 | 0::1
|
---|
563 | -2::1
|
---|
564 | abc::1
|
---|
565 | 2:abc:1
|
---|
566 | &fsstr
|
---|
567 | +inf:inf
|
---|
568 | -inf:-inf
|
---|
569 | abcfsstr:NaN
|
---|
570 | -abcfsstr:NaN
|
---|
571 | 1234.567:1234567e-3
|
---|
572 | 123:123e+0
|
---|
573 | -5:-5e+0
|
---|
574 | -100:-1e+2
|
---|
575 | &fstr
|
---|
576 | +inf:::inf
|
---|
577 | -inf:::-inf
|
---|
578 | abcfstr:::NaN
|
---|
579 | 1234.567:9::1234.56700
|
---|
580 | 1234.567::-6:1234.567000
|
---|
581 | 12345:5::12345
|
---|
582 | 0.001234:6::0.00123400
|
---|
583 | 0.001234::-8:0.00123400
|
---|
584 | 0:4::0
|
---|
585 | 0::-4:0.0000
|
---|
586 | &fnorm
|
---|
587 | inf:inf
|
---|
588 | +inf:inf
|
---|
589 | -inf:-inf
|
---|
590 | +infinity:NaN
|
---|
591 | +-inf:NaN
|
---|
592 | abc:NaN
|
---|
593 | 1 a:NaN
|
---|
594 | 1bcd2:NaN
|
---|
595 | 11111b:NaN
|
---|
596 | +1z:NaN
|
---|
597 | -1z:NaN
|
---|
598 | 0e999:0
|
---|
599 | 0e-999:0
|
---|
600 | -0e999:0
|
---|
601 | -0e-999:0
|
---|
602 | 0:0
|
---|
603 | +0:0
|
---|
604 | +00:0
|
---|
605 | +0_0_0:0
|
---|
606 | 000000_0000000_00000:0
|
---|
607 | -0:0
|
---|
608 | -0000:0
|
---|
609 | +1:1
|
---|
610 | +01:1
|
---|
611 | +001:1
|
---|
612 | +00000100000:100000
|
---|
613 | 123456789:123456789
|
---|
614 | -1:-1
|
---|
615 | -01:-1
|
---|
616 | -001:-1
|
---|
617 | -123456789:-123456789
|
---|
618 | -00000100000:-100000
|
---|
619 | 123.456a:NaN
|
---|
620 | 123.456:123.456
|
---|
621 | 0.01:0.01
|
---|
622 | .002:0.002
|
---|
623 | +.2:0.2
|
---|
624 | -0.0003:-0.0003
|
---|
625 | -.0000000004:-0.0000000004
|
---|
626 | 123456E2:12345600
|
---|
627 | 123456E-2:1234.56
|
---|
628 | -123456E2:-12345600
|
---|
629 | -123456E-2:-1234.56
|
---|
630 | 1e1:10
|
---|
631 | 2e-11:0.00000000002
|
---|
632 | # excercise _split
|
---|
633 | .02e-1:0.002
|
---|
634 | 000001:1
|
---|
635 | -00001:-1
|
---|
636 | -1:-1
|
---|
637 | 000.01:0.01
|
---|
638 | -000.0023:-0.0023
|
---|
639 | 1.1e1:11
|
---|
640 | -3e111:-3000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
---|
641 | -4e-1111:-0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004
|
---|
642 | &fpow
|
---|
643 | NaN:1:NaN
|
---|
644 | 1:NaN:NaN
|
---|
645 | NaN:-1:NaN
|
---|
646 | -1:NaN:NaN
|
---|
647 | NaN:-21:NaN
|
---|
648 | -21:NaN:NaN
|
---|
649 | NaN:21:NaN
|
---|
650 | 21:NaN:NaN
|
---|
651 | 0:0:1
|
---|
652 | 0:1:0
|
---|
653 | 0:9:0
|
---|
654 | 0:-2:inf
|
---|
655 | 2:2:4
|
---|
656 | 1:2:1
|
---|
657 | 1:3:1
|
---|
658 | -1:2:1
|
---|
659 | -1:3:-1
|
---|
660 | 123.456:2:15241.383936
|
---|
661 | 2:-2:0.25
|
---|
662 | 2:-3:0.125
|
---|
663 | 128:-2:0.00006103515625
|
---|
664 | abc:123.456:NaN
|
---|
665 | 123.456:abc:NaN
|
---|
666 | +inf:123.45:inf
|
---|
667 | -inf:123.45:-inf
|
---|
668 | +inf:-123.45:inf
|
---|
669 | -inf:-123.45:-inf
|
---|
670 | -2:2:4
|
---|
671 | -2:3:-8
|
---|
672 | -2:4:16
|
---|
673 | -2:5:-32
|
---|
674 | -3:2:9
|
---|
675 | -3:3:-27
|
---|
676 | -3:4:81
|
---|
677 | -3:5:-243
|
---|
678 | # 2 ** 0.5 == sqrt(2)
|
---|
679 | # 1.41..7 and not 1.4170 since fallback (bsqrt(9) is '3', not 3.0...0)
|
---|
680 | 2:0.5:1.41421356237309504880168872420969807857
|
---|
681 | #2:0.2:1.148698354997035006798626946777927589444
|
---|
682 | #6:1.5:14.6969384566990685891837044482353483518
|
---|
683 | $div_scale = 20;
|
---|
684 | #62.5:12.5:26447206647554886213592.3959144
|
---|
685 | $div_scale = 40;
|
---|
686 | &fneg
|
---|
687 | fnegNaN:NaN
|
---|
688 | +inf:-inf
|
---|
689 | -inf:inf
|
---|
690 | +0:0
|
---|
691 | +1:-1
|
---|
692 | -1:1
|
---|
693 | +123456789:-123456789
|
---|
694 | -123456789:123456789
|
---|
695 | +123.456789:-123.456789
|
---|
696 | -123456.789:123456.789
|
---|
697 | &fabs
|
---|
698 | fabsNaN:NaN
|
---|
699 | +inf:inf
|
---|
700 | -inf:inf
|
---|
701 | +0:0
|
---|
702 | +1:1
|
---|
703 | -1:1
|
---|
704 | +123456789:123456789
|
---|
705 | -123456789:123456789
|
---|
706 | +123.456789:123.456789
|
---|
707 | -123456.789:123456.789
|
---|
708 | &fround
|
---|
709 | $round_mode = "trunc"
|
---|
710 | +inf:5:inf
|
---|
711 | -inf:5:-inf
|
---|
712 | 0:5:0
|
---|
713 | NaNfround:5:NaN
|
---|
714 | +10123456789:5:10123000000
|
---|
715 | -10123456789:5:-10123000000
|
---|
716 | +10123456789.123:5:10123000000
|
---|
717 | -10123456789.123:5:-10123000000
|
---|
718 | +10123456789:9:10123456700
|
---|
719 | -10123456789:9:-10123456700
|
---|
720 | +101234500:6:101234000
|
---|
721 | -101234500:6:-101234000
|
---|
722 | $round_mode = "zero"
|
---|
723 | +20123456789:5:20123000000
|
---|
724 | -20123456789:5:-20123000000
|
---|
725 | +20123456789.123:5:20123000000
|
---|
726 | -20123456789.123:5:-20123000000
|
---|
727 | +20123456789:9:20123456800
|
---|
728 | -20123456789:9:-20123456800
|
---|
729 | +201234500:6:201234000
|
---|
730 | -201234500:6:-201234000
|
---|
731 | $round_mode = "+inf"
|
---|
732 | +30123456789:5:30123000000
|
---|
733 | -30123456789:5:-30123000000
|
---|
734 | +30123456789.123:5:30123000000
|
---|
735 | -30123456789.123:5:-30123000000
|
---|
736 | +30123456789:9:30123456800
|
---|
737 | -30123456789:9:-30123456800
|
---|
738 | +301234500:6:301235000
|
---|
739 | -301234500:6:-301234000
|
---|
740 | $round_mode = "-inf"
|
---|
741 | +40123456789:5:40123000000
|
---|
742 | -40123456789:5:-40123000000
|
---|
743 | +40123456789.123:5:40123000000
|
---|
744 | -40123456789.123:5:-40123000000
|
---|
745 | +40123456789:9:40123456800
|
---|
746 | -40123456789:9:-40123456800
|
---|
747 | +401234500:6:401234000
|
---|
748 | -401234500:6:-401235000
|
---|
749 | $round_mode = "odd"
|
---|
750 | +50123456789:5:50123000000
|
---|
751 | -50123456789:5:-50123000000
|
---|
752 | +50123456789.123:5:50123000000
|
---|
753 | -50123456789.123:5:-50123000000
|
---|
754 | +50123456789:9:50123456800
|
---|
755 | -50123456789:9:-50123456800
|
---|
756 | +501234500:6:501235000
|
---|
757 | -501234500:6:-501235000
|
---|
758 | $round_mode = "even"
|
---|
759 | +60123456789:5:60123000000
|
---|
760 | -60123456789:5:-60123000000
|
---|
761 | +60123456789:9:60123456800
|
---|
762 | -60123456789:9:-60123456800
|
---|
763 | +601234500:6:601234000
|
---|
764 | -601234500:6:-601234000
|
---|
765 | +60123456789.0123:5:60123000000
|
---|
766 | -60123456789.0123:5:-60123000000
|
---|
767 | &ffround
|
---|
768 | $round_mode = "trunc"
|
---|
769 | +inf:5:inf
|
---|
770 | -inf:5:-inf
|
---|
771 | 0:5:0
|
---|
772 | NaNffround:5:NaN
|
---|
773 | +1.23:-1:1.2
|
---|
774 | +1.234:-1:1.2
|
---|
775 | +1.2345:-1:1.2
|
---|
776 | +1.23:-2:1.23
|
---|
777 | +1.234:-2:1.23
|
---|
778 | +1.2345:-2:1.23
|
---|
779 | +1.23:-3:1.230
|
---|
780 | +1.234:-3:1.234
|
---|
781 | +1.2345:-3:1.234
|
---|
782 | -1.23:-1:-1.2
|
---|
783 | +1.27:-1:1.2
|
---|
784 | -1.27:-1:-1.2
|
---|
785 | +1.25:-1:1.2
|
---|
786 | -1.25:-1:-1.2
|
---|
787 | +1.35:-1:1.3
|
---|
788 | -1.35:-1:-1.3
|
---|
789 | -0.0061234567890:-1:0.0
|
---|
790 | -0.0061:-1:0.0
|
---|
791 | -0.00612:-1:0.0
|
---|
792 | -0.00612:-2:0.00
|
---|
793 | -0.006:-1:0.0
|
---|
794 | -0.006:-2:0.00
|
---|
795 | -0.0006:-2:0.00
|
---|
796 | -0.0006:-3:0.000
|
---|
797 | -0.0065:-3:/-0\.006|-6e-03
|
---|
798 | -0.0065:-4:/-0\.006(?:5|49{5}\d+)|-6\.5e-03
|
---|
799 | -0.0065:-5:/-0\.006(?:5|49{5}\d+)|-6\.5e-03
|
---|
800 | 0.05:0:0
|
---|
801 | 0.5:0:0
|
---|
802 | 0.51:0:0
|
---|
803 | 0.41:0:0
|
---|
804 | $round_mode = "zero"
|
---|
805 | +2.23:-1:/2.2(?:0{5}\d+)?
|
---|
806 | -2.23:-1:/-2.2(?:0{5}\d+)?
|
---|
807 | +2.27:-1:/2.(?:3|29{5}\d+)
|
---|
808 | -2.27:-1:/-2.(?:3|29{5}\d+)
|
---|
809 | +2.25:-1:/2.2(?:0{5}\d+)?
|
---|
810 | -2.25:-1:/-2.2(?:0{5}\d+)?
|
---|
811 | +2.35:-1:/2.(?:3|29{5}\d+)
|
---|
812 | -2.35:-1:/-2.(?:3|29{5}\d+)
|
---|
813 | -0.0065:-1:0.0
|
---|
814 | -0.0065:-2:/-0\.01|-1e-02
|
---|
815 | -0.0065:-3:/-0\.006|-6e-03
|
---|
816 | -0.0065:-4:/-0\.006(?:5|49{5}\d+)|-6\.5e-03
|
---|
817 | -0.0065:-5:/-0\.006(?:5|49{5}\d+)|-6\.5e-03
|
---|
818 | 0.05:0:0
|
---|
819 | 0.5:0:0
|
---|
820 | 0.51:0:1
|
---|
821 | 0.41:0:0
|
---|
822 | $round_mode = "+inf"
|
---|
823 | +3.23:-1:/3.2(?:0{5}\d+)?
|
---|
824 | -3.23:-1:/-3.2(?:0{5}\d+)?
|
---|
825 | +3.27:-1:/3.(?:3|29{5}\d+)
|
---|
826 | -3.27:-1:/-3.(?:3|29{5}\d+)
|
---|
827 | +3.25:-1:/3.(?:3|29{5}\d+)
|
---|
828 | -3.25:-1:/-3.2(?:0{5}\d+)?
|
---|
829 | +3.35:-1:/3.(?:4|39{5}\d+)
|
---|
830 | -3.35:-1:/-3.(?:3|29{5}\d+)
|
---|
831 | -0.0065:-1:0.0
|
---|
832 | -0.0065:-2:/-0\.01|-1e-02
|
---|
833 | -0.0065:-3:/-0\.006|-6e-03
|
---|
834 | -0.0065:-4:/-0\.006(?:5|49{5}\d+)|-6\.5e-03
|
---|
835 | -0.0065:-5:/-0\.006(?:5|49{5}\d+)|-6\.5e-03
|
---|
836 | 0.05:0:0
|
---|
837 | 0.5:0:1
|
---|
838 | 0.51:0:1
|
---|
839 | 0.41:0:0
|
---|
840 | $round_mode = "-inf"
|
---|
841 | +4.23:-1:/4.2(?:0{5}\d+)?
|
---|
842 | -4.23:-1:/-4.2(?:0{5}\d+)?
|
---|
843 | +4.27:-1:/4.(?:3|29{5}\d+)
|
---|
844 | -4.27:-1:/-4.(?:3|29{5}\d+)
|
---|
845 | +4.25:-1:/4.2(?:0{5}\d+)?
|
---|
846 | -4.25:-1:/-4.(?:3|29{5}\d+)
|
---|
847 | +4.35:-1:/4.(?:3|29{5}\d+)
|
---|
848 | -4.35:-1:/-4.(?:4|39{5}\d+)
|
---|
849 | -0.0065:-1:0.0
|
---|
850 | -0.0065:-2:/-0\.01|-1e-02
|
---|
851 | -0.0065:-3:/-0\.007|-7e-03
|
---|
852 | -0.0065:-4:/-0\.006(?:5|49{5}\d+)|-6\.5e-03
|
---|
853 | -0.0065:-5:/-0\.006(?:5|49{5}\d+)|-6\.5e-03
|
---|
854 | 0.05:0:0
|
---|
855 | 0.5:0:0
|
---|
856 | 0.51:0:1
|
---|
857 | 0.41:0:0
|
---|
858 | $round_mode = "odd"
|
---|
859 | +5.23:-1:/5.2(?:0{5}\d+)?
|
---|
860 | -5.23:-1:/-5.2(?:0{5}\d+)?
|
---|
861 | +5.27:-1:/5.(?:3|29{5}\d+)
|
---|
862 | -5.27:-1:/-5.(?:3|29{5}\d+)
|
---|
863 | +5.25:-1:/5.(?:3|29{5}\d+)
|
---|
864 | -5.25:-1:/-5.(?:3|29{5}\d+)
|
---|
865 | +5.35:-1:/5.(?:3|29{5}\d+)
|
---|
866 | -5.35:-1:/-5.(?:3|29{5}\d+)
|
---|
867 | -0.0065:-1:0.0
|
---|
868 | -0.0065:-2:/-0\.01|-1e-02
|
---|
869 | -0.0065:-3:/-0\.007|-7e-03
|
---|
870 | -0.0065:-4:/-0\.006(?:5|49{5}\d+)|-6\.5e-03
|
---|
871 | -0.0065:-5:/-0\.006(?:5|49{5}\d+)|-6\.5e-03
|
---|
872 | 0.05:0:0
|
---|
873 | 0.5:0:1
|
---|
874 | 0.51:0:1
|
---|
875 | 0.41:0:0
|
---|
876 | $round_mode = "even"
|
---|
877 | +6.23:-1:/6.2(?:0{5}\d+)?
|
---|
878 | -6.23:-1:/-6.2(?:0{5}\d+)?
|
---|
879 | +6.27:-1:/6.(?:3|29{5}\d+)
|
---|
880 | -6.27:-1:/-6.(?:3|29{5}\d+)
|
---|
881 | +6.25:-1:/6.(?:2(?:0{5}\d+)?|29{5}\d+)
|
---|
882 | -6.25:-1:/-6.(?:2(?:0{5}\d+)?|29{5}\d+)
|
---|
883 | +6.35:-1:/6.(?:4|39{5}\d+|29{8}\d+)
|
---|
884 | -6.35:-1:/-6.(?:4|39{5}\d+|29{8}\d+)
|
---|
885 | -0.0065:-1:0.0
|
---|
886 | -0.0065:-2:/-0\.01|-1e-02
|
---|
887 | -0.0065:-3:/-0\.006|-7e-03
|
---|
888 | -0.0065:-4:/-0\.006(?:5|49{5}\d+)|-6\.5e-03
|
---|
889 | -0.0065:-5:/-0\.006(?:5|49{5}\d+)|-6\.5e-03
|
---|
890 | 0.05:0:0
|
---|
891 | 0.5:0:0
|
---|
892 | 0.51:0:1
|
---|
893 | 0.41:0:0
|
---|
894 | 0.01234567:-3:0.012
|
---|
895 | 0.01234567:-4:0.0123
|
---|
896 | 0.01234567:-5:0.01235
|
---|
897 | 0.01234567:-6:0.012346
|
---|
898 | 0.01234567:-7:0.0123457
|
---|
899 | 0.01234567:-8:0.01234567
|
---|
900 | 0.01234567:-9:0.012345670
|
---|
901 | 0.01234567:-12:0.012345670000
|
---|
902 | &fcmp
|
---|
903 | fcmpNaN:fcmpNaN:
|
---|
904 | fcmpNaN:+0:
|
---|
905 | +0:fcmpNaN:
|
---|
906 | +0:+0:0
|
---|
907 | -1:+0:-1
|
---|
908 | +0:-1:1
|
---|
909 | +1:+0:1
|
---|
910 | +0:+1:-1
|
---|
911 | -1:+1:-1
|
---|
912 | +1:-1:1
|
---|
913 | -1:-1:0
|
---|
914 | +1:+1:0
|
---|
915 | -1.1:0:-1
|
---|
916 | +0:-1.1:1
|
---|
917 | +1.1:+0:1
|
---|
918 | +0:+1.1:-1
|
---|
919 | +123:+123:0
|
---|
920 | +123:+12:1
|
---|
921 | +12:+123:-1
|
---|
922 | -123:-123:0
|
---|
923 | -123:-12:-1
|
---|
924 | -12:-123:1
|
---|
925 | +123:+124:-1
|
---|
926 | +124:+123:1
|
---|
927 | -123:-124:1
|
---|
928 | -124:-123:-1
|
---|
929 | 0:0.01:-1
|
---|
930 | 0:0.0001:-1
|
---|
931 | 0:-0.0001:1
|
---|
932 | 0:-0.1:1
|
---|
933 | 0.1:0:1
|
---|
934 | 0.00001:0:1
|
---|
935 | -0.0001:0:-1
|
---|
936 | -0.1:0:-1
|
---|
937 | 0:0.0001234:-1
|
---|
938 | 0:-0.0001234:1
|
---|
939 | 0.0001234:0:1
|
---|
940 | -0.0001234:0:-1
|
---|
941 | 0.0001:0.0005:-1
|
---|
942 | 0.0005:0.0001:1
|
---|
943 | 0.005:0.0001:1
|
---|
944 | 0.001:0.0005:1
|
---|
945 | 0.000001:0.0005:-1
|
---|
946 | 0.00000123:0.0005:-1
|
---|
947 | 0.00512:0.0001:1
|
---|
948 | 0.005:0.000112:1
|
---|
949 | 0.00123:0.0005:1
|
---|
950 | 1.5:2:-1
|
---|
951 | 2:1.5:1
|
---|
952 | 1.54321:234:-1
|
---|
953 | 234:1.54321:1
|
---|
954 | # infinity
|
---|
955 | -inf:5432112345:-1
|
---|
956 | +inf:5432112345:1
|
---|
957 | -inf:-5432112345:-1
|
---|
958 | +inf:-5432112345:1
|
---|
959 | -inf:54321.12345:-1
|
---|
960 | +inf:54321.12345:1
|
---|
961 | -inf:-54321.12345:-1
|
---|
962 | +inf:-54321.12345:1
|
---|
963 | +inf:+inf:0
|
---|
964 | -inf:-inf:0
|
---|
965 | +inf:-inf:1
|
---|
966 | -inf:+inf:-1
|
---|
967 | # return undef
|
---|
968 | +inf:NaN:
|
---|
969 | NaN:inf:
|
---|
970 | -inf:NaN:
|
---|
971 | NaN:-inf:
|
---|
972 | &facmp
|
---|
973 | fcmpNaN:fcmpNaN:
|
---|
974 | fcmpNaN:+0:
|
---|
975 | +0:fcmpNaN:
|
---|
976 | +0:+0:0
|
---|
977 | -1:+0:1
|
---|
978 | +0:-1:-1
|
---|
979 | +1:+0:1
|
---|
980 | +0:+1:-1
|
---|
981 | -1:+1:0
|
---|
982 | +1:-1:0
|
---|
983 | -1:-1:0
|
---|
984 | +1:+1:0
|
---|
985 | -1.1:0:1
|
---|
986 | +0:-1.1:-1
|
---|
987 | +1.1:+0:1
|
---|
988 | +0:+1.1:-1
|
---|
989 | +123:+123:0
|
---|
990 | +123:+12:1
|
---|
991 | +12:+123:-1
|
---|
992 | -123:-123:0
|
---|
993 | -123:-12:1
|
---|
994 | -12:-123:-1
|
---|
995 | +123:+124:-1
|
---|
996 | +124:+123:1
|
---|
997 | -123:-124:-1
|
---|
998 | -124:-123:1
|
---|
999 | 0:0.01:-1
|
---|
1000 | 0:0.0001:-1
|
---|
1001 | 0:-0.0001:-1
|
---|
1002 | 0:-0.1:-1
|
---|
1003 | 0.1:0:1
|
---|
1004 | 0.00001:0:1
|
---|
1005 | -0.0001:0:1
|
---|
1006 | -0.1:0:1
|
---|
1007 | 0:0.0001234:-1
|
---|
1008 | 0:-0.0001234:-1
|
---|
1009 | 0.0001234:0:1
|
---|
1010 | -0.0001234:0:1
|
---|
1011 | 0.0001:0.0005:-1
|
---|
1012 | 0.0005:0.0001:1
|
---|
1013 | 0.005:0.0001:1
|
---|
1014 | 0.001:0.0005:1
|
---|
1015 | 0.000001:0.0005:-1
|
---|
1016 | 0.00000123:0.0005:-1
|
---|
1017 | 0.00512:0.0001:1
|
---|
1018 | 0.005:0.000112:1
|
---|
1019 | 0.00123:0.0005:1
|
---|
1020 | 1.5:2:-1
|
---|
1021 | 2:1.5:1
|
---|
1022 | 1.54321:234:-1
|
---|
1023 | 234:1.54321:1
|
---|
1024 | # infinity
|
---|
1025 | -inf:5432112345:1
|
---|
1026 | +inf:5432112345:1
|
---|
1027 | -inf:-5432112345:1
|
---|
1028 | +inf:-5432112345:1
|
---|
1029 | -inf:54321.12345:1
|
---|
1030 | +inf:54321.12345:1
|
---|
1031 | -inf:-54321.12345:1
|
---|
1032 | +inf:-54321.12345:1
|
---|
1033 | +inf:+inf:0
|
---|
1034 | -inf:-inf:0
|
---|
1035 | +inf:-inf:0
|
---|
1036 | -inf:+inf:0
|
---|
1037 | 5:inf:-1
|
---|
1038 | -1:inf:-1
|
---|
1039 | 5:-inf:-1
|
---|
1040 | -1:-inf:-1
|
---|
1041 | # return undef
|
---|
1042 | +inf:facmpNaN:
|
---|
1043 | facmpNaN:inf:
|
---|
1044 | -inf:facmpNaN:
|
---|
1045 | facmpNaN:-inf:
|
---|
1046 | &fdec
|
---|
1047 | fdecNaN:NaN
|
---|
1048 | +inf:inf
|
---|
1049 | -inf:-inf
|
---|
1050 | +0:-1
|
---|
1051 | +1:0
|
---|
1052 | -1:-2
|
---|
1053 | 1.23:0.23
|
---|
1054 | -1.23:-2.23
|
---|
1055 | 100:99
|
---|
1056 | 101:100
|
---|
1057 | -100:-101
|
---|
1058 | -99:-100
|
---|
1059 | -98:-99
|
---|
1060 | 99:98
|
---|
1061 | &finc
|
---|
1062 | fincNaN:NaN
|
---|
1063 | +inf:inf
|
---|
1064 | -inf:-inf
|
---|
1065 | +0:1
|
---|
1066 | +1:2
|
---|
1067 | -1:0
|
---|
1068 | 1.23:2.23
|
---|
1069 | -1.23:-0.23
|
---|
1070 | 100:101
|
---|
1071 | -100:-99
|
---|
1072 | -99:-98
|
---|
1073 | -101:-100
|
---|
1074 | 99:100
|
---|
1075 | &fadd
|
---|
1076 | abc:abc:NaN
|
---|
1077 | abc:+0:NaN
|
---|
1078 | +0:abc:NaN
|
---|
1079 | +inf:-inf:NaN
|
---|
1080 | -inf:+inf:NaN
|
---|
1081 | +inf:+inf:inf
|
---|
1082 | -inf:-inf:-inf
|
---|
1083 | baddNaN:+inf:NaN
|
---|
1084 | baddNaN:+inf:NaN
|
---|
1085 | +inf:baddNaN:NaN
|
---|
1086 | -inf:baddNaN:NaN
|
---|
1087 | +0:+0:0
|
---|
1088 | +1:+0:1
|
---|
1089 | +0:+1:1
|
---|
1090 | +1:+1:2
|
---|
1091 | -1:+0:-1
|
---|
1092 | +0:-1:-1
|
---|
1093 | -1:-1:-2
|
---|
1094 | -1:+1:0
|
---|
1095 | +1:-1:0
|
---|
1096 | +9:+1:10
|
---|
1097 | +99:+1:100
|
---|
1098 | +999:+1:1000
|
---|
1099 | +9999:+1:10000
|
---|
1100 | +99999:+1:100000
|
---|
1101 | +999999:+1:1000000
|
---|
1102 | +9999999:+1:10000000
|
---|
1103 | +99999999:+1:100000000
|
---|
1104 | +999999999:+1:1000000000
|
---|
1105 | +9999999999:+1:10000000000
|
---|
1106 | +99999999999:+1:100000000000
|
---|
1107 | +10:-1:9
|
---|
1108 | +100:-1:99
|
---|
1109 | +1000:-1:999
|
---|
1110 | +10000:-1:9999
|
---|
1111 | +100000:-1:99999
|
---|
1112 | +1000000:-1:999999
|
---|
1113 | +10000000:-1:9999999
|
---|
1114 | +100000000:-1:99999999
|
---|
1115 | +1000000000:-1:999999999
|
---|
1116 | +10000000000:-1:9999999999
|
---|
1117 | +123456789:+987654321:1111111110
|
---|
1118 | -123456789:+987654321:864197532
|
---|
1119 | -123456789:-987654321:-1111111110
|
---|
1120 | +123456789:-987654321:-864197532
|
---|
1121 | 0.001234:0.0001234:0.0013574
|
---|
1122 | &fsub
|
---|
1123 | abc:abc:NaN
|
---|
1124 | abc:+0:NaN
|
---|
1125 | +0:abc:NaN
|
---|
1126 | +inf:-inf:inf
|
---|
1127 | -inf:+inf:-inf
|
---|
1128 | +inf:+inf:NaN
|
---|
1129 | -inf:-inf:NaN
|
---|
1130 | baddNaN:+inf:NaN
|
---|
1131 | baddNaN:+inf:NaN
|
---|
1132 | +inf:baddNaN:NaN
|
---|
1133 | -inf:baddNaN:NaN
|
---|
1134 | +0:+0:0
|
---|
1135 | +1:+0:1
|
---|
1136 | +0:+1:-1
|
---|
1137 | +1:+1:0
|
---|
1138 | -1:+0:-1
|
---|
1139 | +0:-1:1
|
---|
1140 | -1:-1:0
|
---|
1141 | -1:+1:-2
|
---|
1142 | +1:-1:2
|
---|
1143 | +9:+1:8
|
---|
1144 | +99:+1:98
|
---|
1145 | +999:+1:998
|
---|
1146 | +9999:+1:9998
|
---|
1147 | +99999:+1:99998
|
---|
1148 | +999999:+1:999998
|
---|
1149 | +9999999:+1:9999998
|
---|
1150 | +99999999:+1:99999998
|
---|
1151 | +999999999:+1:999999998
|
---|
1152 | +9999999999:+1:9999999998
|
---|
1153 | +99999999999:+1:99999999998
|
---|
1154 | +10:-1:11
|
---|
1155 | +100:-1:101
|
---|
1156 | +1000:-1:1001
|
---|
1157 | +10000:-1:10001
|
---|
1158 | +100000:-1:100001
|
---|
1159 | +1000000:-1:1000001
|
---|
1160 | +10000000:-1:10000001
|
---|
1161 | +100000000:-1:100000001
|
---|
1162 | +1000000000:-1:1000000001
|
---|
1163 | +10000000000:-1:10000000001
|
---|
1164 | +123456789:+987654321:-864197532
|
---|
1165 | -123456789:+987654321:-1111111110
|
---|
1166 | -123456789:-987654321:864197532
|
---|
1167 | +123456789:-987654321:1111111110
|
---|
1168 | &fmul
|
---|
1169 | abc:abc:NaN
|
---|
1170 | abc:+0:NaN
|
---|
1171 | +0:abc:NaN
|
---|
1172 | +inf:NaNmul:NaN
|
---|
1173 | +inf:NaNmul:NaN
|
---|
1174 | NaNmul:+inf:NaN
|
---|
1175 | NaNmul:-inf:NaN
|
---|
1176 | +inf:+inf:inf
|
---|
1177 | +inf:-inf:-inf
|
---|
1178 | +inf:-inf:-inf
|
---|
1179 | +inf:+inf:inf
|
---|
1180 | +inf:123.34:inf
|
---|
1181 | +inf:-123.34:-inf
|
---|
1182 | -inf:123.34:-inf
|
---|
1183 | -inf:-123.34:inf
|
---|
1184 | 123.34:+inf:inf
|
---|
1185 | -123.34:+inf:-inf
|
---|
1186 | 123.34:-inf:-inf
|
---|
1187 | -123.34:-inf:inf
|
---|
1188 | +0:+0:0
|
---|
1189 | +0:+1:0
|
---|
1190 | +1:+0:0
|
---|
1191 | +0:-1:0
|
---|
1192 | -1:+0:0
|
---|
1193 | +123456789123456789:+0:0
|
---|
1194 | +0:+123456789123456789:0
|
---|
1195 | -1:-1:1
|
---|
1196 | -1:+1:-1
|
---|
1197 | +1:-1:-1
|
---|
1198 | +1:+1:1
|
---|
1199 | +2:+3:6
|
---|
1200 | -2:+3:-6
|
---|
1201 | +2:-3:-6
|
---|
1202 | -2:-3:6
|
---|
1203 | +111:+111:12321
|
---|
1204 | +10101:+10101:102030201
|
---|
1205 | +1001001:+1001001:1002003002001
|
---|
1206 | +100010001:+100010001:10002000300020001
|
---|
1207 | +10000100001:+10000100001:100002000030000200001
|
---|
1208 | +11111111111:+9:99999999999
|
---|
1209 | +22222222222:+9:199999999998
|
---|
1210 | +33333333333:+9:299999999997
|
---|
1211 | +44444444444:+9:399999999996
|
---|
1212 | +55555555555:+9:499999999995
|
---|
1213 | +66666666666:+9:599999999994
|
---|
1214 | +77777777777:+9:699999999993
|
---|
1215 | +88888888888:+9:799999999992
|
---|
1216 | +99999999999:+9:899999999991
|
---|
1217 | 6:120:720
|
---|
1218 | 10:10000:100000
|
---|
1219 | &fdiv-list
|
---|
1220 | 0:0:NaN,NaN
|
---|
1221 | 0:1:0,0
|
---|
1222 | 9:4:2.25,1
|
---|
1223 | 9:5:1.8,4
|
---|
1224 | # bug in v1.74 with bdiv in list context, when $y is 1 or -1
|
---|
1225 | 2.1:-1:-2.1,0
|
---|
1226 | 2.1:1:2.1,0
|
---|
1227 | -2.1:-1:2.1,0
|
---|
1228 | -2.1:1:-2.1,0
|
---|
1229 | &fdiv
|
---|
1230 | $div_scale = 40; $round_mode = 'even'
|
---|
1231 | abc:abc:NaN
|
---|
1232 | abc:+1:abc:NaN
|
---|
1233 | +1:abc:NaN
|
---|
1234 | -1:abc:NaN
|
---|
1235 | 0:abc:NaN
|
---|
1236 | +0:+0:NaN
|
---|
1237 | +0:+1:0
|
---|
1238 | +1:+0:inf
|
---|
1239 | +3214:+0:inf
|
---|
1240 | +0:-1:0
|
---|
1241 | -1:+0:-inf
|
---|
1242 | -3214:+0:-inf
|
---|
1243 | +1:+1:1
|
---|
1244 | -1:-1:1
|
---|
1245 | +1:-1:-1
|
---|
1246 | -1:+1:-1
|
---|
1247 | +1:+2:0.5
|
---|
1248 | +2:+1:2
|
---|
1249 | 123:+inf:0
|
---|
1250 | 123:-inf:0
|
---|
1251 | +10:+5:2
|
---|
1252 | +100:+4:25
|
---|
1253 | +1000:+8:125
|
---|
1254 | +10000:+16:625
|
---|
1255 | +10000:-16:-625
|
---|
1256 | +999999999999:+9:111111111111
|
---|
1257 | +999999999999:+99:10101010101
|
---|
1258 | +999999999999:+999:1001001001
|
---|
1259 | +999999999999:+9999:100010001
|
---|
1260 | +999999999999999:+99999:10000100001
|
---|
1261 | +1000000000:+9:111111111.1111111111111111111111111111111
|
---|
1262 | +2000000000:+9:222222222.2222222222222222222222222222222
|
---|
1263 | +3000000000:+9:333333333.3333333333333333333333333333333
|
---|
1264 | +4000000000:+9:444444444.4444444444444444444444444444444
|
---|
1265 | +5000000000:+9:555555555.5555555555555555555555555555556
|
---|
1266 | +6000000000:+9:666666666.6666666666666666666666666666667
|
---|
1267 | +7000000000:+9:777777777.7777777777777777777777777777778
|
---|
1268 | +8000000000:+9:888888888.8888888888888888888888888888889
|
---|
1269 | +9000000000:+9:1000000000
|
---|
1270 | +35500000:+113:314159.2920353982300884955752212389380531
|
---|
1271 | +71000000:+226:314159.2920353982300884955752212389380531
|
---|
1272 | +106500000:+339:314159.2920353982300884955752212389380531
|
---|
1273 | +1000000000:+3:333333333.3333333333333333333333333333333
|
---|
1274 | 2:25.024996000799840031993601279744051189762:0.07992009269196593320152084692285869265447
|
---|
1275 | 123456:1:123456
|
---|
1276 | $div_scale = 20
|
---|
1277 | +1000000000:+9:111111111.11111111111
|
---|
1278 | +2000000000:+9:222222222.22222222222
|
---|
1279 | +3000000000:+9:333333333.33333333333
|
---|
1280 | +4000000000:+9:444444444.44444444444
|
---|
1281 | +5000000000:+9:555555555.55555555556
|
---|
1282 | +6000000000:+9:666666666.66666666667
|
---|
1283 | +7000000000:+9:777777777.77777777778
|
---|
1284 | +8000000000:+9:888888888.88888888889
|
---|
1285 | +9000000000:+9:1000000000
|
---|
1286 | 1:10:0.1
|
---|
1287 | 1:100:0.01
|
---|
1288 | 1:1000:0.001
|
---|
1289 | 1:10000:0.0001
|
---|
1290 | 1:504:0.001984126984126984127
|
---|
1291 | 2:1.987654321:1.0062111801179738436
|
---|
1292 | 123456789.123456789123456789123456789:1:123456789.12345678912
|
---|
1293 | # the next two cases are the "old" behaviour, but are now (>v0.01) different
|
---|
1294 | #+35500000:+113:314159.292035398230088
|
---|
1295 | #+71000000:+226:314159.292035398230088
|
---|
1296 | +35500000:+113:314159.29203539823009
|
---|
1297 | +71000000:+226:314159.29203539823009
|
---|
1298 | +106500000:+339:314159.29203539823009
|
---|
1299 | +1000000000:+3:333333333.33333333333
|
---|
1300 | $div_scale = 1
|
---|
1301 | # round to accuracy 1 after bdiv
|
---|
1302 | +124:+3:40
|
---|
1303 | 123456789.1234:1:100000000
|
---|
1304 | # reset scale for further tests
|
---|
1305 | $div_scale = 40
|
---|
1306 | &fmod
|
---|
1307 | +9:4:1
|
---|
1308 | +9:5:4
|
---|
1309 | +9000:56:40
|
---|
1310 | +56:9000:56
|
---|
1311 | # inf handling, see table in doc
|
---|
1312 | 0:inf:0
|
---|
1313 | 0:-inf:0
|
---|
1314 | 5:inf:5
|
---|
1315 | 5:-inf:5
|
---|
1316 | -5:inf:-5
|
---|
1317 | -5:-inf:-5
|
---|
1318 | inf:5:0
|
---|
1319 | -inf:5:0
|
---|
1320 | inf:-5:0
|
---|
1321 | -inf:-5:0
|
---|
1322 | 5:5:0
|
---|
1323 | -5:-5:0
|
---|
1324 | inf:inf:NaN
|
---|
1325 | -inf:-inf:NaN
|
---|
1326 | -inf:inf:NaN
|
---|
1327 | inf:-inf:NaN
|
---|
1328 | 8:0:8
|
---|
1329 | inf:0:inf
|
---|
1330 | # exceptions to reminder rule
|
---|
1331 | -inf:0:-inf
|
---|
1332 | -8:0:-8
|
---|
1333 | 0:0:NaN
|
---|
1334 | abc:abc:NaN
|
---|
1335 | abc:1:abc:NaN
|
---|
1336 | 1:abc:NaN
|
---|
1337 | 0:0:NaN
|
---|
1338 | 0:1:0
|
---|
1339 | 1:0:1
|
---|
1340 | 0:-1:0
|
---|
1341 | -1:0:-1
|
---|
1342 | 1:1:0
|
---|
1343 | -1:-1:0
|
---|
1344 | 1:-1:0
|
---|
1345 | -1:1:0
|
---|
1346 | 1:2:1
|
---|
1347 | 2:1:0
|
---|
1348 | 1000000000:9:1
|
---|
1349 | 2000000000:9:2
|
---|
1350 | 3000000000:9:3
|
---|
1351 | 4000000000:9:4
|
---|
1352 | 5000000000:9:5
|
---|
1353 | 6000000000:9:6
|
---|
1354 | 7000000000:9:7
|
---|
1355 | 8000000000:9:8
|
---|
1356 | 9000000000:9:0
|
---|
1357 | 35500000:113:33
|
---|
1358 | 71000000:226:66
|
---|
1359 | 106500000:339:99
|
---|
1360 | 1000000000:3:1
|
---|
1361 | 10:5:0
|
---|
1362 | 100:4:0
|
---|
1363 | 1000:8:0
|
---|
1364 | 10000:16:0
|
---|
1365 | 999999999999:9:0
|
---|
1366 | 999999999999:99:0
|
---|
1367 | 999999999999:999:0
|
---|
1368 | 999999999999:9999:0
|
---|
1369 | 999999999999999:99999:0
|
---|
1370 | -9:+5:1
|
---|
1371 | +9:-5:-1
|
---|
1372 | -9:-5:-4
|
---|
1373 | -5:3:1
|
---|
1374 | -2:3:1
|
---|
1375 | 4:3:1
|
---|
1376 | 1:3:1
|
---|
1377 | -5:-3:-2
|
---|
1378 | -2:-3:-2
|
---|
1379 | 4:-3:-2
|
---|
1380 | 1:-3:-2
|
---|
1381 | 4095:4095:0
|
---|
1382 | 100041000510123:3:0
|
---|
1383 | 152403346:12345:4321
|
---|
1384 | 87654321:87654321:0
|
---|
1385 | # now some floating point tests
|
---|
1386 | 123:2.5:0.5
|
---|
1387 | 1230:2.5:0
|
---|
1388 | 123.4:2.5:0.9
|
---|
1389 | 123e1:25:5
|
---|
1390 | -2.1:1:0.9
|
---|
1391 | 2.1:1:0.1
|
---|
1392 | -2.1:-1:-0.1
|
---|
1393 | 2.1:-1:-0.9
|
---|
1394 | -3:1:0
|
---|
1395 | 3:1:0
|
---|
1396 | -3:-1:0
|
---|
1397 | 3:-1:0
|
---|
1398 | &ffac
|
---|
1399 | Nanfac:NaN
|
---|
1400 | -1:NaN
|
---|
1401 | +inf:inf
|
---|
1402 | -inf:NaN
|
---|
1403 | 0:1
|
---|
1404 | 1:1
|
---|
1405 | 2:2
|
---|
1406 | 3:6
|
---|
1407 | 4:24
|
---|
1408 | 5:120
|
---|
1409 | 6:720
|
---|
1410 | 10:3628800
|
---|
1411 | 11:39916800
|
---|
1412 | 12:479001600
|
---|
1413 | &froot
|
---|
1414 | # sqrt()
|
---|
1415 | +0:2:0
|
---|
1416 | +1:2:1
|
---|
1417 | -1:2:NaN
|
---|
1418 | # -$x ** (1/2) => -$y, but not in froot()
|
---|
1419 | -123.456:2:NaN
|
---|
1420 | +inf:2:inf
|
---|
1421 | -inf:2:NaN
|
---|
1422 | 2:2:1.41421356237309504880168872420969807857
|
---|
1423 | -2:2:NaN
|
---|
1424 | 4:2:2
|
---|
1425 | 9:2:3
|
---|
1426 | 16:2:4
|
---|
1427 | 100:2:10
|
---|
1428 | 123.456:2:11.11107555549866648462149404118219234119
|
---|
1429 | 15241.38393:2:123.4559999756998444766131352122991626468
|
---|
1430 | 1.44:2:1.2
|
---|
1431 | 12:2:3.464101615137754587054892683011744733886
|
---|
1432 | 0.49:2:0.7
|
---|
1433 | 0.0049:2:0.07
|
---|
1434 | # invalid ones
|
---|
1435 | 1:NaN:NaN
|
---|
1436 | -1:NaN:NaN
|
---|
1437 | 0:NaN:NaN
|
---|
1438 | -inf:NaN:NaN
|
---|
1439 | +inf:NaN:NaN
|
---|
1440 | NaN:0:NaN
|
---|
1441 | NaN:2:NaN
|
---|
1442 | NaN:inf:NaN
|
---|
1443 | NaN:inf:NaN
|
---|
1444 | 12:-inf:NaN
|
---|
1445 | 12:inf:NaN
|
---|
1446 | +0:0:NaN
|
---|
1447 | +1:0:NaN
|
---|
1448 | -1:0:NaN
|
---|
1449 | -2:0:NaN
|
---|
1450 | -123.45:0:NaN
|
---|
1451 | +inf:0:NaN
|
---|
1452 | 12:1:12
|
---|
1453 | -12:1:NaN
|
---|
1454 | 8:-1:NaN
|
---|
1455 | -8:-1:NaN
|
---|
1456 | # cubic root
|
---|
1457 | 8:3:2
|
---|
1458 | -8:3:NaN
|
---|
1459 | # fourths root
|
---|
1460 | 16:4:2
|
---|
1461 | 81:4:3
|
---|
1462 | # see t/bigroot() for more tests
|
---|
1463 | &fsqrt
|
---|
1464 | +0:0
|
---|
1465 | -1:NaN
|
---|
1466 | -2:NaN
|
---|
1467 | -16:NaN
|
---|
1468 | -123.45:NaN
|
---|
1469 | nanfsqrt:NaN
|
---|
1470 | +inf:inf
|
---|
1471 | -inf:NaN
|
---|
1472 | 1:1
|
---|
1473 | 2:1.41421356237309504880168872420969807857
|
---|
1474 | 4:2
|
---|
1475 | 9:3
|
---|
1476 | 16:4
|
---|
1477 | 100:10
|
---|
1478 | 123.456:11.11107555549866648462149404118219234119
|
---|
1479 | 15241.38393:123.4559999756998444766131352122991626468
|
---|
1480 | 1.44:1.2
|
---|
1481 | # sqrt(1.44) = 1.2, sqrt(e10) = e5 => 12e4
|
---|
1482 | 1.44E10:120000
|
---|
1483 | 2e10:141421.356237309504880168872420969807857
|
---|
1484 | 144e20:120000000000
|
---|
1485 | # proved to be an endless loop under 7-9
|
---|
1486 | 12:3.464101615137754587054892683011744733886
|
---|
1487 | 0.49:0.7
|
---|
1488 | 0.0049:0.07
|
---|
1489 | &is_nan
|
---|
1490 | 123:0
|
---|
1491 | abc:1
|
---|
1492 | NaN:1
|
---|
1493 | -123:0
|
---|
1494 | &is_inf
|
---|
1495 | +inf::1
|
---|
1496 | -inf::1
|
---|
1497 | abc::0
|
---|
1498 | 1::0
|
---|
1499 | NaN::0
|
---|
1500 | -1::0
|
---|
1501 | +inf:-:0
|
---|
1502 | +inf:+:1
|
---|
1503 | -inf:-:1
|
---|
1504 | -inf:+:0
|
---|
1505 | # it must be exactly /^[+-]inf$/
|
---|
1506 | +infinity::0
|
---|
1507 | -infinity::0
|
---|
1508 | &is_odd
|
---|
1509 | abc:0
|
---|
1510 | 0:0
|
---|
1511 | -1:1
|
---|
1512 | -3:1
|
---|
1513 | 1:1
|
---|
1514 | 3:1
|
---|
1515 | 1000001:1
|
---|
1516 | 1000002:0
|
---|
1517 | +inf:0
|
---|
1518 | -inf:0
|
---|
1519 | 123.45:0
|
---|
1520 | -123.45:0
|
---|
1521 | 2:0
|
---|
1522 | &is_int
|
---|
1523 | NaNis_int:0
|
---|
1524 | 0:1
|
---|
1525 | 1:1
|
---|
1526 | 2:1
|
---|
1527 | -2:1
|
---|
1528 | -1:1
|
---|
1529 | -inf:0
|
---|
1530 | +inf:0
|
---|
1531 | 123.4567:0
|
---|
1532 | -0.1:0
|
---|
1533 | -0.002:0
|
---|
1534 | &is_even
|
---|
1535 | abc:0
|
---|
1536 | 0:1
|
---|
1537 | -1:0
|
---|
1538 | -3:0
|
---|
1539 | 1:0
|
---|
1540 | 3:0
|
---|
1541 | 1000001:0
|
---|
1542 | 1000002:1
|
---|
1543 | 2:1
|
---|
1544 | +inf:0
|
---|
1545 | -inf:0
|
---|
1546 | 123.456:0
|
---|
1547 | -123.456:0
|
---|
1548 | 0.01:0
|
---|
1549 | -0.01:0
|
---|
1550 | 120:1
|
---|
1551 | 1200:1
|
---|
1552 | -1200:1
|
---|
1553 | &is_positive
|
---|
1554 | 0:0
|
---|
1555 | 1:1
|
---|
1556 | -1:0
|
---|
1557 | -123:0
|
---|
1558 | NaN:0
|
---|
1559 | -inf:0
|
---|
1560 | +inf:1
|
---|
1561 | &is_negative
|
---|
1562 | 0:0
|
---|
1563 | 1:0
|
---|
1564 | -1:1
|
---|
1565 | -123:1
|
---|
1566 | NaN:0
|
---|
1567 | -inf:1
|
---|
1568 | +inf:0
|
---|
1569 | &parts
|
---|
1570 | 0:0 1
|
---|
1571 | 1:1 0
|
---|
1572 | 123:123 0
|
---|
1573 | -123:-123 0
|
---|
1574 | -1200:-12 2
|
---|
1575 | NaNparts:NaN NaN
|
---|
1576 | +inf:inf inf
|
---|
1577 | -inf:-inf inf
|
---|
1578 | &exponent
|
---|
1579 | 0:1
|
---|
1580 | 1:0
|
---|
1581 | 123:0
|
---|
1582 | -123:0
|
---|
1583 | -1200:2
|
---|
1584 | +inf:inf
|
---|
1585 | -inf:inf
|
---|
1586 | NaNexponent:NaN
|
---|
1587 | &mantissa
|
---|
1588 | 0:0
|
---|
1589 | 1:1
|
---|
1590 | 123:123
|
---|
1591 | -123:-123
|
---|
1592 | -1200:-12
|
---|
1593 | +inf:inf
|
---|
1594 | -inf:-inf
|
---|
1595 | NaNmantissa:NaN
|
---|
1596 | &length
|
---|
1597 | 123:3
|
---|
1598 | -123:3
|
---|
1599 | 0:1
|
---|
1600 | 1:1
|
---|
1601 | 12345678901234567890:20
|
---|
1602 | &is_zero
|
---|
1603 | NaNzero:0
|
---|
1604 | +inf:0
|
---|
1605 | -inf:0
|
---|
1606 | 0:1
|
---|
1607 | -1:0
|
---|
1608 | 1:0
|
---|
1609 | &is_one
|
---|
1610 | NaNone:0
|
---|
1611 | +inf:0
|
---|
1612 | -inf:0
|
---|
1613 | 0:0
|
---|
1614 | 2:0
|
---|
1615 | 1:1
|
---|
1616 | -1:0
|
---|
1617 | -2:0
|
---|
1618 | &ffloor
|
---|
1619 | 0:0
|
---|
1620 | abc:NaN
|
---|
1621 | +inf:inf
|
---|
1622 | -inf:-inf
|
---|
1623 | 1:1
|
---|
1624 | -51:-51
|
---|
1625 | -51.2:-52
|
---|
1626 | 12.2:12
|
---|
1627 | 0.12345:0
|
---|
1628 | 0.123456:0
|
---|
1629 | 0.1234567:0
|
---|
1630 | 0.12345678:0
|
---|
1631 | 0.123456789:0
|
---|
1632 | &fceil
|
---|
1633 | 0:0
|
---|
1634 | abc:NaN
|
---|
1635 | +inf:inf
|
---|
1636 | -inf:-inf
|
---|
1637 | 1:1
|
---|
1638 | -51:-51
|
---|
1639 | -51.2:-51
|
---|
1640 | 12.2:13
|
---|