mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-29 23:04:12 +08:00
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
This commit is contained in:
parent
2d84a437b0
commit
2d99c042fc
@ -1,3 +1,8 @@
|
||||
2004-04-30 Roger Sayle <roger@eyesopen.com>
|
||||
|
||||
* builtins.c (java_builtins): Add acos, asin, ceil and floor.
|
||||
(initialize_builtins): Likewise, define acos, asin, ceil and floor.
|
||||
|
||||
2004-04-22 Roger Sayle <roger@eyesopen.com>
|
||||
|
||||
* resource.c (write_resource_constructor): Guard call to possibly
|
||||
|
@ -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",
|
||||
|
@ -1,3 +1,8 @@
|
||||
2004-04-30 Roger Sayle <roger@eyesopen.com>
|
||||
|
||||
* testsuite/libjava.lang/MathBuiltin.java: Add tests for acos, asin,
|
||||
ceil and floor.
|
||||
|
||||
2004-04-25 Ranjit Mathew <rmathew@hotmail.com>
|
||||
|
||||
* testsuite/libjava.jacks/jacks.exp (gcj_jacks_write): Explicitly
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user