orhtej2@eviltoast.org to Programmer Humor@programming.devEnglish · 1 day agoFloating point arithmeticseviltoast.orgimagemessage-square44linkfedilinkarrow-up1730arrow-down14
arrow-up1726arrow-down1imageFloating point arithmeticseviltoast.orgorhtej2@eviltoast.org to Programmer Humor@programming.devEnglish · 1 day agomessage-square44linkfedilink
minus-squareGrandwolf319@sh.itjust.workslinkfedilinkarrow-up16·24 hours 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·23 hours agoYou can also have a type which does it. Raku has a Rational type for this.
minus-squareKacarott@aussie.zonelinkfedilinkarrow-up3·16 hours agoPython has the Fraction type, and there are many more
minus-squaredontsayaword@piefed.sociallinkfedilinkEnglisharrow-up4·22 hours agoPart of my first programming courses in the 90s in C were creating a native fraction type.
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.
Python has the Fraction type, and there are many more
Part of my first programming courses in the 90s in C were creating a native fraction type.