diff options
author | jonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2018-01-04 20:51:36 +0000 |
---|---|---|
committer | jonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2018-01-04 20:51:36 +0000 |
commit | 19e5b0f5dbe59632a46f9781131cf6b617d49e92 (patch) | |
tree | 399e62ead837549e1879c303c750e53f2ca26477 /compiler/ncon.pas | |
parent | a92be8979fb2ea6195d16b6440d7ba063b516742 (diff) | |
download | fpc-19e5b0f5dbe59632a46f9781131cf6b617d49e92.tar.gz |
* when creating a realconstn, cast the value to the specified type
(mantis #25121)
o note that this means that single_const1/single_const2 will now be rounded
to single, instead of staying the at maximum precision
o fixed FahrenheitToCelcius() to handle this change correctly
git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@37911 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'compiler/ncon.pas')
-rw-r--r-- | compiler/ncon.pas | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/compiler/ncon.pas b/compiler/ncon.pas index 5c08d9813f..ea627187b8 100644 --- a/compiler/ncon.pas +++ b/compiler/ncon.pas @@ -337,6 +337,21 @@ implementation internalerror(2008022401); inherited create(realconstn); typedef:=def; + case tfloatdef(def).floattype of + s32real: + v:=single(v); + s64real: + v:=double(v); + s80real, + sc80real, + s64comp, + s64currency: + v:=extended(v); + s128real: + internalerror(2013102701); + else + internalerror(2013102702); + end; value_real:=v; value_currency:=v; lab_real:=nil; |