Skip to content

Commit 64f61d9

Browse files
Merge pull request #30 from jsoulier/main
Fix floating point round error
2 parents ac3c014 + da708cb commit 64f61d9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/cadmium/celldevs/grid/scenario.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ namespace cadmium::celldevs {
201201
throw CadmiumModelException("p must be greater than 0");
202202
}
203203
auto x = std::accumulate(distance.begin(), distance.end(), 0., [p](double sum, int v) { return sum + std::pow(std::abs(v), p); });
204-
return std::pow(x, 1 / p);
204+
return std::pow(x, 1.0 / p);
205205
}
206206

207207
/**

0 commit comments

Comments
 (0)