File: iec60559.R

package info (click to toggle)
r-base 3.1.1-1%2Bdeb8u1
  • links: PTS
  • area: main
  • in suites: jessie
  • size: 85,436 kB
  • ctags: 35,389
  • sloc: ansic: 306,779; fortran: 91,908; sh: 11,216; makefile: 5,311; yacc: 4,994; tcl: 4,562; objc: 746; perl: 655; asm: 553; java: 31; sed: 6
file content (18 lines) | stat: -rw-r--r-- 531 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
## Tests for various features of IEC60559 doubles.
## Most of these are optional, so this is a sloppy test.

# Goes to denormal (aka subnormal) numbers at -708.4
exp(c(-745:-740, -730, -720, -710:-705))

# goes to subnormal numbers at -308, to zero at ca 5e-324.
10^-(324:307)
2^-(1022:1075)

# And because most libm pow() functions special-case integer powers.
10^-(324:307-0.01)/10^0.01

# IEC60559 mandates this, but C99/C11 do not.
# Mingw-w64 did not do so in v 2.0.1
x <- 0*(-1) # negative zero
sqrt(x)
identical(x, sqrt(x))