max

Function max 

Source
pub fn max<R: Float>(x: R, y: R) -> R
Expand description

Primal max.

The primal follows Float::max. For differentiation, ties route the tangent/cotangent to the second argument. If exactly one input is NaN, the non-NaN input receives the gradient.

ยงExamples

use chainrules::max;

assert_eq!(max(1.5_f64, 2.5_f64), 2.5);
assert_eq!(max(2.0_f64, 2.0_f64), 2.0);