view java/src/java/lang/Math.d @ 5:daf5407a1394

Fixed wrong replacement
author Frank Benoit <benoit@tionex.de>
date Wed, 04 Mar 2009 23:50:32 +0100
parents 6bf2837c50fe
children bc29606a740c
line wrap: on
line source

module java.lang.Math;

static import tango.math.Math;

class Math {

    public const double PI = tango.math.Math.PI;

    static double abs(double a){ return a > 0 ? a : -a; }
    static float  abs(float  a){ return a > 0 ? a : -a; }
    static int    abs(int    a){ return a > 0 ? a : -a; }
    static long   abs(long   a){ return a > 0 ? a : -a; }

    static double min(double a, double b){ return a < b ? a : b; }
    static float  min(float  a, float  b){ return a < b ? a : b; }
    static int    min(int    a, int    b){ return a < b ? a : b; }
    static int    min(uint   a, int    b){ return a < b ? a : b; }
    static int    min(int    a, uint   b){ return a < b ? a : b; }
    static int    min(uint   a, uint   b){ return a < b ? a : b; }
    static long   min(long   a, long   b){ return a < b ? a : b; }

    static double max(double a, double b){ return a > b ? a : b; }
    static float  max(float  a, float  b){ return a > b ? a : b; }
    static int    max(int    a, int    b){ return a > b ? a : b; }
    static int    max(uint   a, int    b){ return a > b ? a : b; }
    static int    max(int    a, uint   b){ return a > b ? a : b; }
    static int    max(uint   a, uint   b){ return a > b ? a : b; }
    static long   max(long   a, long   b){ return a > b ? a : b; }


    static double sin(double a)  { return tango.math.Math.sin(a); }
    static double cos(double a)  { return tango.math.Math.cos(a); }

    static long   round(double a) { return cast(long)tango.math.Math.round(a); }
    static int    round(float a)  { return cast(int)tango.math.Math.round(a); }
    static double rint(double a) { return tango.math.Math.rndint(a); }
    static double ceil(double a) { return tango.math.Math.ceil(a); }
    static double floor(double a) { return tango.math.Math.floor(a); }
}