orhtej2@eviltoast.org to Programmer Humor@programming.devEnglish · 10 months agoFloating point arithmeticseviltoast.orgexternal-linkmessage-square45linkfedilinkarrow-up1779arrow-down17
arrow-up1772arrow-down1external-linkFloating point arithmeticseviltoast.orgorhtej2@eviltoast.org to Programmer Humor@programming.devEnglish · 10 months agomessage-square45linkfedilink
minus-squareGrandwolf319@sh.itjust.workslinkfedilinkarrow-up16·10 months agoCause fractions can be figured out in context. You can store the numerators and have the denominator as a constant in the code.
minus-squareFrezik@lemmy.blahaj.zonelinkfedilinkarrow-up11·10 months agoYou can also have a type which does it. Raku has a Rational type for this.
minus-squaredontsayaword@piefed.sociallinkfedilinkEnglisharrow-up5·10 months agoPart of my first programming courses in the 90s in C were creating a native fraction type.
minus-squareKacarott@aussie.zonelinkfedilinkarrow-up4·10 months agoPython has the Fraction type, and there are many more
Cause fractions can be figured out in context. You can store the numerators and have the denominator as a constant in the code.
You can also have a type which does it. Raku has a Rational type for this.
Part of my first programming courses in the 90s in C were creating a native fraction type.
Python has the Fraction type, and there are many more