Skip to content

Conversion Precision #1128

Answered by Brunni
davidkappelt asked this question in Q&A
Discussion options

You must be logged in to vote

This is caused by the normal double precision: https://en.wikipedia.org/wiki/Double-precision_floating-point_format

If you write 328.999d / 1000 in a normal c# code you will get the same error. This is just how floating point in computers work.

To avoid this in c# code it is possible to use decimal instead: 328.999m / 1000

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by angularsen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants