OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [java/] [lang/] [natMath.cc] - Blame information for rev 830

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 758 jeremybenn
/* Copyright (C) 1998, 1999, 2000, 2002, 2006  Free Software Foundation
2
 
3
   This file is part of libgcj.
4
 
5
This software is copyrighted work licensed under the terms of the
6
Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
7
details.  */
8
 
9
/**
10
 * @author Andrew Haley <aph@cygnus.com>
11
 * @date Tue Sep 22 1998 */
12
/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
13
 * "The Java Language Specification", ISBN 0-201-63451-1
14
 * plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
15
 * Status:  Believed complete and correct.
16
 */
17
 
18
#include <config.h>
19
 
20
#include <java/lang/String.h>
21
#include <java/lang/Float.h>
22
#include <java/lang/Double.h>
23
#include <java/lang/Integer.h>
24
#include <java/lang/Long.h>
25
#include <java/lang/Math.h>
26
#include <gcj/array.h>
27
 
28
#include "fdlibm.h"
29
 
30
jdouble java::lang::Math::cos(jdouble x)
31
{
32
  return (jdouble)::cos((double)x);
33
}
34
 
35
jdouble java::lang::Math::sin(jdouble x)
36
{
37
  return (jdouble)::sin((double)x);
38
}
39
 
40
jdouble java::lang::Math::tan(jdouble x)
41
{
42
  return (jdouble)::tan((double)x);
43
}
44
 
45
jdouble java::lang::Math::asin(jdouble x)
46
{
47
  return (jdouble)::asin((double)x);
48
}
49
 
50
jdouble java::lang::Math::acos(jdouble x)
51
{
52
  return (jdouble)::acos((double)x);
53
}
54
 
55
jdouble java::lang::Math::atan(jdouble x)
56
{
57
  return (jdouble)::atan((double)x);
58
}
59
 
60
jdouble java::lang::Math::atan2(jdouble y, jdouble x)
61
{
62
  return (jdouble)::atan2((double)y, (double)x);
63
}
64
 
65
jdouble java::lang::Math::log(jdouble x)
66
{
67
  return (jdouble)::log((double)x);
68
}
69
 
70
jdouble java::lang::Math::exp(jdouble x)
71
{
72
  return (jdouble)::exp((double)x);
73
}
74
 
75
jdouble java::lang::Math::sqrt(jdouble x)
76
{
77
  return (jdouble)::sqrt((double)x);
78
}
79
 
80
jdouble java::lang::Math::pow(jdouble y, jdouble x)
81
{
82
  return (jdouble)::pow((double)y, (double)x);
83
}
84
 
85
jdouble java::lang::Math::IEEEremainder(jdouble y, jdouble x)
86
{
87
  return (jdouble)::__ieee754_remainder((double)y, (double)x);
88
}
89
 
90
jdouble java::lang::Math::rint(jdouble x)
91
{
92
  return (jdouble)::rint((double)x);
93
}
94
 
95
jdouble java::lang::Math::floor(jdouble x)
96
{
97
  return (jdouble)::floor((double)x);
98
}
99
 
100
jdouble java::lang::Math::ceil(jdouble x)
101
{
102
  return (jdouble)::ceil((double)x);
103
}
104
 
105
jdouble java::lang::Math::log10(jdouble x)
106
{
107
  return (jdouble)::log10((double)x);
108
}
109
 
110
jdouble java::lang::Math::cbrt(jdouble x)
111
{
112
  return (jdouble)::cbrt((double)x);
113
}
114
 
115
jdouble java::lang::Math::cosh(jdouble x)
116
{
117
  return (jdouble)::cosh((double)x);
118
}
119
 
120
jdouble java::lang::Math::expm1(jdouble x)
121
{
122
  return (jdouble)::expm1((double)x);
123
}
124
 
125
jdouble java::lang::Math::hypot(jdouble x, jdouble y)
126
{
127
  return (jdouble)::hypot((double)x, (double)y);
128
}
129
 
130
jdouble java::lang::Math::log1p(jdouble x)
131
{
132
  return (jdouble)::log1p((double)x);
133
}
134
 
135
jdouble java::lang::Math::sinh(jdouble x)
136
{
137
  return (jdouble)::sinh((double)x);
138
}
139
 
140
jdouble java::lang::Math::tanh(jdouble x)
141
{
142
  return (jdouble)::tanh((double)x);
143
}
144
 
145
static inline int
146
floatToIntBits (jfloat value)
147
{
148
  union {
149
    jint l;
150
    jfloat d;
151
  } u;
152
  u.d = value;
153
  return u.l;
154
}
155
 
156
static inline bool
157
isNaN (jint bits)
158
{
159
  jint e = bits & 0x7f800000;
160
  jint f = bits & 0x007fffff;
161
 
162
  return e == 0x7f800000 && f != 0;
163
}
164
 
165
static inline jlong
166
doubleToLongBits (jdouble value)
167
{
168
  union {
169
    jlong l;
170
    jdouble d;
171
  } u;
172
  u.d = value;
173
  return u.l;
174
}
175
 
176
static inline bool
177
isNaN (jlong bits)
178
{
179
  jlong e = bits & 0x7ff0000000000000LL;
180
  jlong f = bits & 0x000fffffffffffffLL;
181
 
182
  return e == 0x7ff0000000000000LL && f != 0LL;
183
}
184
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.