
(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%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- y z) t)))
(if (<= t -1.2e+173)
t_1
(if (<= t -4.2e+81)
(- x (* z t))
(if (<= t -4.8e-123)
t_1
(if (<= t 6e-155)
(* x (- 1.0 y))
(if (or (<= t 3e-78) (and (not (<= t 1.3e+65)) (<= t 3.25e+106)))
(+ x (* z x))
t_1)))))))
double code(double x, double y, double z, double t) {
double t_1 = (y - z) * t;
double tmp;
if (t <= -1.2e+173) {
tmp = t_1;
} else if (t <= -4.2e+81) {
tmp = x - (z * t);
} else if (t <= -4.8e-123) {
tmp = t_1;
} else if (t <= 6e-155) {
tmp = x * (1.0 - y);
} else if ((t <= 3e-78) || (!(t <= 1.3e+65) && (t <= 3.25e+106))) {
tmp = x + (z * x);
} 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 = (y - z) * t
if (t <= (-1.2d+173)) then
tmp = t_1
else if (t <= (-4.2d+81)) then
tmp = x - (z * t)
else if (t <= (-4.8d-123)) then
tmp = t_1
else if (t <= 6d-155) then
tmp = x * (1.0d0 - y)
else if ((t <= 3d-78) .or. (.not. (t <= 1.3d+65)) .and. (t <= 3.25d+106)) then
tmp = x + (z * x)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (y - z) * t;
double tmp;
if (t <= -1.2e+173) {
tmp = t_1;
} else if (t <= -4.2e+81) {
tmp = x - (z * t);
} else if (t <= -4.8e-123) {
tmp = t_1;
} else if (t <= 6e-155) {
tmp = x * (1.0 - y);
} else if ((t <= 3e-78) || (!(t <= 1.3e+65) && (t <= 3.25e+106))) {
tmp = x + (z * x);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y - z) * t tmp = 0 if t <= -1.2e+173: tmp = t_1 elif t <= -4.2e+81: tmp = x - (z * t) elif t <= -4.8e-123: tmp = t_1 elif t <= 6e-155: tmp = x * (1.0 - y) elif (t <= 3e-78) or (not (t <= 1.3e+65) and (t <= 3.25e+106)): tmp = x + (z * x) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y - z) * t) tmp = 0.0 if (t <= -1.2e+173) tmp = t_1; elseif (t <= -4.2e+81) tmp = Float64(x - Float64(z * t)); elseif (t <= -4.8e-123) tmp = t_1; elseif (t <= 6e-155) tmp = Float64(x * Float64(1.0 - y)); elseif ((t <= 3e-78) || (!(t <= 1.3e+65) && (t <= 3.25e+106))) tmp = Float64(x + Float64(z * x)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y - z) * t; tmp = 0.0; if (t <= -1.2e+173) tmp = t_1; elseif (t <= -4.2e+81) tmp = x - (z * t); elseif (t <= -4.8e-123) tmp = t_1; elseif (t <= 6e-155) tmp = x * (1.0 - y); elseif ((t <= 3e-78) || (~((t <= 1.3e+65)) && (t <= 3.25e+106))) tmp = x + (z * x); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -1.2e+173], t$95$1, If[LessEqual[t, -4.2e+81], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -4.8e-123], t$95$1, If[LessEqual[t, 6e-155], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t, 3e-78], And[N[Not[LessEqual[t, 1.3e+65]], $MachinePrecision], LessEqual[t, 3.25e+106]]], N[(x + N[(z * x), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y - z\right) \cdot t\\
\mathbf{if}\;t \leq -1.2 \cdot 10^{+173}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -4.2 \cdot 10^{+81}:\\
\;\;\;\;x - z \cdot t\\
\mathbf{elif}\;t \leq -4.8 \cdot 10^{-123}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 6 \cdot 10^{-155}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{elif}\;t \leq 3 \cdot 10^{-78} \lor \neg \left(t \leq 1.3 \cdot 10^{+65}\right) \land t \leq 3.25 \cdot 10^{+106}:\\
\;\;\;\;x + z \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.2e173 or -4.1999999999999997e81 < t < -4.8e-123 or 2.99999999999999988e-78 < t < 1.30000000000000001e65 or 3.2500000000000001e106 < t Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in98.4%
Applied egg-rr98.4%
Taylor expanded in x around 0 80.4%
Taylor expanded in x around 0 74.8%
Taylor expanded in t around 0 76.3%
mul-1-neg76.3%
sub-neg76.3%
Simplified76.3%
if -1.2e173 < t < -4.1999999999999997e81Initial program 100.0%
Taylor expanded in t around inf 88.7%
Taylor expanded in y around 0 83.0%
mul-1-neg83.0%
unsub-neg83.0%
*-commutative83.0%
Simplified83.0%
if -4.8e-123 < t < 5.99999999999999967e-155Initial program 100.0%
Taylor expanded in x around inf 87.9%
mul-1-neg87.9%
unsub-neg87.9%
Simplified87.9%
Taylor expanded in z around 0 66.6%
if 5.99999999999999967e-155 < t < 2.99999999999999988e-78 or 1.30000000000000001e65 < t < 3.2500000000000001e106Initial program 100.0%
Taylor expanded in y around 0 83.9%
mul-1-neg83.9%
distribute-lft-neg-out83.9%
*-commutative83.9%
Simplified83.9%
Taylor expanded in t around 0 79.7%
Final simplification73.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- y z) t)))
(if (<= t -5.3e-123)
t_1
(if (<= t 3.4e-159)
(* x (- 1.0 y))
(if (or (<= t 3e-78) (and (not (<= t 1.8e+65)) (<= t 3.25e+106)))
(+ x (* z x))
t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (y - z) * t;
double tmp;
if (t <= -5.3e-123) {
tmp = t_1;
} else if (t <= 3.4e-159) {
tmp = x * (1.0 - y);
} else if ((t <= 3e-78) || (!(t <= 1.8e+65) && (t <= 3.25e+106))) {
tmp = x + (z * x);
} 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 = (y - z) * t
if (t <= (-5.3d-123)) then
tmp = t_1
else if (t <= 3.4d-159) then
tmp = x * (1.0d0 - y)
else if ((t <= 3d-78) .or. (.not. (t <= 1.8d+65)) .and. (t <= 3.25d+106)) then
tmp = x + (z * x)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (y - z) * t;
double tmp;
if (t <= -5.3e-123) {
tmp = t_1;
} else if (t <= 3.4e-159) {
tmp = x * (1.0 - y);
} else if ((t <= 3e-78) || (!(t <= 1.8e+65) && (t <= 3.25e+106))) {
tmp = x + (z * x);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y - z) * t tmp = 0 if t <= -5.3e-123: tmp = t_1 elif t <= 3.4e-159: tmp = x * (1.0 - y) elif (t <= 3e-78) or (not (t <= 1.8e+65) and (t <= 3.25e+106)): tmp = x + (z * x) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y - z) * t) tmp = 0.0 if (t <= -5.3e-123) tmp = t_1; elseif (t <= 3.4e-159) tmp = Float64(x * Float64(1.0 - y)); elseif ((t <= 3e-78) || (!(t <= 1.8e+65) && (t <= 3.25e+106))) tmp = Float64(x + Float64(z * x)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y - z) * t; tmp = 0.0; if (t <= -5.3e-123) tmp = t_1; elseif (t <= 3.4e-159) tmp = x * (1.0 - y); elseif ((t <= 3e-78) || (~((t <= 1.8e+65)) && (t <= 3.25e+106))) tmp = x + (z * x); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -5.3e-123], t$95$1, If[LessEqual[t, 3.4e-159], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t, 3e-78], And[N[Not[LessEqual[t, 1.8e+65]], $MachinePrecision], LessEqual[t, 3.25e+106]]], N[(x + N[(z * x), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y - z\right) \cdot t\\
\mathbf{if}\;t \leq -5.3 \cdot 10^{-123}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 3.4 \cdot 10^{-159}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{elif}\;t \leq 3 \cdot 10^{-78} \lor \neg \left(t \leq 1.8 \cdot 10^{+65}\right) \land t \leq 3.25 \cdot 10^{+106}:\\
\;\;\;\;x + z \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -5.29999999999999971e-123 or 2.99999999999999988e-78 < t < 1.79999999999999989e65 or 3.2500000000000001e106 < t Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in98.6%
Applied egg-rr98.6%
Taylor expanded in x around 0 81.3%
Taylor expanded in x around 0 72.5%
Taylor expanded in t around 0 73.8%
mul-1-neg73.8%
sub-neg73.8%
Simplified73.8%
if -5.29999999999999971e-123 < t < 3.39999999999999984e-159Initial program 100.0%
Taylor expanded in x around inf 87.9%
mul-1-neg87.9%
unsub-neg87.9%
Simplified87.9%
Taylor expanded in z around 0 66.6%
if 3.39999999999999984e-159 < t < 2.99999999999999988e-78 or 1.79999999999999989e65 < t < 3.2500000000000001e106Initial program 100.0%
Taylor expanded in y around 0 83.9%
mul-1-neg83.9%
distribute-lft-neg-out83.9%
*-commutative83.9%
Simplified83.9%
Taylor expanded in t around 0 79.7%
Final simplification72.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- t))))
(if (<= y -1.45e-10)
(* y t)
(if (<= y -4e-116)
x
(if (<= y 3.5e-139)
t_1
(if (<= y 1.25e-64) x (if (<= y 2.1e+104) t_1 (* y (- x)))))))))
double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double tmp;
if (y <= -1.45e-10) {
tmp = y * t;
} else if (y <= -4e-116) {
tmp = x;
} else if (y <= 3.5e-139) {
tmp = t_1;
} else if (y <= 1.25e-64) {
tmp = x;
} else if (y <= 2.1e+104) {
tmp = t_1;
} else {
tmp = y * -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 = z * -t
if (y <= (-1.45d-10)) then
tmp = y * t
else if (y <= (-4d-116)) then
tmp = x
else if (y <= 3.5d-139) then
tmp = t_1
else if (y <= 1.25d-64) then
tmp = x
else if (y <= 2.1d+104) then
tmp = t_1
else
tmp = y * -x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double tmp;
if (y <= -1.45e-10) {
tmp = y * t;
} else if (y <= -4e-116) {
tmp = x;
} else if (y <= 3.5e-139) {
tmp = t_1;
} else if (y <= 1.25e-64) {
tmp = x;
} else if (y <= 2.1e+104) {
tmp = t_1;
} else {
tmp = y * -x;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * -t tmp = 0 if y <= -1.45e-10: tmp = y * t elif y <= -4e-116: tmp = x elif y <= 3.5e-139: tmp = t_1 elif y <= 1.25e-64: tmp = x elif y <= 2.1e+104: tmp = t_1 else: tmp = y * -x return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(-t)) tmp = 0.0 if (y <= -1.45e-10) tmp = Float64(y * t); elseif (y <= -4e-116) tmp = x; elseif (y <= 3.5e-139) tmp = t_1; elseif (y <= 1.25e-64) tmp = x; elseif (y <= 2.1e+104) tmp = t_1; else tmp = Float64(y * Float64(-x)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * -t; tmp = 0.0; if (y <= -1.45e-10) tmp = y * t; elseif (y <= -4e-116) tmp = x; elseif (y <= 3.5e-139) tmp = t_1; elseif (y <= 1.25e-64) tmp = x; elseif (y <= 2.1e+104) tmp = t_1; else tmp = y * -x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * (-t)), $MachinePrecision]}, If[LessEqual[y, -1.45e-10], N[(y * t), $MachinePrecision], If[LessEqual[y, -4e-116], x, If[LessEqual[y, 3.5e-139], t$95$1, If[LessEqual[y, 1.25e-64], x, If[LessEqual[y, 2.1e+104], t$95$1, N[(y * (-x)), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(-t\right)\\
\mathbf{if}\;y \leq -1.45 \cdot 10^{-10}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq -4 \cdot 10^{-116}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 3.5 \cdot 10^{-139}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.25 \cdot 10^{-64}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 2.1 \cdot 10^{+104}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-x\right)\\
\end{array}
\end{array}
if y < -1.4499999999999999e-10Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in96.8%
Applied egg-rr96.8%
Taylor expanded in x around 0 66.6%
Taylor expanded in x around 0 66.0%
Taylor expanded in z around 0 58.6%
if -1.4499999999999999e-10 < y < -4e-116 or 3.50000000000000001e-139 < y < 1.25000000000000008e-64Initial program 100.0%
Taylor expanded in t around inf 82.2%
Taylor expanded in x around inf 47.9%
if -4e-116 < y < 3.50000000000000001e-139 or 1.25000000000000008e-64 < y < 2.0999999999999998e104Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in99.1%
Applied egg-rr99.1%
Taylor expanded in x around 0 66.4%
Taylor expanded in x around 0 48.2%
Taylor expanded in z around inf 40.6%
associate-*r*40.6%
neg-mul-140.6%
Simplified40.6%
if 2.0999999999999998e104 < y Initial program 100.0%
Taylor expanded in x around inf 64.5%
mul-1-neg64.5%
unsub-neg64.5%
Simplified64.5%
Taylor expanded in z around 0 61.8%
Taylor expanded in y around inf 61.8%
associate-*r*61.8%
neg-mul-161.8%
*-commutative61.8%
Simplified61.8%
Final simplification49.2%
(FPCore (x y z t)
:precision binary64
(if (or (<= x -6.8e+66)
(not
(or (<= x -230000.0) (and (not (<= x -2e-39)) (<= x 1.95e-118)))))
(* x (+ (- z y) 1.0))
(* (- y z) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -6.8e+66) || !((x <= -230000.0) || (!(x <= -2e-39) && (x <= 1.95e-118)))) {
tmp = x * ((z - y) + 1.0);
} else {
tmp = (y - 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 ((x <= (-6.8d+66)) .or. (.not. (x <= (-230000.0d0)) .or. (.not. (x <= (-2d-39))) .and. (x <= 1.95d-118))) then
tmp = x * ((z - y) + 1.0d0)
else
tmp = (y - z) * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -6.8e+66) || !((x <= -230000.0) || (!(x <= -2e-39) && (x <= 1.95e-118)))) {
tmp = x * ((z - y) + 1.0);
} else {
tmp = (y - z) * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -6.8e+66) or not ((x <= -230000.0) or (not (x <= -2e-39) and (x <= 1.95e-118))): tmp = x * ((z - y) + 1.0) else: tmp = (y - z) * t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -6.8e+66) || !((x <= -230000.0) || (!(x <= -2e-39) && (x <= 1.95e-118)))) tmp = Float64(x * Float64(Float64(z - y) + 1.0)); else tmp = Float64(Float64(y - z) * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -6.8e+66) || ~(((x <= -230000.0) || (~((x <= -2e-39)) && (x <= 1.95e-118))))) tmp = x * ((z - y) + 1.0); else tmp = (y - z) * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -6.8e+66], N[Not[Or[LessEqual[x, -230000.0], And[N[Not[LessEqual[x, -2e-39]], $MachinePrecision], LessEqual[x, 1.95e-118]]]], $MachinePrecision]], N[(x * N[(N[(z - y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.8 \cdot 10^{+66} \lor \neg \left(x \leq -230000 \lor \neg \left(x \leq -2 \cdot 10^{-39}\right) \land x \leq 1.95 \cdot 10^{-118}\right):\\
\;\;\;\;x \cdot \left(\left(z - y\right) + 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot t\\
\end{array}
\end{array}
if x < -6.8000000000000006e66 or -2.3e5 < x < -1.99999999999999986e-39 or 1.95e-118 < x Initial program 100.0%
Taylor expanded in x around inf 81.6%
mul-1-neg81.6%
unsub-neg81.6%
Simplified81.6%
if -6.8000000000000006e66 < x < -2.3e5 or -1.99999999999999986e-39 < x < 1.95e-118Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 83.5%
Taylor expanded in x around 0 77.3%
Taylor expanded in t around 0 77.3%
mul-1-neg77.3%
sub-neg77.3%
Simplified77.3%
Final simplification79.7%
(FPCore (x y z t)
:precision binary64
(if (or (<= t -5.3e-123)
(and (not (<= t 2.5e-79)) (or (<= t 1.8e+65) (not (<= t 5.6e+100)))))
(* (- y z) t)
(* x (- 1.0 y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5.3e-123) || (!(t <= 2.5e-79) && ((t <= 1.8e+65) || !(t <= 5.6e+100)))) {
tmp = (y - z) * 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 ((t <= (-5.3d-123)) .or. (.not. (t <= 2.5d-79)) .and. (t <= 1.8d+65) .or. (.not. (t <= 5.6d+100))) then
tmp = (y - z) * 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 ((t <= -5.3e-123) || (!(t <= 2.5e-79) && ((t <= 1.8e+65) || !(t <= 5.6e+100)))) {
tmp = (y - z) * t;
} else {
tmp = x * (1.0 - y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -5.3e-123) or (not (t <= 2.5e-79) and ((t <= 1.8e+65) or not (t <= 5.6e+100))): tmp = (y - z) * t else: tmp = x * (1.0 - y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -5.3e-123) || (!(t <= 2.5e-79) && ((t <= 1.8e+65) || !(t <= 5.6e+100)))) tmp = Float64(Float64(y - z) * 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 ((t <= -5.3e-123) || (~((t <= 2.5e-79)) && ((t <= 1.8e+65) || ~((t <= 5.6e+100))))) tmp = (y - z) * t; else tmp = x * (1.0 - y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -5.3e-123], And[N[Not[LessEqual[t, 2.5e-79]], $MachinePrecision], Or[LessEqual[t, 1.8e+65], N[Not[LessEqual[t, 5.6e+100]], $MachinePrecision]]]], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.3 \cdot 10^{-123} \lor \neg \left(t \leq 2.5 \cdot 10^{-79}\right) \land \left(t \leq 1.8 \cdot 10^{+65} \lor \neg \left(t \leq 5.6 \cdot 10^{+100}\right)\right):\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\end{array}
\end{array}
if t < -5.29999999999999971e-123 or 2.5e-79 < t < 1.79999999999999989e65 or 5.5999999999999996e100 < t Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in98.0%
Applied egg-rr98.0%
Taylor expanded in x around 0 80.9%
Taylor expanded in x around 0 72.0%
Taylor expanded in t around 0 73.4%
mul-1-neg73.4%
sub-neg73.4%
Simplified73.4%
if -5.29999999999999971e-123 < t < 2.5e-79 or 1.79999999999999989e65 < t < 5.5999999999999996e100Initial program 100.0%
Taylor expanded in x around inf 86.9%
mul-1-neg86.9%
unsub-neg86.9%
Simplified86.9%
Taylor expanded in z around 0 63.8%
Final simplification69.4%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.25e+130) (not (<= x 2.8e-118))) (* x (+ (- z y) 1.0)) (+ x (* (- y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.25e+130) || !(x <= 2.8e-118)) {
tmp = x * ((z - y) + 1.0);
} else {
tmp = x + ((y - 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 ((x <= (-1.25d+130)) .or. (.not. (x <= 2.8d-118))) then
tmp = x * ((z - y) + 1.0d0)
else
tmp = x + ((y - z) * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.25e+130) || !(x <= 2.8e-118)) {
tmp = x * ((z - y) + 1.0);
} else {
tmp = x + ((y - z) * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.25e+130) or not (x <= 2.8e-118): tmp = x * ((z - y) + 1.0) else: tmp = x + ((y - z) * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.25e+130) || !(x <= 2.8e-118)) tmp = Float64(x * Float64(Float64(z - y) + 1.0)); else tmp = Float64(x + Float64(Float64(y - z) * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.25e+130) || ~((x <= 2.8e-118))) tmp = x * ((z - y) + 1.0); else tmp = x + ((y - z) * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.25e+130], N[Not[LessEqual[x, 2.8e-118]], $MachinePrecision]], N[(x * N[(N[(z - y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.25 \cdot 10^{+130} \lor \neg \left(x \leq 2.8 \cdot 10^{-118}\right):\\
\;\;\;\;x \cdot \left(\left(z - y\right) + 1\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(y - z\right) \cdot t\\
\end{array}
\end{array}
if x < -1.2499999999999999e130 or 2.8e-118 < x Initial program 100.0%
Taylor expanded in x around inf 83.8%
mul-1-neg83.8%
unsub-neg83.8%
Simplified83.8%
if -1.2499999999999999e130 < x < 2.8e-118Initial program 100.0%
Taylor expanded in t around inf 81.7%
Final simplification82.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4.2e+97) (not (<= z 9.8e+52))) (- x (* z (- t x))) (+ x (* y (- t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.2e+97) || !(z <= 9.8e+52)) {
tmp = x - (z * (t - x));
} 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 <= (-4.2d+97)) .or. (.not. (z <= 9.8d+52))) then
tmp = x - (z * (t - x))
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 <= -4.2e+97) || !(z <= 9.8e+52)) {
tmp = x - (z * (t - x));
} else {
tmp = x + (y * (t - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4.2e+97) or not (z <= 9.8e+52): tmp = x - (z * (t - x)) else: tmp = x + (y * (t - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4.2e+97) || !(z <= 9.8e+52)) tmp = Float64(x - Float64(z * Float64(t - x))); 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 <= -4.2e+97) || ~((z <= 9.8e+52))) tmp = x - (z * (t - x)); else tmp = x + (y * (t - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4.2e+97], N[Not[LessEqual[z, 9.8e+52]], $MachinePrecision]], N[(x - N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.2 \cdot 10^{+97} \lor \neg \left(z \leq 9.8 \cdot 10^{+52}\right):\\
\;\;\;\;x - z \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\end{array}
\end{array}
if z < -4.20000000000000023e97 or 9.79999999999999993e52 < z Initial program 100.0%
Taylor expanded in y around 0 92.5%
mul-1-neg92.5%
distribute-lft-neg-out92.5%
*-commutative92.5%
Simplified92.5%
Taylor expanded in t around 0 83.6%
Taylor expanded in z around 0 92.5%
neg-mul-192.5%
unsub-neg92.5%
Simplified92.5%
if -4.20000000000000023e97 < z < 9.79999999999999993e52Initial program 100.0%
Taylor expanded in y around inf 84.7%
*-commutative84.7%
Simplified84.7%
Final simplification87.5%
(FPCore (x y z t) :precision binary64 (if (or (<= t -3.3e-123) (not (<= t 9.6e-189))) (* (- y z) t) (* y (- x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.3e-123) || !(t <= 9.6e-189)) {
tmp = (y - z) * t;
} else {
tmp = y * -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 ((t <= (-3.3d-123)) .or. (.not. (t <= 9.6d-189))) then
tmp = (y - z) * t
else
tmp = y * -x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.3e-123) || !(t <= 9.6e-189)) {
tmp = (y - z) * t;
} else {
tmp = y * -x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -3.3e-123) or not (t <= 9.6e-189): tmp = (y - z) * t else: tmp = y * -x return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -3.3e-123) || !(t <= 9.6e-189)) tmp = Float64(Float64(y - z) * t); else tmp = Float64(y * Float64(-x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -3.3e-123) || ~((t <= 9.6e-189))) tmp = (y - z) * t; else tmp = y * -x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -3.3e-123], N[Not[LessEqual[t, 9.6e-189]], $MachinePrecision]], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], N[(y * (-x)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.3 \cdot 10^{-123} \lor \neg \left(t \leq 9.6 \cdot 10^{-189}\right):\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-x\right)\\
\end{array}
\end{array}
if t < -3.3000000000000003e-123 or 9.5999999999999994e-189 < t Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in98.3%
Applied egg-rr98.3%
Taylor expanded in x around 0 78.2%
Taylor expanded in x around 0 63.7%
Taylor expanded in t around 0 64.7%
mul-1-neg64.7%
sub-neg64.7%
Simplified64.7%
if -3.3000000000000003e-123 < t < 9.5999999999999994e-189Initial program 100.0%
Taylor expanded in x around inf 90.3%
mul-1-neg90.3%
unsub-neg90.3%
Simplified90.3%
Taylor expanded in z around 0 66.4%
Taylor expanded in y around inf 45.3%
associate-*r*45.3%
neg-mul-145.3%
*-commutative45.3%
Simplified45.3%
Final simplification59.2%
(FPCore (x y z t) :precision binary64 (if (<= y -1.4e-6) (* y t) (if (<= y 1.0) x (* y (- x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.4e-6) {
tmp = y * t;
} else if (y <= 1.0) {
tmp = x;
} else {
tmp = y * -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 <= (-1.4d-6)) then
tmp = y * t
else if (y <= 1.0d0) then
tmp = x
else
tmp = y * -x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.4e-6) {
tmp = y * t;
} else if (y <= 1.0) {
tmp = x;
} else {
tmp = y * -x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.4e-6: tmp = y * t elif y <= 1.0: tmp = x else: tmp = y * -x return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.4e-6) tmp = Float64(y * t); elseif (y <= 1.0) tmp = x; else tmp = Float64(y * Float64(-x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.4e-6) tmp = y * t; elseif (y <= 1.0) tmp = x; else tmp = y * -x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.4e-6], N[(y * t), $MachinePrecision], If[LessEqual[y, 1.0], x, N[(y * (-x)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.4 \cdot 10^{-6}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-x\right)\\
\end{array}
\end{array}
if y < -1.39999999999999994e-6Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in96.8%
Applied egg-rr96.8%
Taylor expanded in x around 0 66.6%
Taylor expanded in x around 0 66.0%
Taylor expanded in z around 0 58.6%
if -1.39999999999999994e-6 < y < 1Initial program 100.0%
Taylor expanded in t around inf 73.6%
Taylor expanded in x around inf 33.9%
if 1 < y Initial program 100.0%
Taylor expanded in x around inf 55.8%
mul-1-neg55.8%
unsub-neg55.8%
Simplified55.8%
Taylor expanded in z around 0 46.9%
Taylor expanded in y around inf 44.4%
associate-*r*44.4%
neg-mul-144.4%
*-commutative44.4%
Simplified44.4%
Final simplification42.6%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.12e-9) (not (<= y 9.2e-18))) (* y t) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.12e-9) || !(y <= 9.2e-18)) {
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 <= (-1.12d-9)) .or. (.not. (y <= 9.2d-18))) 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 <= -1.12e-9) || !(y <= 9.2e-18)) {
tmp = y * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.12e-9) or not (y <= 9.2e-18): tmp = y * t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.12e-9) || !(y <= 9.2e-18)) tmp = Float64(y * t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.12e-9) || ~((y <= 9.2e-18))) tmp = y * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.12e-9], N[Not[LessEqual[y, 9.2e-18]], $MachinePrecision]], N[(y * t), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.12 \cdot 10^{-9} \lor \neg \left(y \leq 9.2 \cdot 10^{-18}\right):\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.12000000000000006e-9 or 9.2000000000000004e-18 < y Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in96.9%
Applied egg-rr96.9%
Taylor expanded in x around 0 55.5%
Taylor expanded in x around 0 54.8%
Taylor expanded in z around 0 45.4%
if -1.12000000000000006e-9 < y < 9.2000000000000004e-18Initial program 100.0%
Taylor expanded in t around inf 74.2%
Taylor expanded in x around inf 34.5%
Final simplification40.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%
Final simplification100.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 t around inf 65.4%
Taylor expanded in x around inf 18.5%
Final simplification18.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 2024040
(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))))