div.prot: Protected division

Description Usage Arguments Value Author(s) Examples

Description

num/den, but num/0 -> .Machine$double.xmax^(3/4)

Usage

1
  div.prot(num,den)

Arguments

den,num

real, numerator and denominator

Value

num/den, if is.infinite(num/den) then .Machine$double.xmax^(3/4), the ^(3/4) for getting something well below Inf.

Author(s)

Christian W. Hoffmann <christian@echoffmann.ch>

Examples

1
2
3
4
  de <- .Machine$double.eps
  v<-c(0,de/c(1,2,4,8))
  div.prot(1,v)
 #  1.55252e+231  4.50360e+15  9.00720e+15  1.80144e+16  3.60288e+16

cwhmisc documentation built on May 1, 2019, 7:55 p.m.