• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright JS Foundation and other contributors, http://js.foundation
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 /*
17  * Math built-in description
18  */
19 
20 #include "ecma-builtin-helpers-macro-defines.inc.h"
21 
22 #if ENABLED (JERRY_BUILTIN_MATH)
23 
24 /* Number properties:
25  *  (property name, number value, writable, enumerable, configurable) */
26 
27 /* ECMA-262 v5, 15.8.1.1 */
28 NUMBER_VALUE (LIT_MAGIC_STRING_E_U,
29               ECMA_BUILTIN_NUMBER_E,
30               ECMA_PROPERTY_FIXED)
31 
32 /* ECMA-262 v5, 15.8.1.2 */
33 NUMBER_VALUE (LIT_MAGIC_STRING_LN10_U,
34               ECMA_BUILTIN_NUMBER_LN10,
35               ECMA_PROPERTY_FIXED)
36 
37 /* ECMA-262 v5, 15.8.1.3 */
38 NUMBER_VALUE (LIT_MAGIC_STRING_LN2_U,
39               ECMA_BUILTIN_NUMBER_LN2,
40               ECMA_PROPERTY_FIXED)
41 
42 /* ECMA-262 v5, 15.8.1.4 */
43 NUMBER_VALUE (LIT_MAGIC_STRING_LOG2E_U,
44               ECMA_BUILTIN_NUMBER_LOG2E,
45               ECMA_PROPERTY_FIXED)
46 
47 /* ECMA-262 v5, 15.8.1.5 */
48 NUMBER_VALUE (LIT_MAGIC_STRING_LOG10E_U,
49               ECMA_BUILTIN_NUMBER_LOG10E,
50               ECMA_PROPERTY_FIXED)
51 
52 /* ECMA-262 v5, 15.8.1.6 */
53 NUMBER_VALUE (LIT_MAGIC_STRING_PI_U,
54               ECMA_BUILTIN_NUMBER_PI,
55               ECMA_PROPERTY_FIXED)
56 
57 /* ECMA-262 v5, 15.8.1.7 */
58 NUMBER_VALUE (LIT_MAGIC_STRING_SQRT1_2_U,
59               ECMA_BUILTIN_NUMBER_SQRT_1_2,
60               ECMA_PROPERTY_FIXED)
61 
62 /* ECMA-262 v5, 15.8.1.8 */
63 NUMBER_VALUE (LIT_MAGIC_STRING_SQRT2_U,
64               ECMA_BUILTIN_NUMBER_SQRT2,
65               ECMA_PROPERTY_FIXED)
66 
67 #if ENABLED (JERRY_ES2015)
68 /* ECMA-262 v6, 20.2.1.9 */
69 STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
70               LIT_MAGIC_STRING_MATH_UL,
71               ECMA_PROPERTY_FLAG_CONFIGURABLE)
72 #endif /* ENABLED (JERRY_ES2015) */
73 
74 /* Routine properties:
75  *  (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
76 ROUTINE (LIT_MAGIC_STRING_ABS, ECMA_MATH_OBJECT_ABS, 1, 1)
77 ROUTINE (LIT_MAGIC_STRING_ACOS, ECMA_MATH_OBJECT_ACOS, 1, 1)
78 ROUTINE (LIT_MAGIC_STRING_ASIN, ECMA_MATH_OBJECT_ASIN, 1, 1)
79 ROUTINE (LIT_MAGIC_STRING_ATAN, ECMA_MATH_OBJECT_ATAN, 1, 1)
80 ROUTINE (LIT_MAGIC_STRING_ATAN2, ECMA_MATH_OBJECT_ATAN2, 2, 2)
81 ROUTINE (LIT_MAGIC_STRING_CEIL, ECMA_MATH_OBJECT_CEIL, 1, 1)
82 ROUTINE (LIT_MAGIC_STRING_COS, ECMA_MATH_OBJECT_COS, 1, 1)
83 ROUTINE (LIT_MAGIC_STRING_EXP, ECMA_MATH_OBJECT_EXP, 1, 1)
84 ROUTINE (LIT_MAGIC_STRING_FLOOR, ECMA_MATH_OBJECT_FLOOR, 1, 1)
85 ROUTINE (LIT_MAGIC_STRING_LOG, ECMA_MATH_OBJECT_LOG, 1, 1)
86 ROUTINE (LIT_MAGIC_STRING_MAX, ECMA_MATH_OBJECT_MAX, NON_FIXED, 2)
87 ROUTINE (LIT_MAGIC_STRING_MIN, ECMA_MATH_OBJECT_MIN, NON_FIXED, 2)
88 ROUTINE (LIT_MAGIC_STRING_POW, ECMA_MATH_OBJECT_POW, 2, 2)
89 ROUTINE (LIT_MAGIC_STRING_RANDOM, ECMA_MATH_OBJECT_RANDOM, 0, 0)
90 ROUTINE (LIT_MAGIC_STRING_ROUND, ECMA_MATH_OBJECT_ROUND, 1, 1)
91 ROUTINE (LIT_MAGIC_STRING_SIN, ECMA_MATH_OBJECT_SIN, 1, 1)
92 ROUTINE (LIT_MAGIC_STRING_SQRT, ECMA_MATH_OBJECT_SQRT, 1, 1)
93 ROUTINE (LIT_MAGIC_STRING_TAN, ECMA_MATH_OBJECT_TAN, 1, 1)
94 #if ENABLED (JERRY_ES2015)
95 ROUTINE (LIT_MAGIC_STRING_ACOSH, ECMA_MATH_OBJECT_ACOSH, 1, 1)
96 ROUTINE (LIT_MAGIC_STRING_ASINH, ECMA_MATH_OBJECT_ASINH, 1, 1)
97 ROUTINE (LIT_MAGIC_STRING_ATANH, ECMA_MATH_OBJECT_ATANH, 1, 1)
98 ROUTINE (LIT_MAGIC_STRING_CBRT, ECMA_MATH_OBJECT_CBRT, 1, 1)
99 ROUTINE (LIT_MAGIC_STRING_CLZ32, ECMA_MATH_OBJECT_CLZ32, 1, 1)
100 ROUTINE (LIT_MAGIC_STRING_COSH, ECMA_MATH_OBJECT_COSH, 1, 1)
101 ROUTINE (LIT_MAGIC_STRING_EXPM1, ECMA_MATH_OBJECT_EXPM1, 1, 1)
102 ROUTINE (LIT_MAGIC_STRING_FROUND, ECMA_MATH_OBJECT_FROUND, 1, 1)
103 ROUTINE (LIT_MAGIC_STRING_HYPOT, ECMA_MATH_OBJECT_HYPOT, NON_FIXED, 2)
104 ROUTINE (LIT_MAGIC_STRING_IMUL, ECMA_MATH_OBJECT_IMUL, 2, 2)
105 ROUTINE (LIT_MAGIC_STRING_LOG1P, ECMA_MATH_OBJECT_LOG1P, 1, 1)
106 ROUTINE (LIT_MAGIC_STRING_LOG10, ECMA_MATH_OBJECT_LOG10, 1, 1)
107 ROUTINE (LIT_MAGIC_STRING_LOG2, ECMA_MATH_OBJECT_LOG2, 1, 1)
108 ROUTINE (LIT_MAGIC_STRING_SIGN, ECMA_MATH_OBJECT_SIGN, 1, 1)
109 ROUTINE (LIT_MAGIC_STRING_SINH, ECMA_MATH_OBJECT_SINH, 1, 1)
110 ROUTINE (LIT_MAGIC_STRING_TANH, ECMA_MATH_OBJECT_TANH, 1, 1)
111 ROUTINE (LIT_MAGIC_STRING_TRUNC, ECMA_MATH_OBJECT_TRUNC, 1, 1)
112 #endif /* ENABLED (JERRY_ES2015) */
113 
114 #endif /* ENABLED (JERRY_BUILTIN_MATH) */
115 
116 #include "ecma-builtin-helpers-macro-undefs.inc.h"
117