
(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 11 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 (- x (/ y (/ (- a z) (- z t)))))
double code(double x, double y, double z, double t, double a) {
return x - (y / ((a - z) / (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 / ((a - z) / (z - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x - (y / ((a - z) / (z - t)));
}
def code(x, y, z, t, a): return x - (y / ((a - z) / (z - t)))
function code(x, y, z, t, a) return Float64(x - Float64(y / Float64(Float64(a - z) / Float64(z - t)))) end
function tmp = code(x, y, z, t, a) tmp = x - (y / ((a - z) / (z - t))); end
code[x_, y_, z_, t_, a_] := N[(x - N[(y / N[(N[(a - z), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y}{\frac{a - z}{z - t}}
\end{array}
Initial program 97.4%
clear-num97.4%
un-div-inv97.4%
Applied egg-rr97.4%
Final simplification97.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* y (/ (- z t) z)))))
(if (<= z -3.5e-15)
t_1
(if (<= z 7.6e-125)
(+ x (* t (/ y a)))
(if (<= z 1.8e+228) (+ x (* z (/ y (- z a)))) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (y * ((z - t) / z));
double tmp;
if (z <= -3.5e-15) {
tmp = t_1;
} else if (z <= 7.6e-125) {
tmp = x + (t * (y / a));
} else if (z <= 1.8e+228) {
tmp = x + (z * (y / (z - a)));
} else {
tmp = t_1;
}
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 - t) / z))
if (z <= (-3.5d-15)) then
tmp = t_1
else if (z <= 7.6d-125) then
tmp = x + (t * (y / a))
else if (z <= 1.8d+228) then
tmp = x + (z * (y / (z - a)))
else
tmp = t_1
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 - t) / z));
double tmp;
if (z <= -3.5e-15) {
tmp = t_1;
} else if (z <= 7.6e-125) {
tmp = x + (t * (y / a));
} else if (z <= 1.8e+228) {
tmp = x + (z * (y / (z - a)));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (y * ((z - t) / z)) tmp = 0 if z <= -3.5e-15: tmp = t_1 elif z <= 7.6e-125: tmp = x + (t * (y / a)) elif z <= 1.8e+228: tmp = x + (z * (y / (z - a))) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(y * Float64(Float64(z - t) / z))) tmp = 0.0 if (z <= -3.5e-15) tmp = t_1; elseif (z <= 7.6e-125) tmp = Float64(x + Float64(t * Float64(y / a))); elseif (z <= 1.8e+228) tmp = Float64(x + Float64(z * Float64(y / Float64(z - a)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (y * ((z - t) / z)); tmp = 0.0; if (z <= -3.5e-15) tmp = t_1; elseif (z <= 7.6e-125) tmp = x + (t * (y / a)); elseif (z <= 1.8e+228) tmp = x + (z * (y / (z - a))); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.5e-15], t$95$1, If[LessEqual[z, 7.6e-125], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.8e+228], N[(x + N[(z * N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + y \cdot \frac{z - t}{z}\\
\mathbf{if}\;z \leq -3.5 \cdot 10^{-15}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 7.6 \cdot 10^{-125}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{+228}:\\
\;\;\;\;x + z \cdot \frac{y}{z - a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.5000000000000001e-15 or 1.8e228 < z Initial program 99.9%
Taylor expanded in a around 0 91.6%
if -3.5000000000000001e-15 < z < 7.6000000000000002e-125Initial program 93.4%
Taylor expanded in z around 0 83.0%
+-commutative83.0%
associate-/l*84.9%
Simplified84.9%
if 7.6000000000000002e-125 < z < 1.8e228Initial program 99.9%
Taylor expanded in t around 0 77.8%
div-inv77.8%
*-commutative77.8%
associate-*l*88.1%
div-inv88.2%
Applied egg-rr88.2%
Final simplification88.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.4e-15) (not (<= z 4.6e+42))) (+ x (* y (/ (- z t) z))) (+ x (* t (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.4e-15) || !(z <= 4.6e+42)) {
tmp = x + (y * ((z - t) / z));
} 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 <= (-2.4d-15)) .or. (.not. (z <= 4.6d+42))) then
tmp = x + (y * ((z - t) / z))
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 <= -2.4e-15) || !(z <= 4.6e+42)) {
tmp = x + (y * ((z - t) / z));
} else {
tmp = x + (t * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.4e-15) or not (z <= 4.6e+42): tmp = x + (y * ((z - t) / z)) else: tmp = x + (t * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.4e-15) || !(z <= 4.6e+42)) tmp = Float64(x + Float64(y * Float64(Float64(z - t) / z))); 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 <= -2.4e-15) || ~((z <= 4.6e+42))) tmp = x + (y * ((z - t) / z)); else tmp = x + (t * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.4e-15], N[Not[LessEqual[z, 4.6e+42]], $MachinePrecision]], N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.4 \cdot 10^{-15} \lor \neg \left(z \leq 4.6 \cdot 10^{+42}\right):\\
\;\;\;\;x + y \cdot \frac{z - t}{z}\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -2.39999999999999995e-15 or 4.6e42 < z Initial program 99.9%
Taylor expanded in a around 0 88.8%
if -2.39999999999999995e-15 < z < 4.6e42Initial program 94.8%
Taylor expanded in z around 0 79.8%
+-commutative79.8%
associate-/l*81.9%
Simplified81.9%
Final simplification85.4%
(FPCore (x y z t a) :precision binary64 (if (<= z -1750000000000.0) (+ x (* y (/ (- z t) z))) (if (<= z 2.9e-117) (- 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 (z <= -1750000000000.0) {
tmp = x + (y * ((z - t) / z));
} else if (z <= 2.9e-117) {
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 (z <= (-1750000000000.0d0)) then
tmp = x + (y * ((z - t) / z))
else if (z <= 2.9d-117) 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 (z <= -1750000000000.0) {
tmp = x + (y * ((z - t) / z));
} else if (z <= 2.9e-117) {
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 z <= -1750000000000.0: tmp = x + (y * ((z - t) / z)) elif z <= 2.9e-117: 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 (z <= -1750000000000.0) tmp = Float64(x + Float64(y * Float64(Float64(z - t) / z))); elseif (z <= 2.9e-117) 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 (z <= -1750000000000.0) tmp = x + (y * ((z - t) / z)); elseif (z <= 2.9e-117) 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[LessEqual[z, -1750000000000.0], N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.9e-117], 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}\;z \leq -1750000000000:\\
\;\;\;\;x + y \cdot \frac{z - t}{z}\\
\mathbf{elif}\;z \leq 2.9 \cdot 10^{-117}:\\
\;\;\;\;x - t \cdot \frac{y}{z - a}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{z - a}\\
\end{array}
\end{array}
if z < -1.75e12Initial program 99.9%
Taylor expanded in a around 0 92.1%
if -1.75e12 < z < 2.9000000000000001e-117Initial program 94.1%
Taylor expanded in t around inf 89.7%
mul-1-neg89.7%
associate-/l*89.8%
Simplified89.8%
if 2.9000000000000001e-117 < z Initial program 99.9%
Taylor expanded in t around 0 73.9%
+-commutative73.9%
associate-/l*90.0%
Simplified90.0%
Final simplification90.4%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.02e-13) (+ x (* y (/ (- z t) z))) (if (<= z 5.4e-125) (+ x (* t (/ y a))) (+ x (* y (/ z (- z a)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.02e-13) {
tmp = x + (y * ((z - t) / z));
} else if (z <= 5.4e-125) {
tmp = x + (t * (y / 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 (z <= (-1.02d-13)) then
tmp = x + (y * ((z - t) / z))
else if (z <= 5.4d-125) then
tmp = x + (t * (y / 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 (z <= -1.02e-13) {
tmp = x + (y * ((z - t) / z));
} else if (z <= 5.4e-125) {
tmp = x + (t * (y / a));
} else {
tmp = x + (y * (z / (z - a)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.02e-13: tmp = x + (y * ((z - t) / z)) elif z <= 5.4e-125: tmp = x + (t * (y / a)) else: tmp = x + (y * (z / (z - a))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.02e-13) tmp = Float64(x + Float64(y * Float64(Float64(z - t) / z))); elseif (z <= 5.4e-125) tmp = Float64(x + Float64(t * Float64(y / 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 (z <= -1.02e-13) tmp = x + (y * ((z - t) / z)); elseif (z <= 5.4e-125) tmp = x + (t * (y / a)); else tmp = x + (y * (z / (z - a))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.02e-13], N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.4e-125], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.02 \cdot 10^{-13}:\\
\;\;\;\;x + y \cdot \frac{z - t}{z}\\
\mathbf{elif}\;z \leq 5.4 \cdot 10^{-125}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{z - a}\\
\end{array}
\end{array}
if z < -1.0199999999999999e-13Initial program 99.9%
Taylor expanded in a around 0 89.2%
if -1.0199999999999999e-13 < z < 5.3999999999999995e-125Initial program 93.4%
Taylor expanded in z around 0 83.0%
+-commutative83.0%
associate-/l*84.9%
Simplified84.9%
if 5.3999999999999995e-125 < z Initial program 99.9%
Taylor expanded in t around 0 73.0%
+-commutative73.0%
associate-/l*89.0%
Simplified89.0%
Final simplification87.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1150000000000.0) (not (<= z 1.1e+43))) (+ x y) (+ x (* t (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1150000000000.0) || !(z <= 1.1e+43)) {
tmp = x + y;
} 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 <= (-1150000000000.0d0)) .or. (.not. (z <= 1.1d+43))) then
tmp = x + y
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 <= -1150000000000.0) || !(z <= 1.1e+43)) {
tmp = x + y;
} else {
tmp = x + (t * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1150000000000.0) or not (z <= 1.1e+43): tmp = x + y else: tmp = x + (t * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1150000000000.0) || !(z <= 1.1e+43)) tmp = Float64(x + y); 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 <= -1150000000000.0) || ~((z <= 1.1e+43))) tmp = x + y; else tmp = x + (t * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1150000000000.0], N[Not[LessEqual[z, 1.1e+43]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1150000000000 \lor \neg \left(z \leq 1.1 \cdot 10^{+43}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -1.15e12 or 1.1e43 < z Initial program 99.9%
Taylor expanded in z around inf 80.1%
+-commutative80.1%
Simplified80.1%
if -1.15e12 < z < 1.1e43Initial program 95.2%
Taylor expanded in z around 0 79.1%
+-commutative79.1%
associate-/l*81.0%
Simplified81.0%
Final simplification80.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -3100000000000.0) (not (<= z 3.5e+42))) (+ x y) (+ x (/ y (/ a t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3100000000000.0) || !(z <= 3.5e+42)) {
tmp = x + y;
} 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 <= (-3100000000000.0d0)) .or. (.not. (z <= 3.5d+42))) then
tmp = x + y
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 <= -3100000000000.0) || !(z <= 3.5e+42)) {
tmp = x + y;
} else {
tmp = x + (y / (a / t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -3100000000000.0) or not (z <= 3.5e+42): tmp = x + y else: tmp = x + (y / (a / t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -3100000000000.0) || !(z <= 3.5e+42)) tmp = Float64(x + y); 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 <= -3100000000000.0) || ~((z <= 3.5e+42))) tmp = x + y; else tmp = x + (y / (a / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -3100000000000.0], N[Not[LessEqual[z, 3.5e+42]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(x + N[(y / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3100000000000 \lor \neg \left(z \leq 3.5 \cdot 10^{+42}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a}{t}}\\
\end{array}
\end{array}
if z < -3.1e12 or 3.50000000000000023e42 < z Initial program 99.9%
Taylor expanded in z around inf 80.1%
+-commutative80.1%
Simplified80.1%
if -3.1e12 < z < 3.50000000000000023e42Initial program 95.2%
clear-num95.1%
un-div-inv95.2%
Applied egg-rr95.2%
Taylor expanded in z around 0 79.8%
Final simplification80.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2000000000000.0) (not (<= z 2.35e+44))) (+ x y) (+ x (* y (/ t a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2000000000000.0) || !(z <= 2.35e+44)) {
tmp = x + y;
} 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 <= (-2000000000000.0d0)) .or. (.not. (z <= 2.35d+44))) then
tmp = x + y
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 <= -2000000000000.0) || !(z <= 2.35e+44)) {
tmp = x + y;
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2000000000000.0) or not (z <= 2.35e+44): tmp = x + y else: tmp = x + (y * (t / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2000000000000.0) || !(z <= 2.35e+44)) tmp = Float64(x + y); 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 <= -2000000000000.0) || ~((z <= 2.35e+44))) tmp = x + y; else tmp = x + (y * (t / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2000000000000.0], N[Not[LessEqual[z, 2.35e+44]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2000000000000 \lor \neg \left(z \leq 2.35 \cdot 10^{+44}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\end{array}
\end{array}
if z < -2e12 or 2.35000000000000009e44 < z Initial program 99.9%
Taylor expanded in z around inf 80.1%
+-commutative80.1%
Simplified80.1%
if -2e12 < z < 2.35000000000000009e44Initial program 95.2%
Taylor expanded in z around 0 79.8%
Final simplification79.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.6e-122) (not (<= z 3.5e+42))) (+ x y) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.6e-122) || !(z <= 3.5e+42)) {
tmp = x + y;
} 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 <= (-2.6d-122)) .or. (.not. (z <= 3.5d+42))) then
tmp = x + y
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 <= -2.6e-122) || !(z <= 3.5e+42)) {
tmp = x + y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.6e-122) or not (z <= 3.5e+42): tmp = x + y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.6e-122) || !(z <= 3.5e+42)) tmp = Float64(x + y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -2.6e-122) || ~((z <= 3.5e+42))) tmp = x + y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.6e-122], N[Not[LessEqual[z, 3.5e+42]], $MachinePrecision]], N[(x + y), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.6 \cdot 10^{-122} \lor \neg \left(z \leq 3.5 \cdot 10^{+42}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.59999999999999975e-122 or 3.50000000000000023e42 < z Initial program 98.7%
Taylor expanded in z around inf 72.2%
+-commutative72.2%
Simplified72.2%
if -2.59999999999999975e-122 < z < 3.50000000000000023e42Initial program 95.5%
Taylor expanded in x around inf 55.4%
Final simplification65.3%
(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 97.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 97.4%
Taylor expanded in x around inf 51.8%
(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 2024141
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisLine from plot-0.2.3.4, A"
:precision binary64
:alt
(! :herbie-platform default (+ x (/ y (/ (- z a) (- z t)))))
(+ x (* y (/ (- z t) (- z a)))))