(FPCore (x y z) :precision binary64 (* x (- 1.0 (* (- 1.0 y) z))))
(FPCore (x y z)
:precision binary64
(if (<= z -1e+136)
(fma (+ y -1.0) (* z x) x)
(if (<= z 3.4472072448506344e-29)
(* x (fma z (+ y -1.0) 1.0))
(fma z (- (* y x) x) x))))double code(double x, double y, double z) {
return x * (1.0 - ((1.0 - y) * z));
}
double code(double x, double y, double z) {
double tmp;
if (z <= -1e+136) {
tmp = fma((y + -1.0), (z * x), x);
} else if (z <= 3.4472072448506344e-29) {
tmp = x * fma(z, (y + -1.0), 1.0);
} else {
tmp = fma(z, ((y * x) - x), x);
}
return tmp;
}
function code(x, y, z) return Float64(x * Float64(1.0 - Float64(Float64(1.0 - y) * z))) end
function code(x, y, z) tmp = 0.0 if (z <= -1e+136) tmp = fma(Float64(y + -1.0), Float64(z * x), x); elseif (z <= 3.4472072448506344e-29) tmp = Float64(x * fma(z, Float64(y + -1.0), 1.0)); else tmp = fma(z, Float64(Float64(y * x) - x), x); end return tmp end
code[x_, y_, z_] := N[(x * N[(1.0 - N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_] := If[LessEqual[z, -1e+136], N[(N[(y + -1.0), $MachinePrecision] * N[(z * x), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 3.4472072448506344e-29], N[(x * N[(z * N[(y + -1.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(z * N[(N[(y * x), $MachinePrecision] - x), $MachinePrecision] + x), $MachinePrecision]]]
x \cdot \left(1 - \left(1 - y\right) \cdot z\right)
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{+136}:\\
\;\;\;\;\mathsf{fma}\left(y + -1, z \cdot x, x\right)\\
\mathbf{elif}\;z \leq 3.4472072448506344 \cdot 10^{-29}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(z, y + -1, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, y \cdot x - x, x\right)\\
\end{array}
| Original | 3.5 |
|---|---|
| Target | 0.3 |
| Herbie | 0.6 |
if z < -1.00000000000000006e136Initial program 13.4
Taylor expanded in z around 0 0.1
Applied egg-rr0.1
if -1.00000000000000006e136 < z < 3.44720724485063437e-29Initial program 0.8
Taylor expanded in z around 0 4.6
Applied egg-rr0.8
if 3.44720724485063437e-29 < z Initial program 7.9
Simplified0.1
Final simplification0.6
herbie shell --seed 2022192
(FPCore (x y z)
:name "Data.Colour.RGBSpace.HSV:hsv from colour-2.3.3, J"
:precision binary64
:herbie-target
(if (< (* x (- 1.0 (* (- 1.0 y) z))) -1.618195973607049e+50) (+ x (* (- 1.0 y) (* (- z) x))) (if (< (* x (- 1.0 (* (- 1.0 y) z))) 3.892237649663903e+134) (- (* (* x y) z) (- (* x z) x)) (+ x (* (- 1.0 y) (* (- z) x)))))
(* x (- 1.0 (* (- 1.0 y) z))))