3 ms·
Rational numbers can also be trated as quotient of two integers and stored with arbitrary precision by storing these two values, even with limited precision of
by ketzu 4y ago
Rational numbers can also be trated as quotient of two integers and stored with arbitrary precision by storing these two values, even with limited precision of 2x32 bit integers, that would perfectly accurately capture 1/3 and 1/10.
But I also don't think it is particularly 'news', the discussion on previous versions centered around the problems that arise from floats, such as inconsistent handling by tools and languages and 'inapropriate use' where the precision from floats is not good enough or misleading. So maybe it is more a "topic of interest".
- dahfizz 4y agoRationals have their own set of issues: 1) it's really slow slow. Adding two fractions involves three integer multiplications and then running the GCD to simplify the fractions. 2) just simply comparing two rational numbers involves multiplication, which may overflow. 3) you can't represent irrational numbers. You can't do square roots, for example.
- ketzu 4y agoYes, all systems will have some drawbacks. My response was only geared towards this part: > numbers like 1/10 and 1/3 can only be approximated in a finite number of bits Maybe I should have been more explicit.