dhall-nix-lib/Double/abs.dhall

12 lines
266 B
Text

λ(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