@elaraai/east 0.0.1-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (251) hide show
  1. package/LICENSE.md +682 -0
  2. package/README.md +276 -0
  3. package/dist/src/analyze.d.ts +95 -0
  4. package/dist/src/analyze.d.ts.map +1 -0
  5. package/dist/src/analyze.js +1110 -0
  6. package/dist/src/analyze.js.map +1 -0
  7. package/dist/src/ast.d.ts +263 -0
  8. package/dist/src/ast.d.ts.map +1 -0
  9. package/dist/src/ast.js +151 -0
  10. package/dist/src/ast.js.map +1 -0
  11. package/dist/src/ast_to_ir.d.ts +24 -0
  12. package/dist/src/ast_to_ir.d.ts.map +1 -0
  13. package/dist/src/ast_to_ir.js +834 -0
  14. package/dist/src/ast_to_ir.js.map +1 -0
  15. package/dist/src/builtins.d.ts +18 -0
  16. package/dist/src/builtins.d.ts.map +1 -0
  17. package/dist/src/builtins.js +1105 -0
  18. package/dist/src/builtins.js.map +1 -0
  19. package/dist/src/comparison.d.ts +28 -0
  20. package/dist/src/comparison.d.ts.map +1 -0
  21. package/dist/src/comparison.js +1017 -0
  22. package/dist/src/comparison.js.map +1 -0
  23. package/dist/src/compile.d.ts +22 -0
  24. package/dist/src/compile.d.ts.map +1 -0
  25. package/dist/src/compile.js +3260 -0
  26. package/dist/src/compile.js.map +1 -0
  27. package/dist/src/containers/ref.d.ts +106 -0
  28. package/dist/src/containers/ref.d.ts.map +1 -0
  29. package/dist/src/containers/ref.js +100 -0
  30. package/dist/src/containers/ref.js.map +1 -0
  31. package/dist/src/containers/sortedmap.d.ts +165 -0
  32. package/dist/src/containers/sortedmap.d.ts.map +1 -0
  33. package/dist/src/containers/sortedmap.js +237 -0
  34. package/dist/src/containers/sortedmap.js.map +1 -0
  35. package/dist/src/containers/sortedset.d.ts +185 -0
  36. package/dist/src/containers/sortedset.d.ts.map +1 -0
  37. package/dist/src/containers/sortedset.js +312 -0
  38. package/dist/src/containers/sortedset.js.map +1 -0
  39. package/dist/src/containers/variant.d.ts +131 -0
  40. package/dist/src/containers/variant.d.ts.map +1 -0
  41. package/dist/src/containers/variant.js +68 -0
  42. package/dist/src/containers/variant.js.map +1 -0
  43. package/dist/src/datetime_format/parse.d.ts +50 -0
  44. package/dist/src/datetime_format/parse.d.ts.map +1 -0
  45. package/dist/src/datetime_format/parse.js +908 -0
  46. package/dist/src/datetime_format/parse.js.map +1 -0
  47. package/dist/src/datetime_format/print.d.ts +35 -0
  48. package/dist/src/datetime_format/print.d.ts.map +1 -0
  49. package/dist/src/datetime_format/print.js +157 -0
  50. package/dist/src/datetime_format/print.js.map +1 -0
  51. package/dist/src/datetime_format/tokenize.d.ts +76 -0
  52. package/dist/src/datetime_format/tokenize.d.ts.map +1 -0
  53. package/dist/src/datetime_format/tokenize.js +271 -0
  54. package/dist/src/datetime_format/tokenize.js.map +1 -0
  55. package/dist/src/datetime_format/types.d.ts +99 -0
  56. package/dist/src/datetime_format/types.d.ts.map +1 -0
  57. package/dist/src/datetime_format/types.js +103 -0
  58. package/dist/src/datetime_format/types.js.map +1 -0
  59. package/dist/src/datetime_format/validate.d.ts +51 -0
  60. package/dist/src/datetime_format/validate.d.ts.map +1 -0
  61. package/dist/src/datetime_format/validate.js +208 -0
  62. package/dist/src/datetime_format/validate.js.map +1 -0
  63. package/dist/src/default.d.ts +21 -0
  64. package/dist/src/default.d.ts.map +1 -0
  65. package/dist/src/default.js +82 -0
  66. package/dist/src/default.js.map +1 -0
  67. package/dist/src/eastir.d.ts +33 -0
  68. package/dist/src/eastir.d.ts.map +1 -0
  69. package/dist/src/eastir.js +92 -0
  70. package/dist/src/eastir.js.map +1 -0
  71. package/dist/src/error.d.ts +13 -0
  72. package/dist/src/error.d.ts.map +1 -0
  73. package/dist/src/error.js +8 -0
  74. package/dist/src/error.js.map +1 -0
  75. package/dist/src/expr/array.d.ts +1711 -0
  76. package/dist/src/expr/array.d.ts.map +1 -0
  77. package/dist/src/expr/array.js +1805 -0
  78. package/dist/src/expr/array.js.map +1 -0
  79. package/dist/src/expr/ast.d.ts +17 -0
  80. package/dist/src/expr/ast.d.ts.map +1 -0
  81. package/dist/src/expr/ast.js +302 -0
  82. package/dist/src/expr/ast.js.map +1 -0
  83. package/dist/src/expr/blob.d.ts +141 -0
  84. package/dist/src/expr/blob.d.ts.map +1 -0
  85. package/dist/src/expr/blob.js +198 -0
  86. package/dist/src/expr/blob.js.map +1 -0
  87. package/dist/src/expr/block.d.ts +201 -0
  88. package/dist/src/expr/block.d.ts.map +1 -0
  89. package/dist/src/expr/block.js +1505 -0
  90. package/dist/src/expr/block.js.map +1 -0
  91. package/dist/src/expr/boolean.d.ts +207 -0
  92. package/dist/src/expr/boolean.d.ts.map +1 -0
  93. package/dist/src/expr/boolean.js +261 -0
  94. package/dist/src/expr/boolean.js.map +1 -0
  95. package/dist/src/expr/datetime.d.ts +544 -0
  96. package/dist/src/expr/datetime.d.ts.map +1 -0
  97. package/dist/src/expr/datetime.js +980 -0
  98. package/dist/src/expr/datetime.js.map +1 -0
  99. package/dist/src/expr/dict.d.ts +1242 -0
  100. package/dist/src/expr/dict.d.ts.map +1 -0
  101. package/dist/src/expr/dict.js +1492 -0
  102. package/dist/src/expr/dict.js.map +1 -0
  103. package/dist/src/expr/expr.d.ts +95 -0
  104. package/dist/src/expr/expr.d.ts.map +1 -0
  105. package/dist/src/expr/expr.js +171 -0
  106. package/dist/src/expr/expr.js.map +1 -0
  107. package/dist/src/expr/float.d.ts +357 -0
  108. package/dist/src/expr/float.d.ts.map +1 -0
  109. package/dist/src/expr/float.js +637 -0
  110. package/dist/src/expr/float.js.map +1 -0
  111. package/dist/src/expr/function.d.ts +46 -0
  112. package/dist/src/expr/function.d.ts.map +1 -0
  113. package/dist/src/expr/function.js +58 -0
  114. package/dist/src/expr/function.js.map +1 -0
  115. package/dist/src/expr/index.d.ts +450 -0
  116. package/dist/src/expr/index.d.ts.map +1 -0
  117. package/dist/src/expr/index.js +423 -0
  118. package/dist/src/expr/index.js.map +1 -0
  119. package/dist/src/expr/integer.d.ts +256 -0
  120. package/dist/src/expr/integer.d.ts.map +1 -0
  121. package/dist/src/expr/integer.js +311 -0
  122. package/dist/src/expr/integer.js.map +1 -0
  123. package/dist/src/expr/libs/array.d.ts +106 -0
  124. package/dist/src/expr/libs/array.d.ts.map +1 -0
  125. package/dist/src/expr/libs/array.js +140 -0
  126. package/dist/src/expr/libs/array.js.map +1 -0
  127. package/dist/src/expr/libs/blob.d.ts +42 -0
  128. package/dist/src/expr/libs/blob.d.ts.map +1 -0
  129. package/dist/src/expr/libs/blob.js +70 -0
  130. package/dist/src/expr/libs/blob.js.map +1 -0
  131. package/dist/src/expr/libs/datetime.d.ts +479 -0
  132. package/dist/src/expr/libs/datetime.d.ts.map +1 -0
  133. package/dist/src/expr/libs/datetime.js +624 -0
  134. package/dist/src/expr/libs/datetime.js.map +1 -0
  135. package/dist/src/expr/libs/dict.d.ts +66 -0
  136. package/dist/src/expr/libs/dict.d.ts.map +1 -0
  137. package/dist/src/expr/libs/dict.js +77 -0
  138. package/dist/src/expr/libs/dict.js.map +1 -0
  139. package/dist/src/expr/libs/float.d.ts +299 -0
  140. package/dist/src/expr/libs/float.d.ts.map +1 -0
  141. package/dist/src/expr/libs/float.js +564 -0
  142. package/dist/src/expr/libs/float.js.map +1 -0
  143. package/dist/src/expr/libs/integer.d.ts +228 -0
  144. package/dist/src/expr/libs/integer.d.ts.map +1 -0
  145. package/dist/src/expr/libs/integer.js +398 -0
  146. package/dist/src/expr/libs/integer.js.map +1 -0
  147. package/dist/src/expr/libs/set.d.ts +59 -0
  148. package/dist/src/expr/libs/set.d.ts.map +1 -0
  149. package/dist/src/expr/libs/set.js +69 -0
  150. package/dist/src/expr/libs/set.js.map +1 -0
  151. package/dist/src/expr/libs/string.d.ts +71 -0
  152. package/dist/src/expr/libs/string.d.ts.map +1 -0
  153. package/dist/src/expr/libs/string.js +75 -0
  154. package/dist/src/expr/libs/string.js.map +1 -0
  155. package/dist/src/expr/never.d.ts +15 -0
  156. package/dist/src/expr/never.d.ts.map +1 -0
  157. package/dist/src/expr/never.js +12 -0
  158. package/dist/src/expr/never.js.map +1 -0
  159. package/dist/src/expr/null.d.ts +15 -0
  160. package/dist/src/expr/null.d.ts.map +1 -0
  161. package/dist/src/expr/null.js +12 -0
  162. package/dist/src/expr/null.js.map +1 -0
  163. package/dist/src/expr/ref.d.ts +103 -0
  164. package/dist/src/expr/ref.d.ts.map +1 -0
  165. package/dist/src/expr/ref.js +131 -0
  166. package/dist/src/expr/ref.js.map +1 -0
  167. package/dist/src/expr/regex_validation.d.ts +25 -0
  168. package/dist/src/expr/regex_validation.d.ts.map +1 -0
  169. package/dist/src/expr/regex_validation.js +130 -0
  170. package/dist/src/expr/regex_validation.js.map +1 -0
  171. package/dist/src/expr/set.d.ts +1071 -0
  172. package/dist/src/expr/set.d.ts.map +1 -0
  173. package/dist/src/expr/set.js +1137 -0
  174. package/dist/src/expr/set.js.map +1 -0
  175. package/dist/src/expr/string.d.ts +414 -0
  176. package/dist/src/expr/string.d.ts.map +1 -0
  177. package/dist/src/expr/string.js +683 -0
  178. package/dist/src/expr/string.js.map +1 -0
  179. package/dist/src/expr/struct.d.ts +48 -0
  180. package/dist/src/expr/struct.d.ts.map +1 -0
  181. package/dist/src/expr/struct.js +65 -0
  182. package/dist/src/expr/struct.js.map +1 -0
  183. package/dist/src/expr/types.d.ts +68 -0
  184. package/dist/src/expr/types.d.ts.map +1 -0
  185. package/dist/src/expr/types.js +6 -0
  186. package/dist/src/expr/types.js.map +1 -0
  187. package/dist/src/expr/variant.d.ts +137 -0
  188. package/dist/src/expr/variant.d.ts.map +1 -0
  189. package/dist/src/expr/variant.js +105 -0
  190. package/dist/src/expr/variant.js.map +1 -0
  191. package/dist/src/fuzz.d.ts +80 -0
  192. package/dist/src/fuzz.d.ts.map +1 -0
  193. package/dist/src/fuzz.js +300 -0
  194. package/dist/src/fuzz.js.map +1 -0
  195. package/dist/src/index.d.ts +21 -0
  196. package/dist/src/index.d.ts.map +1 -0
  197. package/dist/src/index.js +21 -0
  198. package/dist/src/index.js.map +1 -0
  199. package/dist/src/internal.d.ts +36 -0
  200. package/dist/src/internal.d.ts.map +1 -0
  201. package/dist/src/internal.js +11 -0
  202. package/dist/src/internal.js.map +1 -0
  203. package/dist/src/ir.d.ts +1571 -0
  204. package/dist/src/ir.d.ts.map +1 -0
  205. package/dist/src/ir.js +56 -0
  206. package/dist/src/ir.js.map +1 -0
  207. package/dist/src/location.d.ts +48 -0
  208. package/dist/src/location.d.ts.map +1 -0
  209. package/dist/src/location.js +62 -0
  210. package/dist/src/location.js.map +1 -0
  211. package/dist/src/platform.d.ts +21 -0
  212. package/dist/src/platform.d.ts.map +1 -0
  213. package/dist/src/platform.js +8 -0
  214. package/dist/src/platform.js.map +1 -0
  215. package/dist/src/serialization/beast.d.ts +39 -0
  216. package/dist/src/serialization/beast.d.ts.map +1 -0
  217. package/dist/src/serialization/beast.js +555 -0
  218. package/dist/src/serialization/beast.js.map +1 -0
  219. package/dist/src/serialization/beast2-stream.d.ts +38 -0
  220. package/dist/src/serialization/beast2-stream.d.ts.map +1 -0
  221. package/dist/src/serialization/beast2-stream.js +665 -0
  222. package/dist/src/serialization/beast2-stream.js.map +1 -0
  223. package/dist/src/serialization/beast2.d.ts +41 -0
  224. package/dist/src/serialization/beast2.d.ts.map +1 -0
  225. package/dist/src/serialization/beast2.js +489 -0
  226. package/dist/src/serialization/beast2.js.map +1 -0
  227. package/dist/src/serialization/binary-utils.d.ts +151 -0
  228. package/dist/src/serialization/binary-utils.d.ts.map +1 -0
  229. package/dist/src/serialization/binary-utils.js +929 -0
  230. package/dist/src/serialization/binary-utils.js.map +1 -0
  231. package/dist/src/serialization/east.d.ts +84 -0
  232. package/dist/src/serialization/east.d.ts.map +1 -0
  233. package/dist/src/serialization/east.js +1802 -0
  234. package/dist/src/serialization/east.js.map +1 -0
  235. package/dist/src/serialization/index.d.ts +11 -0
  236. package/dist/src/serialization/index.d.ts.map +1 -0
  237. package/dist/src/serialization/index.js +12 -0
  238. package/dist/src/serialization/index.js.map +1 -0
  239. package/dist/src/serialization/json.d.ts +36 -0
  240. package/dist/src/serialization/json.d.ts.map +1 -0
  241. package/dist/src/serialization/json.js +849 -0
  242. package/dist/src/serialization/json.js.map +1 -0
  243. package/dist/src/type_of_type.d.ts +115 -0
  244. package/dist/src/type_of_type.d.ts.map +1 -0
  245. package/dist/src/type_of_type.js +362 -0
  246. package/dist/src/type_of_type.js.map +1 -0
  247. package/dist/src/types.d.ts +648 -0
  248. package/dist/src/types.d.ts.map +1 -0
  249. package/dist/src/types.js +1631 -0
  250. package/dist/src/types.js.map +1 -0
  251. package/package.json +87 -0
