I have big float on database : 20202166.16
When I call on PHP:
$num = odbc_result($sqlQuery,0);
$number = number_format($num,2,',','.');
I get 20.202.170,00
but I want 20.202.166,16
Any idea how to prevent auto-rounding?
I have big float on database : 20202166.16
When I call on PHP:
$num = odbc_result($sqlQuery,0);
$number = number_format($num,2,',','.');
I get 20.202.170,00
but I want 20.202.166,16
Any idea how to prevent auto-rounding?
Sounds like it's not PHP based on the answers in the comments. You don't say what database you're using but taking a guess it might be MySQL?
Problems with Floating-Point Values
Floating-point numbers sometimes cause confusion because they are approximate and not stored as exact values. A floating-point value as written in an SQL statement may not be the same as the value represented internally. Attempts to treat floating-point values as exact in comparisons may lead to problems. They are also subject to platform or implementation dependencies. The FLOAT and DOUBLE data types are subject to these issues. For DECIMAL columns, MySQL performs operations with a precision of 65 decimal digits, which should solve most common inaccuracy problems.
Source: https://dev.mysql.com/doc/refman/5.7/en/problems-with-float.html
Try changing the column type to DECIMAL and see if that resolves the issue.