• lugal@lemmy.dbzer0.com
    link
    fedilink
    arrow-up
    12
    ·
    9 hours ago

    Would this lead to problems if there are multiple identical and close by values? Like for example you have 100 elements each between 1 and 5

    • rbn@sopuli.xyz
      link
      fedilink
      arrow-up
      25
      ·
      7 hours ago

      To reduce the chance of errors, you can multiply all numbers by a factor of 10, 100, 1000, 10000, … for the timeout. The higher the factor, the lower the chances of an incorrect result. And as no one asked about performance…

      • filcuk@lemmy.zip
        link
        fedilink
        arrow-up
        25
        ·
        7 hours ago

        As added benefit, you can then opyimise the code by dividing the number by 2, making it twice as fast. Think of the savings!