@@ -0,0 +1,357 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ import type { AST } from "../ast.js";
6
+ import { FloatType } from "../types.js";
7
+ import { Expr, type ToExpr } from "./expr.js";
8
+ import type { IntegerExpr } from "./integer.js";
9
+ /**
10
+ * Expression representing floating-point values and operations (IEEE 754 double-precision).
11
+ *
12
+ * FloatExpr provides arithmetic, trigonometric, and conversion operations for 64-bit floats.
13
+ * Automatically converts integer operands to float when needed. Supports special values: Infinity, -Infinity, NaN.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * // Basic arithmetic
18
+ * const calculate = East.function([FloatType, FloatType], FloatType, ($, x, y) => {
19
+ * const sum = x.add(y);
20
+ * const ratio = x.divide(y);
21
+ * $.return(sum.multiply(ratio));
22
+ * });
23
+ *
24
+ * // Trigonometry
25
+ * const angle = East.function([FloatType], FloatType, ($, degrees) => {
26
+ * const radians = degrees.multiply(Math.PI / 180);
27
+ * $.return(radians.sin());
28
+ * });
29
+ *
30
+ * // Mixed with integers
31
+ * const mixed = East.function([IntegerType], FloatType, ($, x) => {
32
+ * $.return(x.add(2.5)); // Integer auto-converts to float
33
+ * });
34
+ * ```
35
+ */
36
+ export declare class FloatExpr extends Expr<FloatType> {
37
+ constructor(ast: AST, createExpr: ToExpr);
38
+ /**
39
+ * Negates a floating-point number (-x).
40
+ *
41
+ * @returns A FloatExpr representing the negated value
42
+ *
43
+ * @example
44
+ * ```ts
45
+ * const negateFloat = East.function([FloatType], FloatType, ($, x) => {
46
+ * $.return(x.negate());
47
+ * });
48
+ * const compiled = East.compile(negateFloat.toIR(), []);
49
+ * compiled(3.14); // -3.14
50
+ * compiled(-2.5); // 2.5
51
+ * compiled(0.0); // -0.0 (negative zero)
52
+ * ```
53
+ */
54
+ negate(): FloatExpr;
55
+ /**
56
+ * Adds two floating-point numbers or converts integer to float and adds (x + y).
57
+ *
58
+ * @param y - The float, number, IntegerExpr, or bigint to add
59
+ * @returns A FloatExpr representing the sum
60
+ *
61
+ * @remarks Automatically converts integer operands to float before addition.
62
+ *
63
+ * @example
64
+ * ```ts
65
+ * const addFloats = East.function([FloatType, FloatType], FloatType, ($, x, y) => {
66
+ * $.return(x.add(y));
67
+ * });
68
+ * const compiled = East.compile(addFloats.toIR(), []);
69
+ * compiled(3.14, 2.86); // 6.0
70
+ * compiled(1.5, -0.5); // 1.0
71
+ *
72
+ * // Mixed with integers
73
+ * const addMixed = East.function([FloatType, IntegerType], FloatType, ($, x, y) => {
74
+ * $.return(x.add(y)); // Integer auto-converts to float
75
+ * });
76
+ * compiled = East.compile(addMixed.toIR(), []);
77
+ * compiled(3.14, 2n); // 5.14
78
+ * ```
79
+ */
80
+ add(y: FloatExpr | number | IntegerExpr | bigint): FloatExpr;
81
+ /**
82
+ * Subtracts two floating-point numbers or converts integer to float and subtracts (x - y).
83
+ *
84
+ * @param y - The float, number, IntegerExpr, or bigint to subtract
85
+ * @returns A FloatExpr representing the difference
86
+ *
87
+ * @remarks Automatically converts integer operands to float before subtraction.
88
+ *
89
+ * @example
90
+ * ```ts
91
+ * const subtractFloats = East.function([FloatType, FloatType], FloatType, ($, x, y) => {
92
+ * $.return(x.subtract(y));
93
+ * });
94
+ * const compiled = East.compile(subtractFloats.toIR(), []);
95
+ * compiled(5.5, 2.3); // 3.2
96
+ * compiled(1.0, 1.0); // 0.0
97
+ * compiled(-2.5, 3.5); // -6.0
98
+ * ```
99
+ */
100
+ subtract(y: FloatExpr | number | IntegerExpr | bigint): FloatExpr;
101
+ /**
102
+ * Multiplies two floating-point numbers or converts integer to float and multiplies (x * y).
103
+ *
104
+ * @param y - The float, number, IntegerExpr, or bigint to multiply
105
+ * @returns A FloatExpr representing the product
106
+ *
107
+ * @remarks Automatically converts integer operands to float before multiplication.
108
+ *
109
+ * @example
110
+ * ```ts
111
+ * const multiplyFloats = East.function([FloatType, FloatType], FloatType, ($, x, y) => {
112
+ * $.return(x.multiply(y));
113
+ * });
114
+ * const compiled = East.compile(multiplyFloats.toIR(), []);
115
+ * compiled(3.0, 2.5); // 7.5
116
+ * compiled(2.0, -1.5); // -3.0
117
+ * compiled(0.5, 0.5); // 0.25
118
+ * ```
119
+ */
120
+ multiply(y: FloatExpr | number | IntegerExpr | bigint): FloatExpr;
121
+ /**
122
+ * Divides two floating-point numbers or converts integer to float and divides (x / y).
123
+ *
124
+ * @param y - The float, number, IntegerExpr, or bigint divisor
125
+ * @returns A FloatExpr representing the quotient
126
+ *
127
+ * @remarks Division by zero returns Infinity, -Infinity, or NaN according to IEEE 754.
128
+ * Automatically converts integer operands to float before division.
129
+ *
130
+ * @example
131
+ * ```ts
132
+ * const divideFloats = East.function([FloatType, FloatType], FloatType, ($, x, y) => {
133
+ * $.return(x.divide(y));
134
+ * });
135
+ * const compiled = East.compile(divideFloats.toIR(), []);
136
+ * compiled(10.0, 2.0); // 5.0
137
+ * compiled(1.0, 3.0); // 0.3333333333333333
138
+ * compiled(5.0, 0.0); // Infinity
139
+ * compiled(-5.0, 0.0); // -Infinity
140
+ * compiled(0.0, 0.0); // NaN
141
+ * ```
142
+ */
143
+ divide(y: FloatExpr | number | IntegerExpr | bigint): FloatExpr;
144
+ /**
145
+ * Computes floating-point remainder of division (x % y).
146
+ *
147
+ * @param y - The float, number, IntegerExpr, or bigint divisor
148
+ * @returns A FloatExpr representing the remainder
149
+ *
150
+ * @remarks Uses IEEE 754 remainder semantics. Automatically converts integer operands to float.
151
+ *
152
+ * @example
153
+ * ```ts
154
+ * const remainderFloats = East.function([FloatType, FloatType], FloatType, ($, x, y) => {
155
+ * $.return(x.remainder(y));
156
+ * });
157
+ * const compiled = East.compile(remainderFloats.toIR(), []);
158
+ * compiled(7.5, 2.0); // 1.5
159
+ * compiled(10.0, 3.0); // 1.0
160
+ * compiled(-7.5, 2.0); // -1.5
161
+ * ```
162
+ */
163
+ remainder(y: FloatExpr | number | IntegerExpr | bigint): FloatExpr;
164
+ /**
165
+ * Raises a floating-point number to a power (x ** y).
166
+ *
167
+ * @param y - The float, number, IntegerExpr, or bigint exponent
168
+ * @returns A FloatExpr representing x raised to the power of y
169
+ *
170
+ * @remarks Automatically converts integer operands to float before exponentiation.
171
+ *
172
+ * @example
173
+ * ```ts
174
+ * const powFloats = East.function([FloatType, FloatType], FloatType, ($, x, y) => {
175
+ * $.return(x.pow(y));
176
+ * });
177
+ * const compiled = East.compile(powFloats.toIR(), []);
178
+ * compiled(2.0, 3.0); // 8.0
179
+ * compiled(9.0, 0.5); // 3.0 (square root)
180
+ * compiled(2.0, -1.0); // 0.5
181
+ * compiled(-1.0, 0.5); // NaN (square root of negative)
182
+ * ```
183
+ */
184
+ pow(y: FloatExpr | number | IntegerExpr | bigint): FloatExpr;
185
+ /**
186
+ * Computes the absolute value of a floating-point number (|x|).
187
+ *
188
+ * @returns A FloatExpr representing the absolute value
189
+ *
190
+ * @example
191
+ * ```ts
192
+ * const absFloat = East.function([FloatType], FloatType, ($, x) => {
193
+ * $.return(x.abs());
194
+ * });
195
+ * const compiled = East.compile(absFloat.toIR(), []);
196
+ * compiled(3.14); // 3.14
197
+ * compiled(-2.5); // 2.5
198
+ * compiled(0.0); // 0.0
199
+ * compiled(-0.0); // 0.0
200
+ * ```
201
+ */
202
+ abs(): FloatExpr;
203
+ /**
204
+ * Computes the sign of a floating-point number.
205
+ *
206
+ * @returns A FloatExpr representing -1.0 for negative, 0.0 for zero, 1.0 for positive, or NaN for NaN
207
+ *
208
+ * @example
209
+ * ```ts
210
+ * const signFloat = East.function([FloatType], FloatType, ($, x) => {
211
+ * $.return(x.sign());
212
+ * });
213
+ * const compiled = East.compile(signFloat.toIR(), []);
214
+ * compiled(3.14); // 1.0
215
+ * compiled(-2.5); // -1.0
216
+ * compiled(0.0); // 0.0
217
+ * compiled(-0.0); // -0.0
218
+ * ```
219
+ */
220
+ sign(): FloatExpr;
221
+ /**
222
+ * Computes the square root of a floating-point number (√x).
223
+ *
224
+ * @returns A FloatExpr representing the square root
225
+ *
226
+ * @remarks Returns NaN for negative numbers.
227
+ *
228
+ * @example
229
+ * ```ts
230
+ * const sqrtFloat = East.function([FloatType], FloatType, ($, x) => {
231
+ * $.return(x.sqrt());
232
+ * });
233
+ * const compiled = East.compile(sqrtFloat.toIR(), []);
234
+ * compiled(9.0); // 3.0
235
+ * compiled(2.0); // 1.4142135623730951
236
+ * compiled(0.0); // 0.0
237
+ * compiled(-1.0); // NaN
238
+ * ```
239
+ */
240
+ sqrt(): FloatExpr;
241
+ /**
242
+ * Computes the exponential function (e^x).
243
+ *
244
+ * @returns A FloatExpr representing e raised to the power of x
245
+ *
246
+ * @example
247
+ * ```ts
248
+ * const expFloat = East.function([FloatType], FloatType, ($, x) => {
249
+ * $.return(x.exp());
250
+ * });
251
+ * const compiled = East.compile(expFloat.toIR(), []);
252
+ * compiled(0.0); // 1.0
253
+ * compiled(1.0); // 2.718281828459045
254
+ * compiled(2.0); // 7.38905609893065
255
+ * compiled(-1.0); // 0.36787944117144233
256
+ * ```
257
+ */
258
+ exp(): FloatExpr;
259
+ /**
260
+ * Computes the natural logarithm (ln(x)).
261
+ *
262
+ * @returns A FloatExpr representing the natural logarithm of x
263
+ *
264
+ * @remarks Returns NaN for negative numbers, -Infinity for 0.
265
+ *
266
+ * @example
267
+ * ```ts
268
+ * const logFloat = East.function([FloatType], FloatType, ($, x) => {
269
+ * $.return(x.log());
270
+ * });
271
+ * const compiled = East.compile(logFloat.toIR(), []);
272
+ * compiled(Math.E); // 1.0
273
+ * compiled(1.0); // 0.0
274
+ * compiled(10.0); // 2.302585092994046
275
+ * compiled(0.0); // -Infinity
276
+ * compiled(-1.0); // NaN
277
+ * ```
278
+ */
279
+ log(): FloatExpr;
280
+ /**
281
+ * Computes the sine of a floating-point number (sin(x)).
282
+ *
283
+ * @returns A FloatExpr representing the sine of x (x in radians)
284
+ *
285
+ * @example
286
+ * ```ts
287
+ * const sinFloat = East.function([FloatType], FloatType, ($, x) => {
288
+ * $.return(x.sin());
289
+ * });
290
+ * const compiled = East.compile(sinFloat.toIR(), []);
291
+ * compiled(0.0); // 0.0
292
+ * compiled(Math.PI / 2); // 1.0
293
+ * compiled(Math.PI); // ~0.0 (very close to zero)
294
+ * compiled(Math.PI / 6); // 0.5
295
+ * ```
296
+ */
297
+ sin(): FloatExpr;
298
+ /**
299
+ * Computes the cosine of a floating-point number (cos(x)).
300
+ *
301
+ * @returns A FloatExpr representing the cosine of x (x in radians)
302
+ *
303
+ * @example
304
+ * ```ts
305
+ * const cosFloat = East.function([FloatType], FloatType, ($, x) => {
306
+ * $.return(x.cos());
307
+ * });
308
+ * const compiled = East.compile(cosFloat.toIR(), []);
309
+ * compiled(0.0); // 1.0
310
+ * compiled(Math.PI / 2); // ~0.0 (very close to zero)
311
+ * compiled(Math.PI); // -1.0
312
+ * compiled(Math.PI / 3); // 0.5
313
+ * ```
314
+ */
315
+ cos(): FloatExpr;
316
+ /**
317
+ * Computes the tangent of a floating-point number (tan(x)).
318
+ *
319
+ * @returns A FloatExpr representing the tangent of x (x in radians)
320
+ *
321
+ * @example
322
+ * ```ts
323
+ * const tanFloat = East.function([FloatType], FloatType, ($, x) => {
324
+ * $.return(x.tan());
325
+ * });
326
+ * const compiled = East.compile(tanFloat.toIR(), []);
327
+ * compiled(0.0); // 0.0
328
+ * compiled(Math.PI / 4); // 1.0
329
+ * compiled(Math.PI / 6); // 0.5773502691896257
330
+ * compiled(-Math.PI / 4); // -1.0
331
+ * ```
332
+ */
333
+ tan(): FloatExpr;
334
+ /**
335
+ * Converts a floating-point number to an integer.
336
+ *
337
+ * @returns An IntegerExpr representing the converted value
338
+ *
339
+ * @throws East runtime error if the float is NaN, infinite, larger than 2^63-1, smaller than -2^63, or not an integer value
340
+ *
341
+ * @example
342
+ * ```ts
343
+ * const floatToInt = East.function([FloatType], IntegerType, ($, x) => {
344
+ * $.return(x.toInteger());
345
+ * });
346
+ * const compiled = East.compile(floatToInt.toIR(), []);
347
+ * compiled(42.0); // 42n
348
+ * compiled(-10.0); // -10n
349
+ * compiled(0.0); // 0n
350
+ * // compiled(3.14) would throw error (not an integer value)
351
+ * // compiled(NaN) would throw error
352
+ * // compiled(Infinity) would throw error
353
+ * ```
354
+ */
355
+ toInteger(): IntegerExpr;
356
+ }
357
+ //# sourceMappingURL=float.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"float.d.ts","sourceRoot":"","sources":["../../../src/expr/float.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAErC,OAAO,EAAE,SAAS,EAAuC,MAAM,aAAa,CAAC;AAC7E,OAAO,EAAa,IAAI,EAAiB,KAAK,MAAM,EAAE,MAAM,WAAW,CAAC;AAExE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,qBAAa,SAAU,SAAQ,IAAI,CAAC,SAAS,CAAC;gBAChC,GAAG,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM;IAIxC;;;;;;;;;;;;;;;OAeG;IACH,MAAM,IAAI,SAAS;IAWnB;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,GAAG,CAAC,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,GAAG,SAAS;IA8B5D;;;;;;;;;;;;;;;;;;OAkBG;IACH,QAAQ,CAAC,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,GAAG,SAAS;IA8BjE;;;;;;;;;;;;;;;;;;OAkBG;IACH,QAAQ,CAAC,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,GAAG,SAAS;IA8BjE;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,MAAM,CAAC,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,GAAG,SAAS;IA8B/D;;;;;;;;;;;;;;;;;;OAkBG;IACH,SAAS,CAAC,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,GAAG,SAAS;IA8BlE;;;;;;;;;;;;;;;;;;;OAmBG;IACH,GAAG,CAAC,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,GAAG,SAAS;IA8B5D;;;;;;;;;;;;;;;;OAgBG;IACH,GAAG,IAAI,SAAS;IAWhB;;;;;;;;;;;;;;;;OAgBG;IACH,IAAI,IAAI,SAAS;IAWjB;;;;;;;;;;;;;;;;;;OAkBG;IACH,IAAI,IAAI,SAAS;IAWjB;;;;;;;;;;;;;;;;OAgBG;IACH,GAAG,IAAI,SAAS;IAWhB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,GAAG,IAAI,SAAS;IAWhB;;;;;;;;;;;;;;;;OAgBG;IACH,GAAG,IAAI,SAAS;IAWhB;;;;;;;;;;;;;;;;OAgBG;IACH,GAAG,IAAI,SAAS;IAWhB;;;;;;;;;;;;;;;;OAgBG;IACH,GAAG,IAAI,SAAS;IAWhB;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,SAAS,IAAI,WAAW;CAUzB"}