You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Due to the impossibility to represent floating point numbers in Ink, order of multiplications and divisions are important to ensure numerical precision.
Take for example the following function. It is intended to return the percentage of a total profit:
Description
Due to the impossibility to represent floating point numbers in Ink, order of multiplications and divisions are important to ensure numerical precision.
Take for example the following function. It is intended to return the percentage of a total profit:
The result however, will always be zero, given the integer division
percentage / 100
yields zero.Reordering operations to perform multiplications before divisions is a good way to avoid loss of precision:
Acceptance Criteria
floating-point-and-numerical-precision
The text was updated successfully, but these errors were encountered: