
(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 9 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 (if (or (<= z -2e-31) (not (<= z 1.42e-11))) (fma (* (- y 1.0) x) z x) (fma (* z y) x x)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2e-31) || !(z <= 1.42e-11)) {
tmp = fma(((y - 1.0) * x), z, x);
} else {
tmp = fma((z * y), x, x);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((z <= -2e-31) || !(z <= 1.42e-11)) tmp = fma(Float64(Float64(y - 1.0) * x), z, x); else tmp = fma(Float64(z * y), x, x); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[z, -2e-31], N[Not[LessEqual[z, 1.42e-11]], $MachinePrecision]], N[(N[(N[(y - 1.0), $MachinePrecision] * x), $MachinePrecision] * z + x), $MachinePrecision], N[(N[(z * y), $MachinePrecision] * x + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2 \cdot 10^{-31} \lor \neg \left(z \leq 1.42 \cdot 10^{-11}\right):\\
\;\;\;\;\mathsf{fma}\left(\left(y - 1\right) \cdot x, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z \cdot y, x, x\right)\\
\end{array}
\end{array}
if z < -2e-31 or 1.42e-11 < z Initial program 92.2%
Applied rewrites99.9%
if -2e-31 < z < 1.42e-11Initial program 99.9%
Applied rewrites93.8%
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift--.f64N/A
sub-negN/A
remove-double-negN/A
distribute-neg-inN/A
+-commutativeN/A
sub-negN/A
lift--.f64N/A
neg-mul-1N/A
associate-*r*N/A
lift--.f64N/A
neg-mul-1N/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in y around inf
lower-*.f6499.9
Applied rewrites99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (* z (- y 1.0)) x)) (t_1 (* (- 1.0 y) z)))
(if (<= t_1 (- INFINITY))
(* (* z x) y)
(if (<= t_1 -5e+16)
t_0
(if (<= t_1 10000.0)
(fma (* z y) x x)
(if (<= t_1 4e+307) t_0 (* (* y x) z)))))))
double code(double x, double y, double z) {
double t_0 = (z * (y - 1.0)) * x;
double t_1 = (1.0 - y) * z;
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (z * x) * y;
} else if (t_1 <= -5e+16) {
tmp = t_0;
} else if (t_1 <= 10000.0) {
tmp = fma((z * y), x, x);
} else if (t_1 <= 4e+307) {
tmp = t_0;
} else {
tmp = (y * x) * z;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(z * Float64(y - 1.0)) * x) t_1 = Float64(Float64(1.0 - y) * z) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(z * x) * y); elseif (t_1 <= -5e+16) tmp = t_0; elseif (t_1 <= 10000.0) tmp = fma(Float64(z * y), x, x); elseif (t_1 <= 4e+307) tmp = t_0; else tmp = Float64(Float64(y * x) * z); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(z * N[(y - 1.0), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]}, Block[{t$95$1 = N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(z * x), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t$95$1, -5e+16], t$95$0, If[LessEqual[t$95$1, 10000.0], N[(N[(z * y), $MachinePrecision] * x + x), $MachinePrecision], If[LessEqual[t$95$1, 4e+307], t$95$0, N[(N[(y * x), $MachinePrecision] * z), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(z \cdot \left(y - 1\right)\right) \cdot x\\
t_1 := \left(1 - y\right) \cdot z\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\left(z \cdot x\right) \cdot y\\
\mathbf{elif}\;t\_1 \leq -5 \cdot 10^{+16}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 10000:\\
\;\;\;\;\mathsf{fma}\left(z \cdot y, x, x\right)\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+307}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot x\right) \cdot z\\
\end{array}
\end{array}
if (*.f64 (-.f64 #s(literal 1 binary64) y) z) < -inf.0Initial program 68.5%
Taylor expanded in y around inf
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6499.9
Applied rewrites99.9%
if -inf.0 < (*.f64 (-.f64 #s(literal 1 binary64) y) z) < -5e16 or 1e4 < (*.f64 (-.f64 #s(literal 1 binary64) y) z) < 3.99999999999999994e307Initial program 99.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6499.3
Applied rewrites99.3%
if -5e16 < (*.f64 (-.f64 #s(literal 1 binary64) y) z) < 1e4Initial program 100.0%
Applied rewrites98.2%
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift--.f64N/A
sub-negN/A
remove-double-negN/A
distribute-neg-inN/A
+-commutativeN/A
sub-negN/A
lift--.f64N/A
neg-mul-1N/A
associate-*r*N/A
lift--.f64N/A
neg-mul-1N/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in y around inf
lower-*.f6498.7
Applied rewrites98.7%
if 3.99999999999999994e307 < (*.f64 (-.f64 #s(literal 1 binary64) y) z) Initial program 69.9%
Taylor expanded in y around inf
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6499.8
Applied rewrites99.8%
Applied rewrites100.0%
Final simplification99.2%
(FPCore (x y z) :precision binary64 (if (or (<= (- 1.0 y) -0.05) (not (<= (- 1.0 y) 2.0))) (fma (* z y) x x) (* (- 1.0 z) x)))
double code(double x, double y, double z) {
double tmp;
if (((1.0 - y) <= -0.05) || !((1.0 - y) <= 2.0)) {
tmp = fma((z * y), x, x);
} else {
tmp = (1.0 - z) * x;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((Float64(1.0 - y) <= -0.05) || !(Float64(1.0 - y) <= 2.0)) tmp = fma(Float64(z * y), x, x); else tmp = Float64(Float64(1.0 - z) * x); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[N[(1.0 - y), $MachinePrecision], -0.05], N[Not[LessEqual[N[(1.0 - y), $MachinePrecision], 2.0]], $MachinePrecision]], N[(N[(z * y), $MachinePrecision] * x + x), $MachinePrecision], N[(N[(1.0 - z), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;1 - y \leq -0.05 \lor \neg \left(1 - y \leq 2\right):\\
\;\;\;\;\mathsf{fma}\left(z \cdot y, x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - z\right) \cdot x\\
\end{array}
\end{array}
if (-.f64 #s(literal 1 binary64) y) < -0.050000000000000003 or 2 < (-.f64 #s(literal 1 binary64) y) Initial program 92.1%
Applied rewrites94.3%
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift--.f64N/A
sub-negN/A
remove-double-negN/A
distribute-neg-inN/A
+-commutativeN/A
sub-negN/A
lift--.f64N/A
neg-mul-1N/A
associate-*r*N/A
lift--.f64N/A
neg-mul-1N/A
lower-fma.f64N/A
Applied rewrites92.1%
Taylor expanded in y around inf
lower-*.f6491.5
Applied rewrites91.5%
if -0.050000000000000003 < (-.f64 #s(literal 1 binary64) y) < 2Initial program 100.0%
Taylor expanded in y around 0
lower--.f6498.7
Applied rewrites98.7%
Final simplification94.9%
(FPCore (x y z) :precision binary64 (if (or (<= (- 1.0 y) -2e+37) (not (<= (- 1.0 y) 5e+38))) (* (* y x) z) (* (- 1.0 z) x)))
double code(double x, double y, double z) {
double tmp;
if (((1.0 - y) <= -2e+37) || !((1.0 - y) <= 5e+38)) {
tmp = (y * x) * z;
} else {
tmp = (1.0 - 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 (((1.0d0 - y) <= (-2d+37)) .or. (.not. ((1.0d0 - y) <= 5d+38))) then
tmp = (y * x) * z
else
tmp = (1.0d0 - z) * x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (((1.0 - y) <= -2e+37) || !((1.0 - y) <= 5e+38)) {
tmp = (y * x) * z;
} else {
tmp = (1.0 - z) * x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if ((1.0 - y) <= -2e+37) or not ((1.0 - y) <= 5e+38): tmp = (y * x) * z else: tmp = (1.0 - z) * x return tmp
function code(x, y, z) tmp = 0.0 if ((Float64(1.0 - y) <= -2e+37) || !(Float64(1.0 - y) <= 5e+38)) tmp = Float64(Float64(y * x) * z); else tmp = Float64(Float64(1.0 - z) * x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (((1.0 - y) <= -2e+37) || ~(((1.0 - y) <= 5e+38))) tmp = (y * x) * z; else tmp = (1.0 - z) * x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[N[(1.0 - y), $MachinePrecision], -2e+37], N[Not[LessEqual[N[(1.0 - y), $MachinePrecision], 5e+38]], $MachinePrecision]], N[(N[(y * x), $MachinePrecision] * z), $MachinePrecision], N[(N[(1.0 - z), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;1 - y \leq -2 \cdot 10^{+37} \lor \neg \left(1 - y \leq 5 \cdot 10^{+38}\right):\\
\;\;\;\;\left(y \cdot x\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;\left(1 - z\right) \cdot x\\
\end{array}
\end{array}
if (-.f64 #s(literal 1 binary64) y) < -1.99999999999999991e37 or 4.9999999999999997e38 < (-.f64 #s(literal 1 binary64) y) Initial program 90.8%
Taylor expanded in y around inf
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6477.6
Applied rewrites77.6%
Applied rewrites79.1%
if -1.99999999999999991e37 < (-.f64 #s(literal 1 binary64) y) < 4.9999999999999997e38Initial program 100.0%
Taylor expanded in y around 0
lower--.f6495.8
Applied rewrites95.8%
Final simplification88.3%
(FPCore (x y z) :precision binary64 (if (or (<= (- 1.0 y) -2e+37) (not (<= (- 1.0 y) 5e+38))) (* (* z x) y) (* (- 1.0 z) x)))
double code(double x, double y, double z) {
double tmp;
if (((1.0 - y) <= -2e+37) || !((1.0 - y) <= 5e+38)) {
tmp = (z * x) * y;
} else {
tmp = (1.0 - 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 (((1.0d0 - y) <= (-2d+37)) .or. (.not. ((1.0d0 - y) <= 5d+38))) then
tmp = (z * x) * y
else
tmp = (1.0d0 - z) * x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (((1.0 - y) <= -2e+37) || !((1.0 - y) <= 5e+38)) {
tmp = (z * x) * y;
} else {
tmp = (1.0 - z) * x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if ((1.0 - y) <= -2e+37) or not ((1.0 - y) <= 5e+38): tmp = (z * x) * y else: tmp = (1.0 - z) * x return tmp
function code(x, y, z) tmp = 0.0 if ((Float64(1.0 - y) <= -2e+37) || !(Float64(1.0 - y) <= 5e+38)) tmp = Float64(Float64(z * x) * y); else tmp = Float64(Float64(1.0 - z) * x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (((1.0 - y) <= -2e+37) || ~(((1.0 - y) <= 5e+38))) tmp = (z * x) * y; else tmp = (1.0 - z) * x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[N[(1.0 - y), $MachinePrecision], -2e+37], N[Not[LessEqual[N[(1.0 - y), $MachinePrecision], 5e+38]], $MachinePrecision]], N[(N[(z * x), $MachinePrecision] * y), $MachinePrecision], N[(N[(1.0 - z), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;1 - y \leq -2 \cdot 10^{+37} \lor \neg \left(1 - y \leq 5 \cdot 10^{+38}\right):\\
\;\;\;\;\left(z \cdot x\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;\left(1 - z\right) \cdot x\\
\end{array}
\end{array}
if (-.f64 #s(literal 1 binary64) y) < -1.99999999999999991e37 or 4.9999999999999997e38 < (-.f64 #s(literal 1 binary64) y) Initial program 90.8%
Taylor expanded in y around inf
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6477.6
Applied rewrites77.6%
if -1.99999999999999991e37 < (-.f64 #s(literal 1 binary64) y) < 4.9999999999999997e38Initial program 100.0%
Taylor expanded in y around 0
lower--.f6495.8
Applied rewrites95.8%
Final simplification87.6%
(FPCore (x y z) :precision binary64 (if (<= x 1e-97) (fma (* (- y 1.0) x) z x) (fma (* z (- y 1.0)) x x)))
double code(double x, double y, double z) {
double tmp;
if (x <= 1e-97) {
tmp = fma(((y - 1.0) * x), z, x);
} else {
tmp = fma((z * (y - 1.0)), x, x);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 1e-97) tmp = fma(Float64(Float64(y - 1.0) * x), z, x); else tmp = fma(Float64(z * Float64(y - 1.0)), x, x); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 1e-97], N[(N[(N[(y - 1.0), $MachinePrecision] * x), $MachinePrecision] * z + x), $MachinePrecision], N[(N[(z * N[(y - 1.0), $MachinePrecision]), $MachinePrecision] * x + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 10^{-97}:\\
\;\;\;\;\mathsf{fma}\left(\left(y - 1\right) \cdot x, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z \cdot \left(y - 1\right), x, x\right)\\
\end{array}
\end{array}
if x < 1.00000000000000004e-97Initial program 94.0%
Applied rewrites97.7%
if 1.00000000000000004e-97 < x Initial program 100.0%
Applied rewrites99.9%
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift--.f64N/A
sub-negN/A
remove-double-negN/A
distribute-neg-inN/A
+-commutativeN/A
sub-negN/A
lift--.f64N/A
neg-mul-1N/A
associate-*r*N/A
lift--.f64N/A
neg-mul-1N/A
lower-fma.f64N/A
Applied rewrites100.0%
Final simplification98.4%
(FPCore (x y z) :precision binary64 (if (or (<= z -2.5e-8) (not (<= z 0.0122))) (* (- z) x) (* 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.5e-8) || !(z <= 0.0122)) {
tmp = -z * x;
} else {
tmp = 1.0 * 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 <= (-2.5d-8)) .or. (.not. (z <= 0.0122d0))) then
tmp = -z * x
else
tmp = 1.0d0 * x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -2.5e-8) || !(z <= 0.0122)) {
tmp = -z * x;
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.5e-8) or not (z <= 0.0122): tmp = -z * x else: tmp = 1.0 * x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2.5e-8) || !(z <= 0.0122)) tmp = Float64(Float64(-z) * x); else tmp = Float64(1.0 * x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -2.5e-8) || ~((z <= 0.0122))) tmp = -z * x; else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.5e-8], N[Not[LessEqual[z, 0.0122]], $MachinePrecision]], N[((-z) * x), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.5 \cdot 10^{-8} \lor \neg \left(z \leq 0.0122\right):\\
\;\;\;\;\left(-z\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
\end{array}
if z < -2.4999999999999999e-8 or 0.0122000000000000008 < z Initial program 92.0%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6490.9
Applied rewrites90.9%
Taylor expanded in y around 0
Applied rewrites56.1%
if -2.4999999999999999e-8 < z < 0.0122000000000000008Initial program 99.9%
Taylor expanded in z around 0
Applied rewrites72.2%
Final simplification64.0%
(FPCore (x y z) :precision binary64 (* (- 1.0 z) x))
double code(double x, double y, double z) {
return (1.0 - z) * x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (1.0d0 - z) * x
end function
public static double code(double x, double y, double z) {
return (1.0 - z) * x;
}
def code(x, y, z): return (1.0 - z) * x
function code(x, y, z) return Float64(Float64(1.0 - z) * x) end
function tmp = code(x, y, z) tmp = (1.0 - z) * x; end
code[x_, y_, z_] := N[(N[(1.0 - z), $MachinePrecision] * x), $MachinePrecision]
\begin{array}{l}
\\
\left(1 - z\right) \cdot x
\end{array}
Initial program 95.8%
Taylor expanded in y around 0
lower--.f6464.6
Applied rewrites64.6%
Final simplification64.6%
(FPCore (x y z) :precision binary64 (* 1.0 x))
double code(double x, double y, double z) {
return 1.0 * x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.0d0 * x
end function
public static double code(double x, double y, double z) {
return 1.0 * x;
}
def code(x, y, z): return 1.0 * x
function code(x, y, z) return Float64(1.0 * x) end
function tmp = code(x, y, z) tmp = 1.0 * x; end
code[x_, y_, z_] := N[(1.0 * x), $MachinePrecision]
\begin{array}{l}
\\
1 \cdot x
\end{array}
Initial program 95.8%
Taylor expanded in z around 0
Applied rewrites36.8%
Final simplification36.8%
(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 2024271
(FPCore (x y z)
:name "Data.Colour.RGBSpace.HSV:hsv from colour-2.3.3, J"
:precision binary64
:alt
(! :herbie-platform default (if (< (* x (- 1 (* (- 1 y) z))) -161819597360704900000000000000000000000000000000000) (+ x (* (- 1 y) (* (- z) x))) (if (< (* x (- 1 (* (- 1 y) z))) 389223764966390300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- (* (* x y) z) (- (* x z) x)) (+ x (* (- 1 y) (* (- z) x))))))
(* x (- 1.0 (* (- 1.0 y) z))))