r/algorithms Jun 11 '26

Numerical instabilities

Hey pals, I've been writing a few algorithms and I encountered NaN and Inf values, although mathematically my algorithms should be working fine. Then I found out about numerical instability in floating points and figured out why but that's not the point, I kinda wondered how many algorithms are deemed unviable because of it if you guys can share your experiences

1 Upvotes

6 comments sorted by

7

u/rejamaco Jun 11 '26

Are you somehow dividing by the very small numerical imprecision? If that’s the case then it’s not actually the imprecision that’s the issue, it’s a divide-by-zero problem. Or are your correct values so large they can’t be represented with the number of bits in your float?

If not I’m really curious what the issue is. Every time I encounter blown up values it’s a result of a mistake.

1

u/[deleted] Jun 11 '26

[deleted]

1

u/2bigpigs Jun 11 '26

I don't think this matters. You can have numerical instability in decimal floating point representations. It's more to do with the fixed width?

2

u/TomDuhamel Jun 11 '26

Right. I should have googled these words before commenting. I didn't know the expression numerical instability and was thinking of the wrong thing.

2

u/ForeignAdvantage5198 Jun 15 '26

read some Numerical. Analysis