Home Forums SQL Server 2008 T-SQL (SS2K8) Different values returned by converting the same value type float to 2 decimal from 2 different tables RE: Different values returned by converting the same value type float to 2 decimal from 2 different tables

  • david.jack (6/8/2016)


    Hi - very grateful for any help:

    I've got the same value 2306.7555 in 2 tables,both data type float. I'm comparing the values converted to 3 decimal, but for some reason when I do that, I'm getting 2306.755 from one table and 2306.756 from the other. What's going on here?

    The problem is I can't change the conversion logic because it's not mine, I'm just working with the values but I need to report this problem back to the guy responsible for the original code.

    There are 2 options.

    1. They are not the same.

    FLOAT has 15 digit precision. All 15 digits are significant.

    You're displaying only 8 of them. What are the remaining 7?

    2. Something with the conversion logic.

    It might depend on some parameters outside of the scope.

    If you post the code here we might be able to explain why the same FLOAT is converted to decimals.

    _____________
    Code for TallyGenerator