diff options
author | Stuart Halloway <stu@thinkrelevance.com> | 2011-05-06 11:06:52 -0400 |
---|---|---|
committer | Stuart Halloway <stu@thinkrelevance.com> | 2011-05-13 13:32:37 -0400 |
commit | 507e7b93062cecb52a677aa34357237b770beb42 (patch) | |
tree | 194799103585a823431be9415d167084dd94fd31 /src/jvm/clojure/lang/Numbers.java | |
parent | ca1d49a1491440a809f2f8cfe27fce46e0db4dff (diff) |
inline min/max #784 - not contagious - do math inline for #{prim prim}, #{obj double} - delegate to gt/lt for #{obj long} #{obj obj}
Signed-off-by: Stuart Halloway <stu@thinkrelevance.com>
Diffstat (limited to 'src/jvm/clojure/lang/Numbers.java')
-rw-r--r-- | src/jvm/clojure/lang/Numbers.java | 146 |
1 files changed, 146 insertions, 0 deletions
diff --git a/src/jvm/clojure/lang/Numbers.java b/src/jvm/clojure/lang/Numbers.java index a5c151b9..b89ee0e9 100644 --- a/src/jvm/clojure/lang/Numbers.java +++ b/src/jvm/clojure/lang/Numbers.java @@ -3797,5 +3797,151 @@ static public boolean equiv(long x, double y){ return x == y; } +static public double max(double x, double y){ + if(x > y){ + return x; + } else { + return y; + } +} + +static public Object max(double x, long y){ + if(x > y){ + return x; + } else { + return y; + } +} + +static public Object max(double x, Object y){ + if(x > ((Number)y).doubleValue()){ + return x; + } else { + return y; + } +} + +static public Object max(long x, double y){ + if(x > y){ + return x; + } else { + return y; + } +} + + +static public long max(long x, long y){ + if(x > y) { + return x; + } else { + return y; + } +} + +static public Object max(long x, Object y){ + if(gt(x,y)){ + return x; + } else { + return y; + } +} + +static public Object max(Object x, long y){ + if(gt(x,y)){ + return x; + } else { + return y; + } +} + +static public Object max(Object x, double y){ + if(((Number)x).doubleValue() > y){ + return x; + } else { + return y; + } +} + +static public Object max(Object x, Object y){ + if(gt(x, y)) { + return x; + } else { + return y; + } +} + + +static public double min(double x, double y){ + if(x < y){ + return x; + } else { + return y; + } +} + +static public Object min(double x, long y){ + if(x < y){ + return x; + } else { + return y; + } +} + +static public Object min(double x, Object y){ + if(x < ((Number)y).doubleValue()){ + return x; + } else { + return y; + } +} + +static public Object min(long x, double y){ + if(x < y){ + return x; + } else { + return y; + } +} + + +static public long min(long x, long y){ + if(x < y) { + return x; + } else { + return y; + } +} + +static public Object min(long x, Object y){ + if(lt(x,y)){ + return x; + } else { + return y; + } +} + +static public Object min(Object x, long y){ + if(lt(x,y)){ + return x; + } else { + return y; + } +} + +static public Object min(Object x, double y){ + if(((Number)x).doubleValue() < y){ + return x; + } else { + return y; + } +} + +static public Object min(Object x, Object y){ + if(lt(x,y)) { + return x; + } else { + return y; + } +} } |