
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- z a)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (z - a)));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (y * ((z - t) / (z - a)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (z - a)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (z - a)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(z - a)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (z - a))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{z - a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- z a)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (z - a)));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (y * ((z - t) / (z - a)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (z - a)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (z - a)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(z - a)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (z - a))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{z - a}
\end{array}
(FPCore (x y z t a) :precision binary64 (fma y (/ (- z t) (- z a)) x))
double code(double x, double y, double z, double t, double a) {
return fma(y, ((z - t) / (z - a)), x);
}
function code(x, y, z, t, a) return fma(y, Float64(Float64(z - t) / Float64(z - a)), x) end
code[x_, y_, z_, t_, a_] := N[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, \frac{z - t}{z - a}, x\right)
\end{array}
Initial program 98.4%
+-commutative98.4%
fma-def98.4%
Simplified98.4%
Final simplification98.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* y (/ z (- z a))))))
(if (<= z -1.2e-49)
t_1
(if (<= z 8200.0)
(- x (* y (/ t (- z a))))
(if (<= z 1e+104)
t_1
(if (<= z 1.2e+138)
(- x (/ t (/ (- z a) y)))
(if (<= z 6.5e+167) t_1 (+ x (/ y (/ z (- z t)))))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (y * (z / (z - a)));
double tmp;
if (z <= -1.2e-49) {
tmp = t_1;
} else if (z <= 8200.0) {
tmp = x - (y * (t / (z - a)));
} else if (z <= 1e+104) {
tmp = t_1;
} else if (z <= 1.2e+138) {
tmp = x - (t / ((z - a) / y));
} else if (z <= 6.5e+167) {
tmp = t_1;
} else {
tmp = x + (y / (z / (z - t)));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = x + (y * (z / (z - a)))
if (z <= (-1.2d-49)) then
tmp = t_1
else if (z <= 8200.0d0) then
tmp = x - (y * (t / (z - a)))
else if (z <= 1d+104) then
tmp = t_1
else if (z <= 1.2d+138) then
tmp = x - (t / ((z - a) / y))
else if (z <= 6.5d+167) then
tmp = t_1
else
tmp = x + (y / (z / (z - t)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x + (y * (z / (z - a)));
double tmp;
if (z <= -1.2e-49) {
tmp = t_1;
} else if (z <= 8200.0) {
tmp = x - (y * (t / (z - a)));
} else if (z <= 1e+104) {
tmp = t_1;
} else if (z <= 1.2e+138) {
tmp = x - (t / ((z - a) / y));
} else if (z <= 6.5e+167) {
tmp = t_1;
} else {
tmp = x + (y / (z / (z - t)));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (y * (z / (z - a))) tmp = 0 if z <= -1.2e-49: tmp = t_1 elif z <= 8200.0: tmp = x - (y * (t / (z - a))) elif z <= 1e+104: tmp = t_1 elif z <= 1.2e+138: tmp = x - (t / ((z - a) / y)) elif z <= 6.5e+167: tmp = t_1 else: tmp = x + (y / (z / (z - t))) return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(y * Float64(z / Float64(z - a)))) tmp = 0.0 if (z <= -1.2e-49) tmp = t_1; elseif (z <= 8200.0) tmp = Float64(x - Float64(y * Float64(t / Float64(z - a)))); elseif (z <= 1e+104) tmp = t_1; elseif (z <= 1.2e+138) tmp = Float64(x - Float64(t / Float64(Float64(z - a) / y))); elseif (z <= 6.5e+167) tmp = t_1; else tmp = Float64(x + Float64(y / Float64(z / Float64(z - t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (y * (z / (z - a))); tmp = 0.0; if (z <= -1.2e-49) tmp = t_1; elseif (z <= 8200.0) tmp = x - (y * (t / (z - a))); elseif (z <= 1e+104) tmp = t_1; elseif (z <= 1.2e+138) tmp = x - (t / ((z - a) / y)); elseif (z <= 6.5e+167) tmp = t_1; else tmp = x + (y / (z / (z - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(y * N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.2e-49], t$95$1, If[LessEqual[z, 8200.0], N[(x - N[(y * N[(t / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1e+104], t$95$1, If[LessEqual[z, 1.2e+138], N[(x - N[(t / N[(N[(z - a), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.5e+167], t$95$1, N[(x + N[(y / N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + y \cdot \frac{z}{z - a}\\
\mathbf{if}\;z \leq -1.2 \cdot 10^{-49}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 8200:\\
\;\;\;\;x - y \cdot \frac{t}{z - a}\\
\mathbf{elif}\;z \leq 10^{+104}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{+138}:\\
\;\;\;\;x - \frac{t}{\frac{z - a}{y}}\\
\mathbf{elif}\;z \leq 6.5 \cdot 10^{+167}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{z}{z - t}}\\
\end{array}
\end{array}
if z < -1.19999999999999996e-49 or 8200 < z < 1e104 or 1.2e138 < z < 6.5e167Initial program 98.9%
associate-*r/80.8%
Simplified80.8%
clear-num80.7%
associate-/r/80.7%
Applied egg-rr80.7%
Taylor expanded in t around 0 71.9%
associate-*r/88.0%
Simplified88.0%
if -1.19999999999999996e-49 < z < 8200Initial program 97.6%
Taylor expanded in t around inf 92.5%
neg-mul-192.5%
distribute-neg-frac92.5%
Simplified92.5%
if 1e104 < z < 1.2e138Initial program 99.8%
Taylor expanded in t around inf 85.0%
neg-mul-185.0%
distribute-neg-frac85.0%
Simplified85.0%
Taylor expanded in x around 0 77.8%
mul-1-neg77.8%
*-commutative77.8%
sub-neg77.8%
associate-*l/84.8%
Simplified84.8%
*-commutative84.8%
clear-num84.8%
un-div-inv85.1%
Applied egg-rr85.1%
if 6.5e167 < z Initial program 100.0%
Taylor expanded in a around 0 57.6%
+-commutative57.6%
associate-/l*100.0%
Simplified100.0%
Final simplification91.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* y (/ z (- z a))))) (t_2 (- x (* t (/ y (- z a))))))
(if (<= t -1.6e+101)
t_2
(if (<= t -4.6e+40)
t_1
(if (<= t -1.75e-94)
(- x (/ (* y t) (- z a)))
(if (<= t 4e+52) t_1 t_2))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (y * (z / (z - a)));
double t_2 = x - (t * (y / (z - a)));
double tmp;
if (t <= -1.6e+101) {
tmp = t_2;
} else if (t <= -4.6e+40) {
tmp = t_1;
} else if (t <= -1.75e-94) {
tmp = x - ((y * t) / (z - a));
} else if (t <= 4e+52) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = x + (y * (z / (z - a)))
t_2 = x - (t * (y / (z - a)))
if (t <= (-1.6d+101)) then
tmp = t_2
else if (t <= (-4.6d+40)) then
tmp = t_1
else if (t <= (-1.75d-94)) then
tmp = x - ((y * t) / (z - a))
else if (t <= 4d+52) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x + (y * (z / (z - a)));
double t_2 = x - (t * (y / (z - a)));
double tmp;
if (t <= -1.6e+101) {
tmp = t_2;
} else if (t <= -4.6e+40) {
tmp = t_1;
} else if (t <= -1.75e-94) {
tmp = x - ((y * t) / (z - a));
} else if (t <= 4e+52) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (y * (z / (z - a))) t_2 = x - (t * (y / (z - a))) tmp = 0 if t <= -1.6e+101: tmp = t_2 elif t <= -4.6e+40: tmp = t_1 elif t <= -1.75e-94: tmp = x - ((y * t) / (z - a)) elif t <= 4e+52: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(y * Float64(z / Float64(z - a)))) t_2 = Float64(x - Float64(t * Float64(y / Float64(z - a)))) tmp = 0.0 if (t <= -1.6e+101) tmp = t_2; elseif (t <= -4.6e+40) tmp = t_1; elseif (t <= -1.75e-94) tmp = Float64(x - Float64(Float64(y * t) / Float64(z - a))); elseif (t <= 4e+52) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (y * (z / (z - a))); t_2 = x - (t * (y / (z - a))); tmp = 0.0; if (t <= -1.6e+101) tmp = t_2; elseif (t <= -4.6e+40) tmp = t_1; elseif (t <= -1.75e-94) tmp = x - ((y * t) / (z - a)); elseif (t <= 4e+52) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(y * N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x - N[(t * N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.6e+101], t$95$2, If[LessEqual[t, -4.6e+40], t$95$1, If[LessEqual[t, -1.75e-94], N[(x - N[(N[(y * t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 4e+52], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + y \cdot \frac{z}{z - a}\\
t_2 := x - t \cdot \frac{y}{z - a}\\
\mathbf{if}\;t \leq -1.6 \cdot 10^{+101}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t \leq -4.6 \cdot 10^{+40}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq -1.75 \cdot 10^{-94}:\\
\;\;\;\;x - \frac{y \cdot t}{z - a}\\
\mathbf{elif}\;t \leq 4 \cdot 10^{+52}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if t < -1.60000000000000003e101 or 4e52 < t Initial program 96.0%
Taylor expanded in t around inf 87.6%
neg-mul-187.6%
distribute-neg-frac87.6%
Simplified87.6%
Taylor expanded in x around 0 82.8%
mul-1-neg82.8%
*-commutative82.8%
sub-neg82.8%
associate-*l/89.5%
Simplified89.5%
if -1.60000000000000003e101 < t < -4.59999999999999987e40 or -1.74999999999999999e-94 < t < 4e52Initial program 99.9%
associate-*r/85.5%
Simplified85.5%
clear-num85.4%
associate-/r/85.5%
Applied egg-rr85.5%
Taylor expanded in t around 0 75.0%
associate-*r/88.6%
Simplified88.6%
if -4.59999999999999987e40 < t < -1.74999999999999999e-94Initial program 99.9%
Taylor expanded in t around inf 91.0%
neg-mul-191.0%
distribute-neg-frac91.0%
Simplified91.0%
*-commutative91.0%
add-sqr-sqrt90.8%
sqrt-unprod91.0%
sqr-neg91.0%
sqrt-unprod0.0%
add-sqr-sqrt58.2%
cancel-sign-sub58.2%
distribute-frac-neg58.2%
associate-*l/58.2%
add-sqr-sqrt58.2%
sqrt-unprod58.2%
sqr-neg58.2%
sqrt-unprod0.0%
add-sqr-sqrt90.9%
*-commutative90.9%
Applied egg-rr90.9%
Final simplification89.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.6e-52) (not (<= z 0.00024))) (+ x (* y (/ z (- z a)))) (+ x (/ y (/ a t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.6e-52) || !(z <= 0.00024)) {
tmp = x + (y * (z / (z - a)));
} else {
tmp = x + (y / (a / t));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-2.6d-52)) .or. (.not. (z <= 0.00024d0))) then
tmp = x + (y * (z / (z - a)))
else
tmp = x + (y / (a / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.6e-52) || !(z <= 0.00024)) {
tmp = x + (y * (z / (z - a)));
} else {
tmp = x + (y / (a / t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.6e-52) or not (z <= 0.00024): tmp = x + (y * (z / (z - a))) else: tmp = x + (y / (a / t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.6e-52) || !(z <= 0.00024)) tmp = Float64(x + Float64(y * Float64(z / Float64(z - a)))); else tmp = Float64(x + Float64(y / Float64(a / t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -2.6e-52) || ~((z <= 0.00024))) tmp = x + (y * (z / (z - a))); else tmp = x + (y / (a / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.6e-52], N[Not[LessEqual[z, 0.00024]], $MachinePrecision]], N[(x + N[(y * N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.6 \cdot 10^{-52} \lor \neg \left(z \leq 0.00024\right):\\
\;\;\;\;x + y \cdot \frac{z}{z - a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a}{t}}\\
\end{array}
\end{array}
if z < -2.5999999999999999e-52 or 2.40000000000000006e-4 < z Initial program 99.2%
associate-*r/75.8%
Simplified75.8%
clear-num75.7%
associate-/r/75.7%
Applied egg-rr75.7%
Taylor expanded in t around 0 66.4%
associate-*r/86.3%
Simplified86.3%
if -2.5999999999999999e-52 < z < 2.40000000000000006e-4Initial program 97.6%
Taylor expanded in z around 0 80.3%
+-commutative80.3%
associate-/l*81.7%
associate-/r/82.6%
Simplified82.6%
*-commutative82.6%
clear-num82.6%
un-div-inv82.6%
Applied egg-rr82.6%
Final simplification84.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -2.4e+101) (not (<= t 1.35e+58))) (- x (* t (/ y (- z a)))) (+ x (* y (/ z (- z a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -2.4e+101) || !(t <= 1.35e+58)) {
tmp = x - (t * (y / (z - a)));
} else {
tmp = x + (y * (z / (z - a)));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((t <= (-2.4d+101)) .or. (.not. (t <= 1.35d+58))) then
tmp = x - (t * (y / (z - a)))
else
tmp = x + (y * (z / (z - a)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -2.4e+101) || !(t <= 1.35e+58)) {
tmp = x - (t * (y / (z - a)));
} else {
tmp = x + (y * (z / (z - a)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -2.4e+101) or not (t <= 1.35e+58): tmp = x - (t * (y / (z - a))) else: tmp = x + (y * (z / (z - a))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -2.4e+101) || !(t <= 1.35e+58)) tmp = Float64(x - Float64(t * Float64(y / Float64(z - a)))); else tmp = Float64(x + Float64(y * Float64(z / Float64(z - a)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -2.4e+101) || ~((t <= 1.35e+58))) tmp = x - (t * (y / (z - a))); else tmp = x + (y * (z / (z - a))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -2.4e+101], N[Not[LessEqual[t, 1.35e+58]], $MachinePrecision]], N[(x - N[(t * N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.4 \cdot 10^{+101} \lor \neg \left(t \leq 1.35 \cdot 10^{+58}\right):\\
\;\;\;\;x - t \cdot \frac{y}{z - a}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{z - a}\\
\end{array}
\end{array}
if t < -2.39999999999999988e101 or 1.3500000000000001e58 < t Initial program 96.0%
Taylor expanded in t around inf 87.6%
neg-mul-187.6%
distribute-neg-frac87.6%
Simplified87.6%
Taylor expanded in x around 0 82.8%
mul-1-neg82.8%
*-commutative82.8%
sub-neg82.8%
associate-*l/89.5%
Simplified89.5%
if -2.39999999999999988e101 < t < 1.3500000000000001e58Initial program 99.9%
associate-*r/85.6%
Simplified85.6%
clear-num85.5%
associate-/r/85.6%
Applied egg-rr85.6%
Taylor expanded in t around 0 72.2%
associate-*r/85.9%
Simplified85.9%
Final simplification87.2%
(FPCore (x y z t a) :precision binary64 (if (<= z -7.2e-53) (+ x (* y (/ z (- z a)))) (if (<= z 0.0009) (+ x (/ y (/ a t))) (+ x (/ y (/ z (- z t)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -7.2e-53) {
tmp = x + (y * (z / (z - a)));
} else if (z <= 0.0009) {
tmp = x + (y / (a / t));
} else {
tmp = x + (y / (z / (z - t)));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z <= (-7.2d-53)) then
tmp = x + (y * (z / (z - a)))
else if (z <= 0.0009d0) then
tmp = x + (y / (a / t))
else
tmp = x + (y / (z / (z - t)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -7.2e-53) {
tmp = x + (y * (z / (z - a)));
} else if (z <= 0.0009) {
tmp = x + (y / (a / t));
} else {
tmp = x + (y / (z / (z - t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -7.2e-53: tmp = x + (y * (z / (z - a))) elif z <= 0.0009: tmp = x + (y / (a / t)) else: tmp = x + (y / (z / (z - t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -7.2e-53) tmp = Float64(x + Float64(y * Float64(z / Float64(z - a)))); elseif (z <= 0.0009) tmp = Float64(x + Float64(y / Float64(a / t))); else tmp = Float64(x + Float64(y / Float64(z / Float64(z - t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -7.2e-53) tmp = x + (y * (z / (z - a))); elseif (z <= 0.0009) tmp = x + (y / (a / t)); else tmp = x + (y / (z / (z - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -7.2e-53], N[(x + N[(y * N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.0009], N[(x + N[(y / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.2 \cdot 10^{-53}:\\
\;\;\;\;x + y \cdot \frac{z}{z - a}\\
\mathbf{elif}\;z \leq 0.0009:\\
\;\;\;\;x + \frac{y}{\frac{a}{t}}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{z}{z - t}}\\
\end{array}
\end{array}
if z < -7.1999999999999998e-53Initial program 98.4%
associate-*r/77.2%
Simplified77.2%
clear-num77.1%
associate-/r/77.1%
Applied egg-rr77.1%
Taylor expanded in t around 0 69.0%
associate-*r/87.2%
Simplified87.2%
if -7.1999999999999998e-53 < z < 8.9999999999999998e-4Initial program 97.6%
Taylor expanded in z around 0 80.3%
+-commutative80.3%
associate-/l*81.7%
associate-/r/82.6%
Simplified82.6%
*-commutative82.6%
clear-num82.6%
un-div-inv82.6%
Applied egg-rr82.6%
if 8.9999999999999998e-4 < z Initial program 99.9%
Taylor expanded in a around 0 64.0%
+-commutative64.0%
associate-/l*86.6%
Simplified86.6%
Final simplification84.8%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.55e-50) (+ x (* y (/ z (- z a)))) (if (<= z 0.0068) (+ x (* (/ y a) (- t z))) (+ x (/ y (/ z (- z t)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.55e-50) {
tmp = x + (y * (z / (z - a)));
} else if (z <= 0.0068) {
tmp = x + ((y / a) * (t - z));
} else {
tmp = x + (y / (z / (z - t)));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z <= (-1.55d-50)) then
tmp = x + (y * (z / (z - a)))
else if (z <= 0.0068d0) then
tmp = x + ((y / a) * (t - z))
else
tmp = x + (y / (z / (z - t)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.55e-50) {
tmp = x + (y * (z / (z - a)));
} else if (z <= 0.0068) {
tmp = x + ((y / a) * (t - z));
} else {
tmp = x + (y / (z / (z - t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.55e-50: tmp = x + (y * (z / (z - a))) elif z <= 0.0068: tmp = x + ((y / a) * (t - z)) else: tmp = x + (y / (z / (z - t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.55e-50) tmp = Float64(x + Float64(y * Float64(z / Float64(z - a)))); elseif (z <= 0.0068) tmp = Float64(x + Float64(Float64(y / a) * Float64(t - z))); else tmp = Float64(x + Float64(y / Float64(z / Float64(z - t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.55e-50) tmp = x + (y * (z / (z - a))); elseif (z <= 0.0068) tmp = x + ((y / a) * (t - z)); else tmp = x + (y / (z / (z - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.55e-50], N[(x + N[(y * N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.0068], N[(x + N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.55 \cdot 10^{-50}:\\
\;\;\;\;x + y \cdot \frac{z}{z - a}\\
\mathbf{elif}\;z \leq 0.0068:\\
\;\;\;\;x + \frac{y}{a} \cdot \left(t - z\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{z}{z - t}}\\
\end{array}
\end{array}
if z < -1.5500000000000001e-50Initial program 98.4%
associate-*r/77.2%
Simplified77.2%
clear-num77.1%
associate-/r/77.1%
Applied egg-rr77.1%
Taylor expanded in t around 0 69.0%
associate-*r/87.2%
Simplified87.2%
if -1.5500000000000001e-50 < z < 0.00679999999999999962Initial program 97.6%
Taylor expanded in a around inf 82.9%
mul-1-neg82.9%
unsub-neg82.9%
associate-/l*85.3%
associate-/r/83.9%
Simplified83.9%
if 0.00679999999999999962 < z Initial program 99.9%
Taylor expanded in a around 0 64.0%
+-commutative64.0%
associate-/l*86.6%
Simplified86.6%
Final simplification85.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= x -1.35e-132) (not (<= x 9.8e-45))) (+ y x) (* (/ y a) (- t z))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -1.35e-132) || !(x <= 9.8e-45)) {
tmp = y + x;
} else {
tmp = (y / a) * (t - z);
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((x <= (-1.35d-132)) .or. (.not. (x <= 9.8d-45))) then
tmp = y + x
else
tmp = (y / a) * (t - z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -1.35e-132) || !(x <= 9.8e-45)) {
tmp = y + x;
} else {
tmp = (y / a) * (t - z);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (x <= -1.35e-132) or not (x <= 9.8e-45): tmp = y + x else: tmp = (y / a) * (t - z) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((x <= -1.35e-132) || !(x <= 9.8e-45)) tmp = Float64(y + x); else tmp = Float64(Float64(y / a) * Float64(t - z)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((x <= -1.35e-132) || ~((x <= 9.8e-45))) tmp = y + x; else tmp = (y / a) * (t - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[x, -1.35e-132], N[Not[LessEqual[x, 9.8e-45]], $MachinePrecision]], N[(y + x), $MachinePrecision], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.35 \cdot 10^{-132} \lor \neg \left(x \leq 9.8 \cdot 10^{-45}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
\end{array}
\end{array}
if x < -1.34999999999999995e-132 or 9.7999999999999996e-45 < x Initial program 98.9%
Taylor expanded in z around inf 73.7%
+-commutative73.7%
Simplified73.7%
if -1.34999999999999995e-132 < x < 9.7999999999999996e-45Initial program 97.6%
Taylor expanded in a around inf 58.8%
mul-1-neg58.8%
unsub-neg58.8%
associate-/l*64.1%
associate-/r/61.1%
Simplified61.1%
Taylor expanded in x around 0 46.1%
mul-1-neg46.1%
associate-*l/48.3%
sub-neg48.3%
distribute-lft-out44.6%
distribute-rgt-neg-out44.6%
*-commutative44.6%
associate-*r/40.3%
mul-1-neg40.3%
+-commutative40.3%
distribute-neg-in40.3%
mul-1-neg40.3%
associate-*r/44.6%
remove-double-neg44.6%
sub-neg44.6%
*-commutative44.6%
distribute-lft-out--48.3%
Simplified48.3%
Final simplification64.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.32e-51) (not (<= z 68.0))) (+ y x) (+ x (* t (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.32e-51) || !(z <= 68.0)) {
tmp = y + x;
} else {
tmp = x + (t * (y / a));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-1.32d-51)) .or. (.not. (z <= 68.0d0))) then
tmp = y + x
else
tmp = x + (t * (y / a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.32e-51) || !(z <= 68.0)) {
tmp = y + x;
} else {
tmp = x + (t * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.32e-51) or not (z <= 68.0): tmp = y + x else: tmp = x + (t * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.32e-51) || !(z <= 68.0)) tmp = Float64(y + x); else tmp = Float64(x + Float64(t * Float64(y / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.32e-51) || ~((z <= 68.0))) tmp = y + x; else tmp = x + (t * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.32e-51], N[Not[LessEqual[z, 68.0]], $MachinePrecision]], N[(y + x), $MachinePrecision], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.32 \cdot 10^{-51} \lor \neg \left(z \leq 68\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -1.31999999999999998e-51 or 68 < z Initial program 99.2%
Taylor expanded in z around inf 73.7%
+-commutative73.7%
Simplified73.7%
if -1.31999999999999998e-51 < z < 68Initial program 97.6%
associate-*r/95.2%
Simplified95.2%
clear-num95.2%
associate-/r/95.3%
Applied egg-rr95.3%
Taylor expanded in z around 0 80.3%
*-commutative80.3%
associate-*l/81.7%
Simplified81.7%
Final simplification77.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -9.8e-48) (not (<= z 0.00038))) (+ y x) (+ x (* y (/ t a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -9.8e-48) || !(z <= 0.00038)) {
tmp = y + x;
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-9.8d-48)) .or. (.not. (z <= 0.00038d0))) then
tmp = y + x
else
tmp = x + (y * (t / a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -9.8e-48) || !(z <= 0.00038)) {
tmp = y + x;
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -9.8e-48) or not (z <= 0.00038): tmp = y + x else: tmp = x + (y * (t / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -9.8e-48) || !(z <= 0.00038)) tmp = Float64(y + x); else tmp = Float64(x + Float64(y * Float64(t / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -9.8e-48) || ~((z <= 0.00038))) tmp = y + x; else tmp = x + (y * (t / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -9.8e-48], N[Not[LessEqual[z, 0.00038]], $MachinePrecision]], N[(y + x), $MachinePrecision], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.8 \cdot 10^{-48} \lor \neg \left(z \leq 0.00038\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\end{array}
\end{array}
if z < -9.8000000000000005e-48 or 3.8000000000000002e-4 < z Initial program 99.2%
Taylor expanded in z around inf 73.7%
+-commutative73.7%
Simplified73.7%
if -9.8000000000000005e-48 < z < 3.8000000000000002e-4Initial program 97.6%
Taylor expanded in z around 0 80.3%
+-commutative80.3%
associate-/l*81.7%
associate-/r/82.6%
Simplified82.6%
Final simplification78.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.55e-51) (not (<= z 5.6e-7))) (+ y x) (+ x (/ y (/ a t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.55e-51) || !(z <= 5.6e-7)) {
tmp = y + x;
} else {
tmp = x + (y / (a / t));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-1.55d-51)) .or. (.not. (z <= 5.6d-7))) then
tmp = y + x
else
tmp = x + (y / (a / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.55e-51) || !(z <= 5.6e-7)) {
tmp = y + x;
} else {
tmp = x + (y / (a / t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.55e-51) or not (z <= 5.6e-7): tmp = y + x else: tmp = x + (y / (a / t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.55e-51) || !(z <= 5.6e-7)) tmp = Float64(y + x); else tmp = Float64(x + Float64(y / Float64(a / t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.55e-51) || ~((z <= 5.6e-7))) tmp = y + x; else tmp = x + (y / (a / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.55e-51], N[Not[LessEqual[z, 5.6e-7]], $MachinePrecision]], N[(y + x), $MachinePrecision], N[(x + N[(y / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.55 \cdot 10^{-51} \lor \neg \left(z \leq 5.6 \cdot 10^{-7}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a}{t}}\\
\end{array}
\end{array}
if z < -1.5499999999999999e-51 or 5.60000000000000038e-7 < z Initial program 99.2%
Taylor expanded in z around inf 73.7%
+-commutative73.7%
Simplified73.7%
if -1.5499999999999999e-51 < z < 5.60000000000000038e-7Initial program 97.6%
Taylor expanded in z around 0 80.3%
+-commutative80.3%
associate-/l*81.7%
associate-/r/82.6%
Simplified82.6%
*-commutative82.6%
clear-num82.6%
un-div-inv82.6%
Applied egg-rr82.6%
Final simplification78.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.16e-63) (not (<= z 8e-70))) (+ y x) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.16e-63) || !(z <= 8e-70)) {
tmp = y + x;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-1.16d-63)) .or. (.not. (z <= 8d-70))) 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 a) {
double tmp;
if ((z <= -1.16e-63) || !(z <= 8e-70)) {
tmp = y + x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.16e-63) or not (z <= 8e-70): tmp = y + x else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.16e-63) || !(z <= 8e-70)) tmp = Float64(y + x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.16e-63) || ~((z <= 8e-70))) tmp = y + x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.16e-63], N[Not[LessEqual[z, 8e-70]], $MachinePrecision]], N[(y + x), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.16 \cdot 10^{-63} \lor \neg \left(z \leq 8 \cdot 10^{-70}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.16e-63 or 7.99999999999999997e-70 < z Initial program 99.3%
Taylor expanded in z around inf 72.0%
+-commutative72.0%
Simplified72.0%
if -1.16e-63 < z < 7.99999999999999997e-70Initial program 97.3%
Taylor expanded in x around inf 51.8%
Final simplification63.1%
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- z a)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (z - a)));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (y * ((z - t) / (z - a)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (z - a)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (z - a)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(z - a)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (z - a))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{z - a}
\end{array}
Initial program 98.4%
Final simplification98.4%
(FPCore (x y z t a) :precision binary64 x)
double code(double x, double y, double z, double t, double a) {
return x;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x
end function
public static double code(double x, double y, double z, double t, double a) {
return x;
}
def code(x, y, z, t, a): return x
function code(x, y, z, t, a) return x end
function tmp = code(x, y, z, t, a) tmp = x; end
code[x_, y_, z_, t_, a_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 98.4%
Taylor expanded in x around inf 49.6%
Final simplification49.6%
(FPCore (x y z t a) :precision binary64 (+ x (/ y (/ (- z a) (- z t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y / ((z - a) / (z - t)));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (y / ((z - a) / (z - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y / ((z - a) / (z - t)));
}
def code(x, y, z, t, a): return x + (y / ((z - a) / (z - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y / Float64(Float64(z - a) / Float64(z - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y / ((z - a) / (z - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y / N[(N[(z - a), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{\frac{z - a}{z - t}}
\end{array}
herbie shell --seed 2024021
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisLine from plot-0.2.3.4, A"
:precision binary64
:herbie-target
(+ x (/ y (/ (- z a) (- z t))))
(+ x (* y (/ (- z t) (- z a)))))