
(FPCore (x y z) :precision binary64 (* x (- 1.0 (* (- 1.0 y) z))))
double code(double x, double y, double z) {
return x * (1.0 - ((1.0 - y) * z));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x * (1.0d0 - ((1.0d0 - y) * z))
end function
public static double code(double x, double y, double z) {
return x * (1.0 - ((1.0 - y) * z));
}
def code(x, y, z): return x * (1.0 - ((1.0 - y) * z))
function code(x, y, z) return Float64(x * Float64(1.0 - Float64(Float64(1.0 - y) * z))) end
function tmp = code(x, y, z) tmp = x * (1.0 - ((1.0 - y) * z)); end
code[x_, y_, z_] := N[(x * N[(1.0 - N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(1 - \left(1 - y\right) \cdot z\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (* x (- 1.0 (* (- 1.0 y) z))))
double code(double x, double y, double z) {
return x * (1.0 - ((1.0 - y) * z));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x * (1.0d0 - ((1.0d0 - y) * z))
end function
public static double code(double x, double y, double z) {
return x * (1.0 - ((1.0 - y) * z));
}
def code(x, y, z): return x * (1.0 - ((1.0 - y) * z))
function code(x, y, z) return Float64(x * Float64(1.0 - Float64(Float64(1.0 - y) * z))) end
function tmp = code(x, y, z) tmp = x * (1.0 - ((1.0 - y) * z)); end
code[x_, y_, z_] := N[(x * N[(1.0 - N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(1 - \left(1 - y\right) \cdot z\right)
\end{array}
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (- 1.0 y))))
(if (<= t_0 -5e+224)
(* (* z x) (+ y -1.0))
(if (<= t_0 5e+296) (+ x (* x (- (* z y) z))) (* z (* x y))))))
double code(double x, double y, double z) {
double t_0 = z * (1.0 - y);
double tmp;
if (t_0 <= -5e+224) {
tmp = (z * x) * (y + -1.0);
} else if (t_0 <= 5e+296) {
tmp = x + (x * ((z * y) - z));
} else {
tmp = z * (x * y);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = z * (1.0d0 - y)
if (t_0 <= (-5d+224)) then
tmp = (z * x) * (y + (-1.0d0))
else if (t_0 <= 5d+296) then
tmp = x + (x * ((z * y) - z))
else
tmp = z * (x * y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * (1.0 - y);
double tmp;
if (t_0 <= -5e+224) {
tmp = (z * x) * (y + -1.0);
} else if (t_0 <= 5e+296) {
tmp = x + (x * ((z * y) - z));
} else {
tmp = z * (x * y);
}
return tmp;
}
def code(x, y, z): t_0 = z * (1.0 - y) tmp = 0 if t_0 <= -5e+224: tmp = (z * x) * (y + -1.0) elif t_0 <= 5e+296: tmp = x + (x * ((z * y) - z)) else: tmp = z * (x * y) return tmp
function code(x, y, z) t_0 = Float64(z * Float64(1.0 - y)) tmp = 0.0 if (t_0 <= -5e+224) tmp = Float64(Float64(z * x) * Float64(y + -1.0)); elseif (t_0 <= 5e+296) tmp = Float64(x + Float64(x * Float64(Float64(z * y) - z))); else tmp = Float64(z * Float64(x * y)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * (1.0 - y); tmp = 0.0; if (t_0 <= -5e+224) tmp = (z * x) * (y + -1.0); elseif (t_0 <= 5e+296) tmp = x + (x * ((z * y) - z)); else tmp = z * (x * y); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e+224], N[(N[(z * x), $MachinePrecision] * N[(y + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+296], N[(x + N[(x * N[(N[(z * y), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(x * y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \left(1 - y\right)\\
\mathbf{if}\;t_0 \leq -5 \cdot 10^{+224}:\\
\;\;\;\;\left(z \cdot x\right) \cdot \left(y + -1\right)\\
\mathbf{elif}\;t_0 \leq 5 \cdot 10^{+296}:\\
\;\;\;\;x + x \cdot \left(z \cdot y - z\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(x \cdot y\right)\\
\end{array}
\end{array}
if (*.f64 (-.f64 1 y) z) < -4.99999999999999964e224Initial program 77.4%
Taylor expanded in z around inf 100.0%
*-commutative100.0%
associate-*l*100.0%
sub-neg100.0%
metadata-eval100.0%
*-commutative100.0%
Simplified100.0%
if -4.99999999999999964e224 < (*.f64 (-.f64 1 y) z) < 5.0000000000000001e296Initial program 99.9%
sub-neg99.9%
distribute-rgt-in99.9%
*-un-lft-identity99.9%
distribute-rgt-neg-in99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 99.9%
mul-1-neg99.9%
unsub-neg99.9%
*-commutative99.9%
Simplified99.9%
if 5.0000000000000001e296 < (*.f64 (-.f64 1 y) z) Initial program 62.6%
Taylor expanded in y around inf 99.8%
associate-*r*62.6%
*-commutative62.6%
associate-*l*99.8%
Simplified99.8%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (- 1.0 y))))
(if (<= t_0 -5e+224)
(* (* z x) (+ y -1.0))
(if (<= t_0 5e+296) (* x (- 1.0 t_0)) (* z (* x y))))))
double code(double x, double y, double z) {
double t_0 = z * (1.0 - y);
double tmp;
if (t_0 <= -5e+224) {
tmp = (z * x) * (y + -1.0);
} else if (t_0 <= 5e+296) {
tmp = x * (1.0 - t_0);
} else {
tmp = z * (x * y);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = z * (1.0d0 - y)
if (t_0 <= (-5d+224)) then
tmp = (z * x) * (y + (-1.0d0))
else if (t_0 <= 5d+296) then
tmp = x * (1.0d0 - t_0)
else
tmp = z * (x * y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * (1.0 - y);
double tmp;
if (t_0 <= -5e+224) {
tmp = (z * x) * (y + -1.0);
} else if (t_0 <= 5e+296) {
tmp = x * (1.0 - t_0);
} else {
tmp = z * (x * y);
}
return tmp;
}
def code(x, y, z): t_0 = z * (1.0 - y) tmp = 0 if t_0 <= -5e+224: tmp = (z * x) * (y + -1.0) elif t_0 <= 5e+296: tmp = x * (1.0 - t_0) else: tmp = z * (x * y) return tmp
function code(x, y, z) t_0 = Float64(z * Float64(1.0 - y)) tmp = 0.0 if (t_0 <= -5e+224) tmp = Float64(Float64(z * x) * Float64(y + -1.0)); elseif (t_0 <= 5e+296) tmp = Float64(x * Float64(1.0 - t_0)); else tmp = Float64(z * Float64(x * y)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * (1.0 - y); tmp = 0.0; if (t_0 <= -5e+224) tmp = (z * x) * (y + -1.0); elseif (t_0 <= 5e+296) tmp = x * (1.0 - t_0); else tmp = z * (x * y); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e+224], N[(N[(z * x), $MachinePrecision] * N[(y + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+296], N[(x * N[(1.0 - t$95$0), $MachinePrecision]), $MachinePrecision], N[(z * N[(x * y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \left(1 - y\right)\\
\mathbf{if}\;t_0 \leq -5 \cdot 10^{+224}:\\
\;\;\;\;\left(z \cdot x\right) \cdot \left(y + -1\right)\\
\mathbf{elif}\;t_0 \leq 5 \cdot 10^{+296}:\\
\;\;\;\;x \cdot \left(1 - t_0\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(x \cdot y\right)\\
\end{array}
\end{array}
if (*.f64 (-.f64 1 y) z) < -4.99999999999999964e224Initial program 77.4%
Taylor expanded in z around inf 100.0%
*-commutative100.0%
associate-*l*100.0%
sub-neg100.0%
metadata-eval100.0%
*-commutative100.0%
Simplified100.0%
if -4.99999999999999964e224 < (*.f64 (-.f64 1 y) z) < 5.0000000000000001e296Initial program 99.9%
if 5.0000000000000001e296 < (*.f64 (-.f64 1 y) z) Initial program 62.6%
Taylor expanded in y around inf 99.8%
associate-*r*62.6%
*-commutative62.6%
associate-*l*99.8%
Simplified99.8%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (- 1.0 y))))
(if (<= t_0 -5e+224)
(* (* z x) (+ y -1.0))
(if (<= t_0 5e+296) (* x (+ 1.0 (- (* z y) z))) (* z (* x y))))))
double code(double x, double y, double z) {
double t_0 = z * (1.0 - y);
double tmp;
if (t_0 <= -5e+224) {
tmp = (z * x) * (y + -1.0);
} else if (t_0 <= 5e+296) {
tmp = x * (1.0 + ((z * y) - z));
} else {
tmp = z * (x * y);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = z * (1.0d0 - y)
if (t_0 <= (-5d+224)) then
tmp = (z * x) * (y + (-1.0d0))
else if (t_0 <= 5d+296) then
tmp = x * (1.0d0 + ((z * y) - z))
else
tmp = z * (x * y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * (1.0 - y);
double tmp;
if (t_0 <= -5e+224) {
tmp = (z * x) * (y + -1.0);
} else if (t_0 <= 5e+296) {
tmp = x * (1.0 + ((z * y) - z));
} else {
tmp = z * (x * y);
}
return tmp;
}
def code(x, y, z): t_0 = z * (1.0 - y) tmp = 0 if t_0 <= -5e+224: tmp = (z * x) * (y + -1.0) elif t_0 <= 5e+296: tmp = x * (1.0 + ((z * y) - z)) else: tmp = z * (x * y) return tmp
function code(x, y, z) t_0 = Float64(z * Float64(1.0 - y)) tmp = 0.0 if (t_0 <= -5e+224) tmp = Float64(Float64(z * x) * Float64(y + -1.0)); elseif (t_0 <= 5e+296) tmp = Float64(x * Float64(1.0 + Float64(Float64(z * y) - z))); else tmp = Float64(z * Float64(x * y)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * (1.0 - y); tmp = 0.0; if (t_0 <= -5e+224) tmp = (z * x) * (y + -1.0); elseif (t_0 <= 5e+296) tmp = x * (1.0 + ((z * y) - z)); else tmp = z * (x * y); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e+224], N[(N[(z * x), $MachinePrecision] * N[(y + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+296], N[(x * N[(1.0 + N[(N[(z * y), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(x * y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \left(1 - y\right)\\
\mathbf{if}\;t_0 \leq -5 \cdot 10^{+224}:\\
\;\;\;\;\left(z \cdot x\right) \cdot \left(y + -1\right)\\
\mathbf{elif}\;t_0 \leq 5 \cdot 10^{+296}:\\
\;\;\;\;x \cdot \left(1 + \left(z \cdot y - z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(x \cdot y\right)\\
\end{array}
\end{array}
if (*.f64 (-.f64 1 y) z) < -4.99999999999999964e224Initial program 77.4%
Taylor expanded in z around inf 100.0%
*-commutative100.0%
associate-*l*100.0%
sub-neg100.0%
metadata-eval100.0%
*-commutative100.0%
Simplified100.0%
if -4.99999999999999964e224 < (*.f64 (-.f64 1 y) z) < 5.0000000000000001e296Initial program 99.9%
Taylor expanded in y around 0 99.9%
mul-1-neg99.9%
distribute-lft-neg-out99.9%
+-commutative99.9%
cancel-sign-sub-inv99.9%
*-commutative99.9%
Simplified99.9%
if 5.0000000000000001e296 < (*.f64 (-.f64 1 y) z) Initial program 62.6%
Taylor expanded in y around inf 99.8%
associate-*r*62.6%
*-commutative62.6%
associate-*l*99.8%
Simplified99.8%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (* z x) (+ y -1.0))))
(if (<= z -1.0)
t_0
(if (<= z 1.18e-284)
(+ x (* (* z x) y))
(if (<= z 0.2) (+ x (* z (* x y))) t_0)))))
double code(double x, double y, double z) {
double t_0 = (z * x) * (y + -1.0);
double tmp;
if (z <= -1.0) {
tmp = t_0;
} else if (z <= 1.18e-284) {
tmp = x + ((z * x) * y);
} else if (z <= 0.2) {
tmp = x + (z * (x * y));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = (z * x) * (y + (-1.0d0))
if (z <= (-1.0d0)) then
tmp = t_0
else if (z <= 1.18d-284) then
tmp = x + ((z * x) * y)
else if (z <= 0.2d0) then
tmp = x + (z * (x * y))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (z * x) * (y + -1.0);
double tmp;
if (z <= -1.0) {
tmp = t_0;
} else if (z <= 1.18e-284) {
tmp = x + ((z * x) * y);
} else if (z <= 0.2) {
tmp = x + (z * (x * y));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (z * x) * (y + -1.0) tmp = 0 if z <= -1.0: tmp = t_0 elif z <= 1.18e-284: tmp = x + ((z * x) * y) elif z <= 0.2: tmp = x + (z * (x * y)) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(z * x) * Float64(y + -1.0)) tmp = 0.0 if (z <= -1.0) tmp = t_0; elseif (z <= 1.18e-284) tmp = Float64(x + Float64(Float64(z * x) * y)); elseif (z <= 0.2) tmp = Float64(x + Float64(z * Float64(x * y))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (z * x) * (y + -1.0); tmp = 0.0; if (z <= -1.0) tmp = t_0; elseif (z <= 1.18e-284) tmp = x + ((z * x) * y); elseif (z <= 0.2) tmp = x + (z * (x * y)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(z * x), $MachinePrecision] * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.0], t$95$0, If[LessEqual[z, 1.18e-284], N[(x + N[(N[(z * x), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.2], N[(x + N[(z * N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(z \cdot x\right) \cdot \left(y + -1\right)\\
\mathbf{if}\;z \leq -1:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 1.18 \cdot 10^{-284}:\\
\;\;\;\;x + \left(z \cdot x\right) \cdot y\\
\mathbf{elif}\;z \leq 0.2:\\
\;\;\;\;x + z \cdot \left(x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if z < -1 or 0.20000000000000001 < z Initial program 88.2%
Taylor expanded in z around inf 98.1%
*-commutative98.1%
associate-*l*98.1%
sub-neg98.1%
metadata-eval98.1%
*-commutative98.1%
Simplified98.1%
if -1 < z < 1.17999999999999993e-284Initial program 99.9%
distribute-rgt-out--100.0%
*-lft-identity100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
distribute-lft-neg-in100.0%
associate-*l*98.4%
fma-def98.4%
neg-sub098.4%
associate--r-98.4%
metadata-eval98.4%
+-commutative98.4%
*-commutative98.4%
Simplified98.4%
fma-udef98.4%
associate-*r*87.3%
Applied egg-rr87.3%
Taylor expanded in y around inf 97.4%
if 1.17999999999999993e-284 < z < 0.20000000000000001Initial program 99.9%
distribute-rgt-out--99.9%
*-lft-identity99.9%
cancel-sign-sub-inv99.9%
+-commutative99.9%
distribute-lft-neg-in99.9%
associate-*l*91.3%
fma-def91.3%
neg-sub091.3%
associate--r-91.3%
metadata-eval91.3%
+-commutative91.3%
*-commutative91.3%
Simplified91.3%
fma-udef91.3%
associate-*r*98.5%
Applied egg-rr98.5%
Taylor expanded in y around inf 97.4%
Final simplification97.7%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.0) (not (<= y 0.39))) (+ x (* (* z x) y)) (- x (* z x))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.0) || !(y <= 0.39)) {
tmp = x + ((z * x) * y);
} else {
tmp = x - (z * x);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= (-1.0d0)) .or. (.not. (y <= 0.39d0))) then
tmp = x + ((z * x) * y)
else
tmp = x - (z * x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1.0) || !(y <= 0.39)) {
tmp = x + ((z * x) * y);
} else {
tmp = x - (z * x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.0) or not (y <= 0.39): tmp = x + ((z * x) * y) else: tmp = x - (z * x) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.0) || !(y <= 0.39)) tmp = Float64(x + Float64(Float64(z * x) * y)); else tmp = Float64(x - Float64(z * x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.0) || ~((y <= 0.39))) tmp = x + ((z * x) * y); else tmp = x - (z * x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.0], N[Not[LessEqual[y, 0.39]], $MachinePrecision]], N[(x + N[(N[(z * x), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], N[(x - N[(z * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 0.39\right):\\
\;\;\;\;x + \left(z \cdot x\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;x - z \cdot x\\
\end{array}
\end{array}
if y < -1 or 0.39000000000000001 < y Initial program 88.4%
distribute-rgt-out--88.4%
*-lft-identity88.4%
cancel-sign-sub-inv88.4%
+-commutative88.4%
distribute-lft-neg-in88.4%
associate-*l*94.6%
fma-def94.6%
neg-sub094.6%
associate--r-94.6%
metadata-eval94.6%
+-commutative94.6%
*-commutative94.6%
Simplified94.6%
fma-udef94.6%
associate-*r*93.2%
Applied egg-rr93.2%
Taylor expanded in y around inf 93.4%
if -1 < y < 0.39000000000000001Initial program 99.9%
Taylor expanded in y around 0 98.7%
*-commutative98.7%
distribute-rgt-out--98.7%
*-lft-identity98.7%
Simplified98.7%
Final simplification96.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.9) (not (<= z 0.2))) (* (* z x) (+ y -1.0)) (+ x (* x (* z y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.9) || !(z <= 0.2)) {
tmp = (z * x) * (y + -1.0);
} else {
tmp = x + (x * (z * y));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-0.9d0)) .or. (.not. (z <= 0.2d0))) then
tmp = (z * x) * (y + (-1.0d0))
else
tmp = x + (x * (z * y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -0.9) || !(z <= 0.2)) {
tmp = (z * x) * (y + -1.0);
} else {
tmp = x + (x * (z * y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.9) or not (z <= 0.2): tmp = (z * x) * (y + -1.0) else: tmp = x + (x * (z * y)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.9) || !(z <= 0.2)) tmp = Float64(Float64(z * x) * Float64(y + -1.0)); else tmp = Float64(x + Float64(x * Float64(z * y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -0.9) || ~((z <= 0.2))) tmp = (z * x) * (y + -1.0); else tmp = x + (x * (z * y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.9], N[Not[LessEqual[z, 0.2]], $MachinePrecision]], N[(N[(z * x), $MachinePrecision] * N[(y + -1.0), $MachinePrecision]), $MachinePrecision], N[(x + N[(x * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.9 \lor \neg \left(z \leq 0.2\right):\\
\;\;\;\;\left(z \cdot x\right) \cdot \left(y + -1\right)\\
\mathbf{else}:\\
\;\;\;\;x + x \cdot \left(z \cdot y\right)\\
\end{array}
\end{array}
if z < -0.900000000000000022 or 0.20000000000000001 < z Initial program 88.2%
Taylor expanded in z around inf 98.1%
*-commutative98.1%
associate-*l*98.1%
sub-neg98.1%
metadata-eval98.1%
*-commutative98.1%
Simplified98.1%
if -0.900000000000000022 < z < 0.20000000000000001Initial program 99.9%
distribute-rgt-out--99.9%
*-lft-identity99.9%
cancel-sign-sub-inv99.9%
+-commutative99.9%
distribute-lft-neg-in99.9%
associate-*l*94.7%
fma-def94.7%
neg-sub094.7%
associate--r-94.7%
metadata-eval94.7%
+-commutative94.7%
*-commutative94.7%
Simplified94.7%
fma-udef94.7%
associate-*r*93.2%
Applied egg-rr93.2%
add-cube-cbrt92.8%
pow392.8%
Applied egg-rr92.8%
Taylor expanded in y around inf 93.6%
associate-*r*98.9%
Simplified98.9%
Final simplification98.5%
(FPCore (x y z) :precision binary64 (if (<= z 3.3e-283) (+ x (* (* z x) (+ y -1.0))) (- x (* z (* x (- 1.0 y))))))
double code(double x, double y, double z) {
double tmp;
if (z <= 3.3e-283) {
tmp = x + ((z * x) * (y + -1.0));
} else {
tmp = x - (z * (x * (1.0 - y)));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= 3.3d-283) then
tmp = x + ((z * x) * (y + (-1.0d0)))
else
tmp = x - (z * (x * (1.0d0 - y)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 3.3e-283) {
tmp = x + ((z * x) * (y + -1.0));
} else {
tmp = x - (z * (x * (1.0 - y)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 3.3e-283: tmp = x + ((z * x) * (y + -1.0)) else: tmp = x - (z * (x * (1.0 - y))) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 3.3e-283) tmp = Float64(x + Float64(Float64(z * x) * Float64(y + -1.0))); else tmp = Float64(x - Float64(z * Float64(x * Float64(1.0 - y)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 3.3e-283) tmp = x + ((z * x) * (y + -1.0)); else tmp = x - (z * (x * (1.0 - y))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 3.3e-283], N[(x + N[(N[(z * x), $MachinePrecision] * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(z * N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 3.3 \cdot 10^{-283}:\\
\;\;\;\;x + \left(z \cdot x\right) \cdot \left(y + -1\right)\\
\mathbf{else}:\\
\;\;\;\;x - z \cdot \left(x \cdot \left(1 - y\right)\right)\\
\end{array}
\end{array}
if z < 3.30000000000000019e-283Initial program 95.1%
Taylor expanded in y around 0 92.3%
*-commutative92.3%
sub-neg92.3%
distribute-rgt-in92.3%
*-un-lft-identity92.3%
Applied egg-rr92.3%
Taylor expanded in y around 0 92.3%
associate-+r+92.3%
distribute-rgt-out99.1%
Simplified99.1%
if 3.30000000000000019e-283 < z Initial program 93.2%
distribute-rgt-out--93.2%
*-lft-identity93.2%
cancel-sign-sub-inv93.2%
+-commutative93.2%
distribute-lft-neg-in93.2%
associate-*l*95.7%
fma-def95.7%
neg-sub095.7%
associate--r-95.7%
metadata-eval95.7%
+-commutative95.7%
*-commutative95.7%
Simplified95.7%
fma-udef95.7%
associate-*r*99.2%
Applied egg-rr99.2%
Final simplification99.1%
(FPCore (x y z) :precision binary64 (if (or (<= y -9.5e-143) (not (<= y 4.8e+82))) (* x (* z y)) x))
double code(double x, double y, double z) {
double tmp;
if ((y <= -9.5e-143) || !(y <= 4.8e+82)) {
tmp = x * (z * y);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= (-9.5d-143)) .or. (.not. (y <= 4.8d+82))) then
tmp = x * (z * y)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -9.5e-143) || !(y <= 4.8e+82)) {
tmp = x * (z * y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -9.5e-143) or not (y <= 4.8e+82): tmp = x * (z * y) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -9.5e-143) || !(y <= 4.8e+82)) tmp = Float64(x * Float64(z * y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -9.5e-143) || ~((y <= 4.8e+82))) tmp = x * (z * y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -9.5e-143], N[Not[LessEqual[y, 4.8e+82]], $MachinePrecision]], N[(x * N[(z * y), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.5 \cdot 10^{-143} \lor \neg \left(y \leq 4.8 \cdot 10^{+82}\right):\\
\;\;\;\;x \cdot \left(z \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -9.4999999999999993e-143 or 4.79999999999999996e82 < y Initial program 89.4%
Taylor expanded in y around inf 79.6%
mul-1-neg79.6%
distribute-lft-neg-out79.6%
*-commutative79.6%
Simplified79.6%
Taylor expanded in z around inf 61.4%
*-commutative61.4%
Simplified61.4%
if -9.4999999999999993e-143 < y < 4.79999999999999996e82Initial program 99.2%
Taylor expanded in z around 0 58.9%
Final simplification60.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.4e-30) (not (<= z 1.4e-45))) (* (* z x) y) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.4e-30) || !(z <= 1.4e-45)) {
tmp = (z * x) * y;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-1.4d-30)) .or. (.not. (z <= 1.4d-45))) then
tmp = (z * x) * y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.4e-30) || !(z <= 1.4e-45)) {
tmp = (z * x) * y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.4e-30) or not (z <= 1.4e-45): tmp = (z * x) * y else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.4e-30) || !(z <= 1.4e-45)) tmp = Float64(Float64(z * x) * y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.4e-30) || ~((z <= 1.4e-45))) tmp = (z * x) * y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.4e-30], N[Not[LessEqual[z, 1.4e-45]], $MachinePrecision]], N[(N[(z * x), $MachinePrecision] * y), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.4 \cdot 10^{-30} \lor \neg \left(z \leq 1.4 \cdot 10^{-45}\right):\\
\;\;\;\;\left(z \cdot x\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.39999999999999994e-30 or 1.4000000000000001e-45 < z Initial program 89.7%
Taylor expanded in y around inf 57.3%
if -1.39999999999999994e-30 < z < 1.4000000000000001e-45Initial program 99.9%
Taylor expanded in z around 0 79.8%
Final simplification67.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -6.2e+44) (not (<= y 2.55e+79))) (* z (* x y)) (- x (* z x))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -6.2e+44) || !(y <= 2.55e+79)) {
tmp = z * (x * y);
} else {
tmp = x - (z * x);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= (-6.2d+44)) .or. (.not. (y <= 2.55d+79))) then
tmp = z * (x * y)
else
tmp = x - (z * x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -6.2e+44) || !(y <= 2.55e+79)) {
tmp = z * (x * y);
} else {
tmp = x - (z * x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -6.2e+44) or not (y <= 2.55e+79): tmp = z * (x * y) else: tmp = x - (z * x) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -6.2e+44) || !(y <= 2.55e+79)) tmp = Float64(z * Float64(x * y)); else tmp = Float64(x - Float64(z * x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -6.2e+44) || ~((y <= 2.55e+79))) tmp = z * (x * y); else tmp = x - (z * x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -6.2e+44], N[Not[LessEqual[y, 2.55e+79]], $MachinePrecision]], N[(z * N[(x * y), $MachinePrecision]), $MachinePrecision], N[(x - N[(z * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.2 \cdot 10^{+44} \lor \neg \left(y \leq 2.55 \cdot 10^{+79}\right):\\
\;\;\;\;z \cdot \left(x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;x - z \cdot x\\
\end{array}
\end{array}
if y < -6.19999999999999991e44 or 2.5500000000000001e79 < y Initial program 86.5%
Taylor expanded in y around inf 76.9%
associate-*r*70.0%
*-commutative70.0%
associate-*l*82.3%
Simplified82.3%
if -6.19999999999999991e44 < y < 2.5500000000000001e79Initial program 99.3%
Taylor expanded in y around 0 93.3%
*-commutative93.3%
distribute-rgt-out--93.3%
*-lft-identity93.3%
Simplified93.3%
Final simplification88.8%
(FPCore (x y z) :precision binary64 (+ x (* (* z x) (+ y -1.0))))
double code(double x, double y, double z) {
return x + ((z * x) * (y + -1.0));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + ((z * x) * (y + (-1.0d0)))
end function
public static double code(double x, double y, double z) {
return x + ((z * x) * (y + -1.0));
}
def code(x, y, z): return x + ((z * x) * (y + -1.0))
function code(x, y, z) return Float64(x + Float64(Float64(z * x) * Float64(y + -1.0))) end
function tmp = code(x, y, z) tmp = x + ((z * x) * (y + -1.0)); end
code[x_, y_, z_] := N[(x + N[(N[(z * x), $MachinePrecision] * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(z \cdot x\right) \cdot \left(y + -1\right)
\end{array}
Initial program 94.1%
Taylor expanded in y around 0 91.8%
*-commutative91.8%
sub-neg91.8%
distribute-rgt-in91.8%
*-un-lft-identity91.8%
Applied egg-rr91.8%
Taylor expanded in y around 0 91.8%
associate-+r+91.8%
distribute-rgt-out97.2%
Simplified97.2%
Final simplification97.2%
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
return x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x
end function
public static double code(double x, double y, double z) {
return x;
}
def code(x, y, z): return x
function code(x, y, z) return x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 94.1%
Taylor expanded in z around 0 38.9%
Final simplification38.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (- 1.0 (* (- 1.0 y) z))))
(t_1 (+ x (* (- 1.0 y) (* (- z) x)))))
(if (< t_0 -1.618195973607049e+50)
t_1
(if (< t_0 3.892237649663903e+134) (- (* (* x y) z) (- (* x z) x)) t_1))))
double code(double x, double y, double z) {
double t_0 = x * (1.0 - ((1.0 - y) * z));
double t_1 = x + ((1.0 - y) * (-z * x));
double tmp;
if (t_0 < -1.618195973607049e+50) {
tmp = t_1;
} else if (t_0 < 3.892237649663903e+134) {
tmp = ((x * y) * z) - ((x * z) - x);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x * (1.0d0 - ((1.0d0 - y) * z))
t_1 = x + ((1.0d0 - y) * (-z * x))
if (t_0 < (-1.618195973607049d+50)) then
tmp = t_1
else if (t_0 < 3.892237649663903d+134) then
tmp = ((x * y) * z) - ((x * z) - x)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * (1.0 - ((1.0 - y) * z));
double t_1 = x + ((1.0 - y) * (-z * x));
double tmp;
if (t_0 < -1.618195973607049e+50) {
tmp = t_1;
} else if (t_0 < 3.892237649663903e+134) {
tmp = ((x * y) * z) - ((x * z) - x);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = x * (1.0 - ((1.0 - y) * z)) t_1 = x + ((1.0 - y) * (-z * x)) tmp = 0 if t_0 < -1.618195973607049e+50: tmp = t_1 elif t_0 < 3.892237649663903e+134: tmp = ((x * y) * z) - ((x * z) - x) else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(x * Float64(1.0 - Float64(Float64(1.0 - y) * z))) t_1 = Float64(x + Float64(Float64(1.0 - y) * Float64(Float64(-z) * x))) tmp = 0.0 if (t_0 < -1.618195973607049e+50) tmp = t_1; elseif (t_0 < 3.892237649663903e+134) tmp = Float64(Float64(Float64(x * y) * z) - Float64(Float64(x * z) - x)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (1.0 - ((1.0 - y) * z)); t_1 = x + ((1.0 - y) * (-z * x)); tmp = 0.0; if (t_0 < -1.618195973607049e+50) tmp = t_1; elseif (t_0 < 3.892237649663903e+134) tmp = ((x * y) * z) - ((x * z) - x); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(1.0 - N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x + N[(N[(1.0 - y), $MachinePrecision] * N[((-z) * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$0, -1.618195973607049e+50], t$95$1, If[Less[t$95$0, 3.892237649663903e+134], N[(N[(N[(x * y), $MachinePrecision] * z), $MachinePrecision] - N[(N[(x * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(1 - \left(1 - y\right) \cdot z\right)\\
t_1 := x + \left(1 - y\right) \cdot \left(\left(-z\right) \cdot x\right)\\
\mathbf{if}\;t_0 < -1.618195973607049 \cdot 10^{+50}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_0 < 3.892237649663903 \cdot 10^{+134}:\\
\;\;\;\;\left(x \cdot y\right) \cdot z - \left(x \cdot z - x\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
herbie shell --seed 2023196
(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))))