
(FPCore (x y z t) :precision binary64 (/ (* x (- y z)) (- t z)))
double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - 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 * (y - z)) / (t - z)
end function
public static double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - z);
}
def code(x, y, z, t): return (x * (y - z)) / (t - z)
function code(x, y, z, t) return Float64(Float64(x * Float64(y - z)) / Float64(t - z)) end
function tmp = code(x, y, z, t) tmp = (x * (y - z)) / (t - z); end
code[x_, y_, z_, t_] := N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(y - z\right)}{t - z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (/ (* x (- y z)) (- t z)))
double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - 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 * (y - z)) / (t - z)
end function
public static double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - z);
}
def code(x, y, z, t): return (x * (y - z)) / (t - z)
function code(x, y, z, t) return Float64(Float64(x * Float64(y - z)) / Float64(t - z)) end
function tmp = code(x, y, z, t) tmp = (x * (y - z)) / (t - z); end
code[x_, y_, z_, t_] := N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(y - z\right)}{t - z}
\end{array}
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- y z) (/ x (- t z)))) (t_2 (/ (* x (- y z)) (- t z))))
(if (<= t_2 (- INFINITY))
t_1
(if (<= t_2 -2e-315)
t_2
(if (<= t_2 0.0) (/ y (/ t x)) (if (<= t_2 5e+290) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = (y - z) * (x / (t - z));
double t_2 = (x * (y - z)) / (t - z);
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= -2e-315) {
tmp = t_2;
} else if (t_2 <= 0.0) {
tmp = y / (t / x);
} else if (t_2 <= 5e+290) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = (y - z) * (x / (t - z));
double t_2 = (x * (y - z)) / (t - z);
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = t_1;
} else if (t_2 <= -2e-315) {
tmp = t_2;
} else if (t_2 <= 0.0) {
tmp = y / (t / x);
} else if (t_2 <= 5e+290) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y - z) * (x / (t - z)) t_2 = (x * (y - z)) / (t - z) tmp = 0 if t_2 <= -math.inf: tmp = t_1 elif t_2 <= -2e-315: tmp = t_2 elif t_2 <= 0.0: tmp = y / (t / x) elif t_2 <= 5e+290: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y - z) * Float64(x / Float64(t - z))) t_2 = Float64(Float64(x * Float64(y - z)) / Float64(t - z)) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= -2e-315) tmp = t_2; elseif (t_2 <= 0.0) tmp = Float64(y / Float64(t / x)); elseif (t_2 <= 5e+290) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y - z) * (x / (t - z)); t_2 = (x * (y - z)) / (t - z); tmp = 0.0; if (t_2 <= -Inf) tmp = t_1; elseif (t_2 <= -2e-315) tmp = t_2; elseif (t_2 <= 0.0) tmp = y / (t / x); elseif (t_2 <= 5e+290) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, -2e-315], t$95$2, If[LessEqual[t$95$2, 0.0], N[(y / N[(t / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 5e+290], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y - z\right) \cdot \frac{x}{t - z}\\
t_2 := \frac{x \cdot \left(y - z\right)}{t - z}\\
\mathbf{if}\;t_2 \leq -\infty:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_2 \leq -2 \cdot 10^{-315}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_2 \leq 0:\\
\;\;\;\;\frac{y}{\frac{t}{x}}\\
\mathbf{elif}\;t_2 \leq 5 \cdot 10^{+290}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) < -inf.0 or 4.9999999999999998e290 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) Initial program 36.5%
associate-*l/99.7%
Simplified99.7%
if -inf.0 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) < -2.0000000019e-315 or -0.0 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) < 4.9999999999999998e290Initial program 99.7%
if -2.0000000019e-315 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) < -0.0Initial program 83.4%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in z around 0 83.4%
associate-/l*99.9%
associate-/r/99.9%
Simplified99.9%
*-commutative99.9%
clear-num99.9%
un-div-inv100.0%
Applied egg-rr100.0%
Final simplification99.7%
(FPCore (x y z t)
:precision binary64
(if (<= z -4.6e+80)
x
(if (<= z 2.6e-89)
(* (- y z) (/ x t))
(if (<= z 5e+27)
(* x (/ y (- t z)))
(if (<= z 1.25e+85) (/ (- x) (/ t z)) x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.6e+80) {
tmp = x;
} else if (z <= 2.6e-89) {
tmp = (y - z) * (x / t);
} else if (z <= 5e+27) {
tmp = x * (y / (t - z));
} else if (z <= 1.25e+85) {
tmp = -x / (t / z);
} 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 <= (-4.6d+80)) then
tmp = x
else if (z <= 2.6d-89) then
tmp = (y - z) * (x / t)
else if (z <= 5d+27) then
tmp = x * (y / (t - z))
else if (z <= 1.25d+85) then
tmp = -x / (t / z)
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 <= -4.6e+80) {
tmp = x;
} else if (z <= 2.6e-89) {
tmp = (y - z) * (x / t);
} else if (z <= 5e+27) {
tmp = x * (y / (t - z));
} else if (z <= 1.25e+85) {
tmp = -x / (t / z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -4.6e+80: tmp = x elif z <= 2.6e-89: tmp = (y - z) * (x / t) elif z <= 5e+27: tmp = x * (y / (t - z)) elif z <= 1.25e+85: tmp = -x / (t / z) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -4.6e+80) tmp = x; elseif (z <= 2.6e-89) tmp = Float64(Float64(y - z) * Float64(x / t)); elseif (z <= 5e+27) tmp = Float64(x * Float64(y / Float64(t - z))); elseif (z <= 1.25e+85) tmp = Float64(Float64(-x) / Float64(t / z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -4.6e+80) tmp = x; elseif (z <= 2.6e-89) tmp = (y - z) * (x / t); elseif (z <= 5e+27) tmp = x * (y / (t - z)); elseif (z <= 1.25e+85) tmp = -x / (t / z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -4.6e+80], x, If[LessEqual[z, 2.6e-89], N[(N[(y - z), $MachinePrecision] * N[(x / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5e+27], N[(x * N[(y / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.25e+85], N[((-x) / N[(t / z), $MachinePrecision]), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.6 \cdot 10^{+80}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{-89}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{x}{t}\\
\mathbf{elif}\;z \leq 5 \cdot 10^{+27}:\\
\;\;\;\;x \cdot \frac{y}{t - z}\\
\mathbf{elif}\;z \leq 1.25 \cdot 10^{+85}:\\
\;\;\;\;\frac{-x}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -4.60000000000000008e80 or 1.25e85 < z Initial program 68.7%
associate-*l/67.4%
Simplified67.4%
Taylor expanded in z around inf 63.2%
if -4.60000000000000008e80 < z < 2.5999999999999999e-89Initial program 91.5%
associate-*l/91.6%
Simplified91.6%
Taylor expanded in t around inf 73.7%
associate-/l*75.8%
associate-/r/77.9%
Simplified77.9%
if 2.5999999999999999e-89 < z < 4.99999999999999979e27Initial program 96.0%
associate-*l/94.2%
Simplified94.2%
Taylor expanded in y around inf 67.6%
*-commutative67.6%
associate-/l*69.5%
associate-/r/67.6%
Simplified67.6%
if 4.99999999999999979e27 < z < 1.25e85Initial program 67.9%
associate-*l/99.2%
Simplified99.2%
Taylor expanded in t around inf 52.0%
associate-/l*84.1%
associate-/r/83.3%
Simplified83.3%
Taylor expanded in y around 0 52.0%
mul-1-neg52.0%
associate-/l*84.1%
Simplified84.1%
Final simplification71.9%
(FPCore (x y z t) :precision binary64 (if (<= z -1.2e+87) (* x (/ z (- z t))) (if (<= z 1.85e+199) (* (- y z) (/ x (- t z))) (/ (- x) (/ z (- y z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.2e+87) {
tmp = x * (z / (z - t));
} else if (z <= 1.85e+199) {
tmp = (y - z) * (x / (t - z));
} else {
tmp = -x / (z / (y - z));
}
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.2d+87)) then
tmp = x * (z / (z - t))
else if (z <= 1.85d+199) then
tmp = (y - z) * (x / (t - z))
else
tmp = -x / (z / (y - z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.2e+87) {
tmp = x * (z / (z - t));
} else if (z <= 1.85e+199) {
tmp = (y - z) * (x / (t - z));
} else {
tmp = -x / (z / (y - z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.2e+87: tmp = x * (z / (z - t)) elif z <= 1.85e+199: tmp = (y - z) * (x / (t - z)) else: tmp = -x / (z / (y - z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.2e+87) tmp = Float64(x * Float64(z / Float64(z - t))); elseif (z <= 1.85e+199) tmp = Float64(Float64(y - z) * Float64(x / Float64(t - z))); else tmp = Float64(Float64(-x) / Float64(z / Float64(y - z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.2e+87) tmp = x * (z / (z - t)); elseif (z <= 1.85e+199) tmp = (y - z) * (x / (t - z)); else tmp = -x / (z / (y - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.2e+87], N[(x * N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.85e+199], N[(N[(y - z), $MachinePrecision] * N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-x) / N[(z / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.2 \cdot 10^{+87}:\\
\;\;\;\;x \cdot \frac{z}{z - t}\\
\mathbf{elif}\;z \leq 1.85 \cdot 10^{+199}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{x}{t - z}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{\frac{z}{y - z}}\\
\end{array}
\end{array}
if z < -1.19999999999999991e87Initial program 68.3%
associate-*l/66.6%
Simplified66.6%
Taylor expanded in y around 0 54.9%
mul-1-neg54.9%
associate-*l/56.7%
distribute-rgt-neg-out56.7%
Simplified56.7%
*-commutative56.7%
frac-2neg56.7%
associate-*r/54.9%
add-sqr-sqrt54.6%
sqrt-unprod25.2%
sqr-neg25.2%
sqrt-unprod0.0%
add-sqr-sqrt7.9%
add-sqr-sqrt5.0%
sqrt-unprod21.4%
sqr-neg21.4%
sqrt-unprod22.9%
add-sqr-sqrt54.9%
sub-neg54.9%
distribute-neg-in54.9%
add-sqr-sqrt54.6%
sqrt-unprod24.1%
sqr-neg24.1%
sqrt-unprod0.0%
add-sqr-sqrt15.1%
add-sqr-sqrt15.1%
sqrt-unprod9.8%
sqr-neg9.8%
sqrt-unprod0.0%
add-sqr-sqrt54.9%
Applied egg-rr54.9%
associate-/l*56.5%
associate-/r/79.9%
+-commutative79.9%
unsub-neg79.9%
Simplified79.9%
if -1.19999999999999991e87 < z < 1.85000000000000011e199Initial program 90.1%
associate-*l/91.8%
Simplified91.8%
if 1.85000000000000011e199 < z Initial program 58.9%
associate-*l/47.0%
Simplified47.0%
Taylor expanded in t around 0 58.9%
mul-1-neg58.9%
associate-/l*88.5%
distribute-neg-frac88.5%
Simplified88.5%
Final simplification89.0%
(FPCore (x y z t) :precision binary64 (if (or (<= y -7.4e-28) (not (<= y 1e+51))) (* x (/ y (- t z))) (* x (/ z (- z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -7.4e-28) || !(y <= 1e+51)) {
tmp = x * (y / (t - z));
} else {
tmp = x * (z / (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 ((y <= (-7.4d-28)) .or. (.not. (y <= 1d+51))) then
tmp = x * (y / (t - z))
else
tmp = x * (z / (z - t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -7.4e-28) || !(y <= 1e+51)) {
tmp = x * (y / (t - z));
} else {
tmp = x * (z / (z - t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -7.4e-28) or not (y <= 1e+51): tmp = x * (y / (t - z)) else: tmp = x * (z / (z - t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -7.4e-28) || !(y <= 1e+51)) tmp = Float64(x * Float64(y / Float64(t - z))); else tmp = Float64(x * Float64(z / Float64(z - t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -7.4e-28) || ~((y <= 1e+51))) tmp = x * (y / (t - z)); else tmp = x * (z / (z - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -7.4e-28], N[Not[LessEqual[y, 1e+51]], $MachinePrecision]], N[(x * N[(y / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.4 \cdot 10^{-28} \lor \neg \left(y \leq 10^{+51}\right):\\
\;\;\;\;x \cdot \frac{y}{t - z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{z}{z - t}\\
\end{array}
\end{array}
if y < -7.40000000000000039e-28 or 1e51 < y Initial program 82.6%
associate-*l/83.5%
Simplified83.5%
Taylor expanded in y around inf 72.0%
*-commutative72.0%
associate-/l*72.9%
associate-/r/77.2%
Simplified77.2%
if -7.40000000000000039e-28 < y < 1e51Initial program 84.0%
associate-*l/83.5%
Simplified83.5%
Taylor expanded in y around 0 67.8%
mul-1-neg67.8%
associate-*l/66.4%
distribute-rgt-neg-out66.4%
Simplified66.4%
*-commutative66.4%
frac-2neg66.4%
associate-*r/67.8%
add-sqr-sqrt34.4%
sqrt-unprod36.8%
sqr-neg36.8%
sqrt-unprod10.8%
add-sqr-sqrt17.5%
add-sqr-sqrt8.0%
sqrt-unprod30.9%
sqr-neg30.9%
sqrt-unprod32.5%
add-sqr-sqrt67.8%
sub-neg67.8%
distribute-neg-in67.8%
add-sqr-sqrt34.4%
sqrt-unprod45.3%
sqr-neg45.3%
sqrt-unprod18.5%
add-sqr-sqrt35.3%
add-sqr-sqrt16.8%
sqrt-unprod42.8%
sqr-neg42.8%
sqrt-unprod33.2%
add-sqr-sqrt67.8%
Applied egg-rr67.8%
associate-/l*67.5%
associate-/r/78.6%
+-commutative78.6%
unsub-neg78.6%
Simplified78.6%
Final simplification78.0%
(FPCore (x y z t) :precision binary64 (if (<= z -1.15e+86) x (if (<= z 1.55e+86) (* (- y z) (/ x t)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.15e+86) {
tmp = x;
} else if (z <= 1.55e+86) {
tmp = (y - z) * (x / 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 (z <= (-1.15d+86)) then
tmp = x
else if (z <= 1.55d+86) then
tmp = (y - z) * (x / 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 (z <= -1.15e+86) {
tmp = x;
} else if (z <= 1.55e+86) {
tmp = (y - z) * (x / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.15e+86: tmp = x elif z <= 1.55e+86: tmp = (y - z) * (x / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.15e+86) tmp = x; elseif (z <= 1.55e+86) tmp = Float64(Float64(y - z) * Float64(x / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.15e+86) tmp = x; elseif (z <= 1.55e+86) tmp = (y - z) * (x / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.15e+86], x, If[LessEqual[z, 1.55e+86], N[(N[(y - z), $MachinePrecision] * N[(x / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.15 \cdot 10^{+86}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.55 \cdot 10^{+86}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.14999999999999995e86 or 1.5500000000000001e86 < z Initial program 68.7%
associate-*l/67.4%
Simplified67.4%
Taylor expanded in z around inf 63.2%
if -1.14999999999999995e86 < z < 1.5500000000000001e86Initial program 91.3%
associate-*l/92.2%
Simplified92.2%
Taylor expanded in t around inf 68.9%
associate-/l*72.3%
associate-/r/73.7%
Simplified73.7%
Final simplification70.0%
(FPCore (x y z t) :precision binary64 (if (<= z -4.5e+78) x (if (<= z 4.8e-24) (* y (/ x t)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.5e+78) {
tmp = x;
} else if (z <= 4.8e-24) {
tmp = y * (x / 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 (z <= (-4.5d+78)) then
tmp = x
else if (z <= 4.8d-24) then
tmp = y * (x / 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 (z <= -4.5e+78) {
tmp = x;
} else if (z <= 4.8e-24) {
tmp = y * (x / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -4.5e+78: tmp = x elif z <= 4.8e-24: tmp = y * (x / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -4.5e+78) tmp = x; elseif (z <= 4.8e-24) tmp = Float64(y * Float64(x / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -4.5e+78) tmp = x; elseif (z <= 4.8e-24) tmp = y * (x / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -4.5e+78], x, If[LessEqual[z, 4.8e-24], N[(y * N[(x / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.5 \cdot 10^{+78}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{-24}:\\
\;\;\;\;y \cdot \frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -4.4999999999999999e78 or 4.7999999999999996e-24 < z Initial program 71.6%
associate-*l/71.0%
Simplified71.0%
Taylor expanded in z around inf 58.8%
if -4.4999999999999999e78 < z < 4.7999999999999996e-24Initial program 91.7%
associate-*l/92.4%
Simplified92.4%
Taylor expanded in z around 0 60.0%
associate-/l*65.4%
associate-/r/64.5%
Simplified64.5%
Final simplification62.1%
(FPCore (x y z t) :precision binary64 (if (<= z -2.4e+78) x (if (<= z 2.5e-18) (* x (/ y t)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.4e+78) {
tmp = x;
} else if (z <= 2.5e-18) {
tmp = x * (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 (z <= (-2.4d+78)) then
tmp = x
else if (z <= 2.5d-18) then
tmp = x * (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 (z <= -2.4e+78) {
tmp = x;
} else if (z <= 2.5e-18) {
tmp = x * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.4e+78: tmp = x elif z <= 2.5e-18: tmp = x * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.4e+78) tmp = x; elseif (z <= 2.5e-18) tmp = Float64(x * Float64(y / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -2.4e+78) tmp = x; elseif (z <= 2.5e-18) tmp = x * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.4e+78], x, If[LessEqual[z, 2.5e-18], N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.4 \cdot 10^{+78}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.5 \cdot 10^{-18}:\\
\;\;\;\;x \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.3999999999999999e78 or 2.50000000000000018e-18 < z Initial program 71.6%
associate-*l/71.0%
Simplified71.0%
Taylor expanded in z around inf 58.8%
if -2.3999999999999999e78 < z < 2.50000000000000018e-18Initial program 91.7%
associate-*l/92.4%
Simplified92.4%
*-commutative92.4%
clear-num92.3%
un-div-inv93.1%
Applied egg-rr93.1%
Taylor expanded in z around 0 60.0%
*-commutative60.0%
associate-*l/65.0%
Simplified65.0%
Final simplification62.4%
(FPCore (x y z t) :precision binary64 (if (<= z -3.8e+80) x (if (<= z 1.8e-21) (/ x (/ t y)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.8e+80) {
tmp = x;
} else if (z <= 1.8e-21) {
tmp = x / (t / y);
} 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 <= (-3.8d+80)) then
tmp = x
else if (z <= 1.8d-21) then
tmp = x / (t / y)
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 <= -3.8e+80) {
tmp = x;
} else if (z <= 1.8e-21) {
tmp = x / (t / y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -3.8e+80: tmp = x elif z <= 1.8e-21: tmp = x / (t / y) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -3.8e+80) tmp = x; elseif (z <= 1.8e-21) tmp = Float64(x / Float64(t / y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -3.8e+80) tmp = x; elseif (z <= 1.8e-21) tmp = x / (t / y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -3.8e+80], x, If[LessEqual[z, 1.8e-21], N[(x / N[(t / y), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{+80}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{-21}:\\
\;\;\;\;\frac{x}{\frac{t}{y}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -3.79999999999999997e80 or 1.79999999999999995e-21 < z Initial program 71.6%
associate-*l/71.0%
Simplified71.0%
Taylor expanded in z around inf 58.8%
if -3.79999999999999997e80 < z < 1.79999999999999995e-21Initial program 91.7%
associate-*l/92.4%
Simplified92.4%
Taylor expanded in z around 0 60.0%
associate-/l*65.4%
Simplified65.4%
Final simplification62.7%
(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 83.4%
associate-*l/83.5%
Simplified83.5%
Taylor expanded in z around inf 32.0%
Final simplification32.0%
(FPCore (x y z t) :precision binary64 (/ x (/ (- t z) (- y z))))
double code(double x, double y, double z, double t) {
return x / ((t - z) / (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 - z) / (y - z))
end function
public static double code(double x, double y, double z, double t) {
return x / ((t - z) / (y - z));
}
def code(x, y, z, t): return x / ((t - z) / (y - z))
function code(x, y, z, t) return Float64(x / Float64(Float64(t - z) / Float64(y - z))) end
function tmp = code(x, y, z, t) tmp = x / ((t - z) / (y - z)); end
code[x_, y_, z_, t_] := N[(x / N[(N[(t - z), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{\frac{t - z}{y - z}}
\end{array}
herbie shell --seed 2023293
(FPCore (x y z t)
:name "Graphics.Rendering.Chart.Plot.AreaSpots:renderAreaSpots4D from Chart-1.5.3"
:precision binary64
:herbie-target
(/ x (/ (- t z) (- y z)))
(/ (* x (- y z)) (- t z)))