Re: (* BigDecimal double) should result in BigDecimal, not in Double, isn't it?

2010-01-18 Thread Lauri Oherd
On page http://clojure.org/data_structures#toc2 there is written: Any numeric operation involving Doubles yields a Double. Hope this helps, Lauri On Sun, Jan 17, 2010 at 12:13 AM, Jevgeni Holodkov jevgeni.holod...@gmail.com wrote: Currently, if the result of the multiplication is too small,

Re: (* BigDecimal double) should result in BigDecimal, not in Double, isn't it?

2010-01-18 Thread Jevgeni Holodkov
Hi Ben, thanks for the answer. Yes, I understand the problems with representing float-point numbers using iee7654 and now I understand that returing BigDecimal would not solve the actual problem. However, we don't talk about 0.3(3) in my example, which is non-terminating decimal. Entered 0.1

Re: (* BigDecimal double) should result in BigDecimal, not in Double, isn't it?

2010-01-18 Thread Konrad Hinsen
On 17.01.2010, at 23:13, Jevgeni Holodkov wrote: decimal. Entered 0.1 is actually a very precise number and the fact that it gets imprecise somewhere internally should now affect, IMHO, the result of multiplying two very precise numbers. What's the point There is no such thing as a precise or

Re: (* BigDecimal double) should result in BigDecimal, not in Double, isn't it?

2010-01-18 Thread Richard Newman
Something like replacing the 1.1 with 1.1M or 11/10 before evaluating the code? I don't think so. The very first step of Clojure's expression processing system, the reader, already interprets 1.1 as a floating- point constant. You would need your own reader to give a different meaning to

(* BigDecimal double) should result in BigDecimal, not in Double, isn't it?

2010-01-17 Thread Jevgeni Holodkov
Currently, if the result of the multiplication is too small, then the type will be double, despite the fact that one of the parameter was BigDecimal: Clojure 1.1.0 user= (* 100M 1.1) 110.01 user= (class (* 100M 1.1)) java.lang.Double Such thing are really hard to find and this can be

Re: (* BigDecimal double) should result in BigDecimal, not in Double, isn't it?

2010-01-17 Thread B Smith-Mannschott
On Sat, Jan 16, 2010 at 23:13, Jevgeni Holodkov jevgeni.holod...@gmail.com wrote: Currently, if the result of the multiplication is too small, then the type will be double, despite the fact that one of the parameter was BigDecimal: Clojure 1.1.0 user= (* 100M 1.1) 110.01 user=