3 ms·
Hmm, yes, it can be represented in ASCII. But you still have to approximate when storing it in a way that is actually useful for computation using a finite numb
by craftyguy 9y ago
Hmm, yes, it can be represented in ASCII. But you still have to approximate when storing it in a way that is actually useful for computation using a finite number of bits.
- umanwizard 9y agostruct rational { int numerator; int denominator; };
- dragonwriter 9y agoMany real programming languages support arbitrary precision decimal and/or rational numbers. Sure, there are times when space or speed concerns favor inexact representation over correctness, but that's an optimization that ought to be properly evaluated; the fact that lots of languages are designed in a way which makes it the default everyone reaches for contributes to lots of errors.
- LASR 9y agoNo. of course not. A lot of scientific calculators do this. They have a fractional arithmetic mode that keeps numbers you input as fractions as fractions in the output. Scientific calculators even have irrational modes where they represent irrational numbers such as sqrt(2) as sqrt(2) and can do 100% precise operations on it. Like sqrt(2) * sqrt(2) will give you a result of 2 https://i.imgur.com/l83fwr2.png https://i.imgur.com/l83fwr2.png