
(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 15 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 (* z (- t))))
(if (<= z -7.2e+187)
(* z x)
(if (<= z -1.75e-28)
t_1
(if (<= z 1.8e-271)
x
(if (<= z 7500.0)
(* y t)
(if (or (<= z 5.5e+130) (not (<= z 5.5e+282))) (* z x) t_1)))))))
double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double tmp;
if (z <= -7.2e+187) {
tmp = z * x;
} else if (z <= -1.75e-28) {
tmp = t_1;
} else if (z <= 1.8e-271) {
tmp = x;
} else if (z <= 7500.0) {
tmp = y * t;
} else if ((z <= 5.5e+130) || !(z <= 5.5e+282)) {
tmp = 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 = z * -t
if (z <= (-7.2d+187)) then
tmp = z * x
else if (z <= (-1.75d-28)) then
tmp = t_1
else if (z <= 1.8d-271) then
tmp = x
else if (z <= 7500.0d0) then
tmp = y * t
else if ((z <= 5.5d+130) .or. (.not. (z <= 5.5d+282))) then
tmp = 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 = z * -t;
double tmp;
if (z <= -7.2e+187) {
tmp = z * x;
} else if (z <= -1.75e-28) {
tmp = t_1;
} else if (z <= 1.8e-271) {
tmp = x;
} else if (z <= 7500.0) {
tmp = y * t;
} else if ((z <= 5.5e+130) || !(z <= 5.5e+282)) {
tmp = z * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * -t tmp = 0 if z <= -7.2e+187: tmp = z * x elif z <= -1.75e-28: tmp = t_1 elif z <= 1.8e-271: tmp = x elif z <= 7500.0: tmp = y * t elif (z <= 5.5e+130) or not (z <= 5.5e+282): tmp = z * x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(-t)) tmp = 0.0 if (z <= -7.2e+187) tmp = Float64(z * x); elseif (z <= -1.75e-28) tmp = t_1; elseif (z <= 1.8e-271) tmp = x; elseif (z <= 7500.0) tmp = Float64(y * t); elseif ((z <= 5.5e+130) || !(z <= 5.5e+282)) tmp = Float64(z * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * -t; tmp = 0.0; if (z <= -7.2e+187) tmp = z * x; elseif (z <= -1.75e-28) tmp = t_1; elseif (z <= 1.8e-271) tmp = x; elseif (z <= 7500.0) tmp = y * t; elseif ((z <= 5.5e+130) || ~((z <= 5.5e+282))) tmp = z * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * (-t)), $MachinePrecision]}, If[LessEqual[z, -7.2e+187], N[(z * x), $MachinePrecision], If[LessEqual[z, -1.75e-28], t$95$1, If[LessEqual[z, 1.8e-271], x, If[LessEqual[z, 7500.0], N[(y * t), $MachinePrecision], If[Or[LessEqual[z, 5.5e+130], N[Not[LessEqual[z, 5.5e+282]], $MachinePrecision]], N[(z * x), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(-t\right)\\
\mathbf{if}\;z \leq -7.2 \cdot 10^{+187}:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;z \leq -1.75 \cdot 10^{-28}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{-271}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 7500:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;z \leq 5.5 \cdot 10^{+130} \lor \neg \left(z \leq 5.5 \cdot 10^{+282}\right):\\
\;\;\;\;z \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7.20000000000000072e187 or 7500 < z < 5.4999999999999997e130 or 5.4999999999999999e282 < z Initial program 99.9%
Taylor expanded in x around inf 67.5%
mul-1-neg67.5%
unsub-neg67.5%
Simplified67.5%
Taylor expanded in z around inf 62.1%
if -7.20000000000000072e187 < z < -1.75e-28 or 5.4999999999999997e130 < z < 5.4999999999999999e282Initial program 100.0%
Taylor expanded in y around 0 74.5%
mul-1-neg74.5%
unsub-neg74.5%
Simplified74.5%
Taylor expanded in x around 0 71.6%
Taylor expanded in x around 0 49.9%
mul-1-neg49.9%
*-commutative49.9%
distribute-rgt-neg-in49.9%
Simplified49.9%
if -1.75e-28 < z < 1.7999999999999999e-271Initial program 100.0%
Taylor expanded in y around inf 94.0%
*-commutative94.0%
Simplified94.0%
Taylor expanded in y around 0 42.7%
if 1.7999999999999999e-271 < z < 7500Initial program 100.0%
Taylor expanded in y around inf 92.0%
*-commutative92.0%
Simplified92.0%
Taylor expanded in x around 0 85.5%
Taylor expanded in t around inf 43.5%
*-commutative43.5%
Simplified43.5%
Final simplification49.2%
(FPCore (x y z t)
:precision binary64
(if (<= z -1.18e+118)
(* z x)
(if (<= z -3.6e-222)
(* y t)
(if (<= z 1.75e-269) x (if (<= z 6500.0) (* y t) (* z x))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.18e+118) {
tmp = z * x;
} else if (z <= -3.6e-222) {
tmp = y * t;
} else if (z <= 1.75e-269) {
tmp = x;
} else if (z <= 6500.0) {
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 (z <= (-1.18d+118)) then
tmp = z * x
else if (z <= (-3.6d-222)) then
tmp = y * t
else if (z <= 1.75d-269) then
tmp = x
else if (z <= 6500.0d0) 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 (z <= -1.18e+118) {
tmp = z * x;
} else if (z <= -3.6e-222) {
tmp = y * t;
} else if (z <= 1.75e-269) {
tmp = x;
} else if (z <= 6500.0) {
tmp = y * t;
} else {
tmp = z * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.18e+118: tmp = z * x elif z <= -3.6e-222: tmp = y * t elif z <= 1.75e-269: tmp = x elif z <= 6500.0: tmp = y * t else: tmp = z * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.18e+118) tmp = Float64(z * x); elseif (z <= -3.6e-222) tmp = Float64(y * t); elseif (z <= 1.75e-269) tmp = x; elseif (z <= 6500.0) 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 (z <= -1.18e+118) tmp = z * x; elseif (z <= -3.6e-222) tmp = y * t; elseif (z <= 1.75e-269) tmp = x; elseif (z <= 6500.0) tmp = y * t; else tmp = z * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.18e+118], N[(z * x), $MachinePrecision], If[LessEqual[z, -3.6e-222], N[(y * t), $MachinePrecision], If[LessEqual[z, 1.75e-269], x, If[LessEqual[z, 6500.0], N[(y * t), $MachinePrecision], N[(z * x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.18 \cdot 10^{+118}:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;z \leq -3.6 \cdot 10^{-222}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;z \leq 1.75 \cdot 10^{-269}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 6500:\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if z < -1.1799999999999999e118 or 6500 < z Initial program 100.0%
Taylor expanded in x around inf 53.8%
mul-1-neg53.8%
unsub-neg53.8%
Simplified53.8%
Taylor expanded in z around inf 49.0%
if -1.1799999999999999e118 < z < -3.59999999999999974e-222 or 1.75000000000000009e-269 < z < 6500Initial program 100.0%
Taylor expanded in y around inf 83.0%
*-commutative83.0%
Simplified83.0%
Taylor expanded in x around 0 79.8%
Taylor expanded in t around inf 38.3%
*-commutative38.3%
Simplified38.3%
if -3.59999999999999974e-222 < z < 1.75000000000000009e-269Initial program 99.9%
Taylor expanded in y around inf 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in y around 0 55.0%
Final simplification44.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- x t))))
(if (<= z -1.35e-6)
t_1
(if (<= z 3.3e-278)
(* x (- 1.0 y))
(if (<= z 420.0) (* y (- t x)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double tmp;
if (z <= -1.35e-6) {
tmp = t_1;
} else if (z <= 3.3e-278) {
tmp = x * (1.0 - y);
} else if (z <= 420.0) {
tmp = y * (t - 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 = z * (x - t)
if (z <= (-1.35d-6)) then
tmp = t_1
else if (z <= 3.3d-278) then
tmp = x * (1.0d0 - y)
else if (z <= 420.0d0) then
tmp = y * (t - 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 = z * (x - t);
double tmp;
if (z <= -1.35e-6) {
tmp = t_1;
} else if (z <= 3.3e-278) {
tmp = x * (1.0 - y);
} else if (z <= 420.0) {
tmp = y * (t - x);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (x - t) tmp = 0 if z <= -1.35e-6: tmp = t_1 elif z <= 3.3e-278: tmp = x * (1.0 - y) elif z <= 420.0: tmp = y * (t - x) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(x - t)) tmp = 0.0 if (z <= -1.35e-6) tmp = t_1; elseif (z <= 3.3e-278) tmp = Float64(x * Float64(1.0 - y)); elseif (z <= 420.0) tmp = Float64(y * Float64(t - x)); 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 <= -1.35e-6) tmp = t_1; elseif (z <= 3.3e-278) tmp = x * (1.0 - y); elseif (z <= 420.0) tmp = y * (t - x); 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, -1.35e-6], t$95$1, If[LessEqual[z, 3.3e-278], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 420.0], N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(x - t\right)\\
\mathbf{if}\;z \leq -1.35 \cdot 10^{-6}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.3 \cdot 10^{-278}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{elif}\;z \leq 420:\\
\;\;\;\;y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.34999999999999999e-6 or 420 < z Initial program 99.9%
Taylor expanded in y around 0 83.2%
mul-1-neg83.2%
unsub-neg83.2%
Simplified83.2%
Taylor expanded in x around 0 78.3%
Taylor expanded in z around inf 82.4%
if -1.34999999999999999e-6 < z < 3.2999999999999998e-278Initial program 100.0%
Taylor expanded in x around inf 66.0%
mul-1-neg66.0%
unsub-neg66.0%
Simplified66.0%
Taylor expanded in z around 0 65.6%
if 3.2999999999999998e-278 < z < 420Initial program 100.0%
Taylor expanded in y around inf 92.1%
*-commutative92.1%
Simplified92.1%
Taylor expanded in x around 0 85.7%
Taylor expanded in y around inf 69.6%
neg-mul-169.6%
unsub-neg69.6%
Simplified69.6%
(FPCore (x y z t)
:precision binary64
(if (<= t -9.5e+35)
(* y t)
(if (<= t -6.5e-245)
(* x (+ z 1.0))
(if (<= t 1.3e+74) (* x (- 1.0 y)) (* y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -9.5e+35) {
tmp = y * t;
} else if (t <= -6.5e-245) {
tmp = x * (z + 1.0);
} else if (t <= 1.3e+74) {
tmp = x * (1.0 - y);
} 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 (t <= (-9.5d+35)) then
tmp = y * t
else if (t <= (-6.5d-245)) then
tmp = x * (z + 1.0d0)
else if (t <= 1.3d+74) then
tmp = x * (1.0d0 - y)
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 (t <= -9.5e+35) {
tmp = y * t;
} else if (t <= -6.5e-245) {
tmp = x * (z + 1.0);
} else if (t <= 1.3e+74) {
tmp = x * (1.0 - y);
} else {
tmp = y * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -9.5e+35: tmp = y * t elif t <= -6.5e-245: tmp = x * (z + 1.0) elif t <= 1.3e+74: tmp = x * (1.0 - y) else: tmp = y * t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -9.5e+35) tmp = Float64(y * t); elseif (t <= -6.5e-245) tmp = Float64(x * Float64(z + 1.0)); elseif (t <= 1.3e+74) tmp = Float64(x * Float64(1.0 - y)); else tmp = Float64(y * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -9.5e+35) tmp = y * t; elseif (t <= -6.5e-245) tmp = x * (z + 1.0); elseif (t <= 1.3e+74) tmp = x * (1.0 - y); else tmp = y * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -9.5e+35], N[(y * t), $MachinePrecision], If[LessEqual[t, -6.5e-245], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.3e+74], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], N[(y * t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9.5 \cdot 10^{+35}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;t \leq -6.5 \cdot 10^{-245}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{elif}\;t \leq 1.3 \cdot 10^{+74}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if t < -9.50000000000000062e35 or 1.3e74 < t Initial program 100.0%
Taylor expanded in y around inf 59.9%
*-commutative59.9%
Simplified59.9%
Taylor expanded in x around 0 53.2%
Taylor expanded in t around inf 49.5%
*-commutative49.5%
Simplified49.5%
if -9.50000000000000062e35 < t < -6.5000000000000004e-245Initial program 99.9%
Taylor expanded in x around inf 69.9%
mul-1-neg69.9%
unsub-neg69.9%
Simplified69.9%
Taylor expanded in y around 0 57.1%
+-commutative57.1%
Simplified57.1%
if -6.5000000000000004e-245 < t < 1.3e74Initial program 99.9%
Taylor expanded in x around inf 80.9%
mul-1-neg80.9%
unsub-neg80.9%
Simplified80.9%
Taylor expanded in z around 0 63.8%
(FPCore (x y z t)
:precision binary64
(if (<= y -3.4e+44)
(* y t)
(if (<= y 5.8e+23)
(* x (+ z 1.0))
(if (<= y 1.25e+168) (* y (- x)) (* y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.4e+44) {
tmp = y * t;
} else if (y <= 5.8e+23) {
tmp = x * (z + 1.0);
} else if (y <= 1.25e+168) {
tmp = y * -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 (y <= (-3.4d+44)) then
tmp = y * t
else if (y <= 5.8d+23) then
tmp = x * (z + 1.0d0)
else if (y <= 1.25d+168) then
tmp = y * -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 (y <= -3.4e+44) {
tmp = y * t;
} else if (y <= 5.8e+23) {
tmp = x * (z + 1.0);
} else if (y <= 1.25e+168) {
tmp = y * -x;
} else {
tmp = y * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -3.4e+44: tmp = y * t elif y <= 5.8e+23: tmp = x * (z + 1.0) elif y <= 1.25e+168: tmp = y * -x else: tmp = y * t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -3.4e+44) tmp = Float64(y * t); elseif (y <= 5.8e+23) tmp = Float64(x * Float64(z + 1.0)); elseif (y <= 1.25e+168) tmp = Float64(y * Float64(-x)); else tmp = Float64(y * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -3.4e+44) tmp = y * t; elseif (y <= 5.8e+23) tmp = x * (z + 1.0); elseif (y <= 1.25e+168) tmp = y * -x; else tmp = y * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -3.4e+44], N[(y * t), $MachinePrecision], If[LessEqual[y, 5.8e+23], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.25e+168], N[(y * (-x)), $MachinePrecision], N[(y * t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.4 \cdot 10^{+44}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq 5.8 \cdot 10^{+23}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{elif}\;y \leq 1.25 \cdot 10^{+168}:\\
\;\;\;\;y \cdot \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if y < -3.4e44 or 1.24999999999999992e168 < y Initial program 100.0%
Taylor expanded in y around inf 84.2%
*-commutative84.2%
Simplified84.2%
Taylor expanded in x around 0 76.9%
Taylor expanded in t around inf 58.4%
*-commutative58.4%
Simplified58.4%
if -3.4e44 < y < 5.80000000000000025e23Initial program 100.0%
Taylor expanded in x around inf 61.7%
mul-1-neg61.7%
unsub-neg61.7%
Simplified61.7%
Taylor expanded in y around 0 57.5%
+-commutative57.5%
Simplified57.5%
if 5.80000000000000025e23 < y < 1.24999999999999992e168Initial program 100.0%
Taylor expanded in x around inf 65.3%
mul-1-neg65.3%
unsub-neg65.3%
Simplified65.3%
Taylor expanded in y around inf 47.6%
mul-1-neg47.6%
Simplified47.6%
Final simplification56.4%
(FPCore (x y z t) :precision binary64 (if (<= y -3.9e-63) (* y t) (if (<= y 5.8e+22) x (if (<= y 5.7e+169) (* y (- x)) (* y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.9e-63) {
tmp = y * t;
} else if (y <= 5.8e+22) {
tmp = x;
} else if (y <= 5.7e+169) {
tmp = y * -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 (y <= (-3.9d-63)) then
tmp = y * t
else if (y <= 5.8d+22) then
tmp = x
else if (y <= 5.7d+169) then
tmp = y * -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 (y <= -3.9e-63) {
tmp = y * t;
} else if (y <= 5.8e+22) {
tmp = x;
} else if (y <= 5.7e+169) {
tmp = y * -x;
} else {
tmp = y * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -3.9e-63: tmp = y * t elif y <= 5.8e+22: tmp = x elif y <= 5.7e+169: tmp = y * -x else: tmp = y * t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -3.9e-63) tmp = Float64(y * t); elseif (y <= 5.8e+22) tmp = x; elseif (y <= 5.7e+169) tmp = Float64(y * Float64(-x)); else tmp = Float64(y * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -3.9e-63) tmp = y * t; elseif (y <= 5.8e+22) tmp = x; elseif (y <= 5.7e+169) tmp = y * -x; else tmp = y * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -3.9e-63], N[(y * t), $MachinePrecision], If[LessEqual[y, 5.8e+22], x, If[LessEqual[y, 5.7e+169], N[(y * (-x)), $MachinePrecision], N[(y * t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.9 \cdot 10^{-63}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq 5.8 \cdot 10^{+22}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 5.7 \cdot 10^{+169}:\\
\;\;\;\;y \cdot \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if y < -3.90000000000000022e-63 or 5.7000000000000002e169 < y Initial program 100.0%
Taylor expanded in y around inf 79.4%
*-commutative79.4%
Simplified79.4%
Taylor expanded in x around 0 73.7%
Taylor expanded in t around inf 50.9%
*-commutative50.9%
Simplified50.9%
if -3.90000000000000022e-63 < y < 5.8e22Initial program 100.0%
Taylor expanded in y around inf 43.9%
*-commutative43.9%
Simplified43.9%
Taylor expanded in y around 0 37.5%
if 5.8e22 < y < 5.7000000000000002e169Initial program 100.0%
Taylor expanded in x around inf 65.3%
mul-1-neg65.3%
unsub-neg65.3%
Simplified65.3%
Taylor expanded in y around inf 47.6%
mul-1-neg47.6%
Simplified47.6%
Final simplification44.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.8e+54) (not (<= z 1800.0))) (* z (- x t)) (- x (* y (- x t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.8e+54) || !(z <= 1800.0)) {
tmp = z * (x - t);
} else {
tmp = x - (y * (x - t));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-1.8d+54)) .or. (.not. (z <= 1800.0d0))) then
tmp = z * (x - t)
else
tmp = x - (y * (x - t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.8e+54) || !(z <= 1800.0)) {
tmp = z * (x - t);
} else {
tmp = x - (y * (x - t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.8e+54) or not (z <= 1800.0): tmp = z * (x - t) else: tmp = x - (y * (x - t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.8e+54) || !(z <= 1800.0)) tmp = Float64(z * Float64(x - t)); else tmp = Float64(x - Float64(y * Float64(x - t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.8e+54) || ~((z <= 1800.0))) tmp = z * (x - t); else tmp = x - (y * (x - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.8e+54], N[Not[LessEqual[z, 1800.0]], $MachinePrecision]], N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision], N[(x - N[(y * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.8 \cdot 10^{+54} \lor \neg \left(z \leq 1800\right):\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot \left(x - t\right)\\
\end{array}
\end{array}
if z < -1.8000000000000001e54 or 1800 < z Initial program 99.9%
Taylor expanded in y around 0 86.6%
mul-1-neg86.6%
unsub-neg86.6%
Simplified86.6%
Taylor expanded in x around 0 81.1%
Taylor expanded in z around inf 85.7%
if -1.8000000000000001e54 < z < 1800Initial program 100.0%
Taylor expanded in y around inf 89.0%
*-commutative89.0%
Simplified89.0%
Final simplification87.6%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* z (- x t)))) (if (<= z -1.2e+61) t_1 (if (<= z 10.5) (- x (* y (- x t))) (+ x t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double tmp;
if (z <= -1.2e+61) {
tmp = t_1;
} else if (z <= 10.5) {
tmp = x - (y * (x - t));
} 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 <= (-1.2d+61)) then
tmp = t_1
else if (z <= 10.5d0) then
tmp = x - (y * (x - t))
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 <= -1.2e+61) {
tmp = t_1;
} else if (z <= 10.5) {
tmp = x - (y * (x - t));
} else {
tmp = x + t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (x - t) tmp = 0 if z <= -1.2e+61: tmp = t_1 elif z <= 10.5: tmp = x - (y * (x - t)) 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 <= -1.2e+61) tmp = t_1; elseif (z <= 10.5) tmp = Float64(x - Float64(y * Float64(x - t))); 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 <= -1.2e+61) tmp = t_1; elseif (z <= 10.5) tmp = x - (y * (x - t)); 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, -1.2e+61], t$95$1, If[LessEqual[z, 10.5], N[(x - N[(y * N[(x - t), $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 -1.2 \cdot 10^{+61}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 10.5:\\
\;\;\;\;x - y \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + t\_1\\
\end{array}
\end{array}
if z < -1.1999999999999999e61Initial program 100.0%
Taylor expanded in y around 0 86.3%
mul-1-neg86.3%
unsub-neg86.3%
Simplified86.3%
Taylor expanded in x around 0 81.0%
Taylor expanded in z around inf 86.3%
if -1.1999999999999999e61 < z < 10.5Initial program 100.0%
Taylor expanded in y around inf 89.0%
*-commutative89.0%
Simplified89.0%
if 10.5 < z Initial program 99.9%
Taylor expanded in y around 0 86.7%
mul-1-neg86.7%
unsub-neg86.7%
Simplified86.7%
Final simplification88.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.35e-6) (not (<= z 1.12e-8))) (* z (- x t)) (+ x (* y t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.35e-6) || !(z <= 1.12e-8)) {
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 <= (-1.35d-6)) .or. (.not. (z <= 1.12d-8))) 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 <= -1.35e-6) || !(z <= 1.12e-8)) {
tmp = z * (x - t);
} else {
tmp = x + (y * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.35e-6) or not (z <= 1.12e-8): tmp = z * (x - t) else: tmp = x + (y * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.35e-6) || !(z <= 1.12e-8)) 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 <= -1.35e-6) || ~((z <= 1.12e-8))) tmp = z * (x - t); else tmp = x + (y * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.35e-6], N[Not[LessEqual[z, 1.12e-8]], $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 -1.35 \cdot 10^{-6} \lor \neg \left(z \leq 1.12 \cdot 10^{-8}\right):\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot t\\
\end{array}
\end{array}
if z < -1.34999999999999999e-6 or 1.11999999999999994e-8 < z Initial program 99.9%
Taylor expanded in y around 0 82.5%
mul-1-neg82.5%
unsub-neg82.5%
Simplified82.5%
Taylor expanded in x around 0 77.7%
Taylor expanded in z around inf 81.7%
if -1.34999999999999999e-6 < z < 1.11999999999999994e-8Initial program 100.0%
Taylor expanded in t around inf 75.8%
Taylor expanded in y around inf 68.3%
Final simplification74.7%
(FPCore (x y z t) :precision binary64 (if (or (<= y -85000.0) (not (<= y 3.8e+21))) (* y (- t x)) (* x (+ z 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -85000.0) || !(y <= 3.8e+21)) {
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 <= (-85000.0d0)) .or. (.not. (y <= 3.8d+21))) 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 <= -85000.0) || !(y <= 3.8e+21)) {
tmp = y * (t - x);
} else {
tmp = x * (z + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -85000.0) or not (y <= 3.8e+21): tmp = y * (t - x) else: tmp = x * (z + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -85000.0) || !(y <= 3.8e+21)) 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 <= -85000.0) || ~((y <= 3.8e+21))) tmp = y * (t - x); else tmp = x * (z + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -85000.0], N[Not[LessEqual[y, 3.8e+21]], $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 -85000 \lor \neg \left(y \leq 3.8 \cdot 10^{+21}\right):\\
\;\;\;\;y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\end{array}
\end{array}
if y < -85000 or 3.8e21 < y Initial program 100.0%
Taylor expanded in y around inf 78.3%
*-commutative78.3%
Simplified78.3%
Taylor expanded in x around 0 72.8%
Taylor expanded in y around inf 78.3%
neg-mul-178.3%
unsub-neg78.3%
Simplified78.3%
if -85000 < y < 3.8e21Initial program 100.0%
Taylor expanded in x around inf 61.6%
mul-1-neg61.6%
unsub-neg61.6%
Simplified61.6%
Taylor expanded in y around 0 60.0%
+-commutative60.0%
Simplified60.0%
Final simplification69.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -380000.0) (not (<= z 6e-7))) (* z x) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -380000.0) || !(z <= 6e-7)) {
tmp = z * x;
} 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 ((z <= (-380000.0d0)) .or. (.not. (z <= 6d-7))) then
tmp = z * x
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -380000.0) || !(z <= 6e-7)) {
tmp = z * x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -380000.0) or not (z <= 6e-7): tmp = z * x else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -380000.0) || !(z <= 6e-7)) tmp = Float64(z * x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -380000.0) || ~((z <= 6e-7))) tmp = z * x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -380000.0], N[Not[LessEqual[z, 6e-7]], $MachinePrecision]], N[(z * x), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -380000 \lor \neg \left(z \leq 6 \cdot 10^{-7}\right):\\
\;\;\;\;z \cdot x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -3.8e5 or 5.9999999999999997e-7 < z Initial program 99.9%
Taylor expanded in x around inf 51.9%
mul-1-neg51.9%
unsub-neg51.9%
Simplified51.9%
Taylor expanded in z around inf 43.8%
if -3.8e5 < z < 5.9999999999999997e-7Initial program 100.0%
Taylor expanded in y around inf 91.0%
*-commutative91.0%
Simplified91.0%
Taylor expanded in y around 0 33.9%
Final simplification38.5%
(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 (if (<= y -82000.0) (* y x) x))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -82000.0) {
tmp = y * x;
} 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 <= (-82000.0d0)) then
tmp = y * x
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 <= -82000.0) {
tmp = y * x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -82000.0: tmp = y * x else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -82000.0) tmp = Float64(y * x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -82000.0) tmp = y * x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -82000.0], N[(y * x), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -82000:\\
\;\;\;\;y \cdot x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -82000Initial program 99.9%
Taylor expanded in x around inf 43.5%
mul-1-neg43.5%
unsub-neg43.5%
Simplified43.5%
Taylor expanded in y around inf 32.4%
mul-1-neg32.4%
Simplified32.4%
add-sqr-sqrt32.4%
sqrt-unprod33.9%
sqr-neg33.9%
sqrt-unprod0.0%
add-sqr-sqrt9.9%
pow19.9%
Applied egg-rr9.9%
unpow19.9%
Simplified9.9%
if -82000 < y Initial program 100.0%
Taylor expanded in y around inf 55.6%
*-commutative55.6%
Simplified55.6%
Taylor expanded in y around 0 24.7%
Final simplification21.1%
(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 19.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 2024152
(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))))