Skip to content

Commit 6bc0f7b

Browse files
authored
JavaScript: import all the math functions and constants.
2 parents 3873a5e + 0e2c40b commit 6bc0f7b

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

src/support/cellml/cellmlfileruntime.cpp

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,18 @@ void *instantiateWebAssemblyModule(UnsignedChars pWasmModule, bool pDifferential
6060
// Arithmetic operators.
6161

6262
pow: Math.pow,
63-
// sqrt() is not needed.
64-
// fabs() is not needed.
63+
sqrt: Math.sqrt,
64+
fabs: Math.abs,
6565
exp: Math.exp,
66-
// log() is not needed.
67-
// log10() is not needed.
68-
// ceil() is not needed.
69-
// floor() is not needed.
70-
// fmin() is not needed.
71-
// fmax() is not needed.
72-
// fmod() is not needed.
66+
log: Math.log,
67+
log10: Math.log10,
68+
ceil: Math.ceil,
69+
floor: Math.floor,
70+
fmin: Math.min,
71+
fmax: Math.max,
72+
fmod: function(x, y) {
73+
return x % y;
74+
},
7375

7476
// Trigonometric operators.
7577

@@ -88,8 +90,8 @@ void *instantiateWebAssemblyModule(UnsignedChars pWasmModule, bool pDifferential
8890

8991
// Constants.
9092

91-
// INFINITY is not needed.
92-
// NAN is not needed.
93+
INFINITY: Infinity,
94+
NAN: NaN
9395
}
9496
});
9597

0 commit comments

Comments
 (0)