> The exact ratio is not 14, but it’s as close to 14 as a standard floating point number can be.
How do you get around limitations like that in science?
> The exact ratio is not 14, but it’s as close to 14 as a standard floating point number can be.
How do you get around limitations like that in science?
For rational numbers, Python has a Fraction class in the standard library that performs exact integer arithmetic:
That shows that 0xFEDCBA987654321 / 0x123456789ABCDEF = 14 + 1/5465701947765793 exactly. Shows that the denominator requires 52 bits which is slightly more than the number of mantissa bits in a 64-bit floating point number, so the result gets rounded to 14.0 due to limited precision.You can use Mathematica or Sage that can use any number of digits https://www.wolframalpha.com/input?i=FEDCBA987654321_16+%2F+...
You can use special libraries for floating point that uses more mantisa.
In most sciences, numbers are never integers anyway, so you have errors intervals in the numerator and denumerator and you get an error interval for the result.
You can do symbolic calculations carrying precisely defined numbers (eg. PI, 3/7...), you can use tools which allow arbitrary precision (it's only slower by several orders of magnitude so not too bad if you don't need millions of calculations: this includes Python if you use Decimal objects), or you can use error calculus to decide if the final error is acceptable.