mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-01 23:09:32 +01:00
* 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: trunk@37911 -
This commit is contained in:
parent
4a490323e1
commit
8cfe7e0a0c
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -15466,6 +15466,7 @@ tests/webtbs/tw25059.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw25077.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw25081.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw25101.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw25121.pp svneol=native#text/plain
|
||||
tests/webtbs/tw25122.pp svneol=native#text/plain
|
||||
tests/webtbs/tw25132.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw2514.pp svneol=native#text/plain
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -199,7 +199,7 @@ implementation
|
||||
|
||||
function FahrenheitToCelsius(const AValue: Double): Double;
|
||||
begin
|
||||
result:= (5.0/9.0) * (Avalue - 32.0);
|
||||
result:= (double(5.0)/9.0) * (Avalue - 32.0);
|
||||
end;
|
||||
|
||||
function CelsiusToFahrenheit(const AValue: Double): Double;
|
||||
|
||||
8
tests/webtbs/tw25121.pp
Normal file
8
tests/webtbs/tw25121.pp
Normal file
@ -0,0 +1,8 @@
|
||||
begin
|
||||
if not(single(144115188075855877) = single(144115188075855872)) then
|
||||
halt(1);
|
||||
if not(single(1 / 3.0) = single(0.33333333)) then
|
||||
halt(2);
|
||||
if not(single(92233720368547758) = single(92233720000000000)) then
|
||||
halt(3);
|
||||
end.
|
||||
Loading…
Reference in New Issue
Block a user