‹ BackHN Continuity

Thread

More floating point alternatives

53 points · 51 comments · vismit2000

  1. AlotOfReading · · focus · HN ↗
    Usually, if you know enough about your algorithms to select an appropriate float alternative, you also know enough to fix your float code and that's what you should actually do.

    That said, some of these aren't alternatives. Symbolic computation is a different thing entirely. Interval arithmetic can be built atop floats (e.g. IEEE-1788) and has its own zoo of unintuitive behaviors. BCD is better called a historical artifact than an alternative these days.

    It's really just rationals and decimal floats in this list, which probably don't solve the issues you have if you're considering float alternatives.

    1. TZubiri · · focus · HN ↗
      You can't "fix" floating point code if you are looking for deterministic answers. You just have to use other data types to handle money or complex mathematical operations like 0.2+0.1, no ifs and buts.
      1. messe · · focus · HN ↗
        Floating point is deterministic, what are you talking about?

        > You just have to use other data types to handle money or complex mathematical operations like 0.2+0.1

        Such as... decimal floating point.

        1. timschmidt · · focus · HN ↗
          > Floating point is deterministic, what are you talking about?

          Order of operations can change a result, for example. I suspect you mean that the algorithm never changes. While op means that mathematical operations which most folks would expect to be reliable are not.

          1. messe · · focus · HN ↗
            They're not associative, sure. But that's a very far cry from claiming they're non-deterministic.
            1. timschmidt · · focus · HN ↗
              There are enough problems for a 44 page paper titled "What Every Computer Scientist Should Know About Floating-Point Arithmetic"[1] I don't quibble on the language because I know what people mean.

              Most folks won't encounter most of the issues, generally. But expose your code to a large enough dataset, or be like me and write a CAD/CAM system with motion control and experience most of them.

              That's why I wrote hyperreal[2]

              1: <a href="https:&#x2F;&#x2F;www.cs.tufts.edu&#x2F;cs&#x2F;40&#x2F;docs&#x2F;WhatEveryComputerScientistShouldKnowAboutFloatingPointArithmetic.pdf" rel="nofollow">https:&#x2F;&#x2F;www.cs.tufts.edu&#x2F;cs&#x2F;40&#x2F;docs&#x2F;WhatEveryComputerScienti...

              2: <a href="https:&#x2F;&#x2F;github.com&#x2F;timschmidt&#x2F;hyperreal" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;timschmidt&#x2F;hyperreal

              1. drfloyd51 · · focus · HN ↗
                You don’t quibble about what words mean when the words you choose have very specific meanings in exactly the subject area you are talking about?

                You make it really hard to take you seriously.

                1. timschmidt · · focus · HN ↗
                  No. It&#x27;s been quite some time since I realized that all language is a pidgin used to translate between individuals&#x27; unique lived experiences and points of reference. And find communication much more fluid and less confrontational when the focus is on shared meaning rather than perfect word choice. Especially when working with non-native speakers, but also just people in general. Stephen Fry captures the feeling: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=Ovi7uQbtKas" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=Ovi7uQbtKas

                  When TZubiri made their original comment, I understood they were speaking about some or all of the issues outlined in the paper I linked. If you didn&#x27;t, that&#x27;s ok. If you think the referenced paper missed something, it&#x27;s OK to add that.

                  &gt; You make it really hard to take you seriously.

                  Same, bud.

                  1. rcxdude · · focus · HN ↗
                    These kinds of comments tend to happen when you are assuming a shared meaning that isn&#x27;t so shared. Especially in this context, it&#x27;s a good idea to be precise in your terminology when there is a commonly used vocabulary for talking about it. Especially when it comes to misconceptions about floating point, which is often treated as &#x27;random&#x27; when it generally isn&#x27;t.
                    1. timschmidt · · focus · HN ↗
                      Sometimes specificity matters. Usually when looking directly at some specific piece of code. In this conversation, the intended meaning was clear. Folks just love being the pedant and the brinksmanship which comes with it. There&#x27;s a propensity to derail otherwise useful conversations into discussions like this rather than dig deeper into what people meant, and were trying to communicate.
                      1. messe · · focus · HN ↗
                        &gt; In this conversation, the intended meaning was clear

                        Apparently it wasn&#x27;t, as the commenter who originally used the term has now clarified that they did indeed mean non-deterministic. You misunderstood them.

                        So maybe being specific about terminology here isn&#x27;t just pointless pedantry?

                        1. timschmidt · · focus · HN ↗
                          Regardless of his choice of words, he&#x27;s specified that he&#x27;s speaking about IEEE754 and the sort of issues which arise systemically from the compromises inherent in it&#x27;s design.

                          He can&#x27;t attest to them being the same ones in the paper I linked, but I can. Everything he&#x27;s said is in line with the situation detailed within.

                          He and I seem to understand each other. I get what he&#x27;s saying. How the issues with IEEE754 give rise to the nondeterminism he&#x27;s talking about. I should, I wrote a whole system of libraries to deal with them. Do you understand the conversation? Because it seems like you think we&#x27;re talking about two unrelated things and you&#x27;re still arguing over terminology.

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.