Skip to content

Commit 2e1ba82

Browse files
Shaked Shlomoclaude
authored andcommitted
Fix misleading error message in MidpointIntegration
The validation throws when N <= 0, and the docstring states 'N must be > 0', but the message claimed 'N has to be >= 2'. N = 1 is valid for the midpoint rule, so the message now matches the actual check. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 5c39e87 commit 2e1ba82

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Maths/MidpointIntegration.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function integralEvaluation(N, a, b, func) {
2323
throw new TypeError('Expected integer N and finite a, b')
2424
}
2525
if (N <= 0) {
26-
throw Error('N has to be >= 2')
26+
throw Error('N has to be > 0')
2727
} // check if N > 0
2828
if (a > b) {
2929
throw Error('a must be less or equal than b')

0 commit comments

Comments
 (0)