pg-promise returns the decimal values as string. How do I fix this?
select round(avg(numcol),2)::decimal from details
pg-promise returns the decimal values as string. How do I fix this?
select round(avg(numcol),2)::decimal from details
Copyright © 2021 Jogjafile Inc.
Following the links I provided in the comments (one and two), you should see that JavaScript simply doesn't have the required precision, so automatic conversion may result in lost precision.
If you do not care about that, you can apply JavaScript standard
parseFloat
:Otherwise, use a specialized library for dealing with decimals.