OK group, another quick question/help If I may

OK group, another quick question/help If I may
I am having a problem with real numbers in my code
i.e sometimes they are in the format 1.25343795e-311
i.e with the e- on the end...
like some exponent...scientific notation
and if I use
str(thatnumber:2:1,mystring):
mystring ends up with that e-311 in it..which I dont want

whats the solution?
thanks guys!
(this seems to be something that is happening in XE6 that was not happening in Delphi 2009)

Comments

  1. It's the binary encoding of a number which is extremely close to zero. So consider it a rounding error. Using format() will resolve the issue, as specifying the number of digits will impose rounding.

    ReplyDelete
  2. yeah, that fixes it :)
    I should have used that format from the start...lots of code to change...interesting its now showing as 0.0...i.e the actual real number is some floating point value very close to zero but not actually zero...yes?
    crossed messages there Bill :)

    ReplyDelete
  3. Brian Hamilton It is exactly that. The 311th root of  1.2something. Zero to you and me.

    ReplyDelete

Post a Comment