ieee754.h 2.9 KB
Newer Older
1 2 3 4 5 6 7
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef V8_BASE_IEEE754_H_
#define V8_BASE_IEEE754_H_

8 9
#include "src/base/base-export.h"

10 11 12 13
namespace v8 {
namespace base {
namespace ieee754 {

14
// Returns the arc cosine of |x|; that is the value whose cosine is |x|.
15
V8_BASE_EXPORT double acos(double x);
16 17 18

// Returns the inverse hyperbolic cosine of |x|; that is the value whose
// hyperbolic cosine is |x|.
19
V8_BASE_EXPORT double acosh(double x);
20 21

// Returns the arc sine of |x|; that is the value whose sine is |x|.
22
V8_BASE_EXPORT double asin(double x);
23 24 25

// Returns the inverse hyperbolic sine of |x|; that is the value whose
// hyperbolic sine is |x|.
26
V8_BASE_EXPORT double asinh(double x);
27

28 29
// Returns the principal value of the arc tangent of |x|; that is the value
// whose tangent is |x|.
30
V8_BASE_EXPORT double atan(double x);
31 32 33

// Returns the principal value of the arc tangent of |y/x|, using the signs of
// the two arguments to determine the quadrant of the result.
34
V8_BASE_EXPORT double atan2(double y, double x);
35

36
// Returns the cosine of |x|, where |x| is given in radians.
37
V8_BASE_EXPORT double cos(double x);
38

39
// Returns the base-e exponential of |x|.
40
V8_BASE_EXPORT double exp(double x);
41

42
V8_BASE_EXPORT double atanh(double x);
43

44
// Returns the natural logarithm of |x|.
45
V8_BASE_EXPORT double log(double x);
46

47 48
// Returns a value equivalent to |log(1+x)|, but computed in a way that is
// accurate even if the value of |x| is near zero.
49
V8_BASE_EXPORT double log1p(double x);
50

51
// Returns the base 2 logarithm of |x|.
52
V8_BASE_EXPORT double log2(double x);
53

54
// Returns the base 10 logarithm of |x|.
55
V8_BASE_EXPORT double log10(double x);
56

57
// Returns the cube root of |x|.
58
V8_BASE_EXPORT double cbrt(double x);
59 60

// Returns exp(x)-1, the exponential of |x| minus 1.
61
V8_BASE_EXPORT double expm1(double x);
62

63 64 65 66 67 68 69 70
// Returns |x| to the power of |y|.
// The result of base ** exponent when base is 1 or -1 and exponent is
// +Infinity or -Infinity differs from IEEE 754-2008. The first edition
// of ECMAScript specified a result of NaN for this operation, whereas
// later versions of IEEE 754-2008 specified 1. The historical ECMAScript
// behaviour is preserved for compatibility reasons.
V8_BASE_EXPORT double pow(double x, double y);

71
// Returns the sine of |x|, where |x| is given in radians.
72
V8_BASE_EXPORT double sin(double x);
73

74
// Returns the tangent of |x|, where |x| is given in radians.
75
V8_BASE_EXPORT double tan(double x);
76

77
// Returns the hyperbolic cosine of |x|, where |x| is given radians.
78
V8_BASE_EXPORT double cosh(double x);
79 80

// Returns the hyperbolic sine of |x|, where |x| is given radians.
81
V8_BASE_EXPORT double sinh(double x);
82 83

// Returns the hyperbolic tangent of |x|, where |x| is given radians.
84
V8_BASE_EXPORT double tanh(double x);
85

86 87 88 89 90
}  // namespace ieee754
}  // namespace base
}  // namespace v8

#endif  // V8_BASE_IEEE754_H_