On Feb 6, 7:14 pm, Korny Sietsma <ko...@sietsma.com> wrote: > Hi folks - I was trying the example posted below, and I discovered a > slight snag - unchecked-* methods don't exist for doubles or floats! > (and if you call (unchecked-multiply 1.2 3.4) you get "No matching > method found"... which caused some confusion :) ) > > Is this something that might change in the future? Or would it be > easy for a clojure newbie to implement them himself? :-}
The question is whether it makes sense to have "unchecked_*" methods for floats and doubles. The point of "unchecked_*" methods is to declare your willingness to get nonsense answers with fixed-width integer operations. Floating-point operations already have semantics that make sense for conditions like overflow, and (unlike integer operations in Clojure) they don't switch to "bigfloats" on overflow. If you'd like to have the methods just for completeness' sake, it doesn't look too hard to add them. Check out src/jvm/clojure/lang/ Numbers.java and look for static methods of the form "unchecked_add", "unchecked_multiply", etc. For each "unchecked_*" method name and for each data type, there should be one such method: e.g., static public int unchecked_add(int x, int y){ return x + y; } static public long unchecked_add(long x, long y){ return x + y; } mfh --~--~---------~--~----~------------~-------~--~----~ 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 To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---