looks like if you make any(or both) to double it works as expected due to these being called:
static public double multiply(double x, double y){ return x * y; } static public double multiply(double x, long y){ return x * y; } static public double multiply(long x, double y){ return x * y; } => (unchecked-multiply (double 25214903917) 25214903917) 6.35791379543542E20 => (unchecked-multiply (double 25214903917) (double 25214903917)) 6.35791379543542E20 => (unchecked-multiply 25214903917 (double 25214903917)) 6.35791379543542E20 but it didn't overflow: => (= 25214903917.0 (/ (unchecked-multiply 25214903917 (double 25214903917)) 25214903917)) true but this did: => (= 123E300 (/ (unchecked-multiply 123E300 (double 123E300)) 123E300)) false => 123E300 1.23E302 => *clojure-version* {:major 1, :minor 5, :incremental 0, :qualifier "RC16"} So, given my prev. post, it's apparently a bug in clojure? with the unchecked-multiply if any of the params(or both) is "object" when compared to when they're both "primitive" aka Long. On Wed, Feb 20, 2013 at 11:40 PM, AtKaaZ <atk...@gmail.com> wrote: > > looks like different methods are called: > > for: user=> (unchecked-multiply 25214903917 0x5DEECE66D) > this method: static public long unchecked_multiply(long x, long y){return > x * y;} > > > for: (unchecked-multiply seed1 0x5DEECE66D) > this method: static public Number unchecked_multiply(long x, Object > y){return multiply(x,y);} > > long story short this gets called: > static public long multiply(long x, long y){ > long ret = x * y; > if (y != 0 && ret/y != x) > return throwIntOverflow(); > return ret; > } > > > On Wed, Feb 20, 2013 at 11:25 PM, John Lawrence Aspden < > aspd...@googlemail.com> wrote: > >> Hi, I'm getting an unexpected exception trying to do unchecked >> arithmetic: >> >> user=> (def seed1 25214903917) >> #'user/seed1 >> user=> (type seed1) >> java.lang.Long >> user=> (type 25214903917) >> java.lang.Long >> user=> (unchecked-multiply seed1 0x5DEECE66D) >> ArithmeticException integer overflow >> clojure.lang.Numbers.throwIntOverflow (Numbers.java:1388) >> >> user=> (unchecked-multiply 25214903917 0x5DEECE66D) >> 8602081037417187945 >> >> Could someone explain what's going on for me? >> >> -- >> -- >> 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 posts from new members are moderated - please be patient with >> your first post. >> 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 >> --- >> You received this message because you are subscribed to the Google Groups >> "Clojure" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to clojure+unsubscr...@googlegroups.com. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > > > -- > Please correct me if I'm wrong or incomplete, > even if you think I'll subconsciously hate it. > > -- Please correct me if I'm wrong or incomplete, even if you think I'll subconsciously hate it. -- -- 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 posts from new members are moderated - please be patient with your first post. 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.