MCPcopy Create free account
hub / github.com/alandefreitas/matplotplusplus / truncate

Function truncate

source/matplot/util/common.cpp:111–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109 }
110
111 double truncate(double x, double lower_bound, double upper_bound) {
112 if (x <= lower_bound) {
113 return lower_bound;
114 } else if (x >= upper_bound) {
115 return upper_bound;
116 } else {
117 return x;
118 }
119 }
120
121 std::vector<double> transform(const std::vector<double> &x,
122 const std::vector<double> &y,

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected