• randy@lemmy.ca
    link
    fedilink
    arrow-up
    11
    arrow-down
    1
    ·
    edit-2
    2 days ago

    I got hung up on this line:

    This requires deterministic math with explicit rounding modes and precision, not the platform-dependent behavior you get with floats.

    Aren’t floats mostly standardized these days? The article even mentions that standard. Has anyone here seen platform-dependent float behaviour?

    Not that this affects the article’s main point, which is perfectly reasonable.

    • a1studmuffin@aussie.zone
      link
      fedilink
      English
      arrow-up
      10
      ·
      2 days ago

      Floating-Point Determinism | Random ASCII - tech blog of Bruce Dawson https://randomascii.wordpress.com/2013/07/16/floating-point-determinism/

      The short answer to your questions is no, but if you’re careful you can prevent indeterminism. I’ve personally ran into it encoding audio files using the Opus codec on AMD vs Intel processors (slightly different binary outputs for the exact same inputs). But if you’re able to control your dev environment from platform choice all the way down to the assembly instructions being used, you can prevent it.

      • randy@lemmy.ca
        link
        fedilink
        arrow-up
        4
        ·
        2 days ago

        Thanks, that’s an excellent article, and it’s exactly what I was looking for.

    • nimpnin@sopuli.xyz
      link
      fedilink
      arrow-up
      20
      ·
      2 days ago

      Mostly standardized? Maybe. What I know is that float summation is not associative, which means that things that are supposed to be equal (x + y + z = y + z + x) are not necessarily that for floats.

    • pinball_wizard@lemmy.zip
      link
      fedilink
      arrow-up
      1
      ·
      2 days ago

      The real standard is whatever Katherine in accounting got out of the Excel nightmare sheets they reconcile against.

    • bleistift2@sopuli.xyz
      link
      fedilink
      English
      arrow-up
      1
      arrow-down
      2
      ·
      edit-2
      2 days ago

      If you count the programming language you use as ‘platform’, then yes. Python rounds both 11.5 and 12.5 to 12.