v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
ieee754.h
Go to the documentation of this file.
1
// Copyright 2016 the V8 project authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style license that can be
3
// found in the LICENSE file.
4
5
#ifndef V8_BASE_IEEE754_H_
6
#define V8_BASE_IEEE754_H_
7
8
#include "
src/base/base-export.h
"
9
10
#if defined(V8_USE_LIBM_TRIG_FUNCTIONS)
11
#include "third_party/glibc/src/sysdeps/ieee754/dbl-64/trig.h"
// nogncheck
12
#endif
13
14
namespace
v8
{
15
namespace
base
{
16
namespace
ieee754 {
17
18
// Returns the arc cosine of |x|; that is the value whose cosine is |x|.
19
V8_BASE_EXPORT
double
acos
(
double
x
);
20
21
// Returns the inverse hyperbolic cosine of |x|; that is the value whose
22
// hyperbolic cosine is |x|.
23
V8_BASE_EXPORT
double
acosh
(
double
x
);
24
25
// Returns the arc sine of |x|; that is the value whose sine is |x|.
26
V8_BASE_EXPORT
double
asin
(
double
x
);
27
28
// Returns the inverse hyperbolic sine of |x|; that is the value whose
29
// hyperbolic sine is |x|.
30
V8_BASE_EXPORT
double
asinh
(
double
x
);
31
32
// Returns the principal value of the arc tangent of |x|; that is the value
33
// whose tangent is |x|.
34
V8_BASE_EXPORT
double
atan
(
double
x
);
35
36
// Returns the principal value of the arc tangent of |y/x|, using the signs of
37
// the two arguments to determine the quadrant of the result.
38
V8_BASE_EXPORT
double
atan2
(
double
y
,
double
x
);
39
40
#if defined(V8_USE_LIBM_TRIG_FUNCTIONS)
41
// To ensure there aren't problems with libm's sin/cos, both implementations
42
// are shipped. The plan is to transition to libm once we ensure there are no
43
// compatibility or performance issues.
44
V8_BASE_EXPORT
double
fdlibm_sin(
double
x
);
45
V8_BASE_EXPORT
double
fdlibm_cos(
double
x
);
46
47
#if !defined(BUILDING_V8_BASE_SHARED) && !defined(USING_V8_BASE_SHARED)
48
inline
double
libm_sin(
double
x
) {
return
glibc_sin(
x
); }
49
inline
double
libm_cos(
double
x
) {
return
glibc_cos(
x
); }
50
#else
51
V8_BASE_EXPORT
double
libm_sin(
double
x
);
52
V8_BASE_EXPORT
double
libm_cos(
double
x
);
53
#endif
54
#else
55
V8_BASE_EXPORT
double
cos
(
double
x
);
56
V8_BASE_EXPORT
double
sin
(
double
x
);
57
#endif
58
59
// Returns the base-e exponential of |x|.
60
V8_BASE_EXPORT
double
exp
(
double
x
);
61
62
V8_BASE_EXPORT
double
atanh
(
double
x
);
63
64
// Returns the natural logarithm of |x|.
65
V8_BASE_EXPORT
double
log
(
double
x
);
66
67
// Returns a value equivalent to |log(1+x)|, but computed in a way that is
68
// accurate even if the value of |x| is near zero.
69
V8_BASE_EXPORT
double
log1p
(
double
x
);
70
71
// Returns the base 2 logarithm of |x|.
72
V8_BASE_EXPORT
double
log2
(
double
x
);
73
74
// Returns the base 10 logarithm of |x|.
75
V8_BASE_EXPORT
double
log10
(
double
x
);
76
77
// Returns the cube root of |x|.
78
V8_BASE_EXPORT
double
cbrt
(
double
x
);
79
80
// Returns exp(x)-1, the exponential of |x| minus 1.
81
V8_BASE_EXPORT
double
expm1
(
double
x
);
82
83
namespace
legacy {
84
85
// This function should not be used directly. Instead, use
86
// v8::internal::math::pow.
87
88
// Returns |x| to the power of |y|.
89
// The result of base ** exponent when base is 1 or -1 and exponent is
90
// +Infinity or -Infinity differs from IEEE 754-2008. The first edition
91
// of ECMAScript specified a result of NaN for this operation, whereas
92
// later versions of IEEE 754-2008 specified 1. The historical ECMAScript
93
// behaviour is preserved for compatibility reasons.
94
V8_BASE_EXPORT
double
pow
(
double
x
,
double
y
);
95
96
}
// namespace legacy
97
98
// Returns the tangent of |x|, where |x| is given in radians.
99
V8_BASE_EXPORT
double
tan
(
double
x
);
100
101
// Returns the hyperbolic cosine of |x|, where |x| is given radians.
102
V8_BASE_EXPORT
double
cosh
(
double
x
);
103
104
// Returns the hyperbolic sine of |x|, where |x| is given radians.
105
V8_BASE_EXPORT
double
sinh
(
double
x
);
106
107
// Returns the hyperbolic tangent of |x|, where |x| is given radians.
108
V8_BASE_EXPORT
double
tanh
(
double
x
);
109
110
}
// namespace ieee754
111
}
// namespace base
112
}
// namespace v8
113
114
#endif
// V8_BASE_IEEE754_H_
base-export.h
V8_BASE_EXPORT
#define V8_BASE_EXPORT
Definition
base-export.h:26
base
OpIndex base
Definition
instruction-selector-ia32.cc:65
y
int y
Definition
liveedit-diff.cc:60
x
int x
Definition
liveedit-diff.cc:60
v8::base::ieee754::legacy::pow
double pow(double x, double y)
Definition
ieee754.cc:2646
v8::base::ieee754::atanh
double atanh(double x)
Definition
ieee754.cc:1557
v8::base::ieee754::tan
double tan(double x)
Definition
ieee754.cc:2510
v8::base::ieee754::log
double log(double x)
Definition
ieee754.cc:1638
v8::base::ieee754::log2
double log2(double x)
Definition
ieee754.cc:1973
v8::base::ieee754::sinh
double sinh(double x)
Definition
ieee754.cc:2930
v8::base::ieee754::atan2
double atan2(double y, double x)
Definition
ieee754.cc:1228
v8::base::ieee754::cosh
double cosh(double x)
Definition
ieee754.cc:2554
v8::base::ieee754::acosh
double acosh(double x)
Definition
ieee754.cc:936
v8::base::ieee754::sin
double sin(double x)
Definition
ieee754.cc:2450
v8::base::ieee754::exp
double exp(double x)
Definition
ieee754.cc:1447
v8::base::ieee754::log10
double log10(double x)
Definition
ieee754.cc:2079
v8::base::ieee754::cos
double cos(double x)
Definition
ieee754.cc:1354
v8::base::ieee754::acos
double acos(double x)
Definition
ieee754.cc:862
v8::base::ieee754::log1p
double log1p(double x)
Definition
ieee754.cc:1783
v8::base::ieee754::expm1
double expm1(double x)
Definition
ieee754.cc:2213
v8::base::ieee754::tanh
double tanh(double x)
Definition
ieee754.cc:2986
v8::base::ieee754::cbrt
double cbrt(double x)
Definition
ieee754.cc:2333
v8::base::ieee754::asinh
double asinh(double x)
Definition
ieee754.cc:1067
v8::base::ieee754::asin
double asin(double x)
Definition
ieee754.cc:991
v8::base::ieee754::atan
double atan(double x)
Definition
ieee754.cc:1116
v8
Definition
api-arguments-inl.h:19
src
base
ieee754.h
Generated on Sun Apr 6 2025 21:08:50 for v8 by
1.12.0