Jump to content

KWK

Members
  • Content Count

    1
  • Joined

  • Last visited

Community Reputation

0 Neutral
  1. Generally in Pascal, writing a real, specifying field length and number of decimals, rounds to that number of decimals. Thus x:=1.27; writeln(x:3:1) produces "1.3" However, in DelphiXE2 x:=0.9; writeln(x:3:0) produces " 0" while x:=1.9; writeln(x:3:0) produces " 2". (This also happens if you just do writeln(0.9:3:0) and writeln(1.9:3:0) For some reason, reals with an absolute value less than 1 are not rounded, but reals with an absolute value >1 are rounded. My example has just one decimal, but I discovered this while trying to print probabilities where writing a calculated value x:=0.000647; writeln(x:8:3) produced 0.000 rather than 0.001 which is correct. This appears to me to be a bug,. Is this true in more recent versions of RAD Studio? Thank you.
×