[Kaffe] Problem with Double

Fabien Renaud renaud at nentec.de
Wed May 12 03:31:02 PDT 2004


Hello,


I have a problem when I wamt to run Arith :
iadd
        = 4
isub
        = 2
imul
        = 3
idiv
        = 3
irem
        = 0
ineg
        = -3
ladd
        = 4
lsub
        = 2
lmul
        = 3
ldiv
        = 3
lrem
        = 0
lneg
        = -3
fadd
        = 3.0
fsub
        = 3.0
fmul
        = 0.0
fdiv
        = Infinity
frem
        = NaN
fneg
        = -3.0
dadd
        = 3.0
dsub
        = 3.0
dmul
        = 0.0
ddiv
        = Infinity
drem
kaffe-bin: Double.c:69: toCharArrayWithPrecision: Assertion `eptr != 
((void *)0.
Aborted


I´m still with my ARM (it works with x86).
Someone knows the solution ?

Cheers,
Fabien

public class Arith
{
    static int add(int a, int b)
    {
        return a + b;
    }

    static int sub(int a, int b)
    {
        return a - b;
    }

    static int mul(int a, int b)
    {
        return a * b;
    }

    static int div(int a, int b)
    {
        return a / b;
    }

    static int rem(int a, int b)
    {
        return a % b;
    }

    static int neg(int a)
    {
        return -a;
    }

    static long add(long a, long b)
    {
        return a + b;
    }

    static long sub(long a, long b)
    {
        return a - b;
    }

    static long mul(long a, long b)
    {
        return a * b;
    }

    static long div(long a, long b)
    {
        return a / b;
    }

    static long rem(long a, long b)
    {
        return a % b;
    }

    static long neg(long a)
    {
        return -a;
    }

    static float add(float a, float b)
    {
        return a + b;
    }

    static float sub(float a, float b)
    {
        return a - b;
    }

    static float mul(float a, float b)
    {
        return a * b;
    }

    static float div(float a, float b)
    {
        return a / b;
    }

    static float rem(float a, float b)
    {
        return a % b;
    }

    static float neg(float a)
    {
        return -a;
    }

    static double add(double a, double b)
    {
        return a + b;
    }

    static double sub(double a, double b)
    {
        return a - b;
    }

    static double mul(double a, double b)
    {
        return a * b;
    }

    static double div(double a, double b)
    {
        return a / b;
    }

    static double rem(double a, double b)
    {
        return a % b;
    }

    static double neg(double a)
    {
        return -a;
    }

    public static void main (String[] args)
    {
        test_int (3, 1);
        test_long (3, 1);
        test_float (3, 0);
        test_double (3, 0);
        System.out.println("Done!");
    }

    static void test_int(int a, int b)
    {
        char prefix = 'i';

        System.out.println(prefix + "add");
        System.out.println("\t= " + add(a,b));

        System.out.println(prefix + "sub");
        System.out.println("\t= " + sub(a,b));

        System.out.println(prefix + "mul");
        System.out.println("\t= " + mul(a,b));

        System.out.println(prefix + "div");
        System.out.println("\t= " + div(a,b));

        System.out.println(prefix + "rem");
        System.out.println("\t= " + rem(a,b));

        System.out.println(prefix + "neg");
        System.out.println("\t= " + neg(a));
    }

    static void test_long(long a, long b)
    {
        char prefix = 'l';

        System.out.println(prefix + "add");
        System.out.println("\t= " + add(a,b));

        System.out.println(prefix + "sub");
        System.out.println("\t= " + sub(a,b));

        System.out.println(prefix + "mul");
        System.out.println("\t= " + mul(a,b));

        System.out.println(prefix + "div");
        System.out.println("\t= " + div(a,b));

        System.out.println(prefix + "rem");
        System.out.println("\t= " + rem(a,b));

        System.out.println(prefix + "neg");
        System.out.println("\t= " + neg(a));
    }

    static void test_float(float a, float b)
    {
        char prefix = 'f';

        System.out.println(prefix + "add");
        System.out.println("\t= " + add(a,b));

        System.out.println(prefix + "sub");
        System.out.println("\t= " + sub(a,b));

        System.out.println(prefix + "mul");
        System.out.println("\t= " + mul(a,b));

        System.out.println(prefix + "div");
        System.out.println("\t= " + div(a,b));

        System.out.println(prefix + "rem");
        System.out.println("\t= " + rem(a,b));

        System.out.println(prefix + "neg");
        System.out.println("\t= " + neg(a));
    }

    static void test_double(double a, double b)
    {
        char prefix = 'd';

        System.out.println(prefix + "add");
        System.out.println("\t= " + add(a,b));

        System.out.println(prefix + "sub");
        System.out.println("\t= " + sub(a,b));

        System.out.println(prefix + "mul");
        System.out.println("\t= " + mul(a,b));

        System.out.println(prefix + "div");
        System.out.println("\t= " + div(a,b));

        System.out.println(prefix + "rem");
        System.out.println("\t= " + rem(a,b));

        System.out.println(prefix + "neg");
        System.out.println("\t= " + neg(a));
    }
}






More information about the kaffe mailing list