orhtej2@eviltoast.org to Programmer Humor@programming.devEnglish · 4 months agoFloating point arithmeticseviltoast.orgimagemessage-square44linkfedilinkarrow-up1775arrow-down17
arrow-up1768arrow-down1imageFloating point arithmeticseviltoast.orgorhtej2@eviltoast.org to Programmer Humor@programming.devEnglish · 4 months agomessage-square44linkfedilink
minus-squareGrandwolf319@sh.itjust.workslinkfedilinkarrow-up16·4 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·4 months agoYou can also have a type which does it. Raku has a Rational type for this.
minus-squaredontsayaword@piefed.sociallinkfedilinkEnglisharrow-up5·4 months agoPart of my first programming courses in the 90s in C were creating a native fraction type.
minus-squareKacarott@aussie.zonelinkfedilinkarrow-up4·4 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