MySQL - Float: Hidden Round Down

Hi there,

just to inform, i have a table and a column of type float, when i run IFNULL construct in a sql widget - this is not because of the widget, but the mysql itself:

SyntaxEditor Code Snippet

IFNULL(mycolfloat,-999999999) mycolfloat

the result is -1000000000 if it is NULL, also happen to -999999998, -999999 ...round down...

and to work around, just add decimal:

SyntaxEditor Code Snippet

IFNULL(mycolfloat,-999999999.0) mycolfloat

regards

Solution

Hi Boring,


To complement your example, the rounding method / behavior can vary using the native OutSystems Round action or the ones in SQL can also vary depending on whether you are using SQL Server / Oracle / DB2 / MySQL.

OutSystems documentation provides here the detailed explanation and some examples with differences on using OutSystems native Round method and database server methods.

Solution

Hi Boring,


What platform version/revision is that in?

I remember some years ago to see a fix for something like that for mssql. (Also pretty sure the fix was not database specific)


Regards,

João Rosado

Think it was this one:

https://www.outsystems.com/home/downloadsdetail/76/1882/downloadsdetail

  • Fixed precision of very large decimal literals (#1322328)

That particular fix was rolled out in 8.0.1.75, 9.0.1.75 and 9.1.600.0


Not sure if it's the same problem, but don't have a mysql database at hand to try it.

Thank you Sirs.

It has nothing to do with the platform, even if i select in an MYSQL editor like HEidiSQL, the result is rounded.

regards