Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Comments on Why is it considered bad practice to use float for representing currency?
Post
Why is it considered bad practice to use float for representing currency?
+12
−1
This is intended to be a canonical post for this problem which is pretty common. Especially among beginners.
I've heard that I should avoid using floating point variables for representing currency. What is the reason for that? Representing 123 dollars and 67 cents as 123.67 seems quite natural.
1 comment thread