
(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 10 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 (+ 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.9%
associate-/l*98.8%
Simplified98.8%
Final simplification98.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.5e+37) (not (<= z 1.25e-30))) (+ x (* (- z t) (/ y z))) (+ x (* t (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.5e+37) || !(z <= 1.25e-30)) {
tmp = x + ((z - t) * (y / 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.5d+37)) .or. (.not. (z <= 1.25d-30))) then
tmp = x + ((z - t) * (y / 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.5e+37) || !(z <= 1.25e-30)) {
tmp = x + ((z - t) * (y / z));
} else {
tmp = x + (t * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.5e+37) or not (z <= 1.25e-30): tmp = x + ((z - t) * (y / z)) else: tmp = x + (t * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.5e+37) || !(z <= 1.25e-30)) tmp = Float64(x + Float64(Float64(z - t) * Float64(y / 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.5e+37) || ~((z <= 1.25e-30))) tmp = x + ((z - t) * (y / z)); else tmp = x + (t * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.5e+37], N[Not[LessEqual[z, 1.25e-30]], $MachinePrecision]], N[(x + N[(N[(z - t), $MachinePrecision] * N[(y / 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.5 \cdot 10^{+37} \lor \neg \left(z \leq 1.25 \cdot 10^{-30}\right):\\
\;\;\;\;x + \left(z - t\right) \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -2.49999999999999994e37 or 1.24999999999999993e-30 < z Initial program 72.9%
associate-*l/96.9%
Simplified96.9%
Taylor expanded in z around inf 89.5%
if -2.49999999999999994e37 < z < 1.24999999999999993e-30Initial program 98.2%
+-commutative98.2%
associate-*r/97.0%
fma-def97.0%
Simplified97.0%
Taylor expanded in z around 0 83.2%
associate-/l*83.4%
associate-/r/83.5%
Applied egg-rr83.5%
Final simplification86.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.5e+37) (not (<= z 7.6e-31))) (+ x (* y (- 1.0 (/ t z)))) (+ x (* t (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.5e+37) || !(z <= 7.6e-31)) {
tmp = x + (y * (1.0 - (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.5d+37)) .or. (.not. (z <= 7.6d-31))) then
tmp = x + (y * (1.0d0 - (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.5e+37) || !(z <= 7.6e-31)) {
tmp = x + (y * (1.0 - (t / z)));
} else {
tmp = x + (t * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.5e+37) or not (z <= 7.6e-31): tmp = x + (y * (1.0 - (t / z))) else: tmp = x + (t * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.5e+37) || !(z <= 7.6e-31)) tmp = Float64(x + Float64(y * Float64(1.0 - Float64(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.5e+37) || ~((z <= 7.6e-31))) tmp = x + (y * (1.0 - (t / z))); else tmp = x + (t * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.5e+37], N[Not[LessEqual[z, 7.6e-31]], $MachinePrecision]], N[(x + N[(y * N[(1.0 - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.5 \cdot 10^{+37} \lor \neg \left(z \leq 7.6 \cdot 10^{-31}\right):\\
\;\;\;\;x + y \cdot \left(1 - \frac{t}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -2.49999999999999994e37 or 7.5999999999999999e-31 < z Initial program 72.9%
+-commutative72.9%
associate-*r/99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in a around 0 70.1%
+-commutative70.1%
*-commutative70.1%
associate-/l*92.6%
Simplified92.6%
clear-num92.5%
associate-/r/92.5%
clear-num92.6%
div-sub92.6%
*-inverses92.6%
Applied egg-rr92.6%
if -2.49999999999999994e37 < z < 7.5999999999999999e-31Initial program 98.2%
+-commutative98.2%
associate-*r/97.0%
fma-def97.0%
Simplified97.0%
Taylor expanded in z around 0 83.2%
associate-/l*83.4%
associate-/r/83.5%
Applied egg-rr83.5%
Final simplification87.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.5e+37) (+ x (* y (- 1.0 (/ t z)))) (if (<= z 7.5e-31) (+ x (* t (/ y a))) (+ x (/ y (/ z (- z t)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.5e+37) {
tmp = x + (y * (1.0 - (t / z)));
} else if (z <= 7.5e-31) {
tmp = x + (t * (y / a));
} 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 <= (-2.5d+37)) then
tmp = x + (y * (1.0d0 - (t / z)))
else if (z <= 7.5d-31) then
tmp = x + (t * (y / a))
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 <= -2.5e+37) {
tmp = x + (y * (1.0 - (t / z)));
} else if (z <= 7.5e-31) {
tmp = x + (t * (y / a));
} else {
tmp = x + (y / (z / (z - t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.5e+37: tmp = x + (y * (1.0 - (t / z))) elif z <= 7.5e-31: tmp = x + (t * (y / a)) else: tmp = x + (y / (z / (z - t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.5e+37) tmp = Float64(x + Float64(y * Float64(1.0 - Float64(t / z)))); elseif (z <= 7.5e-31) tmp = Float64(x + Float64(t * Float64(y / a))); 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 <= -2.5e+37) tmp = x + (y * (1.0 - (t / z))); elseif (z <= 7.5e-31) tmp = x + (t * (y / a)); else tmp = x + (y / (z / (z - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.5e+37], N[(x + N[(y * N[(1.0 - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.5e-31], N[(x + N[(t * N[(y / a), $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 -2.5 \cdot 10^{+37}:\\
\;\;\;\;x + y \cdot \left(1 - \frac{t}{z}\right)\\
\mathbf{elif}\;z \leq 7.5 \cdot 10^{-31}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{z}{z - t}}\\
\end{array}
\end{array}
if z < -2.49999999999999994e37Initial program 71.4%
+-commutative71.4%
associate-*r/99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in a around 0 71.2%
+-commutative71.2%
*-commutative71.2%
associate-/l*94.6%
Simplified94.6%
clear-num94.6%
associate-/r/94.6%
clear-num94.6%
div-sub94.6%
*-inverses94.6%
Applied egg-rr94.6%
if -2.49999999999999994e37 < z < 7.49999999999999975e-31Initial program 98.2%
+-commutative98.2%
associate-*r/97.0%
fma-def97.0%
Simplified97.0%
Taylor expanded in z around 0 83.2%
associate-/l*83.4%
associate-/r/83.5%
Applied egg-rr83.5%
if 7.49999999999999975e-31 < z Initial program 74.1%
+-commutative74.1%
associate-*r/99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in a around 0 69.3%
+-commutative69.3%
*-commutative69.3%
associate-/l*91.1%
Simplified91.1%
Final simplification87.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.5e+37) (+ x (* y (- 1.0 (/ t z)))) (if (<= z 1.55e-30) (+ x (/ (- t z) (/ a y))) (+ x (/ y (/ z (- z t)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.5e+37) {
tmp = x + (y * (1.0 - (t / z)));
} else if (z <= 1.55e-30) {
tmp = x + ((t - z) / (a / y));
} 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 <= (-2.5d+37)) then
tmp = x + (y * (1.0d0 - (t / z)))
else if (z <= 1.55d-30) then
tmp = x + ((t - z) / (a / y))
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 <= -2.5e+37) {
tmp = x + (y * (1.0 - (t / z)));
} else if (z <= 1.55e-30) {
tmp = x + ((t - z) / (a / y));
} else {
tmp = x + (y / (z / (z - t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.5e+37: tmp = x + (y * (1.0 - (t / z))) elif z <= 1.55e-30: tmp = x + ((t - z) / (a / y)) else: tmp = x + (y / (z / (z - t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.5e+37) tmp = Float64(x + Float64(y * Float64(1.0 - Float64(t / z)))); elseif (z <= 1.55e-30) tmp = Float64(x + Float64(Float64(t - z) / Float64(a / y))); 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 <= -2.5e+37) tmp = x + (y * (1.0 - (t / z))); elseif (z <= 1.55e-30) tmp = x + ((t - z) / (a / y)); else tmp = x + (y / (z / (z - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.5e+37], N[(x + N[(y * N[(1.0 - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.55e-30], N[(x + N[(N[(t - z), $MachinePrecision] / N[(a / y), $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 -2.5 \cdot 10^{+37}:\\
\;\;\;\;x + y \cdot \left(1 - \frac{t}{z}\right)\\
\mathbf{elif}\;z \leq 1.55 \cdot 10^{-30}:\\
\;\;\;\;x + \frac{t - z}{\frac{a}{y}}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{z}{z - t}}\\
\end{array}
\end{array}
if z < -2.49999999999999994e37Initial program 71.4%
+-commutative71.4%
associate-*r/99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in a around 0 71.2%
+-commutative71.2%
*-commutative71.2%
associate-/l*94.6%
Simplified94.6%
clear-num94.6%
associate-/r/94.6%
clear-num94.6%
div-sub94.6%
*-inverses94.6%
Applied egg-rr94.6%
if -2.49999999999999994e37 < z < 1.54999999999999995e-30Initial program 98.2%
+-commutative98.2%
associate-*r/97.0%
fma-def97.0%
Simplified97.0%
Taylor expanded in a around inf 85.7%
+-commutative85.7%
*-commutative85.7%
mul-1-neg85.7%
unsub-neg85.7%
*-commutative85.7%
associate-/l*85.2%
Simplified85.2%
if 1.54999999999999995e-30 < z Initial program 74.1%
+-commutative74.1%
associate-*r/99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in a around 0 69.3%
+-commutative69.3%
*-commutative69.3%
associate-/l*91.1%
Simplified91.1%
Final simplification88.8%
(FPCore (x y z t a) :precision binary64 (if (<= z -3.1e+37) (+ x y) (if (<= z 2.6e-30) (+ x (* y (/ t a))) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.1e+37) {
tmp = x + y;
} else if (z <= 2.6e-30) {
tmp = x + (y * (t / a));
} else {
tmp = x + y;
}
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 <= (-3.1d+37)) then
tmp = x + y
else if (z <= 2.6d-30) then
tmp = x + (y * (t / a))
else
tmp = x + y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.1e+37) {
tmp = x + y;
} else if (z <= 2.6e-30) {
tmp = x + (y * (t / a));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3.1e+37: tmp = x + y elif z <= 2.6e-30: tmp = x + (y * (t / a)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.1e+37) tmp = Float64(x + y); elseif (z <= 2.6e-30) tmp = Float64(x + Float64(y * Float64(t / a))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -3.1e+37) tmp = x + y; elseif (z <= 2.6e-30) tmp = x + (y * (t / a)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.1e+37], N[(x + y), $MachinePrecision], If[LessEqual[z, 2.6e-30], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.1 \cdot 10^{+37}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{-30}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -3.1000000000000002e37 or 2.59999999999999987e-30 < z Initial program 72.9%
+-commutative72.9%
associate-*r/99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in z around inf 80.6%
if -3.1000000000000002e37 < z < 2.59999999999999987e-30Initial program 98.2%
+-commutative98.2%
associate-*r/97.0%
fma-def97.0%
Simplified97.0%
fma-udef97.0%
Applied egg-rr97.0%
Taylor expanded in z around 0 83.2%
associate-*r/82.7%
Simplified82.7%
Final simplification81.6%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.85e+39) (+ x y) (if (<= z 2.6e-30) (+ x (* t (/ y a))) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.85e+39) {
tmp = x + y;
} else if (z <= 2.6e-30) {
tmp = x + (t * (y / a));
} else {
tmp = x + y;
}
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.85d+39)) then
tmp = x + y
else if (z <= 2.6d-30) then
tmp = x + (t * (y / a))
else
tmp = x + y
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.85e+39) {
tmp = x + y;
} else if (z <= 2.6e-30) {
tmp = x + (t * (y / a));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.85e+39: tmp = x + y elif z <= 2.6e-30: tmp = x + (t * (y / a)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.85e+39) tmp = Float64(x + y); elseif (z <= 2.6e-30) tmp = Float64(x + Float64(t * Float64(y / a))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.85e+39) tmp = x + y; elseif (z <= 2.6e-30) tmp = x + (t * (y / a)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.85e+39], N[(x + y), $MachinePrecision], If[LessEqual[z, 2.6e-30], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.85 \cdot 10^{+39}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{-30}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -1.85000000000000006e39 or 2.59999999999999987e-30 < z Initial program 72.9%
+-commutative72.9%
associate-*r/99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in z around inf 80.6%
if -1.85000000000000006e39 < z < 2.59999999999999987e-30Initial program 98.2%
+-commutative98.2%
associate-*r/97.0%
fma-def97.0%
Simplified97.0%
Taylor expanded in z around 0 83.2%
associate-/l*83.4%
associate-/r/83.5%
Applied egg-rr83.5%
Final simplification82.0%
(FPCore (x y z t a) :precision binary64 (- x (* (/ y (- z a)) (- t z))))
double code(double x, double y, double z, double t, double a) {
return x - ((y / (z - a)) * (t - z));
}
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)) * (t - z))
end function
public static double code(double x, double y, double z, double t, double a) {
return x - ((y / (z - a)) * (t - z));
}
def code(x, y, z, t, a): return x - ((y / (z - a)) * (t - z))
function code(x, y, z, t, a) return Float64(x - Float64(Float64(y / Float64(z - a)) * Float64(t - z))) end
function tmp = code(x, y, z, t, a) tmp = x - ((y / (z - a)) * (t - z)); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y}{z - a} \cdot \left(t - z\right)
\end{array}
Initial program 85.9%
associate-*l/96.6%
Simplified96.6%
Final simplification96.6%
(FPCore (x y z t a) :precision binary64 (+ x y))
double code(double x, double y, double z, double t, double a) {
return x + y;
}
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
end function
public static double code(double x, double y, double z, double t, double a) {
return x + y;
}
def code(x, y, z, t, a): return x + y
function code(x, y, z, t, a) return Float64(x + y) end
function tmp = code(x, y, z, t, a) tmp = x + y; end
code[x_, y_, z_, t_, a_] := N[(x + y), $MachinePrecision]
\begin{array}{l}
\\
x + y
\end{array}
Initial program 85.9%
+-commutative85.9%
associate-*r/98.4%
fma-def98.4%
Simplified98.4%
Taylor expanded in z around inf 61.4%
Final simplification61.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 85.9%
+-commutative85.9%
associate-*r/98.4%
fma-def98.4%
Simplified98.4%
Taylor expanded in y around 0 49.4%
Final simplification49.4%
(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 2023224
(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))))