Search Results

Search found 1 results on 1 pages for 'hannesnz'.

Page 1/1 | 1 

  • Fixing Floating Point Error

    - by HannesNZ
    I have some code that gets the leading value (non-zero) of a Double using normal math instead of String Math... For Example: 0.020 would return 2 3.12 would return 3 1000 should return 1 The code I have at the moment is: LeadingValue := Trunc(ResultValue * Power(10, -(Floor(Log10(ResultValue))))) However when ResultValue is 1000 then LeadingValue ends up as 0. What can I do to fix this problem I'm assuming is being caused by floating point errors? Thanks.

    Read the article

1