
(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 (/ 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}
Initial program 85.9%
associate-*l/80.4%
Simplified80.4%
associate-/r/98.0%
Applied egg-rr98.0%
Final simplification98.0%
(FPCore (x y z t)
:precision binary64
(if (or (<= z -6.6e-13)
(not (or (<= z 3.8e-100) (and (not (<= z 1.65e+39)) (<= z 2.3e+73)))))
(* x (/ z (- z t)))
(* x (/ (- y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6.6e-13) || !((z <= 3.8e-100) || (!(z <= 1.65e+39) && (z <= 2.3e+73)))) {
tmp = x * (z / (z - t));
} 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 ((z <= (-6.6d-13)) .or. (.not. (z <= 3.8d-100) .or. (.not. (z <= 1.65d+39)) .and. (z <= 2.3d+73))) then
tmp = x * (z / (z - t))
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 ((z <= -6.6e-13) || !((z <= 3.8e-100) || (!(z <= 1.65e+39) && (z <= 2.3e+73)))) {
tmp = x * (z / (z - t));
} else {
tmp = x * ((y - z) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -6.6e-13) or not ((z <= 3.8e-100) or (not (z <= 1.65e+39) and (z <= 2.3e+73))): tmp = x * (z / (z - t)) else: tmp = x * ((y - z) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -6.6e-13) || !((z <= 3.8e-100) || (!(z <= 1.65e+39) && (z <= 2.3e+73)))) tmp = Float64(x * Float64(z / Float64(z - t))); 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 ((z <= -6.6e-13) || ~(((z <= 3.8e-100) || (~((z <= 1.65e+39)) && (z <= 2.3e+73))))) tmp = x * (z / (z - t)); else tmp = x * ((y - z) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -6.6e-13], N[Not[Or[LessEqual[z, 3.8e-100], And[N[Not[LessEqual[z, 1.65e+39]], $MachinePrecision], LessEqual[z, 2.3e+73]]]], $MachinePrecision]], N[(x * N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.6 \cdot 10^{-13} \lor \neg \left(z \leq 3.8 \cdot 10^{-100} \lor \neg \left(z \leq 1.65 \cdot 10^{+39}\right) \land z \leq 2.3 \cdot 10^{+73}\right):\\
\;\;\;\;x \cdot \frac{z}{z - t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y - z}{t}\\
\end{array}
\end{array}
if z < -6.6000000000000001e-13 or 3.79999999999999997e-100 < z < 1.6500000000000001e39 or 2.3e73 < z Initial program 81.8%
associate-*l/75.9%
div-inv75.8%
associate-*l*99.1%
Applied egg-rr99.1%
Taylor expanded in y around 0 78.8%
mul-1-neg78.8%
distribute-neg-frac78.8%
Simplified78.8%
frac-2neg78.8%
remove-double-neg78.8%
associate-*r/63.8%
sub-neg63.8%
distribute-neg-in63.8%
remove-double-neg63.8%
Applied egg-rr63.8%
*-commutative63.8%
associate-/l*59.0%
associate-/r/78.8%
+-commutative78.8%
unsub-neg78.8%
Simplified78.8%
if -6.6000000000000001e-13 < z < 3.79999999999999997e-100 or 1.6500000000000001e39 < z < 2.3e73Initial program 91.0%
associate-*l/85.9%
div-inv85.8%
associate-*l*95.8%
Applied egg-rr95.8%
Taylor expanded in t around inf 85.8%
Final simplification81.9%
(FPCore (x y z t)
:precision binary64
(if (or (<= z -2.35e-13)
(and (not (<= z 1.95e-100)) (or (<= z 5.2e+39) (not (<= z 8.5e+72)))))
(* x (/ z (- z t)))
(/ x (/ t (- y z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.35e-13) || (!(z <= 1.95e-100) && ((z <= 5.2e+39) || !(z <= 8.5e+72)))) {
tmp = x * (z / (z - t));
} else {
tmp = x / (t / (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 <= (-2.35d-13)) .or. (.not. (z <= 1.95d-100)) .and. (z <= 5.2d+39) .or. (.not. (z <= 8.5d+72))) then
tmp = x * (z / (z - t))
else
tmp = x / (t / (y - z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.35e-13) || (!(z <= 1.95e-100) && ((z <= 5.2e+39) || !(z <= 8.5e+72)))) {
tmp = x * (z / (z - t));
} else {
tmp = x / (t / (y - z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.35e-13) or (not (z <= 1.95e-100) and ((z <= 5.2e+39) or not (z <= 8.5e+72))): tmp = x * (z / (z - t)) else: tmp = x / (t / (y - z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.35e-13) || (!(z <= 1.95e-100) && ((z <= 5.2e+39) || !(z <= 8.5e+72)))) tmp = Float64(x * Float64(z / Float64(z - t))); else tmp = Float64(x / Float64(t / Float64(y - z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -2.35e-13) || (~((z <= 1.95e-100)) && ((z <= 5.2e+39) || ~((z <= 8.5e+72))))) tmp = x * (z / (z - t)); else tmp = x / (t / (y - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.35e-13], And[N[Not[LessEqual[z, 1.95e-100]], $MachinePrecision], Or[LessEqual[z, 5.2e+39], N[Not[LessEqual[z, 8.5e+72]], $MachinePrecision]]]], N[(x * N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(t / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.35 \cdot 10^{-13} \lor \neg \left(z \leq 1.95 \cdot 10^{-100}\right) \land \left(z \leq 5.2 \cdot 10^{+39} \lor \neg \left(z \leq 8.5 \cdot 10^{+72}\right)\right):\\
\;\;\;\;x \cdot \frac{z}{z - t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{t}{y - z}}\\
\end{array}
\end{array}
if z < -2.3500000000000001e-13 or 1.94999999999999989e-100 < z < 5.2e39 or 8.5000000000000004e72 < z Initial program 81.8%
associate-*l/75.9%
div-inv75.8%
associate-*l*99.1%
Applied egg-rr99.1%
Taylor expanded in y around 0 78.8%
mul-1-neg78.8%
distribute-neg-frac78.8%
Simplified78.8%
frac-2neg78.8%
remove-double-neg78.8%
associate-*r/63.8%
sub-neg63.8%
distribute-neg-in63.8%
remove-double-neg63.8%
Applied egg-rr63.8%
*-commutative63.8%
associate-/l*59.0%
associate-/r/78.8%
+-commutative78.8%
unsub-neg78.8%
Simplified78.8%
if -2.3500000000000001e-13 < z < 1.94999999999999989e-100 or 5.2e39 < z < 8.5000000000000004e72Initial program 91.0%
associate-*l/85.9%
Simplified85.9%
associate-/r/96.6%
Applied egg-rr96.6%
Taylor expanded in t around inf 86.4%
Final simplification82.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- y z) (/ x (- t z)))))
(if (<= y -4.8e-90)
t_1
(if (<= y 2.35e-144)
(* x (/ z (- z t)))
(if (<= y 2.6e+108) t_1 (/ x (/ (- t z) y)))))))
double code(double x, double y, double z, double t) {
double t_1 = (y - z) * (x / (t - z));
double tmp;
if (y <= -4.8e-90) {
tmp = t_1;
} else if (y <= 2.35e-144) {
tmp = x * (z / (z - t));
} else if (y <= 2.6e+108) {
tmp = t_1;
} else {
tmp = x / ((t - z) / 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) :: t_1
real(8) :: tmp
t_1 = (y - z) * (x / (t - z))
if (y <= (-4.8d-90)) then
tmp = t_1
else if (y <= 2.35d-144) then
tmp = x * (z / (z - t))
else if (y <= 2.6d+108) then
tmp = t_1
else
tmp = x / ((t - z) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (y - z) * (x / (t - z));
double tmp;
if (y <= -4.8e-90) {
tmp = t_1;
} else if (y <= 2.35e-144) {
tmp = x * (z / (z - t));
} else if (y <= 2.6e+108) {
tmp = t_1;
} else {
tmp = x / ((t - z) / y);
}
return tmp;
}
def code(x, y, z, t): t_1 = (y - z) * (x / (t - z)) tmp = 0 if y <= -4.8e-90: tmp = t_1 elif y <= 2.35e-144: tmp = x * (z / (z - t)) elif y <= 2.6e+108: tmp = t_1 else: tmp = x / ((t - z) / y) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y - z) * Float64(x / Float64(t - z))) tmp = 0.0 if (y <= -4.8e-90) tmp = t_1; elseif (y <= 2.35e-144) tmp = Float64(x * Float64(z / Float64(z - t))); elseif (y <= 2.6e+108) tmp = t_1; else tmp = Float64(x / Float64(Float64(t - z) / y)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y - z) * (x / (t - z)); tmp = 0.0; if (y <= -4.8e-90) tmp = t_1; elseif (y <= 2.35e-144) tmp = x * (z / (z - t)); elseif (y <= 2.6e+108) tmp = t_1; else tmp = x / ((t - z) / y); 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]}, If[LessEqual[y, -4.8e-90], t$95$1, If[LessEqual[y, 2.35e-144], N[(x * N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.6e+108], t$95$1, N[(x / N[(N[(t - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y - z\right) \cdot \frac{x}{t - z}\\
\mathbf{if}\;y \leq -4.8 \cdot 10^{-90}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 2.35 \cdot 10^{-144}:\\
\;\;\;\;x \cdot \frac{z}{z - t}\\
\mathbf{elif}\;y \leq 2.6 \cdot 10^{+108}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{t - z}{y}}\\
\end{array}
\end{array}
if y < -4.8000000000000003e-90 or 2.3500000000000001e-144 < y < 2.6000000000000002e108Initial program 85.7%
associate-*l/84.3%
Simplified84.3%
if -4.8000000000000003e-90 < y < 2.3500000000000001e-144Initial program 85.7%
associate-*l/78.3%
div-inv78.2%
associate-*l*97.9%
Applied egg-rr97.9%
Taylor expanded in y around 0 92.3%
mul-1-neg92.3%
distribute-neg-frac92.3%
Simplified92.3%
frac-2neg92.3%
remove-double-neg92.3%
associate-*r/81.0%
sub-neg81.0%
distribute-neg-in81.0%
remove-double-neg81.0%
Applied egg-rr81.0%
*-commutative81.0%
associate-/l*72.7%
associate-/r/92.3%
+-commutative92.3%
unsub-neg92.3%
Simplified92.3%
if 2.6000000000000002e108 < y Initial program 86.9%
associate-*l/72.4%
Simplified72.4%
associate-/r/97.5%
Applied egg-rr97.5%
Taylor expanded in y around inf 85.7%
Final simplification87.1%
(FPCore (x y z t) :precision binary64 (if (or (<= y -6.5e+17) (not (<= y 8.2e-40))) (/ x (/ (- t z) y)) (* x (/ z (- z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -6.5e+17) || !(y <= 8.2e-40)) {
tmp = x / ((t - z) / y);
} 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 <= (-6.5d+17)) .or. (.not. (y <= 8.2d-40))) then
tmp = x / ((t - z) / y)
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 <= -6.5e+17) || !(y <= 8.2e-40)) {
tmp = x / ((t - z) / y);
} else {
tmp = x * (z / (z - t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -6.5e+17) or not (y <= 8.2e-40): tmp = x / ((t - z) / y) else: tmp = x * (z / (z - t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -6.5e+17) || !(y <= 8.2e-40)) tmp = Float64(x / Float64(Float64(t - z) / y)); 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 <= -6.5e+17) || ~((y <= 8.2e-40))) tmp = x / ((t - z) / y); else tmp = x * (z / (z - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -6.5e+17], N[Not[LessEqual[y, 8.2e-40]], $MachinePrecision]], N[(x / N[(N[(t - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(x * N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.5 \cdot 10^{+17} \lor \neg \left(y \leq 8.2 \cdot 10^{-40}\right):\\
\;\;\;\;\frac{x}{\frac{t - z}{y}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{z}{z - t}\\
\end{array}
\end{array}
if y < -6.5e17 or 8.19999999999999926e-40 < y Initial program 88.1%
associate-*l/79.6%
Simplified79.6%
associate-/r/98.9%
Applied egg-rr98.9%
Taylor expanded in y around inf 78.0%
if -6.5e17 < y < 8.19999999999999926e-40Initial program 83.4%
associate-*l/81.2%
div-inv81.0%
associate-*l*96.9%
Applied egg-rr96.9%
Taylor expanded in y around 0 86.3%
mul-1-neg86.3%
distribute-neg-frac86.3%
Simplified86.3%
frac-2neg86.3%
remove-double-neg86.3%
associate-*r/73.1%
sub-neg73.1%
distribute-neg-in73.1%
remove-double-neg73.1%
Applied egg-rr73.1%
*-commutative73.1%
associate-/l*69.4%
associate-/r/86.3%
+-commutative86.3%
unsub-neg86.3%
Simplified86.3%
Final simplification81.9%
(FPCore (x y z t) :precision binary64 (if (<= z -1.06e+71) x (if (<= z 5.2e+77) (* x (/ (- y z) t)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.06e+71) {
tmp = x;
} else if (z <= 5.2e+77) {
tmp = x * ((y - z) / 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.06d+71)) then
tmp = x
else if (z <= 5.2d+77) then
tmp = x * ((y - z) / 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.06e+71) {
tmp = x;
} else if (z <= 5.2e+77) {
tmp = x * ((y - z) / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.06e+71: tmp = x elif z <= 5.2e+77: tmp = x * ((y - z) / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.06e+71) tmp = x; elseif (z <= 5.2e+77) tmp = Float64(x * Float64(Float64(y - z) / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.06e+71) tmp = x; elseif (z <= 5.2e+77) tmp = x * ((y - z) / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.06e+71], x, If[LessEqual[z, 5.2e+77], N[(x * N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.06 \cdot 10^{+71}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 5.2 \cdot 10^{+77}:\\
\;\;\;\;x \cdot \frac{y - z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.06e71 or 5.2000000000000004e77 < z Initial program 77.0%
associate-*l/68.9%
Simplified68.9%
Taylor expanded in z around inf 67.3%
if -1.06e71 < z < 5.2000000000000004e77Initial program 91.5%
associate-*l/87.5%
div-inv87.5%
associate-*l*96.3%
Applied egg-rr96.3%
Taylor expanded in t around inf 74.8%
Final simplification71.9%
(FPCore (x y z t) :precision binary64 (if (<= z -2.85e+21) x (if (<= z 1e+73) (* x (/ y t)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.85e+21) {
tmp = x;
} else if (z <= 1e+73) {
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.85d+21)) then
tmp = x
else if (z <= 1d+73) 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.85e+21) {
tmp = x;
} else if (z <= 1e+73) {
tmp = x * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.85e+21: tmp = x elif z <= 1e+73: tmp = x * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.85e+21) tmp = x; elseif (z <= 1e+73) 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.85e+21) tmp = x; elseif (z <= 1e+73) tmp = x * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.85e+21], x, If[LessEqual[z, 1e+73], N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.85 \cdot 10^{+21}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 10^{+73}:\\
\;\;\;\;x \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.85e21 or 9.99999999999999983e72 < z Initial program 77.8%
associate-*l/71.4%
Simplified71.4%
Taylor expanded in z around inf 62.2%
if -2.85e21 < z < 9.99999999999999983e72Initial program 92.0%
associate-*l/87.2%
Simplified87.2%
Taylor expanded in z around 0 64.9%
associate-/l*60.1%
associate-/r/67.8%
Simplified67.8%
Final simplification65.4%
(FPCore (x y z t) :precision binary64 (if (<= z -4.7e+19) x (if (<= z 2.15e+73) (/ x (/ t y)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.7e+19) {
tmp = x;
} else if (z <= 2.15e+73) {
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 <= (-4.7d+19)) then
tmp = x
else if (z <= 2.15d+73) 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 <= -4.7e+19) {
tmp = x;
} else if (z <= 2.15e+73) {
tmp = x / (t / y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -4.7e+19: tmp = x elif z <= 2.15e+73: tmp = x / (t / y) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -4.7e+19) tmp = x; elseif (z <= 2.15e+73) 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 <= -4.7e+19) tmp = x; elseif (z <= 2.15e+73) tmp = x / (t / y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -4.7e+19], x, If[LessEqual[z, 2.15e+73], N[(x / N[(t / y), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.7 \cdot 10^{+19}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.15 \cdot 10^{+73}:\\
\;\;\;\;\frac{x}{\frac{t}{y}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -4.7e19 or 2.15000000000000007e73 < z Initial program 77.8%
associate-*l/71.4%
Simplified71.4%
Taylor expanded in z around inf 62.2%
if -4.7e19 < z < 2.15000000000000007e73Initial program 92.0%
associate-*l/87.2%
Simplified87.2%
associate-/r/96.6%
Applied egg-rr96.6%
Taylor expanded in z around 0 68.2%
Final simplification65.6%
(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 85.9%
associate-*l/80.4%
Simplified80.4%
Taylor expanded in z around inf 34.0%
Final simplification34.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 2023274
(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)))