☆ Yσɠƚԋσʂ ☆@lemmy.ml to Programmer Humor@lemmy.mlEnglish · 1 month agoFirst exposure to floating-point arithmeticpeertube.mesnumeriques.frexternal-linkmessage-square5fedilinkarrow-up118arrow-down11cross-posted to: programmer_humor@programming.dev
arrow-up117arrow-down1external-linkFirst exposure to floating-point arithmeticpeertube.mesnumeriques.fr☆ Yσɠƚԋσʂ ☆@lemmy.ml to Programmer Humor@lemmy.mlEnglish · 1 month agomessage-square5fedilinkcross-posted to: programmer_humor@programming.dev
minus-squaredata1701d (He/Him)@startrek.websitelinkfedilinkEnglisharrow-up2·1 month agoC:\home\dexcube\Development\piper\build> python3 Python 3.13.2 (main, Mar 13 2025, 14:29:07) [GCC 14.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from decimal import Decimal >>> Decimal('0.1') + Decimal('0.2') Decimal('0.3')
minus-squareEphera@lemmy.mllinkfedilinkEnglisharrow-up6·1 month ago> C:\ > on linux Absolutely illegal.
minus-squaredata1701d (He/Him)@startrek.websitelinkfedilinkEnglisharrow-up2·1 month agoI use the Chicago95 XFCE theme, which modifies the bash prompt.
minus-square☆ Yσɠƚԋσʂ ☆@lemmy.mlOPlinkfedilinkarrow-up1·1 month agoI mean sure, I can do this with Clojure too Babashka v1.12.197 REPL. Use :repl/quit or :repl/exit to quit the REPL. Clojure rocks, Bash reaches. user=> (float (+ (/ 1 10) (/ 2 10))) user=> 0.3
minus-squarevext01@lemmy.sdf.orglinkfedilinkarrow-up1·1 month agoI looked into this at some point in the past. From memory, despite 0.3 being unrepresenatable, the routine that formats the output rounds it (stringily) to 0.3. Someone can correct me, because it’s only a vague memory at this point.
C:\home\dexcube\Development\piper\build> python3 Python 3.13.2 (main, Mar 13 2025, 14:29:07) [GCC 14.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from decimal import Decimal >>> Decimal('0.1') + Decimal('0.2') Decimal('0.3')
>
C:\
>
on linux
Absolutely illegal.
I use the Chicago95 XFCE theme, which modifies the bash prompt.
I mean sure, I can do this with Clojure too
I looked into this at some point in the past.
From memory, despite 0.3 being unrepresenatable, the routine that formats the output rounds it (stringily) to 0.3.
Someone can correct me, because it’s only a vague memory at this point.