Timeline for Why do you need float/double?
Current License: CC BY-SA 3.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 29, 2011 at 12:58 | comment | added | vartec | @acid: you can't using straight division, regardless if you use integer, decimal or divide as float then round. That's the whole point, using decimal does not help it that case. | |
Jun 28, 2011 at 18:33 | comment | added | user2528 | reread my comment? my question is when i use software to create a cheque every month. Since one cannot pay 1/2 a cent how does the person get the full amount after a year? | |
Jun 28, 2011 at 16:44 | comment | added | vartec | @acid: >>> x = 100000/12.0 >>> x*12 100000.0 | |
Jun 28, 2011 at 16:39 | comment | added | user2528 |
I had another question. If you paid $100,000/12 and used a float. Why would the result be exactly $100,000? Why wouldnt the float (or decimal) round up or down everytime someone is paid? I am talking about when writing a cheque (you cant do 1/2 or 1/3 a cent) or a direct deposit (i assume it has the same limitations)
|
|
Jun 28, 2011 at 11:58 | comment | added | Scott Whitlock | @Job - decimals and floats are very different. You can store 0.1 exactly in a decimal type, but not in a float or double. | |
Jun 28, 2011 at 1:26 | vote | accept | CommunityBot | ||
Jun 28, 2011 at 1:26 | |||||
Jun 27, 2011 at 22:17 | vote | accept | CommunityBot | ||
Jun 28, 2011 at 1:26 | |||||
Jun 27, 2011 at 22:11 | history | edited | vartec | CC BY-SA 3.0 |
added 38 characters in body
|
Jun 27, 2011 at 21:51 | history | answered | vartec | CC BY-SA 3.0 |