Safe addition: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
m (→{{header|Wren}}: Minor tidy) |
||
Line 997:
However, if Wren is embedded in a suitable C program, then we can ask the latter to call it for us and pass back the result.
<syntaxhighlight lang="
class Interval {
construct new(lower, upper) {
Line 1,026:
Note that Wren's built-in print statement never displays numbers with more than 14 digit accuracy. However, if the interval bounds had been displayed directly from C with 17 digit accuracy (the maximum for the 'double' type), there would have been a marginal difference between them, namely: [1.2299999999999998, 1.2300000000000002].
<syntaxhighlight lang="c">
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
Line 1,092 ⟶ 1,094:
WrenVM* vm = wrenNewVM(&config);
const char* module = "main";
const char* fileName = "
char *script = readFile(fileName);
WrenInterpretResult result = wrenInterpret(vm, module, script);
|