frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

Ask HN: Is float divergence/drift a real issue in many industries?

8•Swapnopam•18h ago
Was wondering if float divergence/drift a very real issue which affects industries or is just a minor inconvenience at best.

Comments

mitchellpkt•12h ago
In my own experience with data science work:

On multiple occasions I’ve seen noticeable accumulated rounding error crop up by the end of a cumprod over very long timeseries of floats.

But in my cases it has just been a minor nuisance that I have to double check whether a mismatch came from float-related quirkiness or a code mistake.

I got into the habit of just using integers where applicable for cases that need to match down to the last bit, and numpy.isclose() for inherently floaty cases where it’s anticipated and reasonable.

Only speaking from my own experience, which doesn’t involve chaotic systems or anything like that. I’m curious to hear from people in other domains who may have more exciting stories.

sigbottle•7h ago
For physics simulations, or even in RF work, the tolerances you need are quite a bit more than say, AI work. For example, for one of our RF algorithms, we "have" to use doubles (I actually can think of an optimization that can let us use floats, but it's quite involved to fix it) to get the required precision. That precision requirement is 10^-15. For physics simulations, I've heard of accuracies of up to 10^-20.

I will say, generally, it depends on what you mean. There's like, numerical drift, and then there's converting to the discrete part. Generally, I'd say that "getting into the discrete part" of an algorithm, unless you're trying to match behavior of another piece of software, is fine. Like, if you're playing a game, people are not going to care if the shot just grazed them and missed, but the "Actual True Value" is like 10^-9 off or something. They will just chalk it up to "close, unlucky". If you have one canonical place for your floating point errors from which your "discrete" parts derive, it's no biggie.

But at work, I recently debugged an algorithm in which the author, effectively wanted to compute the integer and fractional parts of a double type. Their reasoning was that, for the fractional part, there can be imprecision, so you should do some fancy math to recover the fractional part.

This is giga wrong for the application we were building. You never want to try computing the "same double" in two different ways and compose the results like this. Intuitively, if one path "thinks" your double is 15.00001, and the other path "thinks" its 14.99999, you're now saying that the double is 15 (integer) + .99999 (fractional) = 15.99999: this is way off now!

You should just use one double, and extract out the integer and fractional parts. It doesn't matter if the double is imprecise - it's authoritatively imprecise. Much easier to reason about.

This is the first time I've debugged an edge case like this since I wouldn't implement something like this, but it's an example of how subtle floating point errors can be.

Ask HN: What are your favorite blogs not about AI?

67•azhenley•5h ago•29 comments

AWS: Inaccurate Estimated Billing Data – $1.7 billion

1298•nprateem•2d ago•747 comments

Freeact – undetectable browser automation CLI for AI agents via real browsers

2•xuviga•22m ago•0 comments

Thanks HN for 15 years of support and helping me find my life's work

817•nicholasjbs•2d ago•104 comments

Ask HN: How are you doing threat modeling for Terraform/IaC?

2•PotatoFy•7h ago•1 comments

Ask HN: What Are You Working On? (July 2026)

289•david927•1w ago•1123 comments

LG ThinQ Terms of Use

62•tedggh•1d ago•30 comments

Ask HN: Did Fable disappear from your Claude usage and requires credits now?

91•cromka•2d ago•86 comments

Ask HN: Would you rent M3 Ultra from me?

4•realaccfromPL•18h ago•6 comments

Ask HN: Is float divergence/drift a real issue in many industries?

8•Swapnopam•18h ago•2 comments

Ask HN: Add flag for AI-generated articles

1093•levkk•1w ago•458 comments

Ask HN: Is it just me, or is software buggier across the board?

134•kadhirvelm•4d ago•112 comments

Ask HN: USB-to-WiFi print server for old printers – do you want it?

6•ValdikSS•19h ago•7 comments

Ask HN: Is anyone else facing login issues on Facebook?

5•wasi0013•20h ago•3 comments

Ask HN: Are you building agents? What do they need access to?

2•asim•21h ago•3 comments

Prodigy – AI Workforce for professional teams

3•samayashar•21h ago•1 comments

Ask HN: How do you as a normal swe use AI?

4•atworkc•22h ago•4 comments

I procrastinated so hard I built a proxy to stop myself from procrastinating

9•thisislorenzov•1d ago•1 comments

Ask HN: Having a child before career has taken off

6•lassearpe•1d ago•24 comments

Ask HN: Should I do a CS masters at Cambridge or start as a new grad at Amazon?

29•sspehr•6d ago•95 comments

Ask HN: I built it and nobody came. What got you your first users?

11•deadcatfound•3d ago•26 comments

Ask HN: Are AWS Certs worth getting for experienced Devs?

13•Gold-Ask-lx•4d ago•18 comments

You've reached the end!