
(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
(let* ((t_1 (/ (* y (- z t)) (- z a))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 5e+244)))
(+ x (* (- z t) (/ y (- z a))))
(+ x t_1))))
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 <= -((double) INFINITY)) || !(t_1 <= 5e+244)) {
tmp = x + ((z - t) * (y / (z - a)));
} else {
tmp = x + t_1;
}
return tmp;
}
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 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 5e+244)) {
tmp = x + ((z - t) * (y / (z - a)));
} else {
tmp = x + t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y * (z - t)) / (z - a) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 5e+244): tmp = x + ((z - t) * (y / (z - a))) else: tmp = x + t_1 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 <= Float64(-Inf)) || !(t_1 <= 5e+244)) tmp = Float64(x + Float64(Float64(z - t) * Float64(y / Float64(z - a)))); else tmp = Float64(x + t_1); 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 <= -Inf) || ~((t_1 <= 5e+244))) tmp = x + ((z - t) * (y / (z - a))); else tmp = x + t_1; 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, (-Infinity)], N[Not[LessEqual[t$95$1, 5e+244]], $MachinePrecision]], N[(x + N[(N[(z - t), $MachinePrecision] * N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + t$95$1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot \left(z - t\right)}{z - a}\\
\mathbf{if}\;t\_1 \leq -\infty \lor \neg \left(t\_1 \leq 5 \cdot 10^{+244}\right):\\
\;\;\;\;x + \left(z - t\right) \cdot \frac{y}{z - a}\\
\mathbf{else}:\\
\;\;\;\;x + t\_1\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < -inf.0 or 5.00000000000000022e244 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) Initial program 53.6%
+-commutative53.6%
associate-/l*98.2%
fma-define98.2%
Simplified98.2%
fma-undefine98.2%
associate-/l*53.6%
div-inv53.6%
*-commutative53.6%
associate-*r*99.7%
div-inv99.9%
Applied egg-rr99.9%
if -inf.0 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < 5.00000000000000022e244Initial program 99.9%
Final simplification99.9%
(FPCore (x y z t a) :precision binary64 (fma y (/ (- z t) (- z a)) x))
double code(double x, double y, double z, double t, double a) {
return fma(y, ((z - t) / (z - a)), x);
}
function code(x, y, z, t, a) return fma(y, Float64(Float64(z - t) / Float64(z - a)), x) end
code[x_, y_, z_, t_, a_] := N[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, \frac{z - t}{z - a}, x\right)
\end{array}
Initial program 90.0%
+-commutative90.0%
associate-/l*97.5%
fma-define97.5%
Simplified97.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -8.2e+133) (not (<= z 3e+80))) (- x (* y (/ z (- a z)))) (+ x (/ (* y (- z t)) (- z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -8.2e+133) || !(z <= 3e+80)) {
tmp = x - (y * (z / (a - z)));
} else {
tmp = x + ((y * (z - t)) / (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 <= (-8.2d+133)) .or. (.not. (z <= 3d+80))) then
tmp = x - (y * (z / (a - z)))
else
tmp = x + ((y * (z - t)) / (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 <= -8.2e+133) || !(z <= 3e+80)) {
tmp = x - (y * (z / (a - z)));
} else {
tmp = x + ((y * (z - t)) / (z - a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -8.2e+133) or not (z <= 3e+80): tmp = x - (y * (z / (a - z))) else: tmp = x + ((y * (z - t)) / (z - a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -8.2e+133) || !(z <= 3e+80)) tmp = Float64(x - Float64(y * Float64(z / Float64(a - z)))); else tmp = Float64(x + Float64(Float64(y * Float64(z - t)) / Float64(z - a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -8.2e+133) || ~((z <= 3e+80))) tmp = x - (y * (z / (a - z))); else tmp = x + ((y * (z - t)) / (z - a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -8.2e+133], N[Not[LessEqual[z, 3e+80]], $MachinePrecision]], N[(x - N[(y * N[(z / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.2 \cdot 10^{+133} \lor \neg \left(z \leq 3 \cdot 10^{+80}\right):\\
\;\;\;\;x - y \cdot \frac{z}{a - z}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot \left(z - t\right)}{z - a}\\
\end{array}
\end{array}
if z < -8.20000000000000008e133 or 2.99999999999999987e80 < z Initial program 74.6%
Taylor expanded in t around 0 72.3%
associate-/l*95.9%
Simplified95.9%
if -8.20000000000000008e133 < z < 2.99999999999999987e80Initial program 97.2%
Final simplification96.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.35e-17) (not (<= z 9.5e-45))) (- x (* y (/ z (- a z)))) (+ x (* t (/ y (- a z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.35e-17) || !(z <= 9.5e-45)) {
tmp = x - (y * (z / (a - z)));
} else {
tmp = x + (t * (y / (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 <= (-2.35d-17)) .or. (.not. (z <= 9.5d-45))) then
tmp = x - (y * (z / (a - z)))
else
tmp = x + (t * (y / (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 <= -2.35e-17) || !(z <= 9.5e-45)) {
tmp = x - (y * (z / (a - z)));
} else {
tmp = x + (t * (y / (a - z)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.35e-17) or not (z <= 9.5e-45): tmp = x - (y * (z / (a - z))) else: tmp = x + (t * (y / (a - z))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.35e-17) || !(z <= 9.5e-45)) tmp = Float64(x - Float64(y * Float64(z / Float64(a - z)))); else tmp = Float64(x + Float64(t * Float64(y / Float64(a - z)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -2.35e-17) || ~((z <= 9.5e-45))) tmp = x - (y * (z / (a - z))); else tmp = x + (t * (y / (a - z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.35e-17], N[Not[LessEqual[z, 9.5e-45]], $MachinePrecision]], N[(x - N[(y * N[(z / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t * N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.35 \cdot 10^{-17} \lor \neg \left(z \leq 9.5 \cdot 10^{-45}\right):\\
\;\;\;\;x - y \cdot \frac{z}{a - z}\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \frac{y}{a - z}\\
\end{array}
\end{array}
if z < -2.35e-17 or 9.5000000000000002e-45 < z Initial program 82.9%
Taylor expanded in t around 0 78.2%
associate-/l*92.1%
Simplified92.1%
if -2.35e-17 < z < 9.5000000000000002e-45Initial program 97.6%
+-commutative97.6%
associate-/l*94.8%
fma-define94.8%
Simplified94.8%
fma-undefine94.8%
associate-/l*97.6%
div-inv97.5%
*-commutative97.5%
associate-*r*92.9%
div-inv93.0%
Applied egg-rr93.0%
Taylor expanded in z around 0 92.0%
neg-mul-192.0%
Simplified92.0%
Taylor expanded in t around 0 92.1%
neg-mul-192.1%
sub-neg92.1%
associate-/l*92.0%
Simplified92.0%
Final simplification92.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -3.3e-67) (not (<= z 4.9e-87))) (+ 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 <= -3.3e-67) || !(z <= 4.9e-87)) {
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 <= (-3.3d-67)) .or. (.not. (z <= 4.9d-87))) 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 <= -3.3e-67) || !(z <= 4.9e-87)) {
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 <= -3.3e-67) or not (z <= 4.9e-87): 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 <= -3.3e-67) || !(z <= 4.9e-87)) tmp = Float64(x + Float64(y * Float64(1.0 - Float64(t / z)))); else tmp = Float64(x + Float64(Float64(y * t) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -3.3e-67) || ~((z <= 4.9e-87))) 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, -3.3e-67], N[Not[LessEqual[z, 4.9e-87]], $MachinePrecision]], N[(x + N[(y * N[(1.0 - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.3 \cdot 10^{-67} \lor \neg \left(z \leq 4.9 \cdot 10^{-87}\right):\\
\;\;\;\;x + y \cdot \left(1 - \frac{t}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\end{array}
\end{array}
if z < -3.3000000000000002e-67 or 4.8999999999999997e-87 < z Initial program 85.0%
Taylor expanded in a around 0 74.8%
associate-/l*86.3%
div-sub86.4%
*-inverses86.4%
Simplified86.4%
if -3.3000000000000002e-67 < z < 4.8999999999999997e-87Initial program 97.2%
Taylor expanded in z around 0 80.9%
Final simplification84.1%
(FPCore (x y z t a) :precision binary64 (if (<= z -5e-52) (- x (* y (/ z (- a z)))) (if (<= z 3.5e-88) (+ 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 <= -5e-52) {
tmp = x - (y * (z / (a - z)));
} else if (z <= 3.5e-88) {
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 <= (-5d-52)) then
tmp = x - (y * (z / (a - z)))
else if (z <= 3.5d-88) 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 <= -5e-52) {
tmp = x - (y * (z / (a - z)));
} else if (z <= 3.5e-88) {
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 <= -5e-52: tmp = x - (y * (z / (a - z))) elif z <= 3.5e-88: 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 <= -5e-52) tmp = Float64(x - Float64(y * Float64(z / Float64(a - z)))); elseif (z <= 3.5e-88) tmp = Float64(x + Float64(Float64(y * 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 <= -5e-52) tmp = x - (y * (z / (a - z))); elseif (z <= 3.5e-88) 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, -5e-52], N[(x - N[(y * N[(z / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.5e-88], N[(x + N[(N[(y * t), $MachinePrecision] / a), $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 -5 \cdot 10^{-52}:\\
\;\;\;\;x - y \cdot \frac{z}{a - z}\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{-88}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(1 - \frac{t}{z}\right)\\
\end{array}
\end{array}
if z < -5e-52Initial program 83.8%
Taylor expanded in t around 0 77.8%
associate-/l*88.1%
Simplified88.1%
if -5e-52 < z < 3.5000000000000001e-88Initial program 97.3%
Taylor expanded in z around 0 79.2%
if 3.5000000000000001e-88 < z Initial program 85.0%
Taylor expanded in a around 0 76.6%
associate-/l*88.8%
div-sub88.8%
*-inverses88.8%
Simplified88.8%
Final simplification84.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.55e-51) (not (<= z 2.3e-53))) (+ y x) (+ x (/ (* y t) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.55e-51) || !(z <= 2.3e-53)) {
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 <= (-2.55d-51)) .or. (.not. (z <= 2.3d-53))) 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 <= -2.55e-51) || !(z <= 2.3e-53)) {
tmp = y + x;
} else {
tmp = x + ((y * t) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.55e-51) or not (z <= 2.3e-53): tmp = y + x else: tmp = x + ((y * t) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.55e-51) || !(z <= 2.3e-53)) tmp = Float64(y + x); else tmp = Float64(x + Float64(Float64(y * t) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -2.55e-51) || ~((z <= 2.3e-53))) tmp = y + x; else tmp = x + ((y * t) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.55e-51], N[Not[LessEqual[z, 2.3e-53]], $MachinePrecision]], N[(y + x), $MachinePrecision], N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.55 \cdot 10^{-51} \lor \neg \left(z \leq 2.3 \cdot 10^{-53}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\end{array}
\end{array}
if z < -2.5499999999999999e-51 or 2.3000000000000001e-53 < z Initial program 83.9%
+-commutative83.9%
associate-/l*99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in z around inf 82.1%
+-commutative82.1%
Simplified82.1%
if -2.5499999999999999e-51 < z < 2.3000000000000001e-53Initial program 97.4%
Taylor expanded in z around 0 76.9%
Final simplification79.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -7.5e-51) (not (<= z 2.3e-53))) (+ y x) (+ x (* y (/ t a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -7.5e-51) || !(z <= 2.3e-53)) {
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 <= (-7.5d-51)) .or. (.not. (z <= 2.3d-53))) 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 <= -7.5e-51) || !(z <= 2.3e-53)) {
tmp = y + x;
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -7.5e-51) or not (z <= 2.3e-53): tmp = y + x else: tmp = x + (y * (t / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -7.5e-51) || !(z <= 2.3e-53)) 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 <= -7.5e-51) || ~((z <= 2.3e-53))) tmp = y + x; else tmp = x + (y * (t / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -7.5e-51], N[Not[LessEqual[z, 2.3e-53]], $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 -7.5 \cdot 10^{-51} \lor \neg \left(z \leq 2.3 \cdot 10^{-53}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\end{array}
\end{array}
if z < -7.49999999999999976e-51 or 2.3000000000000001e-53 < z Initial program 83.9%
+-commutative83.9%
associate-/l*99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in z around inf 82.1%
+-commutative82.1%
Simplified82.1%
if -7.49999999999999976e-51 < z < 2.3000000000000001e-53Initial program 97.4%
+-commutative97.4%
associate-/l*94.5%
fma-define94.5%
Simplified94.5%
Taylor expanded in a around inf 79.8%
mul-1-neg79.8%
unsub-neg79.8%
associate-/l*78.8%
Simplified78.8%
Taylor expanded in z around 0 75.9%
neg-mul-191.4%
Simplified75.9%
sub-neg75.9%
distribute-lft-neg-in75.9%
add-sqr-sqrt37.3%
sqrt-unprod53.1%
sqr-neg53.1%
sqrt-unprod24.7%
add-sqr-sqrt53.9%
add-sqr-sqrt27.3%
sqrt-unprod56.9%
sqr-neg56.9%
sqrt-unprod38.1%
add-sqr-sqrt75.9%
Applied egg-rr75.9%
Final simplification79.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.02e-67) (not (<= z 2.3e-20))) (+ y x) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.02e-67) || !(z <= 2.3e-20)) {
tmp = y + x;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-1.02d-67)) .or. (.not. (z <= 2.3d-20))) then
tmp = y + x
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.02e-67) || !(z <= 2.3e-20)) {
tmp = y + x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.02e-67) or not (z <= 2.3e-20): tmp = y + x else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.02e-67) || !(z <= 2.3e-20)) tmp = Float64(y + x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.02e-67) || ~((z <= 2.3e-20))) tmp = y + x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.02e-67], N[Not[LessEqual[z, 2.3e-20]], $MachinePrecision]], N[(y + x), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.02 \cdot 10^{-67} \lor \neg \left(z \leq 2.3 \cdot 10^{-20}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.01999999999999993e-67 or 2.2999999999999999e-20 < z Initial program 83.8%
+-commutative83.8%
associate-/l*99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in z around inf 80.6%
+-commutative80.6%
Simplified80.6%
if -1.01999999999999993e-67 < z < 2.2999999999999999e-20Initial program 97.4%
+-commutative97.4%
associate-/l*94.5%
fma-define94.5%
Simplified94.5%
Taylor expanded in y around 0 53.1%
Final simplification68.1%
(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 90.0%
+-commutative90.0%
associate-/l*97.5%
fma-define97.5%
Simplified97.5%
Taylor expanded in y around 0 53.1%
(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 2024180
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTicks from plot-0.2.3.4, A"
:precision binary64
:alt
(! :herbie-platform default (+ x (/ y (/ (- z a) (- z t)))))
(+ x (/ (* y (- z t)) (- z a))))