
(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(Float64(y * 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[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{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(Float64(y * 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[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{z - a}
\end{array}
(FPCore (x y z t a) :precision binary64 (+ (* y (/ (- z t) (- z a))) x))
double code(double x, double y, double z, double t, double a) {
return (y * ((z - t) / (z - a))) + 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 = (y * ((z - t) / (z - a))) + x
end function
public static double code(double x, double y, double z, double t, double a) {
return (y * ((z - t) / (z - a))) + x;
}
def code(x, y, z, t, a): return (y * ((z - t) / (z - a))) + x
function code(x, y, z, t, a) return Float64(Float64(y * Float64(Float64(z - t) / Float64(z - a))) + x) end
function tmp = code(x, y, z, t, a) tmp = (y * ((z - t) / (z - a))) + x; end
code[x_, y_, z_, t_, a_] := N[(N[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \frac{z - t}{z - a} + x
\end{array}
Initial program 85.6%
+-commutative85.6%
associate-*r/99.2%
fma-def99.2%
Simplified99.2%
fma-udef99.2%
Applied egg-rr99.2%
Final simplification99.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.4e-79) (not (<= z 2.5e-54))) (+ x (* (- z t) (/ y z))) (+ x (* y (/ t a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.4e-79) || !(z <= 2.5e-54)) {
tmp = x + ((z - t) * (y / z));
} 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 <= (-1.4d-79)) .or. (.not. (z <= 2.5d-54))) then
tmp = x + ((z - t) * (y / z))
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 <= -1.4e-79) || !(z <= 2.5e-54)) {
tmp = x + ((z - t) * (y / z));
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.4e-79) or not (z <= 2.5e-54): tmp = x + ((z - t) * (y / z)) else: tmp = x + (y * (t / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.4e-79) || !(z <= 2.5e-54)) tmp = Float64(x + Float64(Float64(z - t) * Float64(y / z))); 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 <= -1.4e-79) || ~((z <= 2.5e-54))) tmp = x + ((z - t) * (y / z)); else tmp = x + (y * (t / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.4e-79], N[Not[LessEqual[z, 2.5e-54]], $MachinePrecision]], N[(x + N[(N[(z - t), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.4 \cdot 10^{-79} \lor \neg \left(z \leq 2.5 \cdot 10^{-54}\right):\\
\;\;\;\;x + \left(z - t\right) \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\end{array}
\end{array}
if z < -1.40000000000000006e-79 or 2.50000000000000008e-54 < z Initial program 78.6%
associate-*l/96.6%
Simplified96.6%
Taylor expanded in z around inf 85.3%
if -1.40000000000000006e-79 < z < 2.50000000000000008e-54Initial program 98.8%
associate-*l/94.4%
Simplified94.4%
Taylor expanded in z around 0 85.9%
*-commutative85.9%
associate-/l*83.0%
associate-/r/87.0%
Applied egg-rr87.0%
Final simplification85.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -9.5e+102) (not (<= t 7e-60))) (- x (* t (/ y (- z a)))) (+ x (/ y (/ (- z a) z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -9.5e+102) || !(t <= 7e-60)) {
tmp = x - (t * (y / (z - a)));
} else {
tmp = x + (y / ((z - a) / 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 ((t <= (-9.5d+102)) .or. (.not. (t <= 7d-60))) then
tmp = x - (t * (y / (z - a)))
else
tmp = x + (y / ((z - a) / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -9.5e+102) || !(t <= 7e-60)) {
tmp = x - (t * (y / (z - a)));
} else {
tmp = x + (y / ((z - a) / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -9.5e+102) or not (t <= 7e-60): tmp = x - (t * (y / (z - a))) else: tmp = x + (y / ((z - a) / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -9.5e+102) || !(t <= 7e-60)) tmp = Float64(x - Float64(t * Float64(y / Float64(z - a)))); else tmp = Float64(x + Float64(y / Float64(Float64(z - a) / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -9.5e+102) || ~((t <= 7e-60))) tmp = x - (t * (y / (z - a))); else tmp = x + (y / ((z - a) / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -9.5e+102], N[Not[LessEqual[t, 7e-60]], $MachinePrecision]], N[(x - N[(t * N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(N[(z - a), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9.5 \cdot 10^{+102} \lor \neg \left(t \leq 7 \cdot 10^{-60}\right):\\
\;\;\;\;x - t \cdot \frac{y}{z - a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{z - a}{z}}\\
\end{array}
\end{array}
if t < -9.4999999999999992e102 or 6.99999999999999952e-60 < t Initial program 88.2%
associate-/l*97.9%
Simplified97.9%
clear-num97.8%
associate-/r/97.9%
Applied egg-rr97.9%
Taylor expanded in z around 0 93.3%
Taylor expanded in x around 0 87.2%
+-commutative87.2%
mul-1-neg87.2%
unsub-neg87.2%
*-commutative87.2%
associate-*r/92.1%
Simplified92.1%
if -9.4999999999999992e102 < t < 6.99999999999999952e-60Initial program 84.0%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in t around 0 89.6%
Final simplification90.5%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.7e-82) (+ x (/ y (/ (- z a) z))) (if (<= z 3.2e-57) (+ x (* y (/ t a))) (+ x (* (- z t) (/ y z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.7e-82) {
tmp = x + (y / ((z - a) / z));
} else if (z <= 3.2e-57) {
tmp = x + (y * (t / a));
} else {
tmp = x + ((z - t) * (y / 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 (z <= (-1.7d-82)) then
tmp = x + (y / ((z - a) / z))
else if (z <= 3.2d-57) then
tmp = x + (y * (t / a))
else
tmp = x + ((z - t) * (y / z))
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.7e-82) {
tmp = x + (y / ((z - a) / z));
} else if (z <= 3.2e-57) {
tmp = x + (y * (t / a));
} else {
tmp = x + ((z - t) * (y / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.7e-82: tmp = x + (y / ((z - a) / z)) elif z <= 3.2e-57: tmp = x + (y * (t / a)) else: tmp = x + ((z - t) * (y / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.7e-82) tmp = Float64(x + Float64(y / Float64(Float64(z - a) / z))); elseif (z <= 3.2e-57) tmp = Float64(x + Float64(y * Float64(t / a))); else tmp = Float64(x + Float64(Float64(z - t) * Float64(y / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.7e-82) tmp = x + (y / ((z - a) / z)); elseif (z <= 3.2e-57) tmp = x + (y * (t / a)); else tmp = x + ((z - t) * (y / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.7e-82], N[(x + N[(y / N[(N[(z - a), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.2e-57], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(z - t), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.7 \cdot 10^{-82}:\\
\;\;\;\;x + \frac{y}{\frac{z - a}{z}}\\
\mathbf{elif}\;z \leq 3.2 \cdot 10^{-57}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \left(z - t\right) \cdot \frac{y}{z}\\
\end{array}
\end{array}
if z < -1.69999999999999988e-82Initial program 83.0%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in t around 0 82.9%
if -1.69999999999999988e-82 < z < 3.2000000000000001e-57Initial program 98.8%
associate-*l/94.4%
Simplified94.4%
Taylor expanded in z around 0 85.9%
*-commutative85.9%
associate-/l*83.0%
associate-/r/87.0%
Applied egg-rr87.0%
if 3.2000000000000001e-57 < z Initial program 74.3%
associate-*l/99.0%
Simplified99.0%
Taylor expanded in z around inf 88.8%
Final simplification86.2%
(FPCore (x y z t a) :precision binary64 (if (<= z -4.1e-79) (+ x (* y (/ (- z t) z))) (if (<= z 2.2e-57) (+ x (* y (/ t a))) (+ x (* (- z t) (/ y z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.1e-79) {
tmp = x + (y * ((z - t) / z));
} else if (z <= 2.2e-57) {
tmp = x + (y * (t / a));
} else {
tmp = x + ((z - t) * (y / 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 (z <= (-4.1d-79)) then
tmp = x + (y * ((z - t) / z))
else if (z <= 2.2d-57) then
tmp = x + (y * (t / a))
else
tmp = x + ((z - t) * (y / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.1e-79) {
tmp = x + (y * ((z - t) / z));
} else if (z <= 2.2e-57) {
tmp = x + (y * (t / a));
} else {
tmp = x + ((z - t) * (y / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -4.1e-79: tmp = x + (y * ((z - t) / z)) elif z <= 2.2e-57: tmp = x + (y * (t / a)) else: tmp = x + ((z - t) * (y / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -4.1e-79) tmp = Float64(x + Float64(y * Float64(Float64(z - t) / z))); elseif (z <= 2.2e-57) tmp = Float64(x + Float64(y * Float64(t / a))); else tmp = Float64(x + Float64(Float64(z - t) * Float64(y / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -4.1e-79) tmp = x + (y * ((z - t) / z)); elseif (z <= 2.2e-57) tmp = x + (y * (t / a)); else tmp = x + ((z - t) * (y / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4.1e-79], N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.2e-57], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(z - t), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.1 \cdot 10^{-79}:\\
\;\;\;\;x + y \cdot \frac{z - t}{z}\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{-57}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \left(z - t\right) \cdot \frac{y}{z}\\
\end{array}
\end{array}
if z < -4.09999999999999994e-79Initial program 83.0%
+-commutative83.0%
associate-*r/99.9%
fma-def99.9%
Simplified99.9%
fma-udef99.9%
Applied egg-rr99.9%
Taylor expanded in a around 0 84.1%
if -4.09999999999999994e-79 < z < 2.19999999999999999e-57Initial program 98.8%
associate-*l/94.4%
Simplified94.4%
Taylor expanded in z around 0 85.9%
*-commutative85.9%
associate-/l*83.0%
associate-/r/87.0%
Applied egg-rr87.0%
if 2.19999999999999999e-57 < z Initial program 74.3%
associate-*l/99.0%
Simplified99.0%
Taylor expanded in z around inf 88.8%
Final simplification86.6%
(FPCore (x y z t a) :precision binary64 (if (<= z -12000000000000.0) (+ y x) (if (<= z 5.8e+36) (+ x (* y (/ t a))) (+ y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -12000000000000.0) {
tmp = y + x;
} else if (z <= 5.8e+36) {
tmp = x + (y * (t / a));
} else {
tmp = y + 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 <= (-12000000000000.0d0)) then
tmp = y + x
else if (z <= 5.8d+36) then
tmp = x + (y * (t / a))
else
tmp = y + 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 <= -12000000000000.0) {
tmp = y + x;
} else if (z <= 5.8e+36) {
tmp = x + (y * (t / a));
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -12000000000000.0: tmp = y + x elif z <= 5.8e+36: tmp = x + (y * (t / a)) else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -12000000000000.0) tmp = Float64(y + x); elseif (z <= 5.8e+36) tmp = Float64(x + Float64(y * Float64(t / a))); else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -12000000000000.0) tmp = y + x; elseif (z <= 5.8e+36) tmp = x + (y * (t / a)); else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -12000000000000.0], N[(y + x), $MachinePrecision], If[LessEqual[z, 5.8e+36], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -12000000000000:\\
\;\;\;\;y + x\\
\mathbf{elif}\;z \leq 5.8 \cdot 10^{+36}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if z < -1.2e13 or 5.8e36 < z Initial program 72.3%
associate-*l/95.5%
Simplified95.5%
Taylor expanded in z around inf 81.1%
if -1.2e13 < z < 5.8e36Initial program 98.5%
associate-*l/96.1%
Simplified96.1%
Taylor expanded in z around 0 77.9%
*-commutative77.9%
associate-/l*75.9%
associate-/r/79.3%
Applied egg-rr79.3%
Final simplification80.2%
(FPCore (x y z t a) :precision binary64 (+ x (* (- z t) (/ y (- z a)))))
double code(double x, double y, double z, double t, double a) {
return x + ((z - t) * (y / (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 + ((z - t) * (y / (z - a)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((z - t) * (y / (z - a)));
}
def code(x, y, z, t, a): return x + ((z - t) * (y / (z - a)))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(z - t) * Float64(y / Float64(z - a)))) end
function tmp = code(x, y, z, t, a) tmp = x + ((z - t) * (y / (z - a))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(z - t), $MachinePrecision] * N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(z - t\right) \cdot \frac{y}{z - a}
\end{array}
Initial program 85.6%
associate-*l/95.8%
Simplified95.8%
Final simplification95.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}
Initial program 85.6%
associate-/l*99.2%
Simplified99.2%
Final simplification99.2%
(FPCore (x y z t a) :precision binary64 (if (<= z -1e-92) (+ y x) (if (<= z 860.0) x (+ y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1e-92) {
tmp = y + x;
} else if (z <= 860.0) {
tmp = x;
} else {
tmp = y + 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 <= (-1d-92)) then
tmp = y + x
else if (z <= 860.0d0) then
tmp = x
else
tmp = y + 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 <= -1e-92) {
tmp = y + x;
} else if (z <= 860.0) {
tmp = x;
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1e-92: tmp = y + x elif z <= 860.0: tmp = x else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1e-92) tmp = Float64(y + x); elseif (z <= 860.0) tmp = x; else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1e-92) tmp = y + x; elseif (z <= 860.0) tmp = x; else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1e-92], N[(y + x), $MachinePrecision], If[LessEqual[z, 860.0], x, N[(y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{-92}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;z \leq 860:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if z < -9.99999999999999988e-93 or 860 < z Initial program 77.3%
associate-*l/95.7%
Simplified95.7%
Taylor expanded in z around inf 76.6%
if -9.99999999999999988e-93 < z < 860Initial program 98.1%
associate-*l/96.0%
Simplified96.0%
Taylor expanded in x around inf 55.7%
Final simplification68.3%
(FPCore (x y z t a) :precision binary64 (if (<= x -8e-212) x (if (<= x 5.2e-67) y x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -8e-212) {
tmp = x;
} else if (x <= 5.2e-67) {
tmp = 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 (x <= (-8d-212)) then
tmp = x
else if (x <= 5.2d-67) then
tmp = 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 (x <= -8e-212) {
tmp = x;
} else if (x <= 5.2e-67) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -8e-212: tmp = x elif x <= 5.2e-67: tmp = y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -8e-212) tmp = x; elseif (x <= 5.2e-67) tmp = y; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -8e-212) tmp = x; elseif (x <= 5.2e-67) tmp = y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -8e-212], x, If[LessEqual[x, 5.2e-67], y, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8 \cdot 10^{-212}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 5.2 \cdot 10^{-67}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -7.99999999999999963e-212 or 5.1999999999999998e-67 < x Initial program 86.8%
associate-*l/97.6%
Simplified97.6%
Taylor expanded in x around inf 65.9%
if -7.99999999999999963e-212 < x < 5.1999999999999998e-67Initial program 82.0%
+-commutative82.0%
associate-*r/99.8%
fma-def99.8%
Simplified99.8%
fma-udef99.8%
Applied egg-rr99.8%
Taylor expanded in a around 0 60.8%
Taylor expanded in y around inf 57.0%
Taylor expanded in t around 0 37.8%
Final simplification58.9%
(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 85.6%
associate-*l/95.8%
Simplified95.8%
Taylor expanded in x around inf 52.7%
Final simplification52.7%
(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 2023230
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTicks from plot-0.2.3.4, A"
:precision binary64
:herbie-target
(+ x (/ y (/ (- z a) (- z t))))
(+ x (/ (* y (- z t)) (- z a))))