A Subtle Elixir Gotcha: Pattern Matching with Floats

Ever thought pattern matching with floats in Elixir was straightforward? We learned the hard way in production that it can be surprisingly tricky. This post dives into a real-world bug, why it happened, and how to avoid it.

https://blackode.medium.com/a-subtle-elixir-gotcha-that-bit-us-in-production-pattern-matching-with-floats-1c6a50369389?sk=e0c87477949dce239cd06428515484a2

elixir programming #PatternMatching #BugFix

9 Likes

Wait till you learn that IEEE 754 has two different zeros and pattern matching differentiates between them.

7 Likes

It’s always DNS floats.

1 Like