
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) (- z a))))
double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (z - a));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + ((y * (z - t)) / (z - a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (z - a));
}
def code(x, y, z, t, a): return x + ((y * (z - t)) / (z - a))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / Float64(z - a))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y * (z - t)) / (z - a)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{z - a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) (- z a))))
double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (z - a));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + ((y * (z - t)) / (z - a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (z - a));
}
def code(x, y, z, t, a): return x + ((y * (z - t)) / (z - a))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / Float64(z - a))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y * (z - t)) / (z - a)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{z - a}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* y (- z t)) (- z a))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 2e+250)))
(- x (/ 1.0 (/ (/ (- z a) y) (- t z))))
(+ 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 <= 2e+250)) {
tmp = x - (1.0 / (((z - a) / y) / (t - z)));
} 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 <= 2e+250)) {
tmp = x - (1.0 / (((z - a) / y) / (t - z)));
} 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 <= 2e+250): tmp = x - (1.0 / (((z - a) / y) / (t - z))) 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 <= 2e+250)) tmp = Float64(x - Float64(1.0 / Float64(Float64(Float64(z - a) / y) / Float64(t - z)))); 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 <= 2e+250))) tmp = x - (1.0 / (((z - a) / y) / (t - z))); 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, 2e+250]], $MachinePrecision]], N[(x - N[(1.0 / N[(N[(N[(z - a), $MachinePrecision] / y), $MachinePrecision] / N[(t - z), $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 2 \cdot 10^{+250}\right):\\
\;\;\;\;x - \frac{1}{\frac{\frac{z - a}{y}}{t - z}}\\
\mathbf{else}:\\
\;\;\;\;x + t\_1\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < -inf.0 or 1.9999999999999998e250 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) Initial program 44.6%
clear-num44.7%
inv-pow44.7%
Applied egg-rr44.7%
unpow-144.7%
associate-/r*99.9%
Simplified99.9%
if -inf.0 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < 1.9999999999999998e250Initial 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 86.7%
+-commutative86.7%
associate-/l*97.0%
fma-define97.0%
Simplified97.0%
Final simplification97.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- x (* y (+ (/ t z) -1.0)))))
(if (<= a -6.2e+62)
(+ x (* t (/ y a)))
(if (<= a -4e-169)
t_1
(if (<= a -7.4e-220)
(+ x (/ (* y t) a))
(if (<= a 7e+56) t_1 (+ x (/ y (/ a t)))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x - (y * ((t / z) + -1.0));
double tmp;
if (a <= -6.2e+62) {
tmp = x + (t * (y / a));
} else if (a <= -4e-169) {
tmp = t_1;
} else if (a <= -7.4e-220) {
tmp = x + ((y * t) / a);
} else if (a <= 7e+56) {
tmp = t_1;
} else {
tmp = x + (y / (a / 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) :: t_1
real(8) :: tmp
t_1 = x - (y * ((t / z) + (-1.0d0)))
if (a <= (-6.2d+62)) then
tmp = x + (t * (y / a))
else if (a <= (-4d-169)) then
tmp = t_1
else if (a <= (-7.4d-220)) then
tmp = x + ((y * t) / a)
else if (a <= 7d+56) then
tmp = t_1
else
tmp = x + (y / (a / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x - (y * ((t / z) + -1.0));
double tmp;
if (a <= -6.2e+62) {
tmp = x + (t * (y / a));
} else if (a <= -4e-169) {
tmp = t_1;
} else if (a <= -7.4e-220) {
tmp = x + ((y * t) / a);
} else if (a <= 7e+56) {
tmp = t_1;
} else {
tmp = x + (y / (a / t));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x - (y * ((t / z) + -1.0)) tmp = 0 if a <= -6.2e+62: tmp = x + (t * (y / a)) elif a <= -4e-169: tmp = t_1 elif a <= -7.4e-220: tmp = x + ((y * t) / a) elif a <= 7e+56: tmp = t_1 else: tmp = x + (y / (a / t)) return tmp
function code(x, y, z, t, a) t_1 = Float64(x - Float64(y * Float64(Float64(t / z) + -1.0))) tmp = 0.0 if (a <= -6.2e+62) tmp = Float64(x + Float64(t * Float64(y / a))); elseif (a <= -4e-169) tmp = t_1; elseif (a <= -7.4e-220) tmp = Float64(x + Float64(Float64(y * t) / a)); elseif (a <= 7e+56) tmp = t_1; else tmp = Float64(x + Float64(y / Float64(a / t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x - (y * ((t / z) + -1.0)); tmp = 0.0; if (a <= -6.2e+62) tmp = x + (t * (y / a)); elseif (a <= -4e-169) tmp = t_1; elseif (a <= -7.4e-220) tmp = x + ((y * t) / a); elseif (a <= 7e+56) tmp = t_1; else tmp = x + (y / (a / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x - N[(y * N[(N[(t / z), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -6.2e+62], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, -4e-169], t$95$1, If[LessEqual[a, -7.4e-220], N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 7e+56], t$95$1, N[(x + N[(y / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - y \cdot \left(\frac{t}{z} + -1\right)\\
\mathbf{if}\;a \leq -6.2 \cdot 10^{+62}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\mathbf{elif}\;a \leq -4 \cdot 10^{-169}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq -7.4 \cdot 10^{-220}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\mathbf{elif}\;a \leq 7 \cdot 10^{+56}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a}{t}}\\
\end{array}
\end{array}
if a < -6.20000000000000029e62Initial program 84.0%
Taylor expanded in z around 0 79.9%
associate-/l*87.0%
*-commutative87.0%
Applied egg-rr87.0%
if -6.20000000000000029e62 < a < -4.00000000000000008e-169 or -7.4000000000000003e-220 < a < 6.99999999999999999e56Initial program 84.9%
Taylor expanded in a around 0 70.9%
associate-/l*83.3%
div-sub83.3%
*-inverses83.3%
Simplified83.3%
if -4.00000000000000008e-169 < a < -7.4000000000000003e-220Initial program 99.7%
Taylor expanded in z around 0 90.4%
if 6.99999999999999999e56 < a Initial program 90.6%
+-commutative90.6%
associate-/l*98.3%
fma-define98.3%
Simplified98.3%
Taylor expanded in a around inf 81.5%
mul-1-neg81.5%
unsub-neg81.5%
associate-/l*87.7%
Simplified87.7%
Taylor expanded in z around 0 87.4%
neg-mul-187.4%
distribute-neg-frac287.4%
Simplified87.4%
*-commutative87.4%
associate-*l/79.7%
add-sqr-sqrt0.0%
sqrt-unprod65.4%
sqr-neg65.4%
sqrt-unprod65.4%
add-sqr-sqrt65.4%
frac-2neg65.4%
*-commutative65.4%
distribute-lft-neg-in65.4%
associate-*r/68.4%
clear-num68.4%
un-div-inv68.4%
add-sqr-sqrt0.0%
sqrt-unprod75.0%
sqr-neg75.0%
sqrt-unprod87.4%
add-sqr-sqrt87.4%
Applied egg-rr87.4%
Final simplification85.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.08e+91) (not (<= z 2.2e+200))) (- x (* y (+ (/ t z) -1.0))) (+ x (/ (* y (- z t)) (- z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.08e+91) || !(z <= 2.2e+200)) {
tmp = x - (y * ((t / z) + -1.0));
} 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 <= (-1.08d+91)) .or. (.not. (z <= 2.2d+200))) then
tmp = x - (y * ((t / z) + (-1.0d0)))
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 <= -1.08e+91) || !(z <= 2.2e+200)) {
tmp = x - (y * ((t / z) + -1.0));
} else {
tmp = x + ((y * (z - t)) / (z - a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.08e+91) or not (z <= 2.2e+200): tmp = x - (y * ((t / z) + -1.0)) else: tmp = x + ((y * (z - t)) / (z - a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.08e+91) || !(z <= 2.2e+200)) tmp = Float64(x - Float64(y * Float64(Float64(t / z) + -1.0))); 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 <= -1.08e+91) || ~((z <= 2.2e+200))) tmp = x - (y * ((t / z) + -1.0)); else tmp = x + ((y * (z - t)) / (z - a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.08e+91], N[Not[LessEqual[z, 2.2e+200]], $MachinePrecision]], N[(x - N[(y * N[(N[(t / z), $MachinePrecision] + -1.0), $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 -1.08 \cdot 10^{+91} \lor \neg \left(z \leq 2.2 \cdot 10^{+200}\right):\\
\;\;\;\;x - y \cdot \left(\frac{t}{z} + -1\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot \left(z - t\right)}{z - a}\\
\end{array}
\end{array}
if z < -1.08e91 or 2.2e200 < z Initial program 63.9%
Taylor expanded in a around 0 63.8%
associate-/l*100.0%
div-sub100.0%
*-inverses100.0%
Simplified100.0%
if -1.08e91 < z < 2.2e200Initial program 94.4%
Final simplification95.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -8e+25) (not (<= z 1.05e+23))) (- x (* y (+ (/ t z) -1.0))) (- x (/ (* y t) (- z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -8e+25) || !(z <= 1.05e+23)) {
tmp = x - (y * ((t / z) + -1.0));
} else {
tmp = x - ((y * 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 <= (-8d+25)) .or. (.not. (z <= 1.05d+23))) then
tmp = x - (y * ((t / z) + (-1.0d0)))
else
tmp = x - ((y * 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 <= -8e+25) || !(z <= 1.05e+23)) {
tmp = x - (y * ((t / z) + -1.0));
} else {
tmp = x - ((y * t) / (z - a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -8e+25) or not (z <= 1.05e+23): tmp = x - (y * ((t / z) + -1.0)) else: tmp = x - ((y * t) / (z - a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -8e+25) || !(z <= 1.05e+23)) tmp = Float64(x - Float64(y * Float64(Float64(t / z) + -1.0))); else tmp = Float64(x - Float64(Float64(y * t) / Float64(z - a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -8e+25) || ~((z <= 1.05e+23))) tmp = x - (y * ((t / z) + -1.0)); else tmp = x - ((y * t) / (z - a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -8e+25], N[Not[LessEqual[z, 1.05e+23]], $MachinePrecision]], N[(x - N[(y * N[(N[(t / z), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(y * t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8 \cdot 10^{+25} \lor \neg \left(z \leq 1.05 \cdot 10^{+23}\right):\\
\;\;\;\;x - y \cdot \left(\frac{t}{z} + -1\right)\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y \cdot t}{z - a}\\
\end{array}
\end{array}
if z < -8.00000000000000072e25 or 1.0500000000000001e23 < z Initial program 77.5%
Taylor expanded in a around 0 67.2%
associate-/l*89.0%
div-sub89.0%
*-inverses89.0%
Simplified89.0%
if -8.00000000000000072e25 < z < 1.0500000000000001e23Initial program 95.5%
Taylor expanded in t around inf 88.7%
mul-1-neg88.7%
distribute-neg-frac288.7%
associate-*r/89.7%
sub-neg89.7%
distribute-neg-in89.7%
remove-double-neg89.7%
Simplified89.7%
Taylor expanded in t around 0 88.7%
Final simplification88.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -3.5e+22) (not (<= z 3.3e+25))) (- x (* y (+ (/ t z) -1.0))) (- x (* t (/ y (- z a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.5e+22) || !(z <= 3.3e+25)) {
tmp = x - (y * ((t / z) + -1.0));
} 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 <= (-3.5d+22)) .or. (.not. (z <= 3.3d+25))) then
tmp = x - (y * ((t / z) + (-1.0d0)))
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 <= -3.5e+22) || !(z <= 3.3e+25)) {
tmp = x - (y * ((t / z) + -1.0));
} else {
tmp = x - (t * (y / (z - a)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -3.5e+22) or not (z <= 3.3e+25): tmp = x - (y * ((t / z) + -1.0)) else: tmp = x - (t * (y / (z - a))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -3.5e+22) || !(z <= 3.3e+25)) tmp = Float64(x - Float64(y * Float64(Float64(t / z) + -1.0))); 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 <= -3.5e+22) || ~((z <= 3.3e+25))) tmp = x - (y * ((t / z) + -1.0)); else tmp = x - (t * (y / (z - a))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -3.5e+22], N[Not[LessEqual[z, 3.3e+25]], $MachinePrecision]], N[(x - N[(y * N[(N[(t / z), $MachinePrecision] + -1.0), $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 -3.5 \cdot 10^{+22} \lor \neg \left(z \leq 3.3 \cdot 10^{+25}\right):\\
\;\;\;\;x - y \cdot \left(\frac{t}{z} + -1\right)\\
\mathbf{else}:\\
\;\;\;\;x - t \cdot \frac{y}{z - a}\\
\end{array}
\end{array}
if z < -3.5e22 or 3.3000000000000001e25 < z Initial program 77.5%
Taylor expanded in a around 0 67.2%
associate-/l*89.0%
div-sub89.0%
*-inverses89.0%
Simplified89.0%
if -3.5e22 < z < 3.3000000000000001e25Initial program 95.5%
Taylor expanded in t around inf 88.7%
mul-1-neg88.7%
distribute-neg-frac288.7%
associate-*r/89.7%
sub-neg89.7%
distribute-neg-in89.7%
remove-double-neg89.7%
Simplified89.7%
Final simplification89.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -6.5e+25) (not (<= z 1250000000000.0))) (+ y x) (+ x (* y (/ t a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -6.5e+25) || !(z <= 1250000000000.0)) {
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 <= (-6.5d+25)) .or. (.not. (z <= 1250000000000.0d0))) 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 <= -6.5e+25) || !(z <= 1250000000000.0)) {
tmp = y + x;
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -6.5e+25) or not (z <= 1250000000000.0): tmp = y + x else: tmp = x + (y * (t / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -6.5e+25) || !(z <= 1250000000000.0)) 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 <= -6.5e+25) || ~((z <= 1250000000000.0))) tmp = y + x; else tmp = x + (y * (t / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -6.5e+25], N[Not[LessEqual[z, 1250000000000.0]], $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 -6.5 \cdot 10^{+25} \lor \neg \left(z \leq 1250000000000\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\end{array}
\end{array}
if z < -6.50000000000000005e25 or 1.25e12 < z Initial program 78.2%
+-commutative78.2%
associate-/l*100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in z around inf 80.0%
+-commutative80.0%
Simplified80.0%
if -6.50000000000000005e25 < z < 1.25e12Initial program 95.3%
Taylor expanded in z around 0 78.5%
*-un-lft-identity78.5%
associate-*l/78.5%
associate-*r*78.4%
associate-*l/78.4%
*-un-lft-identity78.4%
Applied egg-rr78.4%
Final simplification79.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.65e+28) (not (<= z 10200000000000.0))) (+ y x) (+ x (* t (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.65e+28) || !(z <= 10200000000000.0)) {
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 <= (-2.65d+28)) .or. (.not. (z <= 10200000000000.0d0))) 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 <= -2.65e+28) || !(z <= 10200000000000.0)) {
tmp = y + x;
} else {
tmp = x + (t * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.65e+28) or not (z <= 10200000000000.0): tmp = y + x else: tmp = x + (t * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.65e+28) || !(z <= 10200000000000.0)) 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 <= -2.65e+28) || ~((z <= 10200000000000.0))) tmp = y + x; else tmp = x + (t * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.65e+28], N[Not[LessEqual[z, 10200000000000.0]], $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 -2.65 \cdot 10^{+28} \lor \neg \left(z \leq 10200000000000\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -2.6500000000000002e28 or 1.02e13 < z Initial program 78.2%
+-commutative78.2%
associate-/l*100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in z around inf 80.0%
+-commutative80.0%
Simplified80.0%
if -2.6500000000000002e28 < z < 1.02e13Initial program 95.3%
Taylor expanded in z around 0 78.5%
associate-/l*79.5%
*-commutative79.5%
Applied egg-rr79.5%
Final simplification79.8%
(FPCore (x y z t a) :precision binary64 (if (<= a -1.6e+62) x (if (<= a 2.8e+220) (+ y x) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.6e+62) {
tmp = x;
} else if (a <= 2.8e+220) {
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 (a <= (-1.6d+62)) then
tmp = x
else if (a <= 2.8d+220) 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 (a <= -1.6e+62) {
tmp = x;
} else if (a <= 2.8e+220) {
tmp = y + x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -1.6e+62: tmp = x elif a <= 2.8e+220: tmp = y + x else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.6e+62) tmp = x; elseif (a <= 2.8e+220) tmp = Float64(y + x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -1.6e+62) tmp = x; elseif (a <= 2.8e+220) tmp = y + x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.6e+62], x, If[LessEqual[a, 2.8e+220], N[(y + x), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.6 \cdot 10^{+62}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 2.8 \cdot 10^{+220}:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -1.59999999999999992e62 or 2.8000000000000001e220 < a Initial program 82.6%
+-commutative82.6%
associate-/l*98.2%
fma-define98.2%
Simplified98.2%
Taylor expanded in y around 0 71.7%
if -1.59999999999999992e62 < a < 2.8000000000000001e220Initial program 87.9%
+-commutative87.9%
associate-/l*96.6%
fma-define96.6%
Simplified96.6%
Taylor expanded in z around inf 68.2%
+-commutative68.2%
Simplified68.2%
Final simplification69.0%
(FPCore (x y z t a) :precision binary64 (+ x (/ -1.0 (/ (/ (- z a) (- t z)) y))))
double code(double x, double y, double z, double t, double a) {
return x + (-1.0 / (((z - a) / (t - z)) / 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 + ((-1.0d0) / (((z - a) / (t - z)) / y))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (-1.0 / (((z - a) / (t - z)) / y));
}
def code(x, y, z, t, a): return x + (-1.0 / (((z - a) / (t - z)) / y))
function code(x, y, z, t, a) return Float64(x + Float64(-1.0 / Float64(Float64(Float64(z - a) / Float64(t - z)) / y))) end
function tmp = code(x, y, z, t, a) tmp = x + (-1.0 / (((z - a) / (t - z)) / y)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(-1.0 / N[(N[(N[(z - a), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{-1}{\frac{\frac{z - a}{t - z}}{y}}
\end{array}
Initial program 86.7%
clear-num86.6%
inv-pow86.6%
Applied egg-rr86.6%
unpow-186.6%
*-commutative86.6%
associate-/r*96.8%
Simplified96.8%
Final simplification96.8%
(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 86.7%
+-commutative86.7%
associate-/l*97.0%
fma-define97.0%
Simplified97.0%
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 2024130
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTicks from plot-0.2.3.4, A"
:precision binary64
:alt
(+ x (/ y (/ (- z a) (- z t))))
(+ x (/ (* y (- z t)) (- z a))))