
(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 12 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 83.0%
associate-/l*98.2%
Simplified98.2%
Final simplification98.2%
(FPCore (x y z t a)
:precision binary64
(if (<= z -7.5e-39)
(+ x y)
(if (<= z 1.15e-61)
(+ x (* t (/ y a)))
(if (<= z 1.3e+99) (- x (* t (/ y z))) (+ x y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -7.5e-39) {
tmp = x + y;
} else if (z <= 1.15e-61) {
tmp = x + (t * (y / a));
} else if (z <= 1.3e+99) {
tmp = x - (t * (y / z));
} 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 <= (-7.5d-39)) then
tmp = x + y
else if (z <= 1.15d-61) then
tmp = x + (t * (y / a))
else if (z <= 1.3d+99) then
tmp = x - (t * (y / z))
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 <= -7.5e-39) {
tmp = x + y;
} else if (z <= 1.15e-61) {
tmp = x + (t * (y / a));
} else if (z <= 1.3e+99) {
tmp = x - (t * (y / z));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -7.5e-39: tmp = x + y elif z <= 1.15e-61: tmp = x + (t * (y / a)) elif z <= 1.3e+99: tmp = x - (t * (y / z)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -7.5e-39) tmp = Float64(x + y); elseif (z <= 1.15e-61) tmp = Float64(x + Float64(t * Float64(y / a))); elseif (z <= 1.3e+99) tmp = Float64(x - Float64(t * Float64(y / z))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -7.5e-39) tmp = x + y; elseif (z <= 1.15e-61) tmp = x + (t * (y / a)); elseif (z <= 1.3e+99) tmp = x - (t * (y / z)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -7.5e-39], N[(x + y), $MachinePrecision], If[LessEqual[z, 1.15e-61], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.3e+99], N[(x - N[(t * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.5 \cdot 10^{-39}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 1.15 \cdot 10^{-61}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\mathbf{elif}\;z \leq 1.3 \cdot 10^{+99}:\\
\;\;\;\;x - t \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -7.49999999999999971e-39 or 1.3e99 < z Initial program 72.8%
+-commutative72.8%
associate-*r/99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in z around inf 76.3%
if -7.49999999999999971e-39 < z < 1.14999999999999996e-61Initial program 94.2%
+-commutative94.2%
associate-*r/95.1%
fma-def95.1%
Simplified95.1%
Taylor expanded in z around 0 80.4%
div-inv80.4%
*-commutative80.4%
associate-*l*85.0%
div-inv85.1%
Applied egg-rr85.1%
if 1.14999999999999996e-61 < z < 1.3e99Initial program 87.5%
+-commutative87.5%
associate-*r/97.4%
fma-def97.4%
Simplified97.4%
Taylor expanded in a around 0 68.9%
+-commutative68.9%
*-commutative68.9%
associate-/l*70.9%
Simplified70.9%
Taylor expanded in z around 0 75.2%
associate-*r/75.2%
mul-1-neg75.2%
distribute-rgt-neg-out75.2%
associate-*l/75.2%
*-commutative75.2%
Simplified75.2%
Taylor expanded in t around 0 75.2%
+-commutative75.2%
mul-1-neg75.2%
*-commutative75.2%
associate-*r/75.2%
sub-neg75.2%
Simplified75.2%
Final simplification79.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.45e-80) (not (<= z 1.05e-61))) (+ 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 <= -1.45e-80) || !(z <= 1.05e-61)) {
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 <= (-1.45d-80)) .or. (.not. (z <= 1.05d-61))) 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 <= -1.45e-80) || !(z <= 1.05e-61)) {
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 <= -1.45e-80) or not (z <= 1.05e-61): 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 <= -1.45e-80) || !(z <= 1.05e-61)) 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 <= -1.45e-80) || ~((z <= 1.05e-61))) 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, -1.45e-80], N[Not[LessEqual[z, 1.05e-61]], $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 -1.45 \cdot 10^{-80} \lor \neg \left(z \leq 1.05 \cdot 10^{-61}\right):\\
\;\;\;\;x + \left(z - t\right) \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -1.44999999999999999e-80 or 1.05e-61 < z Initial program 76.7%
associate-*l/97.1%
Simplified97.1%
Taylor expanded in z around inf 81.9%
if -1.44999999999999999e-80 < z < 1.05e-61Initial program 94.0%
+-commutative94.0%
associate-*r/94.9%
fma-def94.9%
Simplified94.9%
Taylor expanded in z around 0 80.8%
div-inv80.8%
*-commutative80.8%
associate-*l*85.6%
div-inv85.7%
Applied egg-rr85.7%
Final simplification83.3%
(FPCore (x y z t a) :precision binary64 (if (<= z -3.6e-81) (+ x (/ y (/ z (- z t)))) (if (<= z 7.8e-61) (+ x (* t (/ y a))) (+ x (* (- z t) (/ y z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.6e-81) {
tmp = x + (y / (z / (z - t)));
} else if (z <= 7.8e-61) {
tmp = x + (t * (y / 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 <= (-3.6d-81)) then
tmp = x + (y / (z / (z - t)))
else if (z <= 7.8d-61) then
tmp = x + (t * (y / 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 <= -3.6e-81) {
tmp = x + (y / (z / (z - t)));
} else if (z <= 7.8e-61) {
tmp = x + (t * (y / a));
} else {
tmp = x + ((z - t) * (y / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3.6e-81: tmp = x + (y / (z / (z - t))) elif z <= 7.8e-61: tmp = x + (t * (y / a)) else: tmp = x + ((z - t) * (y / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.6e-81) tmp = Float64(x + Float64(y / Float64(z / Float64(z - t)))); elseif (z <= 7.8e-61) tmp = Float64(x + Float64(t * Float64(y / 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 <= -3.6e-81) tmp = x + (y / (z / (z - t))); elseif (z <= 7.8e-61) tmp = x + (t * (y / a)); else tmp = x + ((z - t) * (y / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.6e-81], N[(x + N[(y / N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.8e-61], N[(x + N[(t * N[(y / 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 -3.6 \cdot 10^{-81}:\\
\;\;\;\;x + \frac{y}{\frac{z}{z - t}}\\
\mathbf{elif}\;z \leq 7.8 \cdot 10^{-61}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \left(z - t\right) \cdot \frac{y}{z}\\
\end{array}
\end{array}
if z < -3.5999999999999999e-81Initial program 80.7%
+-commutative80.7%
associate-*r/99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in a around 0 67.2%
+-commutative67.2%
*-commutative67.2%
associate-/l*82.7%
Simplified82.7%
if -3.5999999999999999e-81 < z < 7.80000000000000065e-61Initial program 94.0%
+-commutative94.0%
associate-*r/94.9%
fma-def94.9%
Simplified94.9%
Taylor expanded in z around 0 80.8%
div-inv80.8%
*-commutative80.8%
associate-*l*85.6%
div-inv85.7%
Applied egg-rr85.7%
if 7.80000000000000065e-61 < z Initial program 72.9%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in z around inf 84.2%
Final simplification84.3%
(FPCore (x y z t a) :precision binary64 (if (<= z -8e+61) (+ x (/ y (/ z (- z t)))) (if (<= z 9.8e-61) (+ x (/ (- t z) (/ a y))) (+ x (* (- z t) (/ y z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -8e+61) {
tmp = x + (y / (z / (z - t)));
} else if (z <= 9.8e-61) {
tmp = x + ((t - z) / (a / y));
} 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 <= (-8d+61)) then
tmp = x + (y / (z / (z - t)))
else if (z <= 9.8d-61) then
tmp = x + ((t - z) / (a / y))
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 <= -8e+61) {
tmp = x + (y / (z / (z - t)));
} else if (z <= 9.8e-61) {
tmp = x + ((t - z) / (a / y));
} else {
tmp = x + ((z - t) * (y / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -8e+61: tmp = x + (y / (z / (z - t))) elif z <= 9.8e-61: tmp = x + ((t - z) / (a / y)) else: tmp = x + ((z - t) * (y / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -8e+61) tmp = Float64(x + Float64(y / Float64(z / Float64(z - t)))); elseif (z <= 9.8e-61) tmp = Float64(x + Float64(Float64(t - z) / Float64(a / y))); 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 <= -8e+61) tmp = x + (y / (z / (z - t))); elseif (z <= 9.8e-61) tmp = x + ((t - z) / (a / y)); else tmp = x + ((z - t) * (y / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -8e+61], N[(x + N[(y / N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9.8e-61], N[(x + N[(N[(t - z), $MachinePrecision] / N[(a / y), $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 -8 \cdot 10^{+61}:\\
\;\;\;\;x + \frac{y}{\frac{z}{z - t}}\\
\mathbf{elif}\;z \leq 9.8 \cdot 10^{-61}:\\
\;\;\;\;x + \frac{t - z}{\frac{a}{y}}\\
\mathbf{else}:\\
\;\;\;\;x + \left(z - t\right) \cdot \frac{y}{z}\\
\end{array}
\end{array}
if z < -7.9999999999999996e61Initial program 73.5%
+-commutative73.5%
associate-*r/99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in a around 0 66.3%
+-commutative66.3%
*-commutative66.3%
associate-/l*89.1%
Simplified89.1%
if -7.9999999999999996e61 < z < 9.80000000000000004e-61Initial program 94.4%
+-commutative94.4%
associate-*r/96.0%
fma-def96.0%
Simplified96.0%
Taylor expanded in a around inf 79.9%
+-commutative79.9%
*-commutative79.9%
mul-1-neg79.9%
unsub-neg79.9%
*-commutative79.9%
associate-/l*84.5%
Simplified84.5%
if 9.80000000000000004e-61 < z Initial program 72.9%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in z around inf 84.2%
Final simplification85.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.85e-44) (not (<= z 1e+77))) (+ x y) (+ x (* y (/ t a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.85e-44) || !(z <= 1e+77)) {
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 <= (-1.85d-44)) .or. (.not. (z <= 1d+77))) 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 <= -1.85e-44) || !(z <= 1e+77)) {
tmp = x + y;
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.85e-44) or not (z <= 1e+77): tmp = x + y else: tmp = x + (y * (t / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.85e-44) || !(z <= 1e+77)) 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 <= -1.85e-44) || ~((z <= 1e+77))) tmp = x + y; else tmp = x + (y * (t / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.85e-44], N[Not[LessEqual[z, 1e+77]], $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 -1.85 \cdot 10^{-44} \lor \neg \left(z \leq 10^{+77}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\end{array}
\end{array}
if z < -1.85e-44 or 9.99999999999999983e76 < z Initial program 73.4%
+-commutative73.4%
associate-*r/99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in z around inf 75.2%
if -1.85e-44 < z < 9.99999999999999983e76Initial program 92.7%
associate-/l*96.5%
Simplified96.5%
*-un-lft-identity96.5%
div-inv96.4%
times-frac92.7%
Applied egg-rr92.7%
Taylor expanded in z around 0 73.4%
associate-*r/77.1%
Simplified77.1%
Final simplification76.1%
(FPCore (x y z t a) :precision binary64 (if (<= x -1.5e-176) (+ x y) (if (<= x 1.3e-61) (* y (- 1.0 (/ t z))) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -1.5e-176) {
tmp = x + y;
} else if (x <= 1.3e-61) {
tmp = y * (1.0 - (t / z));
} 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 (x <= (-1.5d-176)) then
tmp = x + y
else if (x <= 1.3d-61) then
tmp = y * (1.0d0 - (t / z))
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 (x <= -1.5e-176) {
tmp = x + y;
} else if (x <= 1.3e-61) {
tmp = y * (1.0 - (t / z));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -1.5e-176: tmp = x + y elif x <= 1.3e-61: tmp = y * (1.0 - (t / z)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -1.5e-176) tmp = Float64(x + y); elseif (x <= 1.3e-61) tmp = Float64(y * Float64(1.0 - Float64(t / z))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -1.5e-176) tmp = x + y; elseif (x <= 1.3e-61) tmp = y * (1.0 - (t / z)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -1.5e-176], N[(x + y), $MachinePrecision], If[LessEqual[x, 1.3e-61], N[(y * N[(1.0 - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.5 \cdot 10^{-176}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{-61}:\\
\;\;\;\;y \cdot \left(1 - \frac{t}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if x < -1.5e-176 or 1.30000000000000005e-61 < x Initial program 83.4%
+-commutative83.4%
associate-*r/98.3%
fma-def98.3%
Simplified98.3%
Taylor expanded in z around inf 71.1%
if -1.5e-176 < x < 1.30000000000000005e-61Initial program 82.3%
+-commutative82.3%
associate-*r/96.4%
fma-def96.4%
Simplified96.4%
Taylor expanded in a around 0 48.4%
+-commutative48.4%
*-commutative48.4%
associate-/l*60.0%
Simplified60.0%
Taylor expanded in y around inf 52.0%
Final simplification65.2%
(FPCore (x y z t a) :precision binary64 (if (<= z -8e-39) (+ x y) (if (<= z 9.8e+76) (+ x (* t (/ y a))) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -8e-39) {
tmp = x + y;
} else if (z <= 9.8e+76) {
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 <= (-8d-39)) then
tmp = x + y
else if (z <= 9.8d+76) 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 <= -8e-39) {
tmp = x + y;
} else if (z <= 9.8e+76) {
tmp = x + (t * (y / a));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -8e-39: tmp = x + y elif z <= 9.8e+76: tmp = x + (t * (y / a)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -8e-39) tmp = Float64(x + y); elseif (z <= 9.8e+76) 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 <= -8e-39) tmp = x + y; elseif (z <= 9.8e+76) tmp = x + (t * (y / a)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -8e-39], N[(x + y), $MachinePrecision], If[LessEqual[z, 9.8e+76], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8 \cdot 10^{-39}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 9.8 \cdot 10^{+76}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -7.99999999999999943e-39 or 9.80000000000000053e76 < z Initial program 73.4%
+-commutative73.4%
associate-*r/99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in z around inf 75.2%
if -7.99999999999999943e-39 < z < 9.80000000000000053e76Initial program 92.7%
+-commutative92.7%
associate-*r/95.5%
fma-def95.5%
Simplified95.5%
Taylor expanded in z around 0 73.4%
div-inv73.4%
*-commutative73.4%
associate-*l*79.2%
div-inv79.3%
Applied egg-rr79.3%
Final simplification77.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 83.0%
associate-*l/97.4%
Simplified97.4%
Final simplification97.4%
(FPCore (x y z t a) :precision binary64 (if (<= a -2e+162) x (if (<= a 4.2e+63) (+ x y) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2e+162) {
tmp = x;
} else if (a <= 4.2e+63) {
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 (a <= (-2d+162)) then
tmp = x
else if (a <= 4.2d+63) 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 (a <= -2e+162) {
tmp = x;
} else if (a <= 4.2e+63) {
tmp = x + y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -2e+162: tmp = x elif a <= 4.2e+63: tmp = x + y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -2e+162) tmp = x; elseif (a <= 4.2e+63) tmp = Float64(x + y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -2e+162) tmp = x; elseif (a <= 4.2e+63) tmp = x + y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -2e+162], x, If[LessEqual[a, 4.2e+63], N[(x + y), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2 \cdot 10^{+162}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 4.2 \cdot 10^{+63}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -1.9999999999999999e162 or 4.2000000000000004e63 < a Initial program 77.7%
+-commutative77.7%
associate-*r/99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in y around 0 66.7%
if -1.9999999999999999e162 < a < 4.2000000000000004e63Initial program 85.5%
+-commutative85.5%
associate-*r/96.7%
fma-def96.7%
Simplified96.7%
Taylor expanded in z around inf 62.7%
Final simplification64.0%
(FPCore (x y z t a) :precision binary64 (if (<= y -5.2e+214) y (if (<= y 6.2e+124) x y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -5.2e+214) {
tmp = y;
} else if (y <= 6.2e+124) {
tmp = x;
} else {
tmp = 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 (y <= (-5.2d+214)) then
tmp = y
else if (y <= 6.2d+124) then
tmp = x
else
tmp = y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -5.2e+214) {
tmp = y;
} else if (y <= 6.2e+124) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -5.2e+214: tmp = y elif y <= 6.2e+124: tmp = x else: tmp = y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -5.2e+214) tmp = y; elseif (y <= 6.2e+124) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -5.2e+214) tmp = y; elseif (y <= 6.2e+124) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -5.2e+214], y, If[LessEqual[y, 6.2e+124], x, y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.2 \cdot 10^{+214}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 6.2 \cdot 10^{+124}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < -5.19999999999999986e214 or 6.2000000000000004e124 < y Initial program 56.8%
+-commutative56.8%
associate-*r/100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in a around 0 35.7%
+-commutative35.7%
*-commutative35.7%
associate-/l*65.4%
Simplified65.4%
Taylor expanded in y around inf 63.6%
Taylor expanded in t around 0 39.7%
if -5.19999999999999986e214 < y < 6.2000000000000004e124Initial program 90.4%
+-commutative90.4%
associate-*r/97.1%
fma-def97.1%
Simplified97.1%
Taylor expanded in y around 0 63.5%
Final simplification58.3%
(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 83.0%
+-commutative83.0%
associate-*r/97.7%
fma-def97.7%
Simplified97.7%
Taylor expanded in y around 0 52.2%
Final simplification52.2%
(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 2023171
(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))))