
(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 (+ 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.6%
associate-/l*98.5%
Simplified98.5%
Final simplification98.5%
(FPCore (x y z t a)
:precision binary64
(if (<= a -2.9e+114)
x
(if (<= a 4.5e-216)
(+ x y)
(if (<= a 4.2e-150) (* y (- 1.0 (/ t z))) (+ x y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2.9e+114) {
tmp = x;
} else if (a <= 4.5e-216) {
tmp = x + y;
} else if (a <= 4.2e-150) {
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 (a <= (-2.9d+114)) then
tmp = x
else if (a <= 4.5d-216) then
tmp = x + y
else if (a <= 4.2d-150) 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 (a <= -2.9e+114) {
tmp = x;
} else if (a <= 4.5e-216) {
tmp = x + y;
} else if (a <= 4.2e-150) {
tmp = y * (1.0 - (t / z));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -2.9e+114: tmp = x elif a <= 4.5e-216: tmp = x + y elif a <= 4.2e-150: tmp = y * (1.0 - (t / z)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -2.9e+114) tmp = x; elseif (a <= 4.5e-216) tmp = Float64(x + y); elseif (a <= 4.2e-150) 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 (a <= -2.9e+114) tmp = x; elseif (a <= 4.5e-216) tmp = x + y; elseif (a <= 4.2e-150) tmp = y * (1.0 - (t / z)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -2.9e+114], x, If[LessEqual[a, 4.5e-216], N[(x + y), $MachinePrecision], If[LessEqual[a, 4.2e-150], N[(y * N[(1.0 - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.9 \cdot 10^{+114}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 4.5 \cdot 10^{-216}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;a \leq 4.2 \cdot 10^{-150}:\\
\;\;\;\;y \cdot \left(1 - \frac{t}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if a < -2.9e114Initial program 87.6%
associate-*l/95.7%
Simplified95.7%
Taylor expanded in x around inf 77.5%
if -2.9e114 < a < 4.4999999999999999e-216 or 4.2000000000000002e-150 < a Initial program 85.0%
associate-*l/95.3%
Simplified95.3%
Taylor expanded in z around inf 62.3%
if 4.4999999999999999e-216 < a < 4.2000000000000002e-150Initial program 86.5%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in a around 0 80.8%
Taylor expanded in y around inf 69.2%
Final simplification65.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -3.6e-78) (not (<= z 0.0006))) (+ x (/ y (- 1.0 (/ a z)))) (+ x (* y (/ t a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.6e-78) || !(z <= 0.0006)) {
tmp = x + (y / (1.0 - (a / z)));
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-3.6d-78)) .or. (.not. (z <= 0.0006d0))) then
tmp = x + (y / (1.0d0 - (a / z)))
else
tmp = x + (y * (t / a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.6e-78) || !(z <= 0.0006)) {
tmp = x + (y / (1.0 - (a / z)));
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -3.6e-78) or not (z <= 0.0006): tmp = x + (y / (1.0 - (a / z))) else: tmp = x + (y * (t / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -3.6e-78) || !(z <= 0.0006)) tmp = Float64(x + Float64(y / Float64(1.0 - Float64(a / z)))); else tmp = Float64(x + Float64(y * Float64(t / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -3.6e-78) || ~((z <= 0.0006))) tmp = x + (y / (1.0 - (a / z))); else tmp = x + (y * (t / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -3.6e-78], N[Not[LessEqual[z, 0.0006]], $MachinePrecision]], N[(x + N[(y / N[(1.0 - N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.6 \cdot 10^{-78} \lor \neg \left(z \leq 0.0006\right):\\
\;\;\;\;x + \frac{y}{1 - \frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\end{array}
\end{array}
if z < -3.6000000000000002e-78 or 5.99999999999999947e-4 < z Initial program 77.5%
associate-*l/94.0%
Simplified94.0%
Taylor expanded in t around 0 69.6%
associate-/l*83.4%
div-sub83.4%
*-inverses83.4%
Simplified83.4%
if -3.6000000000000002e-78 < z < 5.99999999999999947e-4Initial program 96.3%
+-commutative96.3%
associate-*r/96.5%
fma-def96.5%
Simplified96.5%
fma-udef96.5%
Applied egg-rr96.5%
Taylor expanded in z around 0 81.4%
associate-*r/84.8%
Simplified84.8%
Final simplification84.0%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.05e-78) (+ x (/ y (- 1.0 (/ a z)))) (if (<= z 0.0028) (+ x (* y (/ t a))) (+ x (/ y (/ z (- z t)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.05e-78) {
tmp = x + (y / (1.0 - (a / z)));
} else if (z <= 0.0028) {
tmp = x + (y * (t / 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.05d-78)) then
tmp = x + (y / (1.0d0 - (a / z)))
else if (z <= 0.0028d0) then
tmp = x + (y * (t / 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.05e-78) {
tmp = x + (y / (1.0 - (a / z)));
} else if (z <= 0.0028) {
tmp = x + (y * (t / a));
} else {
tmp = x + (y / (z / (z - t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.05e-78: tmp = x + (y / (1.0 - (a / z))) elif z <= 0.0028: tmp = x + (y * (t / a)) else: tmp = x + (y / (z / (z - t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.05e-78) tmp = Float64(x + Float64(y / Float64(1.0 - Float64(a / z)))); elseif (z <= 0.0028) tmp = Float64(x + Float64(y * Float64(t / 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.05e-78) tmp = x + (y / (1.0 - (a / z))); elseif (z <= 0.0028) tmp = x + (y * (t / a)); else tmp = x + (y / (z / (z - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.05e-78], N[(x + N[(y / N[(1.0 - N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.0028], N[(x + N[(y * N[(t / 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.05 \cdot 10^{-78}:\\
\;\;\;\;x + \frac{y}{1 - \frac{a}{z}}\\
\mathbf{elif}\;z \leq 0.0028:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{z}{z - t}}\\
\end{array}
\end{array}
if z < -2.0499999999999999e-78Initial program 78.3%
associate-*l/93.8%
Simplified93.8%
Taylor expanded in t around 0 69.9%
associate-/l*84.4%
div-sub84.4%
*-inverses84.4%
Simplified84.4%
if -2.0499999999999999e-78 < z < 0.00279999999999999997Initial program 96.3%
+-commutative96.3%
associate-*r/96.5%
fma-def96.5%
Simplified96.5%
fma-udef96.5%
Applied egg-rr96.5%
Taylor expanded in z around 0 81.4%
associate-*r/84.8%
Simplified84.8%
if 0.00279999999999999997 < z Initial program 76.6%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in a around 0 90.0%
Final simplification86.1%
(FPCore (x y z t a) :precision binary64 (if (<= z -3.3e-78) (+ x (/ y (- 1.0 (/ a z)))) (if (<= z 0.0305) (+ 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 <= -3.3e-78) {
tmp = x + (y / (1.0 - (a / z)));
} else if (z <= 0.0305) {
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 <= (-3.3d-78)) then
tmp = x + (y / (1.0d0 - (a / z)))
else if (z <= 0.0305d0) 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 <= -3.3e-78) {
tmp = x + (y / (1.0 - (a / z)));
} else if (z <= 0.0305) {
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 <= -3.3e-78: tmp = x + (y / (1.0 - (a / z))) elif z <= 0.0305: 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 <= -3.3e-78) tmp = Float64(x + Float64(y / Float64(1.0 - Float64(a / z)))); elseif (z <= 0.0305) tmp = Float64(x + Float64(y * Float64(t / a))); else tmp = Float64(x + Float64(y * Float64(1.0 - Float64(t / z)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -3.3e-78) tmp = x + (y / (1.0 - (a / z))); elseif (z <= 0.0305) 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, -3.3e-78], N[(x + N[(y / N[(1.0 - N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.0305], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(1.0 - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.3 \cdot 10^{-78}:\\
\;\;\;\;x + \frac{y}{1 - \frac{a}{z}}\\
\mathbf{elif}\;z \leq 0.0305:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(1 - \frac{t}{z}\right)\\
\end{array}
\end{array}
if z < -3.29999999999999982e-78Initial program 78.3%
associate-*l/93.8%
Simplified93.8%
Taylor expanded in t around 0 69.9%
associate-/l*84.4%
div-sub84.4%
*-inverses84.4%
Simplified84.4%
if -3.29999999999999982e-78 < z < 0.030499999999999999Initial program 96.3%
+-commutative96.3%
associate-*r/96.5%
fma-def96.5%
Simplified96.5%
fma-udef96.5%
Applied egg-rr96.5%
Taylor expanded in z around 0 81.4%
associate-*r/84.8%
Simplified84.8%
if 0.030499999999999999 < z Initial program 76.6%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in a around 0 90.0%
Taylor expanded in y around 0 90.0%
Final simplification86.1%
(FPCore (x y z t a) :precision binary64 (if (<= z -3.1e+106) (+ x (/ y (- 1.0 (/ a z)))) (if (<= z 15.5) (- x (* t (/ y (- z a)))) (+ x (* y (- 1.0 (/ t z)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.1e+106) {
tmp = x + (y / (1.0 - (a / z)));
} else if (z <= 15.5) {
tmp = x - (t * (y / (z - 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 <= (-3.1d+106)) then
tmp = x + (y / (1.0d0 - (a / z)))
else if (z <= 15.5d0) then
tmp = x - (t * (y / (z - 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 <= -3.1e+106) {
tmp = x + (y / (1.0 - (a / z)));
} else if (z <= 15.5) {
tmp = x - (t * (y / (z - a)));
} else {
tmp = x + (y * (1.0 - (t / z)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3.1e+106: tmp = x + (y / (1.0 - (a / z))) elif z <= 15.5: tmp = x - (t * (y / (z - a))) else: tmp = x + (y * (1.0 - (t / z))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.1e+106) tmp = Float64(x + Float64(y / Float64(1.0 - Float64(a / z)))); elseif (z <= 15.5) tmp = Float64(x - Float64(t * Float64(y / Float64(z - 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 <= -3.1e+106) tmp = x + (y / (1.0 - (a / z))); elseif (z <= 15.5) tmp = x - (t * (y / (z - a))); else tmp = x + (y * (1.0 - (t / z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.1e+106], N[(x + N[(y / N[(1.0 - N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 15.5], N[(x - N[(t * N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(1.0 - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.1 \cdot 10^{+106}:\\
\;\;\;\;x + \frac{y}{1 - \frac{a}{z}}\\
\mathbf{elif}\;z \leq 15.5:\\
\;\;\;\;x - t \cdot \frac{y}{z - a}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(1 - \frac{t}{z}\right)\\
\end{array}
\end{array}
if z < -3.0999999999999999e106Initial program 66.4%
associate-*l/88.6%
Simplified88.6%
Taylor expanded in t around 0 65.8%
associate-/l*92.7%
div-sub92.7%
*-inverses92.7%
Simplified92.7%
if -3.0999999999999999e106 < z < 15.5Initial program 95.3%
associate-*l/98.6%
Simplified98.6%
Taylor expanded in t around inf 90.6%
associate-*r/90.6%
mul-1-neg90.6%
distribute-rgt-neg-out90.6%
associate-*l/93.9%
Simplified93.9%
distribute-rgt-neg-out93.9%
unsub-neg93.9%
Applied egg-rr93.9%
if 15.5 < z Initial program 76.6%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in a around 0 90.0%
Taylor expanded in y around 0 90.0%
Final simplification92.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -7.4e+46) (not (<= z 4.8))) (+ x y) (+ x (* y (/ t a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -7.4e+46) || !(z <= 4.8)) {
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 <= (-7.4d+46)) .or. (.not. (z <= 4.8d0))) 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 <= -7.4e+46) || !(z <= 4.8)) {
tmp = x + y;
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -7.4e+46) or not (z <= 4.8): tmp = x + y else: tmp = x + (y * (t / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -7.4e+46) || !(z <= 4.8)) 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 <= -7.4e+46) || ~((z <= 4.8))) tmp = x + y; else tmp = x + (y * (t / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -7.4e+46], N[Not[LessEqual[z, 4.8]], $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 -7.4 \cdot 10^{+46} \lor \neg \left(z \leq 4.8\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\end{array}
\end{array}
if z < -7.3999999999999998e46 or 4.79999999999999982 < z Initial program 74.1%
associate-*l/92.9%
Simplified92.9%
Taylor expanded in z around inf 80.4%
if -7.3999999999999998e46 < z < 4.79999999999999982Initial program 96.2%
+-commutative96.2%
associate-*r/97.1%
fma-def97.1%
Simplified97.1%
fma-udef97.1%
Applied egg-rr97.1%
Taylor expanded in z around 0 77.9%
associate-*r/80.7%
Simplified80.7%
Final simplification80.6%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.15e+48) (+ x y) (if (<= z 0.00022) (+ x (/ y (/ a t))) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.15e+48) {
tmp = x + y;
} else if (z <= 0.00022) {
tmp = x + (y / (a / t));
} 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.15d+48)) then
tmp = x + y
else if (z <= 0.00022d0) then
tmp = x + (y / (a / t))
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.15e+48) {
tmp = x + y;
} else if (z <= 0.00022) {
tmp = x + (y / (a / t));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.15e+48: tmp = x + y elif z <= 0.00022: tmp = x + (y / (a / t)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.15e+48) tmp = Float64(x + y); elseif (z <= 0.00022) tmp = Float64(x + Float64(y / Float64(a / t))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.15e+48) tmp = x + y; elseif (z <= 0.00022) tmp = x + (y / (a / t)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.15e+48], N[(x + y), $MachinePrecision], If[LessEqual[z, 0.00022], N[(x + N[(y / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.15 \cdot 10^{+48}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 0.00022:\\
\;\;\;\;x + \frac{y}{\frac{a}{t}}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -1.15e48 or 2.20000000000000008e-4 < z Initial program 74.1%
associate-*l/92.9%
Simplified92.9%
Taylor expanded in z around inf 80.4%
if -1.15e48 < z < 2.20000000000000008e-4Initial program 96.2%
associate-*l/98.4%
Simplified98.4%
Taylor expanded in z around 0 77.9%
associate-/l*81.4%
Simplified81.4%
Final simplification80.9%
(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 85.6%
associate-*l/95.8%
Simplified95.8%
Final simplification95.8%
(FPCore (x y z t a) :precision binary64 (if (<= a -1.25e+115) x (+ x y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.25e+115) {
tmp = x;
} 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 (a <= (-1.25d+115)) then
tmp = x
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 (a <= -1.25e+115) {
tmp = x;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -1.25e+115: tmp = x else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.25e+115) tmp = x; else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -1.25e+115) tmp = x; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.25e+115], x, N[(x + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.25 \cdot 10^{+115}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if a < -1.25000000000000002e115Initial program 87.6%
associate-*l/95.7%
Simplified95.7%
Taylor expanded in x around inf 77.5%
if -1.25000000000000002e115 < a Initial program 85.2%
associate-*l/95.8%
Simplified95.8%
Taylor expanded in z around inf 59.2%
Final simplification62.5%
(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.6%
associate-*l/95.8%
Simplified95.8%
Taylor expanded in x around inf 50.0%
Final simplification50.0%
(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 2023227
(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))))