pesos / pesos.github.io

A new design for a new PES Open Source
https://pesos.github.io/
MIT License
2 stars 22 forks source link

[BLOG POST] 0.1 + 0.2 is not equal to 0.3 #47

Closed tfidfwastaken closed 3 years ago

tfidfwastaken commented 3 years ago

Title: 0.1 + 0.2 and other fantastic ways to make money disappear

Abstract:

Type 0.1 + 0.2 == 0.3 into the Python interpreter. Yep. It's false. Before you throw away Python, try it out in C. And C++. Also Java, Go, Rust, Julia or Assembly.

Let's explore why this bug in all languages that can never be "fixed", and how we go around it to make sure stock markets don't collapse and your weapons of mass destruction don't hit the wrong place.

Who is your target audience with this post? Be as specific as you can.

All programmers who have to concern themselves with floating point calculations. This is some important stuff that nobody taught us which is a big sad.

tfidfwastaken commented 3 years ago

Assigning @anihm136 and @Gituser143 for comments and approval. :p

Gituser143 commented 3 years ago

@tfidfwastaken you've got me curious about how you plan to get a blog post outta this! I'm not sure what you've got planned, but I want to see it. Make it happen fast fast, thanks xD

anihm136 commented 3 years ago

Looks very exciting! Eagerly awaiting the post

Gituser143 commented 3 years ago

Also, @tfidfwastaken, this isn't really the case in Go. You might want to look into that. Here's a link which let's you try this out online (It's called the Go Playground).

tfidfwastaken commented 3 years ago

@Gituser143 It's actually there in Go as well, just masked a little better. That said my title was a little inaccurate for Go's case Put those numbers in variables and it still happens.

The reason for that will indirectly be explained in my post as well :)