Emilio,
In addition to the other comments, check out:
http://www.yoda.arachsys.com/csharp/floatingpoint.html http://www.yoda.arachsys.com/csharp/decimal.html
| ?84.16+39.57
| 123.72999999999999
84.16 & 39.57 are doubles, so you are using doubles (binary floating point)
for the calculation.
? CDec(84.16) + CDec(39.57)
123.73D
The doubles are converted to Decimals before the addition, so you are using
Decimal (decimal floating point) for the calculation.
Instead of CDec(84.16) you could have written 84.16, where 84.16D is a
Decimal literal, and 84.16 (or 84.16R) is a Double literal, 84.16F happens
to be a Single literal.
Hope this helps
Jay
"Emilio Dabdoub" <em****@sandluis.com> wrote in message
news:O6**************@TK2MSFTNGP10.phx.gbl...
| I'm having a problem doing a simple addition in VB.NET
| ?84.16+39.57
| 123.72999999999999
|
| it should be: 123.73
|
| Where is vb.net getting all this decimals?
|
| Any help will be appreciated.
|
| Thanks
|
|