Skip to content

Commit bbf68f0

Browse files
committed
Bug Fix
Preventing Division by zero
1 parent 001adf5 commit bbf68f0

2 files changed

Lines changed: 3 additions & 86 deletions

File tree

src/differint.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,9 @@ T GLpoint(T alpha,
148148
T domain_start,
149149
T domain_end,
150150
std::size_t num_points) {
151-
if (num_points < 1) {
152-
throw std::invalid_argument("num_points must be at least 1");
151+
// Need at least two points to compute a meaningful step size
152+
if (num_points < 2) {
153+
throw std::invalid_argument("num_points must be at least 2");
153154
}
154155
if (domain_start > domain_end) {
155156
std::swap(domain_start, domain_end);

todo.md

Lines changed: 0 additions & 84 deletions
This file was deleted.

0 commit comments

Comments
 (0)