From 2d99c042fc58388ffa5f0701ba5d103d467b9491 Mon Sep 17 00:00:00 2001 From: Roger Sayle Date: Fri, 30 Apr 2004 14:15:08 +0000 Subject: [PATCH] builtins.c (java_builtins): Add acos, asin, ceil and floor. * builtins.c (java_builtins): Add acos, asin, ceil and floor. (initialize_builtins): Likewise, define acos, asin, ceil and floor. * testsuite/libjava.lang/MathBuiltin.java: Add tests for acos, asin, ceil and floor. From-SVN: r81341 --- gcc/java/ChangeLog | 5 ++++ gcc/java/builtins.c | 12 +++++++++ libjava/ChangeLog | 5 ++++ .../testsuite/libjava.lang/MathBuiltin.java | 25 +++++++++++++++++-- 4 files changed, 45 insertions(+), 2 deletions(-) diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 17e6794d31c..4a4017eb058 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,8 @@ +2004-04-30 Roger Sayle + + * builtins.c (java_builtins): Add acos, asin, ceil and floor. + (initialize_builtins): Likewise, define acos, asin, ceil and floor. + 2004-04-22 Roger Sayle * resource.c (write_resource_constructor): Guard call to possibly diff --git a/gcc/java/builtins.c b/gcc/java/builtins.c index 563bd8daad2..1d3095f239d 100644 --- a/gcc/java/builtins.c +++ b/gcc/java/builtins.c @@ -74,10 +74,14 @@ static GTY(()) struct builtin_record java_builtins[] = { { "java.lang.Math" }, { "min" }, min_builtin, 0 }, { { "java.lang.Math" }, { "max" }, max_builtin, 0 }, { { "java.lang.Math" }, { "abs" }, abs_builtin, 0 }, + { { "java.lang.Math" }, { "acos" }, NULL, BUILT_IN_ACOS }, + { { "java.lang.Math" }, { "asin" }, NULL, BUILT_IN_ASIN }, { { "java.lang.Math" }, { "atan" }, NULL, BUILT_IN_ATAN }, { { "java.lang.Math" }, { "atan2" }, NULL, BUILT_IN_ATAN2 }, + { { "java.lang.Math" }, { "ceil" }, NULL, BUILT_IN_CEIL }, { { "java.lang.Math" }, { "cos" }, NULL, BUILT_IN_COS }, { { "java.lang.Math" }, { "exp" }, NULL, BUILT_IN_EXP }, + { { "java.lang.Math" }, { "floor" }, NULL, BUILT_IN_FLOOR }, { { "java.lang.Math" }, { "log" }, NULL, BUILT_IN_LOG }, { { "java.lang.Math" }, { "pow" }, NULL, BUILT_IN_POW }, { { "java.lang.Math" }, { "sin" }, NULL, BUILT_IN_SIN }, @@ -186,14 +190,22 @@ initialize_builtins (void) define_builtin (BUILT_IN_FMODF, "__builtin_fmodf", float_ftype_float_float, "fmodf"); + define_builtin (BUILT_IN_ACOS, "__builtin_acos", + double_ftype_double, "_ZN4java4lang4Math4acosEd"); + define_builtin (BUILT_IN_ASIN, "__builtin_asin", + double_ftype_double, "_ZN4java4lang4Math4asinEd"); define_builtin (BUILT_IN_ATAN, "__builtin_atan", double_ftype_double, "_ZN4java4lang4Math4atanEd"); define_builtin (BUILT_IN_ATAN2, "__builtin_atan2", double_ftype_double_double, "_ZN4java4lang4Math5atan2Edd"); + define_builtin (BUILT_IN_CEIL, "__builtin_ceil", + double_ftype_double, "_ZN4java4lang4Math4ceilEd"); define_builtin (BUILT_IN_COS, "__builtin_cos", double_ftype_double, "_ZN4java4lang4Math3cosEd"); define_builtin (BUILT_IN_EXP, "__builtin_exp", double_ftype_double, "_ZN4java4lang4Math3expEd"); + define_builtin (BUILT_IN_FLOOR, "__builtin_floor", + double_ftype_double, "_ZN4java4lang4Math5floorEd"); define_builtin (BUILT_IN_LOG, "__builtin_log", double_ftype_double, "_ZN4java4lang4Math3logEd"); define_builtin (BUILT_IN_POW, "__builtin_pow", diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 3cb21bdbd9f..d62ca38520b 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,8 @@ +2004-04-30 Roger Sayle + + * testsuite/libjava.lang/MathBuiltin.java: Add tests for acos, asin, + ceil and floor. + 2004-04-25 Ranjit Mathew * testsuite/libjava.jacks/jacks.exp (gcj_jacks_write): Explicitly diff --git a/libjava/testsuite/libjava.lang/MathBuiltin.java b/libjava/testsuite/libjava.lang/MathBuiltin.java index 9a4c367a38e..275a086600a 100644 --- a/libjava/testsuite/libjava.lang/MathBuiltin.java +++ b/libjava/testsuite/libjava.lang/MathBuiltin.java @@ -5,6 +5,16 @@ class MathBuiltin return Math.abs(x); } + static double acos(double x) + { + return Math.acos(x); + } + + static double asin(double x) + { + return Math.asin(x); + } + static double atan(double x) { return Math.atan(x); @@ -15,6 +25,11 @@ class MathBuiltin return Math.atan2(x,y); } + static double ceil(double x) + { + return Math.ceil(x); + } + static double cos(double x) { return Math.cos(x); @@ -25,6 +40,11 @@ class MathBuiltin return Math.exp(x); } + static double floor(double x) + { + return Math.floor(x); + } + static double log(double x) { return Math.log(x); @@ -62,8 +82,9 @@ class MathBuiltin public static void main(String argv[]) { - double sum = abs (1.0) + atan (1.0) + atan2 (1.0, 1.0) + cos (1.0) - + exp (1.0) + log(1.0) + max(1.0, 1.0) + min (1.0, 1.0) + double sum = abs (1.0) + acos (1.0) + asin (1.0) + atan (1.0) + + atan2 (1.0, 1.0) + ceil (1.0) + cos (1.0) + exp (1.0) + + floor (1.0) + log(1.0) + max(1.0, 1.0) + min (1.0, 1.0) + pow (1.0, 1.0) + sin (1.0) + sqrt(1.0) + tan(1.0); } } -- 2.30.2