Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 62 lines (56 sloc) 2.806 kb
4b9f5ae add tests of gradual underflow
ripley authored
1
069e5c0 update reference output
ripley authored
2 R Under development (unstable) (2012-03-05 r58592)
4b9f5ae add tests of gradual underflow
ripley authored
3 Copyright (C) 2012 The R Foundation for Statistical Computing
4 ISBN 3-900051-07-0
069e5c0 update reference output
ripley authored
5 Platform: x86_64-unknown-linux-gnu (64-bit)
4b9f5ae add tests of gradual underflow
ripley authored
6
7 R is free software and comes with ABSOLUTELY NO WARRANTY.
8 You are welcome to redistribute it under certain conditions.
9 Type 'license()' or 'licence()' for distribution details.
10
11 R is a collaborative project with many contributors.
12 Type 'contributors()' for more information and
13 'citation()' on how to cite R or R packages in publications.
14
15 Type 'demo()' for some demos, 'help()' for on-line help, or
16 'help.start()' for an HTML browser interface to help.
17 Type 'q()' to quit R.
18
19 > ## Tests for various features of IEC60559 doubles.
20 > ## Most of these are optional, so this is a sloppy test.
21 >
22 > # Goes to denormal (aka subnormal) numbers at -708.4
23 > exp(c(-745:-740, -730, -720, -710:-705))
24 [1] 4.940656e-324 9.881313e-324 1.976263e-323 5.434722e-323 1.531604e-322
25 [6] 4.199558e-322 9.226315e-318 2.032231e-313 4.476286e-309 1.216781e-308
26 [11] 3.307553e-308 8.990861e-308 2.443969e-307 6.643398e-307
27 >
28 > # goes to subnormal numbers at -308, to zero at ca 5e-324.
29 > 10^-(324:307)
30 [1] 0.000000e+00 9.881313e-324 9.881313e-323 9.980126e-322 9.999889e-321
31 [6] 9.999889e-320 9.999987e-319 1.000000e-317 1.000000e-316 1.000000e-315
32 [11] 1.000000e-314 1.000000e-313 1.000000e-312 1.000000e-311 1.000000e-310
33 [16] 1.000000e-309 1.000000e-308 1.000000e-307
34 > 2^-(1022:1075)
35 [1] 2.225074e-308 1.112537e-308 5.562685e-309 2.781342e-309 1.390671e-309
36 [6] 6.953356e-310 3.476678e-310 1.738339e-310 8.691695e-311 4.345847e-311
37 [11] 2.172924e-311 1.086462e-311 5.432309e-312 2.716155e-312 1.358077e-312
38 [16] 6.790387e-313 3.395193e-313 1.697597e-313 8.487983e-314 4.243992e-314
39 [21] 2.121996e-314 1.060998e-314 5.304989e-315 2.652495e-315 1.326247e-315
40 [26] 6.631237e-316 3.315618e-316 1.657809e-316 8.289046e-317 4.144523e-317
41 [31] 2.072262e-317 1.036131e-317 5.180654e-318 2.590327e-318 1.295163e-318
42 [36] 6.475817e-319 3.237909e-319 1.618954e-319 8.094772e-320 4.047386e-320
43 [41] 2.023693e-320 1.011846e-320 5.059232e-321 2.529616e-321 1.264808e-321
44 [46] 6.324040e-322 3.162020e-322 1.581010e-322 7.905050e-323 3.952525e-323
45 [51] 1.976263e-323 9.881313e-324 4.940656e-324 0.000000e+00
46 >
47 > # And because most libm pow() functions special-case integer powers.
48 > 10^-(324:307-0.01)/10^0.01
49 [1] 0.000000e+00 9.881313e-324 1.037538e-322 9.980126e-322 9.999889e-321
50 [6] 1.000038e-319 9.999987e-319 9.999997e-318 1.000000e-316 1.000000e-315
51 [11] 1.000000e-314 1.000000e-313 1.000000e-312 1.000000e-311 1.000000e-310
52 [16] 1.000000e-309 1.000000e-308 1.000000e-307
53 >
a56cb3d add test for sqrt(-0)
ripley authored
54 > # IEC60559 mandates this, but C99/C11 do not.
55 > # Mingw-w64 did not do so in v 2.0.1
56 > x <- 0*(-1) # negative zero
57 > sqrt(x)
58 [1] 0
59 > identical(x, sqrt(x))
60 [1] TRUE
61 >
Something went wrong with that request. Please try again.