All examplesScientific computing Install Aner
Exact decimal parallel output
Compare serial and local concurrent typed Decimal results, preserve exact text and inspect deterministic seeds.
import aner.parallel
fn copy_and_add(parameters: List, iteration: Int64, seed: Int64,
output: OutputRegion<Decimal>) -> Unit {
let input = cast<FrozenArray<Decimal>>(parameters.get(0))
let step = cast<Decimal>(parameters.get(1))
let terms = DynamicArray<Decimal>(capacity: 2)
terms.append(step)
terms.append(D(0.2))
output[0] = input.get(iteration)
output[1] = terms.sum()
}
let values = Array<Decimal>(size: 3, fill: D(0))
values[0] = D("1234567890123456789012345678901234")
values[1] = D("0.1000")
values[2] = D("-0.00")
let input = values.snapshot()
let serial = parallel.repeat(3, copy_and_add, List(input, D("0.1000")),
output_shape: List(2), execution: parallel.local(1), seed: 42)
let concurrent = parallel.repeat(3, copy_and_add, List(input, D("0.1000")),
output_shape: List(2), execution: parallel.local(), seed: 42)
var equivalent = true
for iteration in Range(3) {
if String(serial[iteration, 0]) != String(concurrent[iteration, 0]) { equivalent = false }
if concurrent[iteration, 1] != D(0.3) { equivalent = false }
if serial.seed(iteration) != concurrent.seed(iteration) { equivalent = false }
}
print(equivalent)
print(String(concurrent[0, 0]))
print(String(concurrent[1, 0]))
print(String(concurrent[2, 0]))
print(dtype(concurrent))
print(concurrent.bytes())
Make it your experiment.
Use a compatible Aner runtime. Save this program as examples/parallel/repeat_decimal.aner inside a folder for your experiment. Open a terminal in that folder, then check and run the program.
aner check examples/parallel/repeat_decimal.aner
aner run examples/parallel/repeat_decimal.anerThe aner command must be on your PATH. Follow the installation guide if your terminal cannot find it.
Use a compatible current native Aner executable. This complete example runs locally with the declared inputs; the guide explains exact shapes, expected results and resource limits.
Bundled datasets retain their own source attribution and license notices. Example outcomes are not comparative benchmarks or evidence of clinical validity.
Dataset sources & attribution