stop rounding

stop rounding

rldean1rldean1 Posts: 141Questions: 66Answers: 1
edited June 2018 in Free community support

How do I stop Datatables from rounding?

I've encountered a column with decimal(38,30)... 38 total spaces, with a possibility of 30 spaces to the right of the decimal.

1.012345678901234567890 -- I would prefer to display the raw value

1.0123456789012346 -- not the rounded value.

Do I use render to make it like I want it? Do I set the column's datatype somehow?

However, if it's zeros, I'm cool with dropping those.

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,300Questions: 26Answers: 4,945
    Answer ✓

    That's more a Javascript limitation than a Datatables limit. Go to your browser's console and paste 1.012345678901234567890. The result will be 1.0123456789012346.

    One option to display the raw value is to return the value as text. You can then convert it, in Javascript, to a floating point number if you need to do calculations. I believe the precision is around 20 digits.

    Kevin

This discussion has been closed.