
(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 14 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
(if (or (<= t -1.1e+103)
(not (or (<= t -3.5e-33) (and (not (<= t -4.5e-52)) (<= t 8e-52)))))
(+ x (* (- y z) t))
(* x (+ (- z y) 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.1e+103) || !((t <= -3.5e-33) || (!(t <= -4.5e-52) && (t <= 8e-52)))) {
tmp = x + ((y - z) * t);
} else {
tmp = x * ((z - y) + 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 ((t <= (-1.1d+103)) .or. (.not. (t <= (-3.5d-33)) .or. (.not. (t <= (-4.5d-52))) .and. (t <= 8d-52))) then
tmp = x + ((y - z) * t)
else
tmp = x * ((z - y) + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.1e+103) || !((t <= -3.5e-33) || (!(t <= -4.5e-52) && (t <= 8e-52)))) {
tmp = x + ((y - z) * t);
} else {
tmp = x * ((z - y) + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.1e+103) or not ((t <= -3.5e-33) or (not (t <= -4.5e-52) and (t <= 8e-52))): tmp = x + ((y - z) * t) else: tmp = x * ((z - y) + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.1e+103) || !((t <= -3.5e-33) || (!(t <= -4.5e-52) && (t <= 8e-52)))) tmp = Float64(x + Float64(Float64(y - z) * t)); else tmp = Float64(x * Float64(Float64(z - y) + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.1e+103) || ~(((t <= -3.5e-33) || (~((t <= -4.5e-52)) && (t <= 8e-52))))) tmp = x + ((y - z) * t); else tmp = x * ((z - y) + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.1e+103], N[Not[Or[LessEqual[t, -3.5e-33], And[N[Not[LessEqual[t, -4.5e-52]], $MachinePrecision], LessEqual[t, 8e-52]]]], $MachinePrecision]], N[(x + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(z - y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.1 \cdot 10^{+103} \lor \neg \left(t \leq -3.5 \cdot 10^{-33} \lor \neg \left(t \leq -4.5 \cdot 10^{-52}\right) \land t \leq 8 \cdot 10^{-52}\right):\\
\;\;\;\;x + \left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\left(z - y\right) + 1\right)\\
\end{array}
\end{array}
if t < -1.09999999999999996e103 or -3.4999999999999999e-33 < t < -4.5e-52 or 8.0000000000000001e-52 < t Initial program 100.0%
Taylor expanded in t around inf 89.0%
if -1.09999999999999996e103 < t < -3.4999999999999999e-33 or -4.5e-52 < t < 8.0000000000000001e-52Initial program 100.0%
Taylor expanded in x around inf 80.5%
mul-1-neg80.5%
unsub-neg80.5%
Simplified80.5%
Final simplification85.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- x t))) (t_2 (* x (+ (- z y) 1.0))))
(if (<= z -7.5e+84)
t_1
(if (<= z -1450.0)
t_2
(if (<= z 1.35e-111) (+ x (* y t)) (if (<= z 9.4e+63) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double t_2 = x * ((z - y) + 1.0);
double tmp;
if (z <= -7.5e+84) {
tmp = t_1;
} else if (z <= -1450.0) {
tmp = t_2;
} else if (z <= 1.35e-111) {
tmp = x + (y * t);
} else if (z <= 9.4e+63) {
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 = z * (x - t)
t_2 = x * ((z - y) + 1.0d0)
if (z <= (-7.5d+84)) then
tmp = t_1
else if (z <= (-1450.0d0)) then
tmp = t_2
else if (z <= 1.35d-111) then
tmp = x + (y * t)
else if (z <= 9.4d+63) 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 = z * (x - t);
double t_2 = x * ((z - y) + 1.0);
double tmp;
if (z <= -7.5e+84) {
tmp = t_1;
} else if (z <= -1450.0) {
tmp = t_2;
} else if (z <= 1.35e-111) {
tmp = x + (y * t);
} else if (z <= 9.4e+63) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (x - t) t_2 = x * ((z - y) + 1.0) tmp = 0 if z <= -7.5e+84: tmp = t_1 elif z <= -1450.0: tmp = t_2 elif z <= 1.35e-111: tmp = x + (y * t) elif z <= 9.4e+63: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(x - t)) t_2 = Float64(x * Float64(Float64(z - y) + 1.0)) tmp = 0.0 if (z <= -7.5e+84) tmp = t_1; elseif (z <= -1450.0) tmp = t_2; elseif (z <= 1.35e-111) tmp = Float64(x + Float64(y * t)); elseif (z <= 9.4e+63) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * (x - t); t_2 = x * ((z - y) + 1.0); tmp = 0.0; if (z <= -7.5e+84) tmp = t_1; elseif (z <= -1450.0) tmp = t_2; elseif (z <= 1.35e-111) tmp = x + (y * t); elseif (z <= 9.4e+63) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(N[(z - y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7.5e+84], t$95$1, If[LessEqual[z, -1450.0], t$95$2, If[LessEqual[z, 1.35e-111], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9.4e+63], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(x - t\right)\\
t_2 := x \cdot \left(\left(z - y\right) + 1\right)\\
\mathbf{if}\;z \leq -7.5 \cdot 10^{+84}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -1450:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{-111}:\\
\;\;\;\;x + y \cdot t\\
\mathbf{elif}\;z \leq 9.4 \cdot 10^{+63}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -7.5000000000000001e84 or 9.4000000000000006e63 < z Initial program 100.0%
Taylor expanded in y around 0 87.9%
mul-1-neg87.9%
*-commutative87.9%
distribute-rgt-neg-out87.9%
Simplified87.9%
distribute-rgt-neg-out87.9%
unsub-neg87.9%
Applied egg-rr87.9%
Taylor expanded in z around inf 87.9%
if -7.5000000000000001e84 < z < -1450 or 1.34999999999999994e-111 < z < 9.4000000000000006e63Initial program 100.0%
Taylor expanded in x around inf 66.1%
mul-1-neg66.1%
unsub-neg66.1%
Simplified66.1%
if -1450 < z < 1.34999999999999994e-111Initial program 100.0%
Taylor expanded in t around inf 80.9%
Taylor expanded in y around inf 73.3%
*-commutative73.3%
Simplified73.3%
Final simplification77.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- 1.0 y))))
(if (<= z -3.5e+109)
(* z x)
(if (<= z -8.5e-254)
t_1
(if (<= z -2.8e-290) (* y t) (if (<= z 2.1e+79) t_1 (* z (- t))))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - y);
double tmp;
if (z <= -3.5e+109) {
tmp = z * x;
} else if (z <= -8.5e-254) {
tmp = t_1;
} else if (z <= -2.8e-290) {
tmp = y * t;
} else if (z <= 2.1e+79) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = x * (1.0d0 - y)
if (z <= (-3.5d+109)) then
tmp = z * x
else if (z <= (-8.5d-254)) then
tmp = t_1
else if (z <= (-2.8d-290)) then
tmp = y * t
else if (z <= 2.1d+79) then
tmp = t_1
else
tmp = z * -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - y);
double tmp;
if (z <= -3.5e+109) {
tmp = z * x;
} else if (z <= -8.5e-254) {
tmp = t_1;
} else if (z <= -2.8e-290) {
tmp = y * t;
} else if (z <= 2.1e+79) {
tmp = t_1;
} else {
tmp = z * -t;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (1.0 - y) tmp = 0 if z <= -3.5e+109: tmp = z * x elif z <= -8.5e-254: tmp = t_1 elif z <= -2.8e-290: tmp = y * t elif z <= 2.1e+79: tmp = t_1 else: tmp = z * -t return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(1.0 - y)) tmp = 0.0 if (z <= -3.5e+109) tmp = Float64(z * x); elseif (z <= -8.5e-254) tmp = t_1; elseif (z <= -2.8e-290) tmp = Float64(y * t); elseif (z <= 2.1e+79) tmp = t_1; else tmp = Float64(z * Float64(-t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (1.0 - y); tmp = 0.0; if (z <= -3.5e+109) tmp = z * x; elseif (z <= -8.5e-254) tmp = t_1; elseif (z <= -2.8e-290) tmp = y * t; elseif (z <= 2.1e+79) tmp = t_1; else tmp = z * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.5e+109], N[(z * x), $MachinePrecision], If[LessEqual[z, -8.5e-254], t$95$1, If[LessEqual[z, -2.8e-290], N[(y * t), $MachinePrecision], If[LessEqual[z, 2.1e+79], t$95$1, N[(z * (-t)), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(1 - y\right)\\
\mathbf{if}\;z \leq -3.5 \cdot 10^{+109}:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;z \leq -8.5 \cdot 10^{-254}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -2.8 \cdot 10^{-290}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;z \leq 2.1 \cdot 10^{+79}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-t\right)\\
\end{array}
\end{array}
if z < -3.49999999999999983e109Initial program 100.0%
Taylor expanded in y around 0 96.1%
mul-1-neg96.1%
*-commutative96.1%
distribute-rgt-neg-out96.1%
Simplified96.1%
Taylor expanded in t around 0 69.2%
Taylor expanded in z around inf 69.2%
*-commutative69.2%
Simplified69.2%
if -3.49999999999999983e109 < z < -8.49999999999999963e-254 or -2.79999999999999997e-290 < z < 2.10000000000000008e79Initial program 100.0%
Taylor expanded in y around inf 83.6%
*-commutative83.6%
Simplified83.6%
Taylor expanded in x around inf 54.1%
mul-1-neg54.1%
unsub-neg54.1%
Simplified54.1%
if -8.49999999999999963e-254 < z < -2.79999999999999997e-290Initial program 99.8%
Taylor expanded in t around inf 96.3%
Taylor expanded in y around inf 96.3%
*-commutative96.3%
Simplified96.3%
Taylor expanded in x around 0 79.3%
if 2.10000000000000008e79 < z Initial program 99.9%
Taylor expanded in y around 0 85.6%
mul-1-neg85.6%
*-commutative85.6%
distribute-rgt-neg-out85.6%
Simplified85.6%
distribute-rgt-neg-out85.6%
unsub-neg85.6%
Applied egg-rr85.6%
Taylor expanded in x around 0 51.1%
mul-1-neg51.1%
distribute-rgt-neg-out51.1%
Simplified51.1%
Final simplification57.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- x t))))
(if (<= z -118000.0)
t_1
(if (<= z 7.5e-107)
(+ x (* y t))
(if (<= z 3.6e+48) (* x (- 1.0 y)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double tmp;
if (z <= -118000.0) {
tmp = t_1;
} else if (z <= 7.5e-107) {
tmp = x + (y * t);
} else if (z <= 3.6e+48) {
tmp = x * (1.0 - y);
} 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 = z * (x - t)
if (z <= (-118000.0d0)) then
tmp = t_1
else if (z <= 7.5d-107) then
tmp = x + (y * t)
else if (z <= 3.6d+48) then
tmp = x * (1.0d0 - y)
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 = z * (x - t);
double tmp;
if (z <= -118000.0) {
tmp = t_1;
} else if (z <= 7.5e-107) {
tmp = x + (y * t);
} else if (z <= 3.6e+48) {
tmp = x * (1.0 - y);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (x - t) tmp = 0 if z <= -118000.0: tmp = t_1 elif z <= 7.5e-107: tmp = x + (y * t) elif z <= 3.6e+48: tmp = x * (1.0 - y) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(x - t)) tmp = 0.0 if (z <= -118000.0) tmp = t_1; elseif (z <= 7.5e-107) tmp = Float64(x + Float64(y * t)); elseif (z <= 3.6e+48) tmp = Float64(x * Float64(1.0 - y)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * (x - t); tmp = 0.0; if (z <= -118000.0) tmp = t_1; elseif (z <= 7.5e-107) tmp = x + (y * t); elseif (z <= 3.6e+48) tmp = x * (1.0 - y); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -118000.0], t$95$1, If[LessEqual[z, 7.5e-107], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.6e+48], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(x - t\right)\\
\mathbf{if}\;z \leq -118000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 7.5 \cdot 10^{-107}:\\
\;\;\;\;x + y \cdot t\\
\mathbf{elif}\;z \leq 3.6 \cdot 10^{+48}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -118000 or 3.59999999999999983e48 < z Initial program 100.0%
Taylor expanded in y around 0 80.3%
mul-1-neg80.3%
*-commutative80.3%
distribute-rgt-neg-out80.3%
Simplified80.3%
distribute-rgt-neg-out80.3%
unsub-neg80.3%
Applied egg-rr80.3%
Taylor expanded in z around inf 79.9%
if -118000 < z < 7.50000000000000047e-107Initial program 100.0%
Taylor expanded in t around inf 80.9%
Taylor expanded in y around inf 73.3%
*-commutative73.3%
Simplified73.3%
if 7.50000000000000047e-107 < z < 3.59999999999999983e48Initial program 100.0%
Taylor expanded in y around inf 87.8%
*-commutative87.8%
Simplified87.8%
Taylor expanded in x around inf 66.9%
mul-1-neg66.9%
unsub-neg66.9%
Simplified66.9%
Final simplification75.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -6.4e+84) (not (<= z 8.4e+48))) (* z (- x t)) (+ x (* y (- t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6.4e+84) || !(z <= 8.4e+48)) {
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 <= (-6.4d+84)) .or. (.not. (z <= 8.4d+48))) 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 <= -6.4e+84) || !(z <= 8.4e+48)) {
tmp = z * (x - t);
} else {
tmp = x + (y * (t - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -6.4e+84) or not (z <= 8.4e+48): tmp = z * (x - t) else: tmp = x + (y * (t - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -6.4e+84) || !(z <= 8.4e+48)) 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 <= -6.4e+84) || ~((z <= 8.4e+48))) tmp = z * (x - t); else tmp = x + (y * (t - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -6.4e+84], N[Not[LessEqual[z, 8.4e+48]], $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 -6.4 \cdot 10^{+84} \lor \neg \left(z \leq 8.4 \cdot 10^{+48}\right):\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\end{array}
\end{array}
if z < -6.4000000000000002e84 or 8.3999999999999994e48 < z Initial program 100.0%
Taylor expanded in y around 0 87.9%
mul-1-neg87.9%
*-commutative87.9%
distribute-rgt-neg-out87.9%
Simplified87.9%
distribute-rgt-neg-out87.9%
unsub-neg87.9%
Applied egg-rr87.9%
Taylor expanded in z around inf 87.9%
if -6.4000000000000002e84 < z < 8.3999999999999994e48Initial program 100.0%
Taylor expanded in y around inf 86.6%
*-commutative86.6%
Simplified86.6%
Final simplification87.1%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* z (- x t)))) (if (<= z -6.4e+84) t_1 (if (<= z 4.9e+53) (+ x (* y (- t x))) (+ x t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double tmp;
if (z <= -6.4e+84) {
tmp = t_1;
} else if (z <= 4.9e+53) {
tmp = x + (y * (t - x));
} else {
tmp = x + 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 = z * (x - t)
if (z <= (-6.4d+84)) then
tmp = t_1
else if (z <= 4.9d+53) then
tmp = x + (y * (t - x))
else
tmp = x + t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double tmp;
if (z <= -6.4e+84) {
tmp = t_1;
} else if (z <= 4.9e+53) {
tmp = x + (y * (t - x));
} else {
tmp = x + t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (x - t) tmp = 0 if z <= -6.4e+84: tmp = t_1 elif z <= 4.9e+53: tmp = x + (y * (t - x)) else: tmp = x + t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(x - t)) tmp = 0.0 if (z <= -6.4e+84) tmp = t_1; elseif (z <= 4.9e+53) tmp = Float64(x + Float64(y * Float64(t - x))); else tmp = Float64(x + t_1); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * (x - t); tmp = 0.0; if (z <= -6.4e+84) tmp = t_1; elseif (z <= 4.9e+53) tmp = x + (y * (t - x)); else tmp = x + t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -6.4e+84], t$95$1, If[LessEqual[z, 4.9e+53], N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(x - t\right)\\
\mathbf{if}\;z \leq -6.4 \cdot 10^{+84}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 4.9 \cdot 10^{+53}:\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x + t_1\\
\end{array}
\end{array}
if z < -6.4000000000000002e84Initial program 100.0%
Taylor expanded in y around 0 92.8%
mul-1-neg92.8%
*-commutative92.8%
distribute-rgt-neg-out92.8%
Simplified92.8%
distribute-rgt-neg-out92.8%
unsub-neg92.8%
Applied egg-rr92.8%
Taylor expanded in z around inf 92.8%
if -6.4000000000000002e84 < z < 4.90000000000000018e53Initial program 100.0%
Taylor expanded in y around inf 86.6%
*-commutative86.6%
Simplified86.6%
if 4.90000000000000018e53 < z Initial program 99.9%
Taylor expanded in y around 0 83.5%
mul-1-neg83.5%
*-commutative83.5%
distribute-rgt-neg-out83.5%
Simplified83.5%
distribute-rgt-neg-out83.5%
unsub-neg83.5%
Applied egg-rr83.5%
Final simplification87.1%
(FPCore (x y z t) :precision binary64 (if (<= z -4.6e+104) (* z x) (if (<= z 5e-108) (* y t) (if (<= z 1.26e+79) (* y (- x)) (* z (- t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.6e+104) {
tmp = z * x;
} else if (z <= 5e-108) {
tmp = y * t;
} else if (z <= 1.26e+79) {
tmp = y * -x;
} 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 (z <= (-4.6d+104)) then
tmp = z * x
else if (z <= 5d-108) then
tmp = y * t
else if (z <= 1.26d+79) then
tmp = y * -x
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 (z <= -4.6e+104) {
tmp = z * x;
} else if (z <= 5e-108) {
tmp = y * t;
} else if (z <= 1.26e+79) {
tmp = y * -x;
} else {
tmp = z * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -4.6e+104: tmp = z * x elif z <= 5e-108: tmp = y * t elif z <= 1.26e+79: tmp = y * -x else: tmp = z * -t return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -4.6e+104) tmp = Float64(z * x); elseif (z <= 5e-108) tmp = Float64(y * t); elseif (z <= 1.26e+79) tmp = Float64(y * Float64(-x)); else tmp = Float64(z * Float64(-t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -4.6e+104) tmp = z * x; elseif (z <= 5e-108) tmp = y * t; elseif (z <= 1.26e+79) tmp = y * -x; else tmp = z * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -4.6e+104], N[(z * x), $MachinePrecision], If[LessEqual[z, 5e-108], N[(y * t), $MachinePrecision], If[LessEqual[z, 1.26e+79], N[(y * (-x)), $MachinePrecision], N[(z * (-t)), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.6 \cdot 10^{+104}:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;z \leq 5 \cdot 10^{-108}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;z \leq 1.26 \cdot 10^{+79}:\\
\;\;\;\;y \cdot \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-t\right)\\
\end{array}
\end{array}
if z < -4.59999999999999969e104Initial program 100.0%
Taylor expanded in y around 0 94.1%
mul-1-neg94.1%
*-commutative94.1%
distribute-rgt-neg-out94.1%
Simplified94.1%
Taylor expanded in t around 0 67.8%
Taylor expanded in z around inf 67.8%
*-commutative67.8%
Simplified67.8%
if -4.59999999999999969e104 < z < 5e-108Initial program 100.0%
Taylor expanded in t around inf 74.8%
Taylor expanded in y around inf 63.4%
*-commutative63.4%
Simplified63.4%
Taylor expanded in x around 0 43.5%
if 5e-108 < z < 1.26e79Initial program 100.0%
Taylor expanded in y around inf 81.7%
*-commutative81.7%
Simplified81.7%
Taylor expanded in x around inf 60.9%
mul-1-neg60.9%
unsub-neg60.9%
Simplified60.9%
Taylor expanded in y around inf 45.4%
mul-1-neg45.4%
distribute-rgt-neg-out45.4%
Simplified45.4%
if 1.26e79 < z Initial program 99.9%
Taylor expanded in y around 0 85.6%
mul-1-neg85.6%
*-commutative85.6%
distribute-rgt-neg-out85.6%
Simplified85.6%
distribute-rgt-neg-out85.6%
unsub-neg85.6%
Applied egg-rr85.6%
Taylor expanded in x around 0 51.1%
mul-1-neg51.1%
distribute-rgt-neg-out51.1%
Simplified51.1%
Final simplification49.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.6e+30) (not (<= z 3.6e+48))) (* z (- x t)) (* x (- 1.0 y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.6e+30) || !(z <= 3.6e+48)) {
tmp = z * (x - t);
} else {
tmp = x * (1.0 - y);
}
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.6d+30)) .or. (.not. (z <= 3.6d+48))) then
tmp = z * (x - t)
else
tmp = x * (1.0d0 - y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.6e+30) || !(z <= 3.6e+48)) {
tmp = z * (x - t);
} else {
tmp = x * (1.0 - y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.6e+30) or not (z <= 3.6e+48): tmp = z * (x - t) else: tmp = x * (1.0 - y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.6e+30) || !(z <= 3.6e+48)) tmp = Float64(z * Float64(x - t)); else tmp = Float64(x * Float64(1.0 - y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -2.6e+30) || ~((z <= 3.6e+48))) tmp = z * (x - t); else tmp = x * (1.0 - y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.6e+30], N[Not[LessEqual[z, 3.6e+48]], $MachinePrecision]], N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.6 \cdot 10^{+30} \lor \neg \left(z \leq 3.6 \cdot 10^{+48}\right):\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\end{array}
\end{array}
if z < -2.59999999999999988e30 or 3.59999999999999983e48 < z Initial program 100.0%
Taylor expanded in y around 0 83.6%
mul-1-neg83.6%
*-commutative83.6%
distribute-rgt-neg-out83.6%
Simplified83.6%
distribute-rgt-neg-out83.6%
unsub-neg83.6%
Applied egg-rr83.6%
Taylor expanded in z around inf 83.6%
if -2.59999999999999988e30 < z < 3.59999999999999983e48Initial program 100.0%
Taylor expanded in y around inf 89.7%
*-commutative89.7%
Simplified89.7%
Taylor expanded in x around inf 55.5%
mul-1-neg55.5%
unsub-neg55.5%
Simplified55.5%
Final simplification68.6%
(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%
Final simplification100.0%
(FPCore (x y z t) :precision binary64 (if (<= z -2.8e+106) (* z x) (if (<= z 6.6e+81) (* y t) (* z (- t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.8e+106) {
tmp = z * x;
} else if (z <= 6.6e+81) {
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 (z <= (-2.8d+106)) then
tmp = z * x
else if (z <= 6.6d+81) 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 (z <= -2.8e+106) {
tmp = z * x;
} else if (z <= 6.6e+81) {
tmp = y * t;
} else {
tmp = z * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.8e+106: tmp = z * x elif z <= 6.6e+81: tmp = y * t else: tmp = z * -t return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.8e+106) tmp = Float64(z * x); elseif (z <= 6.6e+81) 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 (z <= -2.8e+106) tmp = z * x; elseif (z <= 6.6e+81) tmp = y * t; else tmp = z * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.8e+106], N[(z * x), $MachinePrecision], If[LessEqual[z, 6.6e+81], N[(y * t), $MachinePrecision], N[(z * (-t)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.8 \cdot 10^{+106}:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;z \leq 6.6 \cdot 10^{+81}:\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-t\right)\\
\end{array}
\end{array}
if z < -2.79999999999999993e106Initial program 100.0%
Taylor expanded in y around 0 94.1%
mul-1-neg94.1%
*-commutative94.1%
distribute-rgt-neg-out94.1%
Simplified94.1%
Taylor expanded in t around 0 67.8%
Taylor expanded in z around inf 67.8%
*-commutative67.8%
Simplified67.8%
if -2.79999999999999993e106 < z < 6.6e81Initial program 100.0%
Taylor expanded in t around inf 70.9%
Taylor expanded in y around inf 59.7%
*-commutative59.7%
Simplified59.7%
Taylor expanded in x around 0 40.7%
if 6.6e81 < z Initial program 99.9%
Taylor expanded in y around 0 85.6%
mul-1-neg85.6%
*-commutative85.6%
distribute-rgt-neg-out85.6%
Simplified85.6%
distribute-rgt-neg-out85.6%
unsub-neg85.6%
Applied egg-rr85.6%
Taylor expanded in x around 0 51.1%
mul-1-neg51.1%
distribute-rgt-neg-out51.1%
Simplified51.1%
Final simplification47.6%
(FPCore (x y z t) :precision binary64 (if (or (<= y -4.1e-54) (not (<= y 1.45e-22))) (* y t) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4.1e-54) || !(y <= 1.45e-22)) {
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 <= (-4.1d-54)) .or. (.not. (y <= 1.45d-22))) 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 <= -4.1e-54) || !(y <= 1.45e-22)) {
tmp = y * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -4.1e-54) or not (y <= 1.45e-22): tmp = y * t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -4.1e-54) || !(y <= 1.45e-22)) tmp = Float64(y * t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -4.1e-54) || ~((y <= 1.45e-22))) tmp = y * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -4.1e-54], N[Not[LessEqual[y, 1.45e-22]], $MachinePrecision]], N[(y * t), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.1 \cdot 10^{-54} \lor \neg \left(y \leq 1.45 \cdot 10^{-22}\right):\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -4.1000000000000001e-54 or 1.4500000000000001e-22 < y Initial program 100.0%
Taylor expanded in t around inf 59.6%
Taylor expanded in y around inf 46.6%
*-commutative46.6%
Simplified46.6%
Taylor expanded in x around 0 45.0%
if -4.1000000000000001e-54 < y < 1.4500000000000001e-22Initial program 100.0%
Taylor expanded in t around inf 70.3%
Taylor expanded in x around inf 30.9%
Final simplification39.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.75e+96) (not (<= z 3.4e+101))) (* z x) (* y t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.75e+96) || !(z <= 3.4e+101)) {
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.75d+96)) .or. (.not. (z <= 3.4d+101))) 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.75e+96) || !(z <= 3.4e+101)) {
tmp = z * x;
} else {
tmp = y * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.75e+96) or not (z <= 3.4e+101): tmp = z * x else: tmp = y * t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.75e+96) || !(z <= 3.4e+101)) 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.75e+96) || ~((z <= 3.4e+101))) tmp = z * x; else tmp = y * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.75e+96], N[Not[LessEqual[z, 3.4e+101]], $MachinePrecision]], N[(z * x), $MachinePrecision], N[(y * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.75 \cdot 10^{+96} \lor \neg \left(z \leq 3.4 \cdot 10^{+101}\right):\\
\;\;\;\;z \cdot x\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if z < -1.7499999999999999e96 or 3.40000000000000017e101 < z Initial program 100.0%
Taylor expanded in y around 0 91.0%
mul-1-neg91.0%
*-commutative91.0%
distribute-rgt-neg-out91.0%
Simplified91.0%
Taylor expanded in t around 0 55.4%
Taylor expanded in z around inf 55.4%
*-commutative55.4%
Simplified55.4%
if -1.7499999999999999e96 < z < 3.40000000000000017e101Initial program 100.0%
Taylor expanded in t around inf 70.9%
Taylor expanded in y around inf 58.2%
*-commutative58.2%
Simplified58.2%
Taylor expanded in x around 0 39.9%
Final simplification45.4%
(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 63.5%
Taylor expanded in x around inf 14.1%
Final simplification14.1%
(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 2023301
(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))))