Por Que Você NUNCA Deve Usar FLOAT pra Representar Dinheiro no Código — Como Corrigir do Jeito Certo

Meet THE ARCHITECT'S MAP - A complete career guide from Beginner to Software Architect: https://go.hotmart.com/R100244660B 📚 Recommended Readings: 🔗 The Pragmatic Programmer: From Apprentice to Master - https://amzn.to/4jHQBd8 🔗 Refactoring: Improving the Design of Existing Code - https://amzn.to/4i9ZZWc Hey, guys! Renato Augusto here again, and in today's video I'm going to show you why you should never use the FLOAT type to represent money in your system — and, more importantly, I'm going to teach you how to solve this the right way. It may seem like a silly detail, but this mistake can cost you dearly. Literally. FLOAT was made for something else, and when you use this type to store monetary values, you open the door to inaccuracies, hard-to-detect bugs, and even serious failures in systems that depend on precise calculations. In this video, I show you, in a clear and didactic way, the technical reason behind these errors, real examples of bugs caused by rounding, and how languages ​​like Python, Java, JavaScript, PHP, and others deal with this problem. 🚀 What will you learn in this video? | Why You Should NEVER Use FLOAT to Represent Money in Code — How to Fix It the Right Way ✅ What is the FLOAT type and why was it created ✅ How FLOAT stores numbers and why it is imprecise ✅ The technical reason behind the failure in simple calculations like 0.1 + 0.2 ✅ Real examples of serious bugs caused by floating point imprecision ✅ The correct way to represent money using integers and cents ✅ When this approach is not enough (e.g.: compound interest, cryptocurrencies) ✅ The recommended libraries in each language to work with high precision ✅ How these libraries work under the hood ✅ When it is still worth using FLOAT and when to avoid it at all costs 📘 My Personal Reading Recommendations: 📚Fundamentals of Software Architecture: an Engineering Approach -https://amzn.to/4aFP9UT 📚 Creating Microservices: Designing Systems with Smaller, More Specialized Components - https://amzn.to/3BfiSqx 📚 Migrating Monolithic Systems to Microservices: Evolutionary Patterns to Transform Your Monolithic System - https://amzn.to/3BkY00W 📚 Domain Driven Design: Attacking Complexity at the Heart of Software - https://amzn.to/3Bmr3RV 💡 Why watch? 🔹 Understand one of the most common and dangerous errors in storing monetary values 🔹 Discover why your system may be calculating incorrectly without you realizing it 🔹 Learn how to definitively solve this problem using the right tool 🔹 Increase the maturity of your code and avoid common programming pitfalls 🎯 Who should watch? 👨‍💻 Developers looking to learn best programming practices 📚 Programming students learning primitive types and decimal number representation in complex systems 💼 Professionals working with banking systems, ERPs or e-commerce 🔥 Did you like the video? Like it, subscribe to the channel and activate the bell to follow more content like this! Want to support my work directly? Consider becoming a member of the channel! 📩 Do you have questions or suggestions? Comment here! I always read everything and respond whenever possible. #programming #float #python #java #javascript #php #cleanCode #goodpractices