
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
(FPCore (x y z t) :precision binary64 (fma (- y z) (- t x) x))
double code(double x, double y, double z, double t) {
return fma((y - z), (t - x), x);
}
function code(x, y, z, t) return fma(Float64(y - z), Float64(t - x), x) end
code[x_, y_, z_, t_] := N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y - z, t - x, x\right)
\end{array}
Initial program 100.0%
+-commutative100.0%
fma-def100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- x))) (t_2 (- x (* z t))))
(if (<= y -8.2e+66)
t_1
(if (<= y -1.35e-60)
t_2
(if (<= y -6e-147)
(+ x (* z x))
(if (<= y -1.9e-292)
t_2
(if (<= y 5e-200)
(* x (+ z 1.0))
(if (<= y 5.5e+65)
t_2
(if (<= y 1.05e+223) t_1 (+ x (* y t)))))))))))
double code(double x, double y, double z, double t) {
double t_1 = y * -x;
double t_2 = x - (z * t);
double tmp;
if (y <= -8.2e+66) {
tmp = t_1;
} else if (y <= -1.35e-60) {
tmp = t_2;
} else if (y <= -6e-147) {
tmp = x + (z * x);
} else if (y <= -1.9e-292) {
tmp = t_2;
} else if (y <= 5e-200) {
tmp = x * (z + 1.0);
} else if (y <= 5.5e+65) {
tmp = t_2;
} else if (y <= 1.05e+223) {
tmp = t_1;
} else {
tmp = x + (y * t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = y * -x
t_2 = x - (z * t)
if (y <= (-8.2d+66)) then
tmp = t_1
else if (y <= (-1.35d-60)) then
tmp = t_2
else if (y <= (-6d-147)) then
tmp = x + (z * x)
else if (y <= (-1.9d-292)) then
tmp = t_2
else if (y <= 5d-200) then
tmp = x * (z + 1.0d0)
else if (y <= 5.5d+65) then
tmp = t_2
else if (y <= 1.05d+223) then
tmp = t_1
else
tmp = x + (y * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * -x;
double t_2 = x - (z * t);
double tmp;
if (y <= -8.2e+66) {
tmp = t_1;
} else if (y <= -1.35e-60) {
tmp = t_2;
} else if (y <= -6e-147) {
tmp = x + (z * x);
} else if (y <= -1.9e-292) {
tmp = t_2;
} else if (y <= 5e-200) {
tmp = x * (z + 1.0);
} else if (y <= 5.5e+65) {
tmp = t_2;
} else if (y <= 1.05e+223) {
tmp = t_1;
} else {
tmp = x + (y * t);
}
return tmp;
}
def code(x, y, z, t): t_1 = y * -x t_2 = x - (z * t) tmp = 0 if y <= -8.2e+66: tmp = t_1 elif y <= -1.35e-60: tmp = t_2 elif y <= -6e-147: tmp = x + (z * x) elif y <= -1.9e-292: tmp = t_2 elif y <= 5e-200: tmp = x * (z + 1.0) elif y <= 5.5e+65: tmp = t_2 elif y <= 1.05e+223: tmp = t_1 else: tmp = x + (y * t) return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(-x)) t_2 = Float64(x - Float64(z * t)) tmp = 0.0 if (y <= -8.2e+66) tmp = t_1; elseif (y <= -1.35e-60) tmp = t_2; elseif (y <= -6e-147) tmp = Float64(x + Float64(z * x)); elseif (y <= -1.9e-292) tmp = t_2; elseif (y <= 5e-200) tmp = Float64(x * Float64(z + 1.0)); elseif (y <= 5.5e+65) tmp = t_2; elseif (y <= 1.05e+223) tmp = t_1; else tmp = Float64(x + Float64(y * t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * -x; t_2 = x - (z * t); tmp = 0.0; if (y <= -8.2e+66) tmp = t_1; elseif (y <= -1.35e-60) tmp = t_2; elseif (y <= -6e-147) tmp = x + (z * x); elseif (y <= -1.9e-292) tmp = t_2; elseif (y <= 5e-200) tmp = x * (z + 1.0); elseif (y <= 5.5e+65) tmp = t_2; elseif (y <= 1.05e+223) tmp = t_1; else tmp = x + (y * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * (-x)), $MachinePrecision]}, Block[{t$95$2 = N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -8.2e+66], t$95$1, If[LessEqual[y, -1.35e-60], t$95$2, If[LessEqual[y, -6e-147], N[(x + N[(z * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -1.9e-292], t$95$2, If[LessEqual[y, 5e-200], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.5e+65], t$95$2, If[LessEqual[y, 1.05e+223], t$95$1, N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(-x\right)\\
t_2 := x - z \cdot t\\
\mathbf{if}\;y \leq -8.2 \cdot 10^{+66}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -1.35 \cdot 10^{-60}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq -6 \cdot 10^{-147}:\\
\;\;\;\;x + z \cdot x\\
\mathbf{elif}\;y \leq -1.9 \cdot 10^{-292}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq 5 \cdot 10^{-200}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{+65}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq 1.05 \cdot 10^{+223}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot t\\
\end{array}
\end{array}
if y < -8.19999999999999989e66 or 5.4999999999999996e65 < y < 1.04999999999999995e223Initial program 100.0%
Taylor expanded in x around -inf 67.9%
mul-1-neg67.9%
distribute-rgt-neg-in67.9%
+-commutative67.9%
Simplified67.9%
Taylor expanded in y around inf 55.7%
if -8.19999999999999989e66 < y < -1.35e-60 or -6.0000000000000004e-147 < y < -1.9000000000000001e-292 or 4.99999999999999991e-200 < y < 5.4999999999999996e65Initial program 100.0%
Taylor expanded in y around 0 85.0%
+-commutative85.0%
mul-1-neg85.0%
unsub-neg85.0%
*-commutative85.0%
Simplified85.0%
Taylor expanded in t around inf 67.0%
*-commutative67.0%
Simplified67.0%
if -1.35e-60 < y < -6.0000000000000004e-147Initial program 99.9%
*-commutative99.9%
flip--93.0%
associate-*r/86.4%
Applied egg-rr86.4%
associate-/l*93.0%
difference-of-squares93.0%
associate-/r*100.0%
*-inverses100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in t around 0 92.9%
if -1.9000000000000001e-292 < y < 4.99999999999999991e-200Initial program 100.0%
Taylor expanded in y around 0 100.0%
+-commutative100.0%
mul-1-neg100.0%
unsub-neg100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around -inf 86.9%
if 1.04999999999999995e223 < y Initial program 100.0%
Taylor expanded in t around inf 71.3%
Taylor expanded in z around 0 71.3%
Final simplification67.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (* (- y z) t))) (t_2 (+ x (* y (- t x)))))
(if (<= y -8.5e+66)
t_2
(if (<= y -1.05e-60)
t_1
(if (<= y -1.25e-145)
(+ x (* z x))
(if (<= y -8.2e-290)
(- x (* z t))
(if (<= y 2.6e-200)
(* x (+ z 1.0))
(if (<= y 2.5e+62) t_1 t_2))))))))
double code(double x, double y, double z, double t) {
double t_1 = x + ((y - z) * t);
double t_2 = x + (y * (t - x));
double tmp;
if (y <= -8.5e+66) {
tmp = t_2;
} else if (y <= -1.05e-60) {
tmp = t_1;
} else if (y <= -1.25e-145) {
tmp = x + (z * x);
} else if (y <= -8.2e-290) {
tmp = x - (z * t);
} else if (y <= 2.6e-200) {
tmp = x * (z + 1.0);
} else if (y <= 2.5e+62) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = x + ((y - z) * t)
t_2 = x + (y * (t - x))
if (y <= (-8.5d+66)) then
tmp = t_2
else if (y <= (-1.05d-60)) then
tmp = t_1
else if (y <= (-1.25d-145)) then
tmp = x + (z * x)
else if (y <= (-8.2d-290)) then
tmp = x - (z * t)
else if (y <= 2.6d-200) then
tmp = x * (z + 1.0d0)
else if (y <= 2.5d+62) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x + ((y - z) * t);
double t_2 = x + (y * (t - x));
double tmp;
if (y <= -8.5e+66) {
tmp = t_2;
} else if (y <= -1.05e-60) {
tmp = t_1;
} else if (y <= -1.25e-145) {
tmp = x + (z * x);
} else if (y <= -8.2e-290) {
tmp = x - (z * t);
} else if (y <= 2.6e-200) {
tmp = x * (z + 1.0);
} else if (y <= 2.5e+62) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + ((y - z) * t) t_2 = x + (y * (t - x)) tmp = 0 if y <= -8.5e+66: tmp = t_2 elif y <= -1.05e-60: tmp = t_1 elif y <= -1.25e-145: tmp = x + (z * x) elif y <= -8.2e-290: tmp = x - (z * t) elif y <= 2.6e-200: tmp = x * (z + 1.0) elif y <= 2.5e+62: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(Float64(y - z) * t)) t_2 = Float64(x + Float64(y * Float64(t - x))) tmp = 0.0 if (y <= -8.5e+66) tmp = t_2; elseif (y <= -1.05e-60) tmp = t_1; elseif (y <= -1.25e-145) tmp = Float64(x + Float64(z * x)); elseif (y <= -8.2e-290) tmp = Float64(x - Float64(z * t)); elseif (y <= 2.6e-200) tmp = Float64(x * Float64(z + 1.0)); elseif (y <= 2.5e+62) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + ((y - z) * t); t_2 = x + (y * (t - x)); tmp = 0.0; if (y <= -8.5e+66) tmp = t_2; elseif (y <= -1.05e-60) tmp = t_1; elseif (y <= -1.25e-145) tmp = x + (z * x); elseif (y <= -8.2e-290) tmp = x - (z * t); elseif (y <= 2.6e-200) tmp = x * (z + 1.0); elseif (y <= 2.5e+62) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -8.5e+66], t$95$2, If[LessEqual[y, -1.05e-60], t$95$1, If[LessEqual[y, -1.25e-145], N[(x + N[(z * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -8.2e-290], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.6e-200], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.5e+62], t$95$1, t$95$2]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(y - z\right) \cdot t\\
t_2 := x + y \cdot \left(t - x\right)\\
\mathbf{if}\;y \leq -8.5 \cdot 10^{+66}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq -1.05 \cdot 10^{-60}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -1.25 \cdot 10^{-145}:\\
\;\;\;\;x + z \cdot x\\
\mathbf{elif}\;y \leq -8.2 \cdot 10^{-290}:\\
\;\;\;\;x - z \cdot t\\
\mathbf{elif}\;y \leq 2.6 \cdot 10^{-200}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{elif}\;y \leq 2.5 \cdot 10^{+62}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if y < -8.5000000000000004e66 or 2.50000000000000014e62 < y Initial program 100.0%
Taylor expanded in z around 0 86.6%
if -8.5000000000000004e66 < y < -1.04999999999999996e-60 or 2.5999999999999999e-200 < y < 2.50000000000000014e62Initial program 100.0%
Taylor expanded in t around inf 75.6%
if -1.04999999999999996e-60 < y < -1.2499999999999999e-145Initial program 99.9%
*-commutative99.9%
flip--93.0%
associate-*r/86.4%
Applied egg-rr86.4%
associate-/l*93.0%
difference-of-squares93.0%
associate-/r*100.0%
*-inverses100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in t around 0 92.9%
if -1.2499999999999999e-145 < y < -8.2000000000000005e-290Initial program 100.0%
Taylor expanded in y around 0 100.0%
+-commutative100.0%
mul-1-neg100.0%
unsub-neg100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in t around inf 83.7%
*-commutative83.7%
Simplified83.7%
if -8.2000000000000005e-290 < y < 2.5999999999999999e-200Initial program 100.0%
Taylor expanded in y around 0 100.0%
+-commutative100.0%
mul-1-neg100.0%
unsub-neg100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around -inf 86.9%
Final simplification83.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- x))))
(if (<= z -1.95e+124)
(* z x)
(if (<= z -2.5e-8)
t_1
(if (<= z -1.2e-196)
x
(if (<= z 4.6e-300) t_1 (if (<= z 1.0) x (* z x))))))))
double code(double x, double y, double z, double t) {
double t_1 = y * -x;
double tmp;
if (z <= -1.95e+124) {
tmp = z * x;
} else if (z <= -2.5e-8) {
tmp = t_1;
} else if (z <= -1.2e-196) {
tmp = x;
} else if (z <= 4.6e-300) {
tmp = t_1;
} else if (z <= 1.0) {
tmp = x;
} else {
tmp = z * x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = y * -x
if (z <= (-1.95d+124)) then
tmp = z * x
else if (z <= (-2.5d-8)) then
tmp = t_1
else if (z <= (-1.2d-196)) then
tmp = x
else if (z <= 4.6d-300) then
tmp = t_1
else if (z <= 1.0d0) then
tmp = x
else
tmp = z * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * -x;
double tmp;
if (z <= -1.95e+124) {
tmp = z * x;
} else if (z <= -2.5e-8) {
tmp = t_1;
} else if (z <= -1.2e-196) {
tmp = x;
} else if (z <= 4.6e-300) {
tmp = t_1;
} else if (z <= 1.0) {
tmp = x;
} else {
tmp = z * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * -x tmp = 0 if z <= -1.95e+124: tmp = z * x elif z <= -2.5e-8: tmp = t_1 elif z <= -1.2e-196: tmp = x elif z <= 4.6e-300: tmp = t_1 elif z <= 1.0: tmp = x else: tmp = z * x return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(-x)) tmp = 0.0 if (z <= -1.95e+124) tmp = Float64(z * x); elseif (z <= -2.5e-8) tmp = t_1; elseif (z <= -1.2e-196) tmp = x; elseif (z <= 4.6e-300) tmp = t_1; elseif (z <= 1.0) tmp = x; else tmp = Float64(z * x); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * -x; tmp = 0.0; if (z <= -1.95e+124) tmp = z * x; elseif (z <= -2.5e-8) tmp = t_1; elseif (z <= -1.2e-196) tmp = x; elseif (z <= 4.6e-300) tmp = t_1; elseif (z <= 1.0) tmp = x; else tmp = z * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * (-x)), $MachinePrecision]}, If[LessEqual[z, -1.95e+124], N[(z * x), $MachinePrecision], If[LessEqual[z, -2.5e-8], t$95$1, If[LessEqual[z, -1.2e-196], x, If[LessEqual[z, 4.6e-300], t$95$1, If[LessEqual[z, 1.0], x, N[(z * x), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(-x\right)\\
\mathbf{if}\;z \leq -1.95 \cdot 10^{+124}:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;z \leq -2.5 \cdot 10^{-8}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -1.2 \cdot 10^{-196}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 4.6 \cdot 10^{-300}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if z < -1.95e124 or 1 < z Initial program 100.0%
Taylor expanded in x around -inf 57.5%
mul-1-neg57.5%
distribute-rgt-neg-in57.5%
+-commutative57.5%
Simplified57.5%
Taylor expanded in z around inf 49.4%
if -1.95e124 < z < -2.4999999999999999e-8 or -1.2000000000000001e-196 < z < 4.60000000000000002e-300Initial program 100.0%
Taylor expanded in x around -inf 57.2%
mul-1-neg57.2%
distribute-rgt-neg-in57.2%
+-commutative57.2%
Simplified57.2%
Taylor expanded in y around inf 42.6%
if -2.4999999999999999e-8 < z < -1.2000000000000001e-196 or 4.60000000000000002e-300 < z < 1Initial program 100.0%
Taylor expanded in t around inf 76.7%
Taylor expanded in x around inf 43.0%
Final simplification45.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (+ z 1.0))))
(if (<= x -6.8e+166)
t_1
(if (<= x -4.2e+111)
(* x (- 1.0 y))
(if (<= x 2.6e+91) (+ x (* (- y z) t)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x * (z + 1.0);
double tmp;
if (x <= -6.8e+166) {
tmp = t_1;
} else if (x <= -4.2e+111) {
tmp = x * (1.0 - y);
} else if (x <= 2.6e+91) {
tmp = x + ((y - z) * t);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x * (z + 1.0d0)
if (x <= (-6.8d+166)) then
tmp = t_1
else if (x <= (-4.2d+111)) then
tmp = x * (1.0d0 - y)
else if (x <= 2.6d+91) then
tmp = x + ((y - z) * t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (z + 1.0);
double tmp;
if (x <= -6.8e+166) {
tmp = t_1;
} else if (x <= -4.2e+111) {
tmp = x * (1.0 - y);
} else if (x <= 2.6e+91) {
tmp = x + ((y - z) * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (z + 1.0) tmp = 0 if x <= -6.8e+166: tmp = t_1 elif x <= -4.2e+111: tmp = x * (1.0 - y) elif x <= 2.6e+91: tmp = x + ((y - z) * t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(z + 1.0)) tmp = 0.0 if (x <= -6.8e+166) tmp = t_1; elseif (x <= -4.2e+111) tmp = Float64(x * Float64(1.0 - y)); elseif (x <= 2.6e+91) tmp = Float64(x + Float64(Float64(y - z) * t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (z + 1.0); tmp = 0.0; if (x <= -6.8e+166) tmp = t_1; elseif (x <= -4.2e+111) tmp = x * (1.0 - y); elseif (x <= 2.6e+91) tmp = x + ((y - z) * t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6.8e+166], t$95$1, If[LessEqual[x, -4.2e+111], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.6e+91], N[(x + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(z + 1\right)\\
\mathbf{if}\;x \leq -6.8 \cdot 10^{+166}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -4.2 \cdot 10^{+111}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{+91}:\\
\;\;\;\;x + \left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -6.8000000000000001e166 or 2.6e91 < x Initial program 100.0%
Taylor expanded in y around 0 71.6%
+-commutative71.6%
mul-1-neg71.6%
unsub-neg71.6%
*-commutative71.6%
Simplified71.6%
Taylor expanded in x around -inf 66.6%
if -6.8000000000000001e166 < x < -4.1999999999999999e111Initial program 100.0%
Taylor expanded in x around -inf 100.0%
mul-1-neg100.0%
distribute-rgt-neg-in100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in z around 0 100.0%
if -4.1999999999999999e111 < x < 2.6e91Initial program 100.0%
Taylor expanded in t around inf 76.6%
Final simplification74.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- x))))
(if (<= y -2.2e+123)
t_1
(if (<= y 2800.0)
(* x (+ z 1.0))
(if (<= y 8.2e+222) t_1 (+ x (* y t)))))))
double code(double x, double y, double z, double t) {
double t_1 = y * -x;
double tmp;
if (y <= -2.2e+123) {
tmp = t_1;
} else if (y <= 2800.0) {
tmp = x * (z + 1.0);
} else if (y <= 8.2e+222) {
tmp = t_1;
} else {
tmp = x + (y * t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = y * -x
if (y <= (-2.2d+123)) then
tmp = t_1
else if (y <= 2800.0d0) then
tmp = x * (z + 1.0d0)
else if (y <= 8.2d+222) then
tmp = t_1
else
tmp = x + (y * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * -x;
double tmp;
if (y <= -2.2e+123) {
tmp = t_1;
} else if (y <= 2800.0) {
tmp = x * (z + 1.0);
} else if (y <= 8.2e+222) {
tmp = t_1;
} else {
tmp = x + (y * t);
}
return tmp;
}
def code(x, y, z, t): t_1 = y * -x tmp = 0 if y <= -2.2e+123: tmp = t_1 elif y <= 2800.0: tmp = x * (z + 1.0) elif y <= 8.2e+222: tmp = t_1 else: tmp = x + (y * t) return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(-x)) tmp = 0.0 if (y <= -2.2e+123) tmp = t_1; elseif (y <= 2800.0) tmp = Float64(x * Float64(z + 1.0)); elseif (y <= 8.2e+222) tmp = t_1; else tmp = Float64(x + Float64(y * t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * -x; tmp = 0.0; if (y <= -2.2e+123) tmp = t_1; elseif (y <= 2800.0) tmp = x * (z + 1.0); elseif (y <= 8.2e+222) tmp = t_1; else tmp = x + (y * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * (-x)), $MachinePrecision]}, If[LessEqual[y, -2.2e+123], t$95$1, If[LessEqual[y, 2800.0], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8.2e+222], t$95$1, N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(-x\right)\\
\mathbf{if}\;y \leq -2.2 \cdot 10^{+123}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 2800:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{elif}\;y \leq 8.2 \cdot 10^{+222}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot t\\
\end{array}
\end{array}
if y < -2.19999999999999992e123 or 2800 < y < 8.19999999999999974e222Initial program 99.9%
Taylor expanded in x around -inf 62.0%
mul-1-neg62.0%
distribute-rgt-neg-in62.0%
+-commutative62.0%
Simplified62.0%
Taylor expanded in y around inf 53.0%
if -2.19999999999999992e123 < y < 2800Initial program 100.0%
Taylor expanded in y around 0 90.2%
+-commutative90.2%
mul-1-neg90.2%
unsub-neg90.2%
*-commutative90.2%
Simplified90.2%
Taylor expanded in x around -inf 61.7%
if 8.19999999999999974e222 < y Initial program 100.0%
Taylor expanded in t around inf 71.3%
Taylor expanded in z around 0 71.3%
Final simplification59.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- x))))
(if (<= y -2.5e+124)
t_1
(if (<= y 2800.0)
(+ x (* z x))
(if (<= y 1.25e+223) t_1 (+ x (* y t)))))))
double code(double x, double y, double z, double t) {
double t_1 = y * -x;
double tmp;
if (y <= -2.5e+124) {
tmp = t_1;
} else if (y <= 2800.0) {
tmp = x + (z * x);
} else if (y <= 1.25e+223) {
tmp = t_1;
} else {
tmp = x + (y * t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = y * -x
if (y <= (-2.5d+124)) then
tmp = t_1
else if (y <= 2800.0d0) then
tmp = x + (z * x)
else if (y <= 1.25d+223) then
tmp = t_1
else
tmp = x + (y * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * -x;
double tmp;
if (y <= -2.5e+124) {
tmp = t_1;
} else if (y <= 2800.0) {
tmp = x + (z * x);
} else if (y <= 1.25e+223) {
tmp = t_1;
} else {
tmp = x + (y * t);
}
return tmp;
}
def code(x, y, z, t): t_1 = y * -x tmp = 0 if y <= -2.5e+124: tmp = t_1 elif y <= 2800.0: tmp = x + (z * x) elif y <= 1.25e+223: tmp = t_1 else: tmp = x + (y * t) return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(-x)) tmp = 0.0 if (y <= -2.5e+124) tmp = t_1; elseif (y <= 2800.0) tmp = Float64(x + Float64(z * x)); elseif (y <= 1.25e+223) tmp = t_1; else tmp = Float64(x + Float64(y * t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * -x; tmp = 0.0; if (y <= -2.5e+124) tmp = t_1; elseif (y <= 2800.0) tmp = x + (z * x); elseif (y <= 1.25e+223) tmp = t_1; else tmp = x + (y * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * (-x)), $MachinePrecision]}, If[LessEqual[y, -2.5e+124], t$95$1, If[LessEqual[y, 2800.0], N[(x + N[(z * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.25e+223], t$95$1, N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(-x\right)\\
\mathbf{if}\;y \leq -2.5 \cdot 10^{+124}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 2800:\\
\;\;\;\;x + z \cdot x\\
\mathbf{elif}\;y \leq 1.25 \cdot 10^{+223}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot t\\
\end{array}
\end{array}
if y < -2.4999999999999998e124 or 2800 < y < 1.24999999999999996e223Initial program 99.9%
Taylor expanded in x around -inf 62.0%
mul-1-neg62.0%
distribute-rgt-neg-in62.0%
+-commutative62.0%
Simplified62.0%
Taylor expanded in y around inf 53.0%
if -2.4999999999999998e124 < y < 2800Initial program 100.0%
*-commutative100.0%
flip--85.5%
associate-*r/79.4%
Applied egg-rr79.4%
associate-/l*85.3%
difference-of-squares85.3%
associate-/r*99.8%
*-inverses99.8%
Simplified99.8%
Taylor expanded in y around 0 90.0%
Taylor expanded in t around 0 61.8%
if 1.24999999999999996e223 < y Initial program 100.0%
Taylor expanded in t around inf 71.3%
Taylor expanded in z around 0 71.3%
Final simplification59.5%
(FPCore (x y z t) :precision binary64 (if (or (<= y -7.6e+117) (not (<= y 8e+67))) (+ x (* y (- t x))) (+ x (* z (- x t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -7.6e+117) || !(y <= 8e+67)) {
tmp = x + (y * (t - x));
} else {
tmp = x + (z * (x - t));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-7.6d+117)) .or. (.not. (y <= 8d+67))) then
tmp = x + (y * (t - x))
else
tmp = x + (z * (x - t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -7.6e+117) || !(y <= 8e+67)) {
tmp = x + (y * (t - x));
} else {
tmp = x + (z * (x - t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -7.6e+117) or not (y <= 8e+67): tmp = x + (y * (t - x)) else: tmp = x + (z * (x - t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -7.6e+117) || !(y <= 8e+67)) tmp = Float64(x + Float64(y * Float64(t - x))); else tmp = Float64(x + Float64(z * Float64(x - t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -7.6e+117) || ~((y <= 8e+67))) tmp = x + (y * (t - x)); else tmp = x + (z * (x - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -7.6e+117], N[Not[LessEqual[y, 8e+67]], $MachinePrecision]], N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.6 \cdot 10^{+117} \lor \neg \left(y \leq 8 \cdot 10^{+67}\right):\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(x - t\right)\\
\end{array}
\end{array}
if y < -7.6000000000000003e117 or 7.99999999999999986e67 < y Initial program 100.0%
Taylor expanded in z around 0 89.8%
if -7.6000000000000003e117 < y < 7.99999999999999986e67Initial program 100.0%
Taylor expanded in y around 0 87.9%
+-commutative87.9%
mul-1-neg87.9%
unsub-neg87.9%
*-commutative87.9%
Simplified87.9%
Final simplification88.6%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.8e+124) (not (<= y 2850.0))) (* y (- x)) (* x (+ z 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.8e+124) || !(y <= 2850.0)) {
tmp = y * -x;
} else {
tmp = x * (z + 1.0);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-1.8d+124)) .or. (.not. (y <= 2850.0d0))) then
tmp = y * -x
else
tmp = x * (z + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.8e+124) || !(y <= 2850.0)) {
tmp = y * -x;
} else {
tmp = x * (z + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.8e+124) or not (y <= 2850.0): tmp = y * -x else: tmp = x * (z + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.8e+124) || !(y <= 2850.0)) tmp = Float64(y * Float64(-x)); else tmp = Float64(x * Float64(z + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.8e+124) || ~((y <= 2850.0))) tmp = y * -x; else tmp = x * (z + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.8e+124], N[Not[LessEqual[y, 2850.0]], $MachinePrecision]], N[(y * (-x)), $MachinePrecision], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.8 \cdot 10^{+124} \lor \neg \left(y \leq 2850\right):\\
\;\;\;\;y \cdot \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\end{array}
\end{array}
if y < -1.79999999999999993e124 or 2850 < y Initial program 100.0%
Taylor expanded in x around -inf 56.0%
mul-1-neg56.0%
distribute-rgt-neg-in56.0%
+-commutative56.0%
Simplified56.0%
Taylor expanded in y around inf 48.7%
if -1.79999999999999993e124 < y < 2850Initial program 100.0%
Taylor expanded in y around 0 90.2%
+-commutative90.2%
mul-1-neg90.2%
unsub-neg90.2%
*-commutative90.2%
Simplified90.2%
Taylor expanded in x around -inf 61.7%
Final simplification56.4%
(FPCore (x y z t) :precision binary64 (- x (* (- y z) (- x t))))
double code(double x, double y, double z, double t) {
return x - ((y - z) * (x - t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x - ((y - z) * (x - t))
end function
public static double code(double x, double y, double z, double t) {
return x - ((y - z) * (x - t));
}
def code(x, y, z, t): return x - ((y - z) * (x - t))
function code(x, y, z, t) return Float64(x - Float64(Float64(y - z) * Float64(x - t))) end
function tmp = code(x, y, z, t) tmp = x - ((y - z) * (x - t)); end
code[x_, y_, z_, t_] := N[(x - N[(N[(y - z), $MachinePrecision] * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \left(y - z\right) \cdot \left(x - t\right)
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y z t) :precision binary64 (if (<= z -2.9e-8) (* z x) (if (<= z 1.0) x (* z x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.9e-8) {
tmp = z * x;
} else if (z <= 1.0) {
tmp = x;
} else {
tmp = z * x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-2.9d-8)) then
tmp = z * x
else if (z <= 1.0d0) then
tmp = x
else
tmp = z * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.9e-8) {
tmp = z * x;
} else if (z <= 1.0) {
tmp = x;
} else {
tmp = z * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.9e-8: tmp = z * x elif z <= 1.0: tmp = x else: tmp = z * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.9e-8) tmp = Float64(z * x); elseif (z <= 1.0) tmp = x; else tmp = Float64(z * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -2.9e-8) tmp = z * x; elseif (z <= 1.0) tmp = x; else tmp = z * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.9e-8], N[(z * x), $MachinePrecision], If[LessEqual[z, 1.0], x, N[(z * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.9 \cdot 10^{-8}:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if z < -2.9000000000000002e-8 or 1 < z Initial program 100.0%
Taylor expanded in x around -inf 55.4%
mul-1-neg55.4%
distribute-rgt-neg-in55.4%
+-commutative55.4%
Simplified55.4%
Taylor expanded in z around inf 43.6%
if -2.9000000000000002e-8 < z < 1Initial program 100.0%
Taylor expanded in t around inf 71.6%
Taylor expanded in x around inf 38.6%
Final simplification41.3%
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
return x;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x
end function
public static double code(double x, double y, double z, double t) {
return x;
}
def code(x, y, z, t): return x
function code(x, y, z, t) return x end
function tmp = code(x, y, z, t) tmp = x; end
code[x_, y_, z_, t_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 100.0%
Taylor expanded in t around inf 60.8%
Taylor expanded in x around inf 19.5%
Final simplification19.5%
(FPCore (x y z t) :precision binary64 (+ x (+ (* t (- y z)) (* (- x) (- y z)))))
double code(double x, double y, double z, double t) {
return x + ((t * (y - z)) + (-x * (y - z)));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((t * (y - z)) + (-x * (y - z)))
end function
public static double code(double x, double y, double z, double t) {
return x + ((t * (y - z)) + (-x * (y - z)));
}
def code(x, y, z, t): return x + ((t * (y - z)) + (-x * (y - z)))
function code(x, y, z, t) return Float64(x + Float64(Float64(t * Float64(y - z)) + Float64(Float64(-x) * Float64(y - z)))) end
function tmp = code(x, y, z, t) tmp = x + ((t * (y - z)) + (-x * (y - z))); end
code[x_, y_, z_, t_] := N[(x + N[(N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision] + N[((-x) * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(t \cdot \left(y - z\right) + \left(-x\right) \cdot \left(y - z\right)\right)
\end{array}
herbie shell --seed 2023185
(FPCore (x y z t)
:name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
:precision binary64
:herbie-target
(+ x (+ (* t (- y z)) (* (- x) (- y z))))
(+ x (* (- y z) (- t x))))