|
|
|
|
|
by xmprt
275 days ago
|
|
Maybe it's different since you're not native English but clamp is as intuitive for me as something like ceil or floor methods. It might not be as simple for someone who is ESL, probably because no major programming languages that I know of include clamp in their standard library like they do with min, max, ceil, floor. I'm also coming from being a Go programmer where the native library is very barebones so a lot of custom utility methods like this are inevitable. |
|
C++: https://en.cppreference.com/w/cpp/algorithm/clamp.html
.NET/C#: https://learn.microsoft.com/en-us/dotnet/api/system.math.cla...
Java: https://docs.oracle.com/en/java/javase/24/docs/api/java.base...
Ruby: https://ruby-doc.org/core-2.4.0/Comparable.html#method-i-cla...
Rust: https://doc.rust-lang.org/stable/std/primitive.f64.html#meth...