diff options
author | sergei <sergei@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2014-06-01 01:20:06 +0000 |
---|---|---|
committer | sergei <sergei@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2014-06-01 01:20:06 +0000 |
commit | 3b6b778d820da8c06739713508937ff96188b0e1 (patch) | |
tree | 1ec7883df838d446f6dd8ea187619351b4b14913 /compiler/ninl.pas | |
parent | 19c7e9322b76f3d0df2082b5d415073709e7904b (diff) | |
download | fpc-3b6b778d820da8c06739713508937ff96188b0e1.tar.gz |
* handle_ln_const: if/else branches were swapped, correct values are: ln(0)=-Inf and ln(-#)=NaN.
* handle_ln_const and handle_sqrt_const handle all arguments, not just invalid ones, so calling code can be simplified.
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@27837 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'compiler/ninl.pas')
-rw-r--r-- | compiler/ninl.pas | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/compiler/ninl.pas b/compiler/ninl.pas index 9392991b0c..5230205760 100644 --- a/compiler/ninl.pas +++ b/compiler/ninl.pas @@ -1874,9 +1874,9 @@ implementation else begin if r=0.0 then - result:=crealconstnode.create(MathQNaN.Value,pbestrealtype^) - else result:=crealconstnode.create(MathNegInf.Value,pbestrealtype^) + else + result:=crealconstnode.create(MathQNaN.Value,pbestrealtype^) end else result:=crealconstnode.create(ln(r),pbestrealtype^) @@ -2425,24 +2425,12 @@ implementation in_sqrt_real : begin if left.nodetype in [ordconstn,realconstn] then - begin - vr:=getconstrealvalue; - if vr<0.0 then - result:=handle_sqrt_const(vr) - else - setconstrealvalue(sqrt(vr)); - end + result:=handle_sqrt_const(getconstrealvalue); end; in_ln_real : begin if left.nodetype in [ordconstn,realconstn] then - begin - vr:=getconstrealvalue; - if vr<=0.0 then - result:=handle_ln_const(vr) - else - setconstrealvalue(ln(vr)); - end + result:=handle_ln_const(getconstrealvalue); end; in_assert_x_y : begin |