On Thu, Oct 20, 2011 at 11:17, Joel Gluth <[email protected]> wrote: > On Tue, Oct 18, 2011 at 3:47 PM, Tassilo Horn <[email protected]> wrote: >> Scott Hickey <[email protected]> writes: >> And usually, you should refrain from using floating points at all, no >> matter if BigDecimal or Double. > > I thought BigDecimal with was not a floating point in the traditional > sense (ie., subject to all of the usual rounding horror, unless you > ask it to be)? That is, you can do decimal calculations exactly using > it.
The term "floating" point is used to distingiush from fixed-point schemes, such as deciding that We're going to store money as a 64 bit integer representing the number of 100ths of a cent. Effectively, fixing the decimal point thus: $1000.0000. BigDecimal is an arbitrary precision integer and a scale factor (think of the scale factor as multiplying or dividing by a power of ten.) So, in that sense the (decimal) point floats. Unlike "floating point" in the IEEE754 sense, BigDecimal is decimal, not binary, (so e.g. 0.1 has a terminating representation) and arbitrary precision, so you can avoid rounding effects unless you're dividing where you might have to round to truncate a non-terminating representation. // Ben -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en
