Re: [fpc-pascal] Two "double" related question

2014-03-26 Thread Jonas Maebe
On 25 Mar 2014, at 07:13, Xiangrong Fang wrote: 2. How can I tell the compiler NOT to generate EDivideByZero or any similar stuff, but just return the IEEE Infinity NegInfinity or Nan accordingly? I know that they are defined in the math unit. http://www.freepascal.org/docs-html/rtl/math/

[fpc-pascal] Two "double" related question

2014-03-24 Thread Xiangrong Fang
Hi All, I am trying to convert an R program to pascal. Having 2 problems: 1. In R, ln(0) is -Inf (negative infinity) and ln(-1) is NaN, while in FPC (2.6.2), ln(0) is NaN, and ln(-1) is -Inf, why? Mathematically, I think R's rationale is better because ln(x) approaches -Inf while X approaches 0.