
20 Apr
2014
20 Apr
'14
9:21 p.m.
On Sun, Apr 20, 2014, at 02:12 PM, Chapman, Anthony Sergio wrote:
I would it to round to 2 decimal places no matter what the size of the input is
The problem is that what I actually get is 22.220000000000002
The Double type cannot represent all values exactly, which produces this behavior. [1] If you just want to round the number for display purposes, you should probably round it as part of the conversion to text. Otherwise, there are a lot of other numeric representations, but the right one would depend on your application. -Karl 1: http://en.wikipedia.org/wiki/Double_precision_floating-point_format