
(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 13 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-define100.0%
Simplified100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- t x))) (t_2 (* z (- x t))))
(if (<= y -1.15e+44)
t_1
(if (<= y -4e-199)
t_2
(if (<= y 4.2e-257) (* x (+ z 1.0)) (if (<= y 6.5e+36) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (t - x);
double t_2 = z * (x - t);
double tmp;
if (y <= -1.15e+44) {
tmp = t_1;
} else if (y <= -4e-199) {
tmp = t_2;
} else if (y <= 4.2e-257) {
tmp = x * (z + 1.0);
} else if (y <= 6.5e+36) {
tmp = t_2;
} 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) :: t_2
real(8) :: tmp
t_1 = y * (t - x)
t_2 = z * (x - t)
if (y <= (-1.15d+44)) then
tmp = t_1
else if (y <= (-4d-199)) then
tmp = t_2
else if (y <= 4.2d-257) then
tmp = x * (z + 1.0d0)
else if (y <= 6.5d+36) then
tmp = t_2
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 = y * (t - x);
double t_2 = z * (x - t);
double tmp;
if (y <= -1.15e+44) {
tmp = t_1;
} else if (y <= -4e-199) {
tmp = t_2;
} else if (y <= 4.2e-257) {
tmp = x * (z + 1.0);
} else if (y <= 6.5e+36) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (t - x) t_2 = z * (x - t) tmp = 0 if y <= -1.15e+44: tmp = t_1 elif y <= -4e-199: tmp = t_2 elif y <= 4.2e-257: tmp = x * (z + 1.0) elif y <= 6.5e+36: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(t - x)) t_2 = Float64(z * Float64(x - t)) tmp = 0.0 if (y <= -1.15e+44) tmp = t_1; elseif (y <= -4e-199) tmp = t_2; elseif (y <= 4.2e-257) tmp = Float64(x * Float64(z + 1.0)); elseif (y <= 6.5e+36) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (t - x); t_2 = z * (x - t); tmp = 0.0; if (y <= -1.15e+44) tmp = t_1; elseif (y <= -4e-199) tmp = t_2; elseif (y <= 4.2e-257) tmp = x * (z + 1.0); elseif (y <= 6.5e+36) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.15e+44], t$95$1, If[LessEqual[y, -4e-199], t$95$2, If[LessEqual[y, 4.2e-257], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.5e+36], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(t - x\right)\\
t_2 := z \cdot \left(x - t\right)\\
\mathbf{if}\;y \leq -1.15 \cdot 10^{+44}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -4 \cdot 10^{-199}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{-257}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{elif}\;y \leq 6.5 \cdot 10^{+36}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.15000000000000002e44 or 6.4999999999999998e36 < y Initial program 100.0%
Taylor expanded in z around inf 85.1%
Taylor expanded in z around -inf 76.4%
mul-1-neg76.4%
*-commutative76.4%
distribute-rgt-neg-in76.4%
mul-1-neg76.4%
unsub-neg76.4%
associate-/l*82.6%
Simplified82.6%
Taylor expanded in y around -inf 83.7%
if -1.15000000000000002e44 < y < -3.99999999999999993e-199 or 4.2000000000000002e-257 < y < 6.4999999999999998e36Initial program 100.0%
Taylor expanded in y around 0 80.4%
mul-1-neg80.4%
unsub-neg80.4%
Simplified80.4%
Taylor expanded in z around inf 62.4%
if -3.99999999999999993e-199 < y < 4.2000000000000002e-257Initial program 100.0%
Taylor expanded in x around inf 90.5%
mul-1-neg90.5%
unsub-neg90.5%
Simplified90.5%
Taylor expanded in y around 0 90.5%
+-commutative90.5%
Simplified90.5%
(FPCore (x y z t)
:precision binary64
(if (<= t -6.1e+35)
(* y t)
(if (<= t 7.5e+88)
(* x (+ z 1.0))
(if (or (<= t 8.2e+114) (not (<= t 4.5e+235))) (* y t) (* z (- t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -6.1e+35) {
tmp = y * t;
} else if (t <= 7.5e+88) {
tmp = x * (z + 1.0);
} else if ((t <= 8.2e+114) || !(t <= 4.5e+235)) {
tmp = y * t;
} else {
tmp = z * -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 (t <= (-6.1d+35)) then
tmp = y * t
else if (t <= 7.5d+88) then
tmp = x * (z + 1.0d0)
else if ((t <= 8.2d+114) .or. (.not. (t <= 4.5d+235))) then
tmp = y * t
else
tmp = z * -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -6.1e+35) {
tmp = y * t;
} else if (t <= 7.5e+88) {
tmp = x * (z + 1.0);
} else if ((t <= 8.2e+114) || !(t <= 4.5e+235)) {
tmp = y * t;
} else {
tmp = z * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -6.1e+35: tmp = y * t elif t <= 7.5e+88: tmp = x * (z + 1.0) elif (t <= 8.2e+114) or not (t <= 4.5e+235): tmp = y * t else: tmp = z * -t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -6.1e+35) tmp = Float64(y * t); elseif (t <= 7.5e+88) tmp = Float64(x * Float64(z + 1.0)); elseif ((t <= 8.2e+114) || !(t <= 4.5e+235)) tmp = Float64(y * t); else tmp = Float64(z * Float64(-t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -6.1e+35) tmp = y * t; elseif (t <= 7.5e+88) tmp = x * (z + 1.0); elseif ((t <= 8.2e+114) || ~((t <= 4.5e+235))) tmp = y * t; else tmp = z * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -6.1e+35], N[(y * t), $MachinePrecision], If[LessEqual[t, 7.5e+88], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t, 8.2e+114], N[Not[LessEqual[t, 4.5e+235]], $MachinePrecision]], N[(y * t), $MachinePrecision], N[(z * (-t)), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.1 \cdot 10^{+35}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;t \leq 7.5 \cdot 10^{+88}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{elif}\;t \leq 8.2 \cdot 10^{+114} \lor \neg \left(t \leq 4.5 \cdot 10^{+235}\right):\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-t\right)\\
\end{array}
\end{array}
if t < -6.09999999999999977e35 or 7.50000000000000031e88 < t < 8.2000000000000001e114 or 4.5e235 < t Initial program 100.0%
Taylor expanded in z around inf 94.5%
Taylor expanded in z around -inf 80.9%
mul-1-neg80.9%
*-commutative80.9%
distribute-rgt-neg-in80.9%
mul-1-neg80.9%
unsub-neg80.9%
associate-/l*78.7%
Simplified78.7%
Taylor expanded in y around -inf 68.2%
Taylor expanded in t around inf 65.3%
*-commutative65.3%
Simplified65.3%
if -6.09999999999999977e35 < t < 7.50000000000000031e88Initial program 100.0%
Taylor expanded in x around inf 77.8%
mul-1-neg77.8%
unsub-neg77.8%
Simplified77.8%
Taylor expanded in y around 0 56.3%
+-commutative56.3%
Simplified56.3%
if 8.2000000000000001e114 < t < 4.5e235Initial program 100.0%
Taylor expanded in y around 0 77.7%
mul-1-neg77.7%
unsub-neg77.7%
Simplified77.7%
Taylor expanded in x around 0 56.4%
mul-1-neg56.4%
distribute-rgt-neg-in56.4%
Simplified56.4%
Final simplification59.3%
(FPCore (x y z t)
:precision binary64
(if (<= x -1.08e+145)
(* z x)
(if (<= x -2.3e-96)
(* y t)
(if (<= x -2e-304) (* z (- t)) (if (<= x 2.2e+48) (* y t) (* z x))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.08e+145) {
tmp = z * x;
} else if (x <= -2.3e-96) {
tmp = y * t;
} else if (x <= -2e-304) {
tmp = z * -t;
} else if (x <= 2.2e+48) {
tmp = y * t;
} 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 (x <= (-1.08d+145)) then
tmp = z * x
else if (x <= (-2.3d-96)) then
tmp = y * t
else if (x <= (-2d-304)) then
tmp = z * -t
else if (x <= 2.2d+48) then
tmp = y * t
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 (x <= -1.08e+145) {
tmp = z * x;
} else if (x <= -2.3e-96) {
tmp = y * t;
} else if (x <= -2e-304) {
tmp = z * -t;
} else if (x <= 2.2e+48) {
tmp = y * t;
} else {
tmp = z * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.08e+145: tmp = z * x elif x <= -2.3e-96: tmp = y * t elif x <= -2e-304: tmp = z * -t elif x <= 2.2e+48: tmp = y * t else: tmp = z * x return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.08e+145) tmp = Float64(z * x); elseif (x <= -2.3e-96) tmp = Float64(y * t); elseif (x <= -2e-304) tmp = Float64(z * Float64(-t)); elseif (x <= 2.2e+48) tmp = Float64(y * t); else tmp = Float64(z * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -1.08e+145) tmp = z * x; elseif (x <= -2.3e-96) tmp = y * t; elseif (x <= -2e-304) tmp = z * -t; elseif (x <= 2.2e+48) tmp = y * t; else tmp = z * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.08e+145], N[(z * x), $MachinePrecision], If[LessEqual[x, -2.3e-96], N[(y * t), $MachinePrecision], If[LessEqual[x, -2e-304], N[(z * (-t)), $MachinePrecision], If[LessEqual[x, 2.2e+48], N[(y * t), $MachinePrecision], N[(z * x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.08 \cdot 10^{+145}:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;x \leq -2.3 \cdot 10^{-96}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;x \leq -2 \cdot 10^{-304}:\\
\;\;\;\;z \cdot \left(-t\right)\\
\mathbf{elif}\;x \leq 2.2 \cdot 10^{+48}:\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if x < -1.08000000000000006e145 or 2.1999999999999999e48 < x Initial program 100.0%
Taylor expanded in x around inf 88.4%
mul-1-neg88.4%
unsub-neg88.4%
Simplified88.4%
Taylor expanded in z around inf 44.8%
*-commutative44.8%
Simplified44.8%
if -1.08000000000000006e145 < x < -2.3e-96 or -1.99999999999999994e-304 < x < 2.1999999999999999e48Initial program 100.0%
Taylor expanded in z around inf 88.8%
Taylor expanded in z around -inf 83.5%
mul-1-neg83.5%
*-commutative83.5%
distribute-rgt-neg-in83.5%
mul-1-neg83.5%
unsub-neg83.5%
associate-/l*78.8%
Simplified78.8%
Taylor expanded in y around -inf 61.6%
Taylor expanded in t around inf 45.8%
*-commutative45.8%
Simplified45.8%
if -2.3e-96 < x < -1.99999999999999994e-304Initial program 100.0%
Taylor expanded in y around 0 85.0%
mul-1-neg85.0%
unsub-neg85.0%
Simplified85.0%
Taylor expanded in x around 0 62.4%
mul-1-neg62.4%
distribute-rgt-neg-in62.4%
Simplified62.4%
Final simplification48.2%
(FPCore (x y z t)
:precision binary64
(if (<= x -1.85e-31)
(* x (- 1.0 y))
(if (<= x -1.1e-305)
(* z (- t))
(if (<= x 1.1e-32) (* y t) (* x (+ z 1.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.85e-31) {
tmp = x * (1.0 - y);
} else if (x <= -1.1e-305) {
tmp = z * -t;
} else if (x <= 1.1e-32) {
tmp = y * t;
} 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 (x <= (-1.85d-31)) then
tmp = x * (1.0d0 - y)
else if (x <= (-1.1d-305)) then
tmp = z * -t
else if (x <= 1.1d-32) then
tmp = y * t
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 (x <= -1.85e-31) {
tmp = x * (1.0 - y);
} else if (x <= -1.1e-305) {
tmp = z * -t;
} else if (x <= 1.1e-32) {
tmp = y * t;
} else {
tmp = x * (z + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.85e-31: tmp = x * (1.0 - y) elif x <= -1.1e-305: tmp = z * -t elif x <= 1.1e-32: tmp = y * t else: tmp = x * (z + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.85e-31) tmp = Float64(x * Float64(1.0 - y)); elseif (x <= -1.1e-305) tmp = Float64(z * Float64(-t)); elseif (x <= 1.1e-32) tmp = Float64(y * t); else tmp = Float64(x * Float64(z + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -1.85e-31) tmp = x * (1.0 - y); elseif (x <= -1.1e-305) tmp = z * -t; elseif (x <= 1.1e-32) tmp = y * t; else tmp = x * (z + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.85e-31], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.1e-305], N[(z * (-t)), $MachinePrecision], If[LessEqual[x, 1.1e-32], N[(y * t), $MachinePrecision], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.85 \cdot 10^{-31}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{elif}\;x \leq -1.1 \cdot 10^{-305}:\\
\;\;\;\;z \cdot \left(-t\right)\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{-32}:\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\end{array}
\end{array}
if x < -1.8499999999999999e-31Initial program 99.9%
Taylor expanded in x around inf 82.0%
mul-1-neg82.0%
unsub-neg82.0%
Simplified82.0%
Taylor expanded in z around 0 58.9%
if -1.8499999999999999e-31 < x < -1.09999999999999998e-305Initial program 100.0%
Taylor expanded in y around 0 82.3%
mul-1-neg82.3%
unsub-neg82.3%
Simplified82.3%
Taylor expanded in x around 0 60.2%
mul-1-neg60.2%
distribute-rgt-neg-in60.2%
Simplified60.2%
if -1.09999999999999998e-305 < x < 1.1e-32Initial program 100.0%
Taylor expanded in z around inf 81.9%
Taylor expanded in z around -inf 70.2%
mul-1-neg70.2%
*-commutative70.2%
distribute-rgt-neg-in70.2%
mul-1-neg70.2%
unsub-neg70.2%
associate-/l*70.3%
Simplified70.3%
Taylor expanded in y around -inf 63.0%
Taylor expanded in t around inf 57.9%
*-commutative57.9%
Simplified57.9%
if 1.1e-32 < x Initial program 100.0%
Taylor expanded in x around inf 79.0%
mul-1-neg79.0%
unsub-neg79.0%
Simplified79.0%
Taylor expanded in y around 0 58.7%
+-commutative58.7%
Simplified58.7%
Final simplification58.9%
(FPCore (x y z t) :precision binary64 (if (<= x -2e-35) (* x (- y)) (if (<= x -4.8e-306) (* z (- t)) (if (<= x 8e+46) (* y t) (* z x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2e-35) {
tmp = x * -y;
} else if (x <= -4.8e-306) {
tmp = z * -t;
} else if (x <= 8e+46) {
tmp = y * t;
} 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 (x <= (-2d-35)) then
tmp = x * -y
else if (x <= (-4.8d-306)) then
tmp = z * -t
else if (x <= 8d+46) then
tmp = y * t
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 (x <= -2e-35) {
tmp = x * -y;
} else if (x <= -4.8e-306) {
tmp = z * -t;
} else if (x <= 8e+46) {
tmp = y * t;
} else {
tmp = z * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2e-35: tmp = x * -y elif x <= -4.8e-306: tmp = z * -t elif x <= 8e+46: tmp = y * t else: tmp = z * x return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2e-35) tmp = Float64(x * Float64(-y)); elseif (x <= -4.8e-306) tmp = Float64(z * Float64(-t)); elseif (x <= 8e+46) tmp = Float64(y * t); else tmp = Float64(z * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -2e-35) tmp = x * -y; elseif (x <= -4.8e-306) tmp = z * -t; elseif (x <= 8e+46) tmp = y * t; else tmp = z * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2e-35], N[(x * (-y)), $MachinePrecision], If[LessEqual[x, -4.8e-306], N[(z * (-t)), $MachinePrecision], If[LessEqual[x, 8e+46], N[(y * t), $MachinePrecision], N[(z * x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{-35}:\\
\;\;\;\;x \cdot \left(-y\right)\\
\mathbf{elif}\;x \leq -4.8 \cdot 10^{-306}:\\
\;\;\;\;z \cdot \left(-t\right)\\
\mathbf{elif}\;x \leq 8 \cdot 10^{+46}:\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if x < -2.00000000000000002e-35Initial program 99.9%
Taylor expanded in x around inf 82.0%
mul-1-neg82.0%
unsub-neg82.0%
Simplified82.0%
Taylor expanded in y around inf 39.2%
mul-1-neg39.2%
distribute-lft-neg-out39.2%
*-commutative39.2%
Simplified39.2%
if -2.00000000000000002e-35 < x < -4.7999999999999999e-306Initial program 100.0%
Taylor expanded in y around 0 82.3%
mul-1-neg82.3%
unsub-neg82.3%
Simplified82.3%
Taylor expanded in x around 0 60.2%
mul-1-neg60.2%
distribute-rgt-neg-in60.2%
Simplified60.2%
if -4.7999999999999999e-306 < x < 7.9999999999999999e46Initial program 100.0%
Taylor expanded in z around inf 85.2%
Taylor expanded in z around -inf 76.3%
mul-1-neg76.3%
*-commutative76.3%
distribute-rgt-neg-in76.3%
mul-1-neg76.3%
unsub-neg76.3%
associate-/l*73.8%
Simplified73.8%
Taylor expanded in y around -inf 62.2%
Taylor expanded in t around inf 49.7%
*-commutative49.7%
Simplified49.7%
if 7.9999999999999999e46 < x Initial program 100.0%
Taylor expanded in x around inf 84.3%
mul-1-neg84.3%
unsub-neg84.3%
Simplified84.3%
Taylor expanded in z around inf 48.9%
*-commutative48.9%
Simplified48.9%
Final simplification48.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -7.5e+24) (not (<= z 1.05e+56))) (* z (- x t)) (+ x (* y (- t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.5e+24) || !(z <= 1.05e+56)) {
tmp = z * (x - t);
} else {
tmp = x + (y * (t - 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 <= (-7.5d+24)) .or. (.not. (z <= 1.05d+56))) then
tmp = z * (x - t)
else
tmp = x + (y * (t - x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.5e+24) || !(z <= 1.05e+56)) {
tmp = z * (x - t);
} else {
tmp = x + (y * (t - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -7.5e+24) or not (z <= 1.05e+56): tmp = z * (x - t) else: tmp = x + (y * (t - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -7.5e+24) || !(z <= 1.05e+56)) tmp = Float64(z * Float64(x - t)); else tmp = Float64(x + Float64(y * Float64(t - x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -7.5e+24) || ~((z <= 1.05e+56))) tmp = z * (x - t); else tmp = x + (y * (t - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -7.5e+24], N[Not[LessEqual[z, 1.05e+56]], $MachinePrecision]], N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.5 \cdot 10^{+24} \lor \neg \left(z \leq 1.05 \cdot 10^{+56}\right):\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\end{array}
\end{array}
if z < -7.50000000000000014e24 or 1.05000000000000009e56 < z Initial program 100.0%
Taylor expanded in y around 0 86.5%
mul-1-neg86.5%
unsub-neg86.5%
Simplified86.5%
Taylor expanded in z around inf 86.5%
if -7.50000000000000014e24 < z < 1.05000000000000009e56Initial program 100.0%
Taylor expanded in y around inf 88.2%
*-commutative88.2%
Simplified88.2%
Final simplification87.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -5.5e+24) (not (<= z 53000000000.0))) (* z (- x t)) (+ x (* y t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.5e+24) || !(z <= 53000000000.0)) {
tmp = z * (x - t);
} 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) :: tmp
if ((z <= (-5.5d+24)) .or. (.not. (z <= 53000000000.0d0))) then
tmp = z * (x - t)
else
tmp = x + (y * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.5e+24) || !(z <= 53000000000.0)) {
tmp = z * (x - t);
} else {
tmp = x + (y * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5.5e+24) or not (z <= 53000000000.0): tmp = z * (x - t) else: tmp = x + (y * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5.5e+24) || !(z <= 53000000000.0)) tmp = Float64(z * Float64(x - t)); else tmp = Float64(x + Float64(y * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -5.5e+24) || ~((z <= 53000000000.0))) tmp = z * (x - t); else tmp = x + (y * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5.5e+24], N[Not[LessEqual[z, 53000000000.0]], $MachinePrecision]], N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \cdot 10^{+24} \lor \neg \left(z \leq 53000000000\right):\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot t\\
\end{array}
\end{array}
if z < -5.5000000000000002e24 or 5.3e10 < z Initial program 100.0%
Taylor expanded in y around 0 83.6%
mul-1-neg83.6%
unsub-neg83.6%
Simplified83.6%
Taylor expanded in z around inf 83.3%
if -5.5000000000000002e24 < z < 5.3e10Initial program 100.0%
Taylor expanded in y around inf 90.8%
*-commutative90.8%
Simplified90.8%
Taylor expanded in t around inf 72.7%
Final simplification77.7%
(FPCore (x y z t) :precision binary64 (if (or (<= y -7.2e-9) (not (<= y 80000.0))) (* y (- t x)) (* x (+ z 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -7.2e-9) || !(y <= 80000.0)) {
tmp = y * (t - 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 <= (-7.2d-9)) .or. (.not. (y <= 80000.0d0))) then
tmp = y * (t - 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 <= -7.2e-9) || !(y <= 80000.0)) {
tmp = y * (t - x);
} else {
tmp = x * (z + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -7.2e-9) or not (y <= 80000.0): tmp = y * (t - x) else: tmp = x * (z + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -7.2e-9) || !(y <= 80000.0)) tmp = Float64(y * Float64(t - 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 <= -7.2e-9) || ~((y <= 80000.0))) tmp = y * (t - x); else tmp = x * (z + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -7.2e-9], N[Not[LessEqual[y, 80000.0]], $MachinePrecision]], N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.2 \cdot 10^{-9} \lor \neg \left(y \leq 80000\right):\\
\;\;\;\;y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\end{array}
\end{array}
if y < -7.2e-9 or 8e4 < y Initial program 100.0%
Taylor expanded in z around inf 87.4%
Taylor expanded in z around -inf 79.4%
mul-1-neg79.4%
*-commutative79.4%
distribute-rgt-neg-in79.4%
mul-1-neg79.4%
unsub-neg79.4%
associate-/l*84.6%
Simplified84.6%
Taylor expanded in y around -inf 76.6%
if -7.2e-9 < y < 8e4Initial program 100.0%
Taylor expanded in x around inf 57.9%
mul-1-neg57.9%
unsub-neg57.9%
Simplified57.9%
Taylor expanded in y around 0 57.1%
+-commutative57.1%
Simplified57.1%
Final simplification67.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.1e+37) (not (<= z 46000000000.0))) (* z x) (* y t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.1e+37) || !(z <= 46000000000.0)) {
tmp = z * x;
} else {
tmp = 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) :: tmp
if ((z <= (-1.1d+37)) .or. (.not. (z <= 46000000000.0d0))) then
tmp = z * x
else
tmp = y * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.1e+37) || !(z <= 46000000000.0)) {
tmp = z * x;
} else {
tmp = y * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.1e+37) or not (z <= 46000000000.0): tmp = z * x else: tmp = y * t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.1e+37) || !(z <= 46000000000.0)) tmp = Float64(z * x); else tmp = Float64(y * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.1e+37) || ~((z <= 46000000000.0))) tmp = z * x; else tmp = y * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.1e+37], N[Not[LessEqual[z, 46000000000.0]], $MachinePrecision]], N[(z * x), $MachinePrecision], N[(y * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.1 \cdot 10^{+37} \lor \neg \left(z \leq 46000000000\right):\\
\;\;\;\;z \cdot x\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if z < -1.1e37 or 4.6e10 < z Initial program 100.0%
Taylor expanded in x around inf 55.5%
mul-1-neg55.5%
unsub-neg55.5%
Simplified55.5%
Taylor expanded in z around inf 45.2%
*-commutative45.2%
Simplified45.2%
if -1.1e37 < z < 4.6e10Initial program 100.0%
Taylor expanded in z around inf 87.6%
Taylor expanded in z around -inf 80.0%
mul-1-neg80.0%
*-commutative80.0%
distribute-rgt-neg-in80.0%
mul-1-neg80.0%
unsub-neg80.0%
associate-/l*67.9%
Simplified67.9%
Taylor expanded in y around -inf 60.5%
Taylor expanded in t around inf 43.2%
*-commutative43.2%
Simplified43.2%
Final simplification44.1%
(FPCore (x y z t) :precision binary64 (if (or (<= y -3.5e-10) (not (<= y 5.6e-101))) (* y t) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.5e-10) || !(y <= 5.6e-101)) {
tmp = y * t;
} else {
tmp = 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 ((y <= (-3.5d-10)) .or. (.not. (y <= 5.6d-101))) then
tmp = y * t
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.5e-10) || !(y <= 5.6e-101)) {
tmp = y * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -3.5e-10) or not (y <= 5.6e-101): tmp = y * t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -3.5e-10) || !(y <= 5.6e-101)) tmp = Float64(y * t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -3.5e-10) || ~((y <= 5.6e-101))) tmp = y * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -3.5e-10], N[Not[LessEqual[y, 5.6e-101]], $MachinePrecision]], N[(y * t), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.5 \cdot 10^{-10} \lor \neg \left(y \leq 5.6 \cdot 10^{-101}\right):\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -3.4999999999999998e-10 or 5.59999999999999978e-101 < y Initial program 100.0%
Taylor expanded in z around inf 89.3%
Taylor expanded in z around -inf 81.3%
mul-1-neg81.3%
*-commutative81.3%
distribute-rgt-neg-in81.3%
mul-1-neg81.3%
unsub-neg81.3%
associate-/l*84.5%
Simplified84.5%
Taylor expanded in y around -inf 69.3%
Taylor expanded in t around inf 44.5%
*-commutative44.5%
Simplified44.5%
if -3.4999999999999998e-10 < y < 5.59999999999999978e-101Initial program 100.0%
Taylor expanded in y around inf 44.3%
*-commutative44.3%
Simplified44.3%
Taylor expanded in y around 0 38.2%
Final simplification42.1%
(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}
Initial program 100.0%
(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 y around inf 61.6%
*-commutative61.6%
Simplified61.6%
Taylor expanded in y around 0 17.3%
(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 2024170
(FPCore (x y z t)
:name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
:precision binary64
:alt
(! :herbie-platform default (+ x (+ (* t (- y z)) (* (- x) (- y z)))))
(+ x (* (- y z) (- t x))))