Re: Why doe floor and ceil accept clojure.lang.Ratio but round not

2014-11-25 Thread Fluid Dynamics
On Tuesday, November 25, 2014 8:54:35 AM UTC-5, Michael Griffiths wrote: > > Hi Cecil, > > I think the issue doesn't occur for ceil and floor because there's only > one overload, so Clojure can infer which method you intended to call (since > it can convert a Ratio into a double). Because round

Re: Why doe floor and ceil accept clojure.lang.Ratio but round not

2014-11-25 Thread Michael Griffiths
Hi Cecil, I think the issue doesn't occur for ceil and floor because there's only one overload, so Clojure can infer which method you intended to call (since it can convert a Ratio into a double). Because round has two overloads, which both take a type that can be converted from Ratio (float a

Re: Why doe floor and ceil accept clojure.lang.Ratio but round not

2014-11-25 Thread Cecil Westerhof
2014-11-24 14:48 GMT+01:00 Plínio Balduino : > Because java.lang.Math#round supports only two types: float and double. > Java won't find the equivalent signature with Ratio or Number. > ​But ceil and floor only have double and they work. In my opinion those should go wrong then also. When Ratio i

Why doe floor and ceil accept clojure.lang.Ratio but round not

2014-11-24 Thread Niels van Klaveren
If you want math operations that are guaranteed to work with all clojure numeric types, be sure to use clojure.math.numeric-tower -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that

Re: Why doe floor and ceil accept clojure.lang.Ratio but round not

2014-11-24 Thread Plínio Balduino
Hi, Cecil Because java.lang.Math#round supports only two types: float and double. Java won't find the equivalent signature with Ratio or Number. https://docs.oracle.com/javase/7/docs/api/java/lang/Math.html#round(double) https://docs.oracle.com/javase/7/docs/api/java/lang/Math.html#round(float)

Re: Why doe floor and ceil accept clojure.lang.Ratio but round not

2014-11-24 Thread Fluid Dynamics
On Monday, November 24, 2014 7:37:20 AM UTC-5, Cecil Westerhof wrote: > > Floor works: > (Math/floor (/ (* 12 100) 71)) > 16.0 > > Ceil works: > (Math/ceil (/ (* 12 100) 71)) > 17.0 > > But round gives an error: > (Math/round (/ (* 12 100) 71)) > IllegalArgumentException No

Why doe floor and ceil accept clojure.lang.Ratio but round not

2014-11-24 Thread Cecil Westerhof
Floor works: (Math/floor (/ (* 12 100) 71)) 16.0 Ceil works: (Math/ceil (/ (* 12 100) 71)) 17.0 But round gives an error: (Math/round (/ (* 12 100) 71)) IllegalArgumentException No matching method found: round clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:80)