@Override public double apply(double a, double b) { return Math.IEEEremainder(a, b); } };
@Override public double apply(double a) { return Math.IEEEremainder(a, b); } };
@Override protected ExprEval eval(double x, double y) { return ExprEval.of(Math.IEEEremainder(x, y)); } }
public Object evaluate(Object feature) { double arg0; double arg1; try { // attempt to get value and perform conversion arg0 = getExpression(0).evaluate(feature, Double.class).doubleValue(); } catch (Exception e) { // probably a type error throw new IllegalArgumentException( "Filter Function problem for function IEEEremainder argument #0 - expected type double"); } try { // attempt to get value and perform conversion arg1 = getExpression(1).evaluate(feature, Double.class).doubleValue(); } catch (Exception e) { // probably a type error throw new IllegalArgumentException( "Filter Function problem for function IEEEremainder argument #1 - expected type double"); } return new Double(Math.IEEEremainder(arg0, arg1)); } }
/** * put longitude into the range [center +/- 180] deg * * @param lon lon to normalize * @param center center point * @return longitude into the range [center +/- 180] deg */ static public double lonNormal(double lon, double center) { return center + Math.IEEEremainder(lon - center, 360.0); }
@Override public double apply(double a, double b) { return Math.IEEEremainder(a, b); } };
/** * Computes the remainder operation on two arguments as prescribed by the * IEEE 754 standard. * @param f1 the dividend. * @param f2 the divisor. * @return the remainder when f1 is divided by f2 */ public static float IEEEremainder(float f1, float f2) { return (float)Math.IEEEremainder(f1,f2); }
/** * Find difference (lon1 - lon2) normalized so that maximum value is += 180. * @param lon1 start * @param lon2 end * @return */ static public double lonDiff(double lon1, double lon2) { return Math.IEEEremainder(lon1-lon2, 360.0); }
@Test public void testStorableDoubles() { for (double d: toIterable(doubles(), 10000)) { assertThat(DoubleShard.Compact.isStorable(d), equalTo(d > -64 && d < 64 && Scalars.isZero(Math.IEEEremainder(d, 0.5)))); } } }
/** * put longitude into the range [center +/- 180] deg * * @param lon lon to normalize * @param center center point * @return longitude into the range [center +/- 180] deg */ static public double lonNormal(double lon, double center) { return center + Math.IEEEremainder(lon - center, 360.0); }
@Override public double apply(double a) { return Math.IEEEremainder(a, b); } };
/** * Computes the remainder operation on two arguments as prescribed by the IEEE 754 standard. */ public static double IEEEremainder(double f1, double f2) { return java.lang.Math.IEEEremainder(f1, f2); }
/** * put longitude into the range [center +/- 180] deg * * @param lon lon to normalize * @param center center point * @return longitude into the range [center +/- 180] deg */ static public double lonNormal(double lon, double center) { return center + Math.IEEEremainder(lon - center, 360.0); }
@Override public double apply(double a) { return Math.IEEEremainder(a, b); } };
double good0 = Math.IEEEremainder(1.0, -1.0); if (Double.isNaN(good0)) { assertTrue( assertEquals( "IEEEremainder of (1.0,-1.0):", (double) Math.IEEEremainder(1.0, -1.0), ((Double) IEEEremainderFunction.evaluate(null)).doubleValue(), 0.00001); double good1 = Math.IEEEremainder(-1.0, 2.0); if (Double.isNaN(good1)) { assertTrue( assertEquals( "IEEEremainder of (-1.0,2.0):", (double) Math.IEEEremainder(-1.0, 2.0), ((Double) IEEEremainderFunction.evaluate(null)).doubleValue(), 0.00001); double good2 = Math.IEEEremainder(2.0, -2.0); if (Double.isNaN(good2)) { assertTrue( assertEquals( "IEEEremainder of (2.0,-2.0):", (double) Math.IEEEremainder(2.0, -2.0), ((Double) IEEEremainderFunction.evaluate(null)).doubleValue(), 0.00001);
public IRubyObject op_mod(ThreadContext context, double other) { // Modelled after c ruby implementation (java /,% not same as ruby) double x = value; double mod = Math.IEEEremainder(x, other); if (other * mod < 0) { mod += other; } return RubyFloat.newFloat(context.runtime, mod); }
static private double lam_delta(double lam) { double d = Math.IEEEremainder(lam, PE_2PI); return (PE_ABS(d) <= PE_PI) ? d : ((d < 0) ? d + PE_2PI : d - PE_2PI); }
/** * Starting from lon1, find * Find difference (lon1 - lon2) normalized so that maximum value is += 180. * * @param lon1 start * @param lon2 end * @return */ static public double lonDiff(double lon1, double lon2) { return Math.IEEEremainder(lon1 - lon2, 720.0); } }
public IRubyObject op_mod(ThreadContext context, double other) { // Modelled after c ruby implementation (java /,% not same as ruby) double x = value; double mod = Math.IEEEremainder(x, other); if (other * mod < 0) { mod += other; } return RubyFloat.newFloat(getRuntime(), mod); }
public IRubyObject op_mod(ThreadContext context, double other) { // Modelled after c ruby implementation (java /,% not same as ruby) double x = value; double mod = Math.IEEEremainder(x, other); if (other * mod < 0) { mod += other; } return RubyFloat.newFloat(getRuntime(), mod); }