Thursday, 15 April 2010

java - Multiplying Intervals -



java - Multiplying Intervals -

i'm trying create method, reason isn't working...

public static interval multiply(interval x, interval y) { int min = math.min(x.lo * y.lo, x.hi * y.hi, x.hi * y.lo, x.hi * y.hi); int max = math.max(x.lo * y.lo, x.hi * y.hi, x.hi * y.lo, x.hi * y.hi); homecoming new interval(min, max);

it has math.min/math.max, looked up, i'm not sure how i'm not using correctly??

ugly, but:

public static interval multiply(interval x, interval y) { int min = math.min(math.min(math.min(x.lo * y.lo, x.hi * y.hi), x.hi * y.lo), x.hi * y.hi); int max = math.max(math.max(math.max(x.lo * y.lo, x.hi * y.hi), x.hi * y.lo), x.hi * y.hi); homecoming new interval(min, max);

java

No comments:

Post a Comment