blackode

blackode

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

Most Liked

hauleth

hauleth

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

adamu

adamu

It’s always DNS floats.

Where Next?

Popular in Blog Posts Top

DevotionGeo
There are 3 main formatters for Erlang which you can use from the command-line, rebar3_format, Steamroller elmfmt. Visual Studio Code’...
New
mudasobwa
Just blogged on the general approach to creating easily extendable applications with plugin support.
New
mssantosdev
This post is a guide on how Norba and I are building LiveMatch, a real-time app for soccer to follow multiple games in one place. https:...
New
ryotsu
How does a torrent client download huge files from the internet with just a .torrent file? In this post we’ll explore the BitTorrent prot...
New
rlopzc
Use the new log handlers to plug Slack or any other provider into your logging system. https://rlopzc.com/posts/integrate-slack-into-the...
New
psantos
Just wrote a new blog post about how to deploy a Phoenix app using Kamal 2. Check it out and let me know what do you think: https://blog...
New
JEG2
I’m closing out, for now, my series on questions at the heart of development with an analysis of when we need more abstraction. For exam...
New

Other popular topics Top

nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 31586 112
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New

We're in Beta

About us Mission Statement