Loss of precision on Float fields
See original GitHub issueBug description
I have a price Float @default(0)
field and while the value stored in the database row (postgres) is 0.69
the value returned by the prisma client is 0.6900000000000001
(this is a console.log
on the output of .findMany
)
Environment & setup
- OS: ArchLinux
- Database: PostgreSQL
- Prisma version: 2.1.3
- Node.js version: 12.17
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Losing My Precision: Tips For Handling Tricky Floating Point ...
Loss of precision in converting into floating point; Adding numbers of very different magnitudes; Subtracting numbers of similar magnitudes; Multiplying and ...
Read more >java - Loss of precision - int -> float or double - Stack Overflow
Casting to float will lose precision if the integral value has more than 24 significant bits. Casting to double will lose precision if...
Read more >Why Do My Floating Point Numbers Lose Precision ... - Support
For this reason, you may experience a loss of precision, and some floating-point operations may produce unexpected results.
Read more >Floating Point Numbers & Causes of Imprecision
INGRES lost precision on 1.00000005 because 9 decimal digits were entered, causing the least significant portion of the number to be lost.
Read more >Demystifying Floating Point Precision
Floating point numbers have limited precision. If you are a game programmer, you have likely encountered bugs where things start breaking ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thank you, I deployed it to our staging environment. Everything seems to be ok. Should I find anything wrong I’ll keep you posted.
Fix is done. Merging when reviewed and tests are green. You can read what was the issue from the PR.