October 17, 2021
https://issues.dlang.org/show_bug.cgi?id=22414

          Issue ID: 22414
           Summary: clamp(a, b, c) should always return typeof(a)
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody@puremagic.com
          Reporter: andrei@erdani.com

"I will now clamp this value between this limits" has the implied contract that you get the same type as that of the initial value.

Using min and max in the implementation of clamp is specious; in min and max there is no "preferred" type so they use a fair method of choosing the type of the result. In contrast, clamp is about a value that occasionally is forced to a limit.

--