Initial commit
Test (in pplus-core) / in-core (push) Failing after 28m44s

This commit is contained in:
alexm committed 2026-11-12 22:23:48 -05:00
commit 568474d52f
1591 files changed
+528213

No files matched your search

@@ -0,0 +1,19 @@
{
"tool": "godbolt",
"compiler": "mojo_1_2_0",
"mojoVersion": "1.2.0",
"source_sha256": "64af3a830bfe088770c17b6dab589a5944de61b88d95d11c9670da169931c145",
"stdin": "3 5 0 0 1 0 1 2 9 0 1 4 1 0 2 1 0 1 0 1 -1 3 0 0 1 -2 1 0 1 -1 end\n",
"args": "--target-cpu x86-64-v3 --fp-mode contract=off",
"asked": "2026-11-12",
"result": {
"compiled": true,
"buildStderr": "",
"executed": true,
"exitCode": 0,
"stdout": "22.0\n0.5\n0.375",
"stderr": "",
"timedOut": false,
"asm": null
}
}
@@ -0,0 +1,5 @@
def trapezoid(y: List[Float64], h: Float64) -> Float64:
var total: Float64 = (y[0] + y[len(y) - 1]) / 2.0
for i in range(1, len(y) - 1):
total = total + y[i]
return total * h
@@ -0,0 +1,5 @@
def trapezoid(y, h):
total = (y[0] + y[len(y) - 1]) / 2.0
for i in range(1, len(y) - 1):
total += y[i]
return total * h
+39
View File
@@ -0,0 +1,39 @@
{
"name": "Trapezoid",
"summary": "The integral of samples Y taken H apart, by the trapezoidal rule.",
"tags": [
"integration",
"quadrature"
],
"sources": [
{
"title": "NIST Digital Library of Mathematical Functions, section 3.5(i), the composite trapezoidal rule (equation 3.5.2)",
"url": "https://dlmf.nist.gov/3.5.i"
}
],
"cases": [
{
"call": "Trapezoid([0.0, 1.0, 4.0, 9.0, 16.0], 1.0)"
},
{
"call": "Trapezoid([1.0, 1.0], 0.5)"
},
{
"call": "Trapezoid([0.0, 0.25, 1.0], 0.5)"
}
],
"references": [
{
"lang": "python",
"level": "plain",
"file": "ref/python/plain.py",
"note": "The same sums."
},
{
"lang": "mojo",
"level": "plain",
"file": "ref/mojo/plain.mojo",
"note": "The same sums in Mojo."
}
]
}
+11
View File
@@ -0,0 +1,11 @@
// Trapezoid: the integral of samples Y taken H apart, by the composite
// trapezoidal rule: the ends count half, every inside sample counts whole.
// The error shrinks with H^2 for a smooth function.
FUNCTION Trapezoid(Y : LIST OF FLOAT, H : FLOAT) RETURNS FLOAT
REQUIRE LENGTH(Y) >= 2
DECLARE Total : FLOAT <- (Y[0] + Y[LENGTH(Y) - 1]) / 2.0
FOR I <- 1 TO LENGTH(Y) - 1
Total <- Total + Y[I]
NEXT I
RETURN Total * H
ENDFUNCTION