MCPcopy Create free account
hub / github.com/Apress/beginning-cpp20 / scale_range

Function scale_range

Exercises/Modules/Chapter 09/Soln9_03.cpp:79–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77}
78
79std::span<double> scale_range(std::span<double> data, double divisor)
80{
81 if (!divisor) return data; // Do nothing for a zero divisor
82
83 for (size_t i{}; i < data.size(); ++i)
84 data[i] /= divisor;
85 return data;
86}
87
88std::span<double> normalize_range(std::span<double> data)
89{

Callers 1

normalize_rangeFunction · 0.70

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected