dhall-nix-lib/Double/abs.dhall

13 lines
266 B
Text
Raw Normal View History

λ(nix : ../NixPrelude.dhall) →
let isZero = ./isZero.dhall nix
let clamp = ./clamp.dhall nix
let negate = ./negate.dhall nix
let abs
: Double → Double
= λ(n : Double) → if isZero (clamp n) then clamp (negate n) else clamp n
in abs