@live-codes/ocaml 0.0.0-stage → 0.1.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 (130) hide show
  1. package/LICENSE +220 -0
  2. package/README.md +165 -2
  3. package/THIRD-PARTY-NOTICES.md +52 -0
  4. package/assets/compiler/compile_stdout.browser.js +27856 -0
  5. package/assets/compiler/jsoo.js +12631 -0
  6. package/assets/compiler/package.json +3 -0
  7. package/assets/compiler/runtime/bigarray.js +1072 -0
  8. package/assets/compiler/runtime/bigstring.js +137 -0
  9. package/assets/compiler/runtime/domain.js +393 -0
  10. package/assets/compiler/runtime/dynlink.js +91 -0
  11. package/assets/compiler/runtime/float32.js +486 -0
  12. package/assets/compiler/runtime/fs.js +416 -0
  13. package/assets/compiler/runtime/fs_fake.js +600 -0
  14. package/assets/compiler/runtime/fs_node.js +609 -0
  15. package/assets/compiler/runtime/fs_quickjs.js +532 -0
  16. package/assets/compiler/runtime/gc.js +201 -0
  17. package/assets/compiler/runtime/graphics.js +1053 -0
  18. package/assets/compiler/runtime/ieee_754.js +621 -0
  19. package/assets/compiler/runtime/int64.js +516 -0
  20. package/assets/compiler/runtime/io.js +739 -0
  21. package/assets/compiler/runtime/jslib.js +553 -0
  22. package/assets/compiler/runtime/jslib_js_of_ocaml.js +81 -0
  23. package/assets/compiler/runtime/lexing.js +240 -0
  24. package/assets/compiler/runtime/manifest.txt +31 -0
  25. package/assets/compiler/runtime/marshal.js +863 -0
  26. package/assets/compiler/runtime/md5.js +236 -0
  27. package/assets/compiler/runtime/mlBytes.js +1007 -0
  28. package/assets/compiler/runtime/nat.js +469 -0
  29. package/assets/compiler/runtime/parsing.js +317 -0
  30. package/assets/compiler/runtime/prng.js +84 -0
  31. package/assets/compiler/runtime/promise.js +45 -0
  32. package/assets/compiler/runtime/runtime.js +16688 -0
  33. package/assets/compiler/runtime/runtime_events.js +90 -0
  34. package/assets/compiler/runtime/stdlib.js +363 -0
  35. package/assets/compiler/runtime/sync.js +35 -0
  36. package/assets/compiler/runtime/toplevel.js +150 -0
  37. package/assets/compiler/runtime/unix.js +914 -0
  38. package/assets/compiler/runtime/weak.js +247 -0
  39. package/assets/compiler/stdlib.js +254 -0
  40. package/assets/compiler/worker.js +46 -0
  41. package/assets/interpreter/libs/greet.cma +0 -0
  42. package/assets/interpreter/libs/greet.cmi +0 -0
  43. package/assets/interpreter/libs/manifest.txt +1 -0
  44. package/assets/interpreter/package.json +3 -0
  45. package/assets/interpreter/stdlib/camlinternalFormat.cmi +0 -0
  46. package/assets/interpreter/stdlib/camlinternalFormatBasics.cmi +0 -0
  47. package/assets/interpreter/stdlib/camlinternalLazy.cmi +0 -0
  48. package/assets/interpreter/stdlib/camlinternalMod.cmi +0 -0
  49. package/assets/interpreter/stdlib/camlinternalOO.cmi +0 -0
  50. package/assets/interpreter/stdlib/std_exit.cmi +0 -0
  51. package/assets/interpreter/stdlib/stdlib.cmi +0 -0
  52. package/assets/interpreter/stdlib/stdlib__Arg.cmi +0 -0
  53. package/assets/interpreter/stdlib/stdlib__Array.cmi +0 -0
  54. package/assets/interpreter/stdlib/stdlib__ArrayLabels.cmi +0 -0
  55. package/assets/interpreter/stdlib/stdlib__Atomic.cmi +0 -0
  56. package/assets/interpreter/stdlib/stdlib__Bigarray.cmi +0 -0
  57. package/assets/interpreter/stdlib/stdlib__Bool.cmi +0 -0
  58. package/assets/interpreter/stdlib/stdlib__Buffer.cmi +0 -0
  59. package/assets/interpreter/stdlib/stdlib__Bytes.cmi +0 -0
  60. package/assets/interpreter/stdlib/stdlib__BytesLabels.cmi +0 -0
  61. package/assets/interpreter/stdlib/stdlib__Callback.cmi +0 -0
  62. package/assets/interpreter/stdlib/stdlib__Char.cmi +0 -0
  63. package/assets/interpreter/stdlib/stdlib__Complex.cmi +0 -0
  64. package/assets/interpreter/stdlib/stdlib__Condition.cmi +0 -0
  65. package/assets/interpreter/stdlib/stdlib__Digest.cmi +0 -0
  66. package/assets/interpreter/stdlib/stdlib__Domain.cmi +0 -0
  67. package/assets/interpreter/stdlib/stdlib__Dynarray.cmi +0 -0
  68. package/assets/interpreter/stdlib/stdlib__Effect.cmi +0 -0
  69. package/assets/interpreter/stdlib/stdlib__Either.cmi +0 -0
  70. package/assets/interpreter/stdlib/stdlib__Ephemeron.cmi +0 -0
  71. package/assets/interpreter/stdlib/stdlib__Filename.cmi +0 -0
  72. package/assets/interpreter/stdlib/stdlib__Float.cmi +0 -0
  73. package/assets/interpreter/stdlib/stdlib__Format.cmi +0 -0
  74. package/assets/interpreter/stdlib/stdlib__Fun.cmi +0 -0
  75. package/assets/interpreter/stdlib/stdlib__Gc.cmi +0 -0
  76. package/assets/interpreter/stdlib/stdlib__Hashtbl.cmi +0 -0
  77. package/assets/interpreter/stdlib/stdlib__Iarray.cmi +0 -0
  78. package/assets/interpreter/stdlib/stdlib__In_channel.cmi +0 -0
  79. package/assets/interpreter/stdlib/stdlib__Int.cmi +0 -0
  80. package/assets/interpreter/stdlib/stdlib__Int32.cmi +0 -0
  81. package/assets/interpreter/stdlib/stdlib__Int64.cmi +0 -0
  82. package/assets/interpreter/stdlib/stdlib__Lazy.cmi +0 -0
  83. package/assets/interpreter/stdlib/stdlib__Lexing.cmi +0 -0
  84. package/assets/interpreter/stdlib/stdlib__List.cmi +0 -0
  85. package/assets/interpreter/stdlib/stdlib__ListLabels.cmi +0 -0
  86. package/assets/interpreter/stdlib/stdlib__Map.cmi +0 -0
  87. package/assets/interpreter/stdlib/stdlib__Marshal.cmi +0 -0
  88. package/assets/interpreter/stdlib/stdlib__MoreLabels.cmi +0 -0
  89. package/assets/interpreter/stdlib/stdlib__Mutex.cmi +0 -0
  90. package/assets/interpreter/stdlib/stdlib__Nativeint.cmi +0 -0
  91. package/assets/interpreter/stdlib/stdlib__Obj.cmi +0 -0
  92. package/assets/interpreter/stdlib/stdlib__Oo.cmi +0 -0
  93. package/assets/interpreter/stdlib/stdlib__Option.cmi +0 -0
  94. package/assets/interpreter/stdlib/stdlib__Out_channel.cmi +0 -0
  95. package/assets/interpreter/stdlib/stdlib__Pair.cmi +0 -0
  96. package/assets/interpreter/stdlib/stdlib__Parsing.cmi +0 -0
  97. package/assets/interpreter/stdlib/stdlib__Pqueue.cmi +0 -0
  98. package/assets/interpreter/stdlib/stdlib__Printexc.cmi +0 -0
  99. package/assets/interpreter/stdlib/stdlib__Printf.cmi +0 -0
  100. package/assets/interpreter/stdlib/stdlib__Queue.cmi +0 -0
  101. package/assets/interpreter/stdlib/stdlib__Random.cmi +0 -0
  102. package/assets/interpreter/stdlib/stdlib__Repr.cmi +0 -0
  103. package/assets/interpreter/stdlib/stdlib__Result.cmi +0 -0
  104. package/assets/interpreter/stdlib/stdlib__Scanf.cmi +0 -0
  105. package/assets/interpreter/stdlib/stdlib__Semaphore.cmi +0 -0
  106. package/assets/interpreter/stdlib/stdlib__Seq.cmi +0 -0
  107. package/assets/interpreter/stdlib/stdlib__Set.cmi +0 -0
  108. package/assets/interpreter/stdlib/stdlib__Stack.cmi +0 -0
  109. package/assets/interpreter/stdlib/stdlib__StdLabels.cmi +0 -0
  110. package/assets/interpreter/stdlib/stdlib__String.cmi +0 -0
  111. package/assets/interpreter/stdlib/stdlib__StringLabels.cmi +0 -0
  112. package/assets/interpreter/stdlib/stdlib__Sys.cmi +0 -0
  113. package/assets/interpreter/stdlib/stdlib__Type.cmi +0 -0
  114. package/assets/interpreter/stdlib/stdlib__Uchar.cmi +0 -0
  115. package/assets/interpreter/stdlib/stdlib__Unit.cmi +0 -0
  116. package/assets/interpreter/stdlib/stdlib__Weak.cmi +0 -0
  117. package/assets/interpreter/stdlib/topdirs.cmi +0 -0
  118. package/assets/interpreter/stdlib/units.txt +75 -0
  119. package/assets/interpreter/stdlib/unix.cmi +0 -0
  120. package/assets/interpreter/stdlib/unixLabels.cmi +0 -0
  121. package/assets/interpreter/worker-entry.js +39 -0
  122. package/assets/interpreter/worker.js +42356 -0
  123. package/bin/copy-assets.mjs +75 -0
  124. package/package.json +41 -4
  125. package/src/compiler/compile.js +170 -0
  126. package/src/compiler/index.js +46 -0
  127. package/src/compiler/worker.js +46 -0
  128. package/src/index.js +12 -0
  129. package/src/interpreter/api.js +182 -0
  130. package/src/interpreter/index.js +5 -0
@@ -0,0 +1,486 @@
1
+ /*
2
+ 32-bit floats are represented as javascript numbers, i.e. 64-bit floats.
3
+ Each operation is performed in 64-bit precision and then rounded to the
4
+ nearest 32-bit float. This is not identical to using true 32-bit operations.
5
+ For example, if rounding an exact result to 64 bits places it halfway
6
+ between the two nearest 32-bit numbers, rounding it again to 32 bits
7
+ may not result in the closest 32-bit number to the exact result.
8
+
9
+ Marshalled float32s therefore look like normal floats. This means that
10
+ javascript programs are not be able to read float32 data marshalled
11
+ by native programs and vice versa.
12
+ */
13
+
14
+ //Provides: caml_float_of_float32 const
15
+ //Version: >= 5.2, < 5.3
16
+ //OxCaml
17
+ function caml_float_of_float32(x) {
18
+ return x;
19
+ }
20
+
21
+ //Provides: caml_float32_of_float const
22
+ //Version: >= 5.2, < 5.3
23
+ //OxCaml
24
+ function caml_float32_of_float(x) {
25
+ return Math.fround(x);
26
+ }
27
+
28
+ //Provides: caml_float32_of_int const
29
+ //Version: >= 5.2, < 5.3
30
+ //OxCaml
31
+ function caml_float32_of_int(x) {
32
+ return Math.fround(x);
33
+ }
34
+
35
+ //Provides: caml_int_of_float32 const
36
+ //Version: >= 5.2, < 5.3
37
+ //OxCaml
38
+ function caml_int_of_float32(x) {
39
+ return x | 0;
40
+ }
41
+
42
+ //Provides: caml_float32_of_bits_bytecode const
43
+ //Requires: caml_int32_float_of_bits
44
+ //Version: >= 5.2, < 5.3
45
+ //OxCaml
46
+ const caml_float32_of_bits_bytecode = caml_int32_float_of_bits;
47
+
48
+ //Provides: caml_float32_to_bits_bytecode const
49
+ //Requires: caml_int32_bits_of_float
50
+ //Version: >= 5.2, < 5.3
51
+ //OxCaml
52
+ const caml_float32_to_bits_bytecode = caml_int32_bits_of_float;
53
+
54
+ //Provides: caml_float32_of_int64_bytecode const
55
+ //Requires: caml_int64_to_float
56
+ //Version: >= 5.2, < 5.3
57
+ //OxCaml
58
+ function caml_float32_of_int64_bytecode(x) {
59
+ return Math.fround(caml_int64_to_float(x));
60
+ }
61
+
62
+ //Provides: caml_float32_to_int64_bytecode const
63
+ //Requires: caml_int64_of_float
64
+ //Version: >= 5.2, < 5.3
65
+ //OxCaml
66
+ const caml_float32_to_int64_bytecode = caml_int64_of_float;
67
+
68
+ //Provides: caml_float32_of_string (const)
69
+ //Requires: caml_parse_float
70
+ //Version: >= 5.2, < 5.3
71
+ //OxCaml
72
+ function caml_float32_of_string(x) {
73
+ return Math.fround(caml_parse_float(x, "float32_of_string"));
74
+ }
75
+
76
+ //Provides: caml_format_float32 const
77
+ //Requires: caml_format_float
78
+ //Version: >= 5.2, < 5.3
79
+ //OxCaml
80
+ const caml_format_float32 = caml_format_float;
81
+
82
+ //Provides: caml_float32_compare const
83
+ //Requires: caml_float_compare
84
+ //Version: >= 5.2, < 5.3
85
+ //OxCaml
86
+ const caml_float32_compare = caml_float_compare;
87
+
88
+ //Provides: caml_add_float32 const
89
+ //Version: >= 5.2, < 5.3
90
+ //OxCaml
91
+ function caml_add_float32(x, y) {
92
+ return Math.fround(x + y);
93
+ }
94
+
95
+ //Provides: caml_sub_float32 const
96
+ //Version: >= 5.2, < 5.3
97
+ //OxCaml
98
+ function caml_sub_float32(x, y) {
99
+ return Math.fround(x - y);
100
+ }
101
+
102
+ //Provides: caml_mul_float32 const
103
+ //Version: >= 5.2, < 5.3
104
+ //OxCaml
105
+ function caml_mul_float32(x, y) {
106
+ return Math.fround(x * y);
107
+ }
108
+
109
+ //Provides: caml_div_float32 const
110
+ //Version: >= 5.2, < 5.3
111
+ //OxCaml
112
+ function caml_div_float32(x, y) {
113
+ return Math.fround(x / y);
114
+ }
115
+
116
+ //Provides: caml_fmod_float32_bytecode const
117
+ //Version: >= 5.2, < 5.3
118
+ //OxCaml
119
+ function caml_fmod_float32_bytecode(x, y) {
120
+ return Math.fround(x % y);
121
+ }
122
+
123
+ //Provides: caml_neg_float32 const
124
+ //Version: >= 5.2, < 5.3
125
+ //OxCaml
126
+ function caml_neg_float32(x) {
127
+ return -x; // Result is exact
128
+ }
129
+
130
+ //Provides: caml_abs_float32 const
131
+ //Version: >= 5.2, < 5.3
132
+ //OxCaml
133
+ function caml_abs_float32(x) {
134
+ return Math.abs(x); // Result is exact
135
+ }
136
+
137
+ //Provides: caml_modf_float32 const
138
+ //Requires: caml_modf_float
139
+ //Version: >= 5.2, < 5.3
140
+ //OxCaml
141
+ const caml_modf_float32 = caml_modf_float; // Result is exact
142
+
143
+ //Provides: caml_acos_float32_bytecode const
144
+ //Version: >= 5.2, < 5.3
145
+ //OxCaml
146
+ function caml_acos_float32_bytecode(x) {
147
+ return Math.fround(Math.acos(x));
148
+ }
149
+
150
+ //Provides: caml_asin_float32_bytecode const
151
+ //Version: >= 5.2, < 5.3
152
+ //OxCaml
153
+ function caml_asin_float32_bytecode(x) {
154
+ return Math.fround(Math.asin(x));
155
+ }
156
+
157
+ //Provides: caml_atan_float32_bytecode const
158
+ //Version: >= 5.2, < 5.3
159
+ //OxCaml
160
+ function caml_atan_float32_bytecode(x) {
161
+ return Math.fround(Math.atan(x));
162
+ }
163
+
164
+ //Provides: caml_atan2_float32_bytecode const
165
+ //Version: >= 5.2, < 5.3
166
+ //OxCaml
167
+ function caml_atan2_float32_bytecode(x, y) {
168
+ return Math.fround(Math.atan2(x, y));
169
+ }
170
+
171
+ //Provides: caml_ceil_float32_bytecode const
172
+ //Alias: caml_simd_float32_round_pos_inf_bytecode
173
+ //Version: >= 5.2, < 5.3
174
+ //OxCaml
175
+ function caml_ceil_float32_bytecode(x) {
176
+ return Math.fround(Math.ceil(x));
177
+ }
178
+
179
+ //Provides: caml_cos_float32_bytecode const
180
+ //Version: >= 5.2, < 5.3
181
+ //OxCaml
182
+ function caml_cos_float32_bytecode(x) {
183
+ return Math.fround(Math.cos(x));
184
+ }
185
+
186
+ //Provides: caml_exp_float32_bytecode const
187
+ //Version: >= 5.2, < 5.3
188
+ //OxCaml
189
+ function caml_exp_float32_bytecode(x) {
190
+ return Math.fround(Math.exp(x));
191
+ }
192
+
193
+ //Provides: caml_floor_float32_bytecode const
194
+ //Alias: caml_simd_float32_round_neg_inf_bytecode
195
+ //Version: >= 5.2, < 5.3
196
+ //OxCaml
197
+ function caml_floor_float32_bytecode(x) {
198
+ return Math.fround(Math.floor(x));
199
+ }
200
+
201
+ //Provides: caml_log_float32_bytecode const
202
+ //Version: >= 5.2, < 5.3
203
+ //OxCaml
204
+ function caml_log_float32_bytecode(x) {
205
+ return Math.fround(Math.log(x));
206
+ }
207
+
208
+ //Provides: caml_power_float32_bytecode const
209
+ //Version: >= 5.2, < 5.3
210
+ //OxCaml
211
+ function caml_power_float32_bytecode(x, y) {
212
+ return Math.fround(Math.pow(x, y));
213
+ }
214
+
215
+ //Provides: caml_sin_float32_bytecode const
216
+ //Version: >= 5.2, < 5.3
217
+ //OxCaml
218
+ function caml_sin_float32_bytecode(x) {
219
+ return Math.fround(Math.sin(x));
220
+ }
221
+
222
+ //Provides: caml_sqrt_float32_bytecode const
223
+ //Version: >= 5.2, < 5.3
224
+ //OxCaml
225
+ function caml_sqrt_float32_bytecode(x) {
226
+ return Math.fround(Math.sqrt(x));
227
+ }
228
+
229
+ //Provides: caml_tan_float32_bytecode const
230
+ //Version: >= 5.2, < 5.3
231
+ //OxCaml
232
+ function caml_tan_float32_bytecode(x) {
233
+ return Math.fround(Math.tan(x));
234
+ }
235
+
236
+ //Provides: caml_nextafter_float32_bytecode const
237
+ //Requires: caml_int32_bits_of_float, caml_int32_float_of_bits
238
+ //Version: >= 5.2, < 5.3
239
+ //OxCaml
240
+ function caml_nextafter_float32_bytecode(x, y) {
241
+ if (Number.isNaN(x) || Number.isNaN(y)) return Number.NaN;
242
+ if (x === y) return y;
243
+ if (x === 0) {
244
+ if (y < 0) return -Math.pow(2, -149);
245
+ else return Math.pow(2, -149);
246
+ }
247
+ var bits = caml_int32_bits_of_float(x);
248
+ if (x < y === x > 0) bits++;
249
+ else bits--;
250
+ return caml_int32_float_of_bits(bits);
251
+ }
252
+
253
+ //Provides: caml_trunc_float32_bytecode const
254
+ //Alias: caml_simd_float32_round_towards_zero_bytecode
255
+ //Version: >= 5.2, < 5.3
256
+ //OxCaml
257
+ function caml_trunc_float32_bytecode(x) {
258
+ return Math.fround(Math.trunc(x));
259
+ }
260
+
261
+ //Provides: caml_classify_float32_bytecode const
262
+ //Version: >= 5.2, < 5.3
263
+ //OxCaml
264
+ function caml_classify_float32_bytecode(x) {
265
+ if (Number.isFinite(x)) {
266
+ if (Math.abs(x) >= 1.1754943508222875e-38) return 0;
267
+ if (x !== 0) return 1;
268
+ return 2;
269
+ }
270
+ return Number.isNaN(x) ? 4 : 3;
271
+ }
272
+
273
+ //Provides: caml_ldexp_float32_bytecode const
274
+ //Requires: caml_ldexp_float
275
+ //Version: >= 5.2, < 5.3
276
+ //OxCaml
277
+ function caml_ldexp_float32_bytecode(x, y) {
278
+ return Math.fround(caml_ldexp_float(x, y));
279
+ }
280
+
281
+ //Provides: caml_frexp_float32 const
282
+ //Requires: caml_frexp_float
283
+ //Version: >= 5.2, < 5.3
284
+ //OxCaml
285
+ const caml_frexp_float32 = caml_frexp_float; // Result is exact
286
+
287
+ //Provides: caml_copysign_float32_bytecode const
288
+ //Requires: caml_copysign_float
289
+ //Version: >= 5.2, < 5.3
290
+ //OxCaml
291
+ const caml_copysign_float32_bytecode = caml_copysign_float; // Result is exact
292
+
293
+ //Provides: caml_signbit_float32_bytecode const
294
+ //Requires: caml_signbit_float
295
+ //Version: >= 5.2, < 5.3
296
+ //OxCaml
297
+ const caml_signbit_float32_bytecode = caml_signbit_float;
298
+
299
+ //Provides: caml_expm1_float32_bytecode const
300
+ //Version: >= 5.2, < 5.3
301
+ //OxCaml
302
+ function caml_expm1_float32_bytecode(x) {
303
+ return Math.fround(Math.expm1(x));
304
+ }
305
+
306
+ //Provides: caml_exp2_float32_bytecode const
307
+ //Version: >= 5.2, < 5.3
308
+ //OxCaml
309
+ function caml_exp2_float32_bytecode(x) {
310
+ return Math.fround(Math.pow(2, x));
311
+ }
312
+
313
+ //Provides: caml_log1p_float32_bytecode const
314
+ //Version: >= 5.2, < 5.3
315
+ //OxCaml
316
+ function caml_log1p_float32_bytecode(x) {
317
+ return Math.fround(Math.log1p(x));
318
+ }
319
+
320
+ //Provides: caml_log2_float32_bytecode const
321
+ //Version: >= 5.2, < 5.3
322
+ //OxCaml
323
+ function caml_log2_float32_bytecode(x) {
324
+ return Math.fround(Math.log2(x));
325
+ }
326
+
327
+ //Provides: caml_hypot_float32_bytecode const
328
+ //Version: >= 5.2, < 5.3
329
+ //OxCaml
330
+ function caml_hypot_float32_bytecode(x, y) {
331
+ return Math.fround(Math.hypot(x, y));
332
+ }
333
+
334
+ //Provides: caml_log10_float32_bytecode const
335
+ //Version: >= 5.2, < 5.3
336
+ //OxCaml
337
+ function caml_log10_float32_bytecode(x) {
338
+ return Math.fround(Math.log10(x));
339
+ }
340
+
341
+ //Provides: caml_cosh_float32_bytecode const
342
+ //Version: >= 5.2, < 5.3
343
+ //OxCaml
344
+ function caml_cosh_float32_bytecode(x) {
345
+ return Math.fround(Math.cosh(x));
346
+ }
347
+
348
+ //Provides: caml_acosh_float32_bytecode const
349
+ //Version: >= 5.2, < 5.3
350
+ //OxCaml
351
+ function caml_acosh_float32_bytecode(x) {
352
+ return Math.fround(Math.acosh(x));
353
+ }
354
+
355
+ //Provides: caml_sinh_float32_bytecode const
356
+ //Version: >= 5.2, < 5.3
357
+ //OxCaml
358
+ function caml_sinh_float32_bytecode(x) {
359
+ return Math.fround(Math.sinh(x));
360
+ }
361
+
362
+ //Provides: caml_asinh_float32_bytecode const
363
+ //Version: >= 5.2, < 5.3
364
+ //OxCaml
365
+ function caml_asinh_float32_bytecode(x) {
366
+ return Math.fround(Math.asinh(x));
367
+ }
368
+
369
+ //Provides: caml_tanh_float32_bytecode const
370
+ //Version: >= 5.2, < 5.3
371
+ //OxCaml
372
+ function caml_tanh_float32_bytecode(x) {
373
+ return Math.fround(Math.tanh(x));
374
+ }
375
+
376
+ //Provides: caml_atanh_float32_bytecode const
377
+ //Version: >= 5.2, < 5.3
378
+ //OxCaml
379
+ function caml_atanh_float32_bytecode(x) {
380
+ return Math.fround(Math.atanh(x));
381
+ }
382
+
383
+ //Provides: caml_round_float32_bytecode const
384
+ //Requires: caml_round_float
385
+ //Alias: caml_simd_float32_round_current_bytecode
386
+ //Version: >= 5.2, < 5.3
387
+ //OxCaml
388
+ function caml_round_float32_bytecode(x) {
389
+ return Math.fround(caml_round_float(x));
390
+ }
391
+
392
+ //Provides: caml_cbrt_float32_bytecode const
393
+ //Version: >= 5.2, < 5.3
394
+ //OxCaml
395
+ function caml_cbrt_float32_bytecode(x) {
396
+ return Math.fround(Math.cbrt(x));
397
+ }
398
+
399
+ //Provides: caml_erf_float32_bytecode const
400
+ //Requires: caml_erf_float
401
+ //Version: >= 5.2, < 5.3
402
+ //OxCaml
403
+ function caml_erf_float32_bytecode(x) {
404
+ return Math.fround(caml_erf_float(x));
405
+ }
406
+
407
+ //Provides: caml_erfc_float32_bytecode const
408
+ //Requires: caml_erfc_float
409
+ //Version: >= 5.2, < 5.3
410
+ //OxCaml
411
+ function caml_erfc_float32_bytecode(x) {
412
+ return Math.fround(caml_erfc_float(x));
413
+ }
414
+
415
+ //Provides: caml_fma_float32_bytecode const
416
+ //Requires: caml_fma_float
417
+ //Version: >= 5.2, < 5.3
418
+ //OxCaml
419
+ function caml_fma_float32_bytecode(x, y, z) {
420
+ return Math.fround(caml_fma_float(x, y, z));
421
+ }
422
+
423
+ //Provides: caml_simd_float32_min_bytecode const
424
+ //Version: >= 5.2, < 5.3
425
+ //OxCaml
426
+ // Mirrors x86 MINSS: returns y when the comparison fails (NaN or equal,
427
+ // including ±0), unlike Math.min which propagates NaN and treats -0 < +0.
428
+ function caml_simd_float32_min_bytecode(x, y) {
429
+ return x < y ? x : y;
430
+ }
431
+
432
+ //Provides: caml_simd_float32_max_bytecode const
433
+ //Version: >= 5.2, < 5.3
434
+ //OxCaml
435
+ // Mirrors x86 MAXSS; see caml_simd_float32_min_bytecode.
436
+ function caml_simd_float32_max_bytecode(x, y) {
437
+ return x > y ? x : y;
438
+ }
439
+
440
+ //Provides: caml_simd_cast_float32_int64_bytecode const
441
+ //Requires: caml_int64_of_float
442
+ //Version: >= 5.2, < 5.3
443
+ //OxCaml
444
+ function caml_simd_cast_float32_int64_bytecode(x) {
445
+ return caml_int64_of_float(Math.round(x));
446
+ }
447
+
448
+ //Provides: caml_ba_uint8_getf32
449
+ //Requires: caml_ba_uint8_get32, caml_float32_of_bits_bytecode
450
+ //Version: >= 5.2, < 5.3
451
+ //OxCaml
452
+ function caml_ba_uint8_getf32(ba, i) {
453
+ return caml_float32_of_bits_bytecode(caml_ba_uint8_get32(ba, i));
454
+ }
455
+
456
+ //Provides: caml_ba_uint8_setf32
457
+ //Requires: caml_ba_uint8_set32, caml_float32_to_bits_bytecode
458
+ //Version: >= 5.2, < 5.3
459
+ //OxCaml
460
+ function caml_ba_uint8_setf32(ba, i, v) {
461
+ return caml_ba_uint8_set32(ba, i, caml_float32_to_bits_bytecode(v));
462
+ }
463
+
464
+ //Provides: caml_string_getf32
465
+ //Requires: caml_string_get32, caml_float32_of_bits_bytecode
466
+ //Version: >= 5.2, < 5.3
467
+ //OxCaml
468
+ function caml_string_getf32(ba, i) {
469
+ return caml_float32_of_bits_bytecode(caml_string_get32(ba, i));
470
+ }
471
+
472
+ //Provides: caml_bytes_getf32
473
+ //Requires: caml_bytes_get32, caml_float32_of_bits_bytecode
474
+ //Version: >= 5.2, < 5.3
475
+ //OxCaml
476
+ function caml_bytes_getf32(ba, i) {
477
+ return caml_float32_of_bits_bytecode(caml_bytes_get32(ba, i));
478
+ }
479
+
480
+ //Provides: caml_bytes_setf32
481
+ //Requires: caml_bytes_set32, caml_float32_to_bits_bytecode
482
+ //Version: >= 5.2, < 5.3
483
+ //OxCaml
484
+ function caml_bytes_setf32(ba, i, v) {
485
+ return caml_bytes_set32(ba, i, caml_float32_to_bits_bytecode(v));
486
+ }