• data1701d (He/Him)
    link
    fedilink
    English
    22 months ago
    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')
    
    • Ephera
      link
      fedilink
      English
      62 months ago

      > C:\
      > on linux

      Absolutely illegal.

    • ☆ Yσɠƚԋσʂ ☆OP
      link
      fedilink
      12 months ago

      I 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
      
    • @vext01@lemmy.sdf.org
      link
      fedilink
      12 months ago

      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.