
(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 13 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
(let* ((t_1 (/ (* y (- z t)) (- z a))))
(if (<= t_1 -5e+256)
(fma (/ y (- z a)) (- z t) x)
(if (<= t_1 2e+263)
(- x (/ (* y (- t z)) (- z a)))
(+ x (/ (- z t) (/ (- z a) y)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y * (z - t)) / (z - a);
double tmp;
if (t_1 <= -5e+256) {
tmp = fma((y / (z - a)), (z - t), x);
} else if (t_1 <= 2e+263) {
tmp = x - ((y * (t - z)) / (z - a));
} else {
tmp = x + ((z - t) / ((z - a) / y));
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(y * Float64(z - t)) / Float64(z - a)) tmp = 0.0 if (t_1 <= -5e+256) tmp = fma(Float64(y / Float64(z - a)), Float64(z - t), x); elseif (t_1 <= 2e+263) tmp = Float64(x - Float64(Float64(y * Float64(t - z)) / Float64(z - a))); else tmp = Float64(x + Float64(Float64(z - t) / Float64(Float64(z - a) / y))); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+256], N[(N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(z - t), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 2e+263], N[(x - N[(N[(y * N[(t - z), $MachinePrecision]), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(z - t), $MachinePrecision] / N[(N[(z - a), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot \left(z - t\right)}{z - a}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+256}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{z - a}, z - t, x\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+263}:\\
\;\;\;\;x - \frac{y \cdot \left(t - z\right)}{z - a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z - t}{\frac{z - a}{y}}\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < -5.00000000000000015e256Initial program 46.7%
+-commutative46.7%
associate-*l/99.9%
fma-def99.9%
Simplified99.9%
if -5.00000000000000015e256 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < 2.00000000000000003e263Initial program 99.6%
if 2.00000000000000003e263 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) Initial program 42.4%
*-commutative42.4%
associate-/l*99.9%
Simplified99.9%
Final simplification99.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* y (- z t)) (- z a))))
(if (or (<= t_1 -2e+305) (not (<= t_1 2e+263)))
(+ x (/ (- z t) (/ (- z a) y)))
(- x (/ (* y (- t z)) (- z a))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y * (z - t)) / (z - a);
double tmp;
if ((t_1 <= -2e+305) || !(t_1 <= 2e+263)) {
tmp = x + ((z - t) / ((z - a) / y));
} else {
tmp = x - ((y * (t - 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) :: t_1
real(8) :: tmp
t_1 = (y * (z - t)) / (z - a)
if ((t_1 <= (-2d+305)) .or. (.not. (t_1 <= 2d+263))) then
tmp = x + ((z - t) / ((z - a) / y))
else
tmp = x - ((y * (t - z)) / (z - a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y * (z - t)) / (z - a);
double tmp;
if ((t_1 <= -2e+305) || !(t_1 <= 2e+263)) {
tmp = x + ((z - t) / ((z - a) / y));
} else {
tmp = x - ((y * (t - z)) / (z - a));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y * (z - t)) / (z - a) tmp = 0 if (t_1 <= -2e+305) or not (t_1 <= 2e+263): tmp = x + ((z - t) / ((z - a) / y)) else: tmp = x - ((y * (t - z)) / (z - a)) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y * Float64(z - t)) / Float64(z - a)) tmp = 0.0 if ((t_1 <= -2e+305) || !(t_1 <= 2e+263)) tmp = Float64(x + Float64(Float64(z - t) / Float64(Float64(z - a) / y))); else tmp = Float64(x - Float64(Float64(y * Float64(t - z)) / Float64(z - a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y * (z - t)) / (z - a); tmp = 0.0; if ((t_1 <= -2e+305) || ~((t_1 <= 2e+263))) tmp = x + ((z - t) / ((z - a) / y)); else tmp = x - ((y * (t - z)) / (z - a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -2e+305], N[Not[LessEqual[t$95$1, 2e+263]], $MachinePrecision]], N[(x + N[(N[(z - t), $MachinePrecision] / N[(N[(z - a), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(y * N[(t - z), $MachinePrecision]), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot \left(z - t\right)}{z - a}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+305} \lor \neg \left(t\_1 \leq 2 \cdot 10^{+263}\right):\\
\;\;\;\;x + \frac{z - t}{\frac{z - a}{y}}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y \cdot \left(t - z\right)}{z - a}\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < -1.9999999999999999e305 or 2.00000000000000003e263 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) Initial program 43.1%
*-commutative43.1%
associate-/l*99.8%
Simplified99.8%
if -1.9999999999999999e305 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < 2.00000000000000003e263Initial program 99.6%
Final simplification99.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -7e+79) (not (<= z 1.85e+113))) (+ x (/ y (/ (- z a) z))) (- x (/ (* y (- t z)) (- z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -7e+79) || !(z <= 1.85e+113)) {
tmp = x + (y / ((z - a) / z));
} else {
tmp = x - ((y * (t - 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 <= (-7d+79)) .or. (.not. (z <= 1.85d+113))) then
tmp = x + (y / ((z - a) / z))
else
tmp = x - ((y * (t - 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 <= -7e+79) || !(z <= 1.85e+113)) {
tmp = x + (y / ((z - a) / z));
} else {
tmp = x - ((y * (t - z)) / (z - a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -7e+79) or not (z <= 1.85e+113): tmp = x + (y / ((z - a) / z)) else: tmp = x - ((y * (t - z)) / (z - a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -7e+79) || !(z <= 1.85e+113)) tmp = Float64(x + Float64(y / Float64(Float64(z - a) / z))); else tmp = Float64(x - Float64(Float64(y * Float64(t - z)) / Float64(z - a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -7e+79) || ~((z <= 1.85e+113))) tmp = x + (y / ((z - a) / z)); else tmp = x - ((y * (t - z)) / (z - a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -7e+79], N[Not[LessEqual[z, 1.85e+113]], $MachinePrecision]], N[(x + N[(y / N[(N[(z - a), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(y * N[(t - z), $MachinePrecision]), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7 \cdot 10^{+79} \lor \neg \left(z \leq 1.85 \cdot 10^{+113}\right):\\
\;\;\;\;x + \frac{y}{\frac{z - a}{z}}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y \cdot \left(t - z\right)}{z - a}\\
\end{array}
\end{array}
if z < -6.99999999999999961e79 or 1.8499999999999999e113 < z Initial program 62.0%
+-commutative62.0%
associate-*l/95.1%
fma-def95.1%
Simplified95.1%
Taylor expanded in t around 0 62.4%
+-commutative62.4%
associate-/l*95.9%
Simplified95.9%
if -6.99999999999999961e79 < z < 1.8499999999999999e113Initial program 96.8%
Final simplification96.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -32000000.0) (not (<= z 2.35e+111))) (+ x (* y (- 1.0 (/ t z)))) (+ x (* y (/ t a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -32000000.0) || !(z <= 2.35e+111)) {
tmp = x + (y * (1.0 - (t / 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 <= (-32000000.0d0)) .or. (.not. (z <= 2.35d+111))) then
tmp = x + (y * (1.0d0 - (t / 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 <= -32000000.0) || !(z <= 2.35e+111)) {
tmp = x + (y * (1.0 - (t / z)));
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -32000000.0) or not (z <= 2.35e+111): tmp = x + (y * (1.0 - (t / z))) else: tmp = x + (y * (t / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -32000000.0) || !(z <= 2.35e+111)) tmp = Float64(x + Float64(y * Float64(1.0 - Float64(t / 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 <= -32000000.0) || ~((z <= 2.35e+111))) tmp = x + (y * (1.0 - (t / z))); else tmp = x + (y * (t / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -32000000.0], N[Not[LessEqual[z, 2.35e+111]], $MachinePrecision]], N[(x + N[(y * N[(1.0 - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -32000000 \lor \neg \left(z \leq 2.35 \cdot 10^{+111}\right):\\
\;\;\;\;x + y \cdot \left(1 - \frac{t}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\end{array}
\end{array}
if z < -3.2e7 or 2.35000000000000004e111 < z Initial program 66.4%
+-commutative66.4%
associate-*l/95.8%
fma-def95.7%
Simplified95.7%
Taylor expanded in a around 0 61.5%
+-commutative61.5%
associate-/l*92.1%
Simplified92.1%
Taylor expanded in z around 0 84.5%
mul-1-neg84.5%
unsub-neg84.5%
associate-*r/92.1%
Simplified92.1%
Taylor expanded in y around 0 92.1%
if -3.2e7 < z < 2.35000000000000004e111Initial program 97.1%
+-commutative97.1%
associate-*l/96.8%
fma-def96.8%
Simplified96.8%
Taylor expanded in z around 0 79.1%
+-commutative79.1%
associate-/l*79.3%
associate-/r/81.0%
Simplified81.0%
Final simplification85.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -0.445) (not (<= z 2.9e+28))) (+ x (/ y (/ (- z a) z))) (+ x (* y (/ t a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -0.445) || !(z <= 2.9e+28)) {
tmp = x + (y / ((z - a) / 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 <= (-0.445d0)) .or. (.not. (z <= 2.9d+28))) then
tmp = x + (y / ((z - a) / 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 <= -0.445) || !(z <= 2.9e+28)) {
tmp = x + (y / ((z - a) / z));
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -0.445) or not (z <= 2.9e+28): tmp = x + (y / ((z - a) / z)) else: tmp = x + (y * (t / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -0.445) || !(z <= 2.9e+28)) tmp = Float64(x + Float64(y / Float64(Float64(z - a) / 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 <= -0.445) || ~((z <= 2.9e+28))) tmp = x + (y / ((z - a) / z)); else tmp = x + (y * (t / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -0.445], N[Not[LessEqual[z, 2.9e+28]], $MachinePrecision]], N[(x + N[(y / N[(N[(z - a), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.445 \lor \neg \left(z \leq 2.9 \cdot 10^{+28}\right):\\
\;\;\;\;x + \frac{y}{\frac{z - a}{z}}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\end{array}
\end{array}
if z < -0.445000000000000007 or 2.9000000000000001e28 < z Initial program 70.8%
+-commutative70.8%
associate-*l/96.4%
fma-def96.4%
Simplified96.4%
Taylor expanded in t around 0 68.5%
+-commutative68.5%
associate-/l*92.1%
Simplified92.1%
if -0.445000000000000007 < z < 2.9000000000000001e28Initial program 97.4%
+-commutative97.4%
associate-*l/96.4%
fma-def96.4%
Simplified96.4%
Taylor expanded in z around 0 79.9%
+-commutative79.9%
associate-/l*79.4%
associate-/r/81.3%
Simplified81.3%
Final simplification86.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -9.9e+39) (not (<= z 1.02e+113))) (+ x (/ y (/ (- z a) z))) (- x (* t (/ y (- z a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -9.9e+39) || !(z <= 1.02e+113)) {
tmp = x + (y / ((z - a) / z));
} else {
tmp = x - (t * (y / (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 <= (-9.9d+39)) .or. (.not. (z <= 1.02d+113))) then
tmp = x + (y / ((z - a) / z))
else
tmp = x - (t * (y / (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 <= -9.9e+39) || !(z <= 1.02e+113)) {
tmp = x + (y / ((z - a) / z));
} else {
tmp = x - (t * (y / (z - a)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -9.9e+39) or not (z <= 1.02e+113): tmp = x + (y / ((z - a) / z)) else: tmp = x - (t * (y / (z - a))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -9.9e+39) || !(z <= 1.02e+113)) tmp = Float64(x + Float64(y / Float64(Float64(z - a) / z))); else tmp = Float64(x - Float64(t * Float64(y / Float64(z - a)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -9.9e+39) || ~((z <= 1.02e+113))) tmp = x + (y / ((z - a) / z)); else tmp = x - (t * (y / (z - a))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -9.9e+39], N[Not[LessEqual[z, 1.02e+113]], $MachinePrecision]], N[(x + N[(y / N[(N[(z - a), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(t * N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.9 \cdot 10^{+39} \lor \neg \left(z \leq 1.02 \cdot 10^{+113}\right):\\
\;\;\;\;x + \frac{y}{\frac{z - a}{z}}\\
\mathbf{else}:\\
\;\;\;\;x - t \cdot \frac{y}{z - a}\\
\end{array}
\end{array}
if z < -9.9e39 or 1.02000000000000002e113 < z Initial program 65.2%
+-commutative65.2%
associate-*l/95.5%
fma-def95.5%
Simplified95.5%
Taylor expanded in t around 0 65.6%
+-commutative65.6%
associate-/l*96.3%
Simplified96.3%
if -9.9e39 < z < 1.02000000000000002e113Initial program 96.6%
Taylor expanded in t around inf 86.6%
associate-*r/87.0%
neg-mul-187.0%
distribute-lft-neg-in87.0%
*-commutative87.0%
Simplified87.0%
Final simplification90.4%
(FPCore (x y z t a) :precision binary64 (if (<= z -38000000.0) (+ x (- y (* t (/ y z)))) (if (<= z 2.35e+111) (+ x (* y (/ t a))) (+ x (* y (- 1.0 (/ t z)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -38000000.0) {
tmp = x + (y - (t * (y / z)));
} else if (z <= 2.35e+111) {
tmp = x + (y * (t / a));
} else {
tmp = x + (y * (1.0 - (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 (z <= (-38000000.0d0)) then
tmp = x + (y - (t * (y / z)))
else if (z <= 2.35d+111) then
tmp = x + (y * (t / a))
else
tmp = x + (y * (1.0d0 - (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 (z <= -38000000.0) {
tmp = x + (y - (t * (y / z)));
} else if (z <= 2.35e+111) {
tmp = x + (y * (t / a));
} else {
tmp = x + (y * (1.0 - (t / z)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -38000000.0: tmp = x + (y - (t * (y / z))) elif z <= 2.35e+111: tmp = x + (y * (t / a)) else: tmp = x + (y * (1.0 - (t / z))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -38000000.0) tmp = Float64(x + Float64(y - Float64(t * Float64(y / z)))); elseif (z <= 2.35e+111) tmp = Float64(x + Float64(y * Float64(t / a))); else tmp = Float64(x + Float64(y * Float64(1.0 - Float64(t / z)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -38000000.0) tmp = x + (y - (t * (y / z))); elseif (z <= 2.35e+111) tmp = x + (y * (t / a)); else tmp = x + (y * (1.0 - (t / z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -38000000.0], N[(x + N[(y - N[(t * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.35e+111], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(1.0 - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -38000000:\\
\;\;\;\;x + \left(y - t \cdot \frac{y}{z}\right)\\
\mathbf{elif}\;z \leq 2.35 \cdot 10^{+111}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(1 - \frac{t}{z}\right)\\
\end{array}
\end{array}
if z < -3.8e7Initial program 68.9%
+-commutative68.9%
associate-*l/99.8%
fma-def99.8%
Simplified99.8%
Taylor expanded in a around 0 63.1%
+-commutative63.1%
associate-/l*88.6%
Simplified88.6%
Taylor expanded in z around 0 83.2%
mul-1-neg83.2%
unsub-neg83.2%
associate-*r/88.7%
Simplified88.7%
if -3.8e7 < z < 2.35000000000000004e111Initial program 97.1%
+-commutative97.1%
associate-*l/96.8%
fma-def96.8%
Simplified96.8%
Taylor expanded in z around 0 79.1%
+-commutative79.1%
associate-/l*79.3%
associate-/r/81.0%
Simplified81.0%
if 2.35000000000000004e111 < z Initial program 63.6%
+-commutative63.6%
associate-*l/91.3%
fma-def91.2%
Simplified91.2%
Taylor expanded in a around 0 59.7%
+-commutative59.7%
associate-/l*96.0%
Simplified96.0%
Taylor expanded in z around 0 85.9%
mul-1-neg85.9%
unsub-neg85.9%
associate-*r/95.9%
Simplified95.9%
Taylor expanded in y around 0 96.0%
Final simplification85.3%
(FPCore (x y z t a) :precision binary64 (if (<= z -140000000.0) (+ x (- y (* t (/ y z)))) (if (<= z 4.2e+18) (+ x (* (/ y a) (- t z))) (+ x (/ y (/ (- z a) z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -140000000.0) {
tmp = x + (y - (t * (y / z)));
} else if (z <= 4.2e+18) {
tmp = x + ((y / a) * (t - z));
} 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 (z <= (-140000000.0d0)) then
tmp = x + (y - (t * (y / z)))
else if (z <= 4.2d+18) then
tmp = x + ((y / a) * (t - z))
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 (z <= -140000000.0) {
tmp = x + (y - (t * (y / z)));
} else if (z <= 4.2e+18) {
tmp = x + ((y / a) * (t - z));
} else {
tmp = x + (y / ((z - a) / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -140000000.0: tmp = x + (y - (t * (y / z))) elif z <= 4.2e+18: tmp = x + ((y / a) * (t - z)) else: tmp = x + (y / ((z - a) / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -140000000.0) tmp = Float64(x + Float64(y - Float64(t * Float64(y / z)))); elseif (z <= 4.2e+18) tmp = Float64(x + Float64(Float64(y / a) * Float64(t - z))); 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 (z <= -140000000.0) tmp = x + (y - (t * (y / z))); elseif (z <= 4.2e+18) tmp = x + ((y / a) * (t - z)); else tmp = x + (y / ((z - a) / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -140000000.0], N[(x + N[(y - N[(t * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.2e+18], N[(x + N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(N[(z - a), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -140000000:\\
\;\;\;\;x + \left(y - t \cdot \frac{y}{z}\right)\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{+18}:\\
\;\;\;\;x + \frac{y}{a} \cdot \left(t - z\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{z - a}{z}}\\
\end{array}
\end{array}
if z < -1.4e8Initial program 68.9%
+-commutative68.9%
associate-*l/99.8%
fma-def99.8%
Simplified99.8%
Taylor expanded in a around 0 63.1%
+-commutative63.1%
associate-/l*88.6%
Simplified88.6%
Taylor expanded in z around 0 83.2%
mul-1-neg83.2%
unsub-neg83.2%
associate-*r/88.7%
Simplified88.7%
if -1.4e8 < z < 4.2e18Initial program 97.4%
+-commutative97.4%
associate-*l/96.4%
fma-def96.4%
Simplified96.4%
Taylor expanded in a around inf 84.5%
mul-1-neg84.5%
unsub-neg84.5%
associate-/l*84.6%
associate-/r/83.9%
Simplified83.9%
if 4.2e18 < z Initial program 72.2%
+-commutative72.2%
associate-*l/93.7%
fma-def93.7%
Simplified93.7%
Taylor expanded in t around 0 72.2%
+-commutative72.2%
associate-/l*94.1%
Simplified94.1%
Final simplification87.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -32000000.0) (not (<= z 2.35e+111))) (+ y x) (+ x (* t (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -32000000.0) || !(z <= 2.35e+111)) {
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 <= (-32000000.0d0)) .or. (.not. (z <= 2.35d+111))) 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 <= -32000000.0) || !(z <= 2.35e+111)) {
tmp = y + x;
} else {
tmp = x + (t * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -32000000.0) or not (z <= 2.35e+111): tmp = y + x else: tmp = x + (t * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -32000000.0) || !(z <= 2.35e+111)) 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 <= -32000000.0) || ~((z <= 2.35e+111))) tmp = y + x; else tmp = x + (t * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -32000000.0], N[Not[LessEqual[z, 2.35e+111]], $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 -32000000 \lor \neg \left(z \leq 2.35 \cdot 10^{+111}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -3.2e7 or 2.35000000000000004e111 < z Initial program 66.4%
+-commutative66.4%
associate-*l/95.8%
fma-def95.7%
Simplified95.7%
Taylor expanded in z around inf 85.9%
+-commutative85.9%
Simplified85.9%
if -3.2e7 < z < 2.35000000000000004e111Initial program 97.1%
+-commutative97.1%
associate-*l/96.8%
fma-def96.8%
Simplified96.8%
Taylor expanded in z around 0 79.1%
+-commutative79.1%
associate-/l*79.3%
associate-/r/81.0%
Simplified81.0%
Taylor expanded in t around 0 79.1%
associate-*r/79.2%
Simplified79.2%
Final simplification81.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -80000000.0) (not (<= z 2.35e+111))) (+ y x) (+ x (* y (/ t a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -80000000.0) || !(z <= 2.35e+111)) {
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 <= (-80000000.0d0)) .or. (.not. (z <= 2.35d+111))) 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 <= -80000000.0) || !(z <= 2.35e+111)) {
tmp = y + x;
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -80000000.0) or not (z <= 2.35e+111): tmp = y + x else: tmp = x + (y * (t / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -80000000.0) || !(z <= 2.35e+111)) 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 <= -80000000.0) || ~((z <= 2.35e+111))) tmp = y + x; else tmp = x + (y * (t / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -80000000.0], N[Not[LessEqual[z, 2.35e+111]], $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 -80000000 \lor \neg \left(z \leq 2.35 \cdot 10^{+111}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\end{array}
\end{array}
if z < -8e7 or 2.35000000000000004e111 < z Initial program 66.4%
+-commutative66.4%
associate-*l/95.8%
fma-def95.7%
Simplified95.7%
Taylor expanded in z around inf 85.9%
+-commutative85.9%
Simplified85.9%
if -8e7 < z < 2.35000000000000004e111Initial program 97.1%
+-commutative97.1%
associate-*l/96.8%
fma-def96.8%
Simplified96.8%
Taylor expanded in z around 0 79.1%
+-commutative79.1%
associate-/l*79.3%
associate-/r/81.0%
Simplified81.0%
Final simplification82.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -35000000.0) (+ x (/ (- z t) (/ z y))) (if (<= z 2.35e+111) (+ x (* y (/ t a))) (+ y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -35000000.0) {
tmp = x + ((z - t) / (z / y));
} else if (z <= 2.35e+111) {
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 <= (-35000000.0d0)) then
tmp = x + ((z - t) / (z / y))
else if (z <= 2.35d+111) 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 <= -35000000.0) {
tmp = x + ((z - t) / (z / y));
} else if (z <= 2.35e+111) {
tmp = x + (y * (t / a));
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -35000000.0: tmp = x + ((z - t) / (z / y)) elif z <= 2.35e+111: tmp = x + (y * (t / a)) else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -35000000.0) tmp = Float64(x + Float64(Float64(z - t) / Float64(z / y))); elseif (z <= 2.35e+111) 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 <= -35000000.0) tmp = x + ((z - t) / (z / y)); elseif (z <= 2.35e+111) tmp = x + (y * (t / a)); else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -35000000.0], N[(x + N[(N[(z - t), $MachinePrecision] / N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.35e+111], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -35000000:\\
\;\;\;\;x + \frac{z - t}{\frac{z}{y}}\\
\mathbf{elif}\;z \leq 2.35 \cdot 10^{+111}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if z < -3.5e7Initial program 68.9%
*-commutative68.9%
associate-/l*99.7%
Simplified99.7%
Taylor expanded in z around inf 88.5%
if -3.5e7 < z < 2.35000000000000004e111Initial program 97.1%
+-commutative97.1%
associate-*l/96.8%
fma-def96.8%
Simplified96.8%
Taylor expanded in z around 0 79.1%
+-commutative79.1%
associate-/l*79.3%
associate-/r/81.0%
Simplified81.0%
if 2.35000000000000004e111 < z Initial program 63.6%
+-commutative63.6%
associate-*l/91.3%
fma-def91.2%
Simplified91.2%
Taylor expanded in z around inf 93.9%
+-commutative93.9%
Simplified93.9%
Final simplification84.9%
(FPCore (x y z t a) :precision binary64 (if (<= a -8.8e+91) x (+ y x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -8.8e+91) {
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 (a <= (-8.8d+91)) 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 (a <= -8.8e+91) {
tmp = x;
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -8.8e+91: tmp = x else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -8.8e+91) tmp = x; else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -8.8e+91) tmp = x; else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -8.8e+91], x, N[(y + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -8.8 \cdot 10^{+91}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if a < -8.79999999999999998e91Initial program 84.4%
+-commutative84.4%
associate-*l/97.7%
fma-def97.7%
Simplified97.7%
Taylor expanded in y around 0 73.2%
if -8.79999999999999998e91 < a Initial program 85.4%
+-commutative85.4%
associate-*l/96.2%
fma-def96.1%
Simplified96.1%
Taylor expanded in z around inf 60.6%
+-commutative60.6%
Simplified60.6%
Final simplification62.7%
(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.2%
+-commutative85.2%
associate-*l/96.4%
fma-def96.4%
Simplified96.4%
Taylor expanded in y around 0 51.9%
Final simplification51.9%
(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 2024036
(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))))