
(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 4e-69)))
(+ 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 <= 4e-69)) {
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 <= 4e-69)) {
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 <= 4e-69): 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 <= 4e-69)) 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 <= 4e-69))) 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, 4e-69]], $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 4 \cdot 10^{-69}\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 3.9999999999999999e-69 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) Initial program 50.7%
+-commutative50.7%
associate-/l*97.2%
fma-define97.2%
Simplified97.2%
fma-undefine97.2%
associate-/l*50.7%
div-inv50.7%
*-commutative50.7%
associate-*r*99.6%
div-inv99.7%
Applied egg-rr99.7%
if -inf.0 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < 3.9999999999999999e-69Initial program 99.2%
Final simplification99.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* y (/ (- z t) (- z a)))) (t_2 (/ (* y (- z t)) (- z a))))
(if (<= t_2 -2e+238)
t_1
(if (<= t_2 -1e-91)
(+ x (/ (* y t) a))
(if (<= t_2 5e+98) (+ x (/ y (/ (- z a) z))) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * ((z - t) / (z - a));
double t_2 = (y * (z - t)) / (z - a);
double tmp;
if (t_2 <= -2e+238) {
tmp = t_1;
} else if (t_2 <= -1e-91) {
tmp = x + ((y * t) / a);
} else if (t_2 <= 5e+98) {
tmp = x + (y / ((z - a) / z));
} else {
tmp = t_1;
}
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) :: t_2
real(8) :: tmp
t_1 = y * ((z - t) / (z - a))
t_2 = (y * (z - t)) / (z - a)
if (t_2 <= (-2d+238)) then
tmp = t_1
else if (t_2 <= (-1d-91)) then
tmp = x + ((y * t) / a)
else if (t_2 <= 5d+98) then
tmp = x + (y / ((z - a) / z))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = y * ((z - t) / (z - a));
double t_2 = (y * (z - t)) / (z - a);
double tmp;
if (t_2 <= -2e+238) {
tmp = t_1;
} else if (t_2 <= -1e-91) {
tmp = x + ((y * t) / a);
} else if (t_2 <= 5e+98) {
tmp = x + (y / ((z - a) / z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y * ((z - t) / (z - a)) t_2 = (y * (z - t)) / (z - a) tmp = 0 if t_2 <= -2e+238: tmp = t_1 elif t_2 <= -1e-91: tmp = x + ((y * t) / a) elif t_2 <= 5e+98: tmp = x + (y / ((z - a) / z)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(y * Float64(Float64(z - t) / Float64(z - a))) t_2 = Float64(Float64(y * Float64(z - t)) / Float64(z - a)) tmp = 0.0 if (t_2 <= -2e+238) tmp = t_1; elseif (t_2 <= -1e-91) tmp = Float64(x + Float64(Float64(y * t) / a)); elseif (t_2 <= 5e+98) tmp = Float64(x + Float64(y / Float64(Float64(z - a) / z))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y * ((z - t) / (z - a)); t_2 = (y * (z - t)) / (z - a); tmp = 0.0; if (t_2 <= -2e+238) tmp = t_1; elseif (t_2 <= -1e-91) tmp = x + ((y * t) / a); elseif (t_2 <= 5e+98) tmp = x + (y / ((z - a) / z)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+238], t$95$1, If[LessEqual[t$95$2, -1e-91], N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 5e+98], N[(x + N[(y / N[(N[(z - a), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z - t}{z - a}\\
t_2 := \frac{y \cdot \left(z - t\right)}{z - a}\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+238}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -1 \cdot 10^{-91}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+98}:\\
\;\;\;\;x + \frac{y}{\frac{z - a}{z}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < -2.0000000000000001e238 or 4.9999999999999998e98 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) Initial program 41.2%
+-commutative41.2%
associate-/l*96.8%
fma-define96.8%
Simplified96.8%
clear-num96.7%
inv-pow96.7%
Applied egg-rr96.7%
unpow-196.7%
Simplified96.7%
Taylor expanded in y around inf 87.0%
div-sub87.0%
Simplified87.0%
if -2.0000000000000001e238 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < -1.00000000000000002e-91Initial program 99.8%
Taylor expanded in z around 0 76.2%
if -1.00000000000000002e-91 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < 4.9999999999999998e98Initial program 99.0%
+-commutative99.0%
associate-/l*99.0%
fma-define99.0%
Simplified99.0%
fma-undefine99.0%
associate-/l*99.0%
div-inv99.0%
*-commutative99.0%
associate-*r*93.6%
div-inv93.6%
Applied egg-rr93.6%
*-commutative93.6%
div-inv93.6%
associate-*r*99.0%
associate-/r/99.1%
un-div-inv99.1%
Applied egg-rr99.1%
Taylor expanded in t around 0 90.7%
Final simplification86.7%
(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+230)))
(* y (/ (- z t) (- 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+230)) {
tmp = y * ((z - t) / (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+230)) {
tmp = y * ((z - t) / (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+230): tmp = y * ((z - t) / (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+230)) tmp = Float64(y * Float64(Float64(z - t) / 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+230))) tmp = y * ((z - t) / (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+230]], $MachinePrecision]], N[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $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^{+230}\right):\\
\;\;\;\;y \cdot \frac{z - t}{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.0000000000000003e230 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) Initial program 30.0%
+-commutative30.0%
associate-/l*99.8%
fma-define99.8%
Simplified99.8%
clear-num99.8%
inv-pow99.8%
Applied egg-rr99.8%
unpow-199.8%
Simplified99.8%
Taylor expanded in y around inf 89.6%
div-sub89.6%
Simplified89.6%
if -inf.0 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < 5.0000000000000003e230Initial program 99.2%
Final simplification96.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -4e+30) (not (<= t 1.6e-45))) (+ x (* t (/ y (- a z)))) (+ x (/ y (/ (- z a) z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -4e+30) || !(t <= 1.6e-45)) {
tmp = x + (t * (y / (a - z)));
} else {
tmp = x + (y / ((z - 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 ((t <= (-4d+30)) .or. (.not. (t <= 1.6d-45))) then
tmp = x + (t * (y / (a - z)))
else
tmp = x + (y / ((z - 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 ((t <= -4e+30) || !(t <= 1.6e-45)) {
tmp = x + (t * (y / (a - z)));
} else {
tmp = x + (y / ((z - a) / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -4e+30) or not (t <= 1.6e-45): tmp = x + (t * (y / (a - z))) else: tmp = x + (y / ((z - a) / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -4e+30) || !(t <= 1.6e-45)) tmp = Float64(x + Float64(t * Float64(y / Float64(a - z)))); else tmp = Float64(x + Float64(y / Float64(Float64(z - a) / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -4e+30) || ~((t <= 1.6e-45))) tmp = x + (t * (y / (a - z))); else tmp = x + (y / ((z - a) / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -4e+30], N[Not[LessEqual[t, 1.6e-45]], $MachinePrecision]], N[(x + N[(t * N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(N[(z - a), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4 \cdot 10^{+30} \lor \neg \left(t \leq 1.6 \cdot 10^{-45}\right):\\
\;\;\;\;x + t \cdot \frac{y}{a - z}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{z - a}{z}}\\
\end{array}
\end{array}
if t < -4.0000000000000001e30 or 1.60000000000000004e-45 < t Initial program 79.2%
Taylor expanded in t around inf 76.8%
mul-1-neg76.8%
associate-/l*87.5%
distribute-rgt-neg-in87.5%
distribute-frac-neg287.5%
Simplified87.5%
if -4.0000000000000001e30 < t < 1.60000000000000004e-45Initial program 76.8%
+-commutative76.8%
associate-/l*99.9%
fma-define99.9%
Simplified99.9%
fma-undefine99.9%
associate-/l*76.8%
div-inv76.9%
*-commutative76.9%
associate-*r*94.9%
div-inv94.9%
Applied egg-rr94.9%
*-commutative94.9%
div-inv94.9%
associate-*r*99.7%
associate-/r/99.9%
un-div-inv100.0%
Applied egg-rr100.0%
Taylor expanded in t around 0 93.3%
Final simplification90.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.12e+18) (not (<= z 4.1e-137))) (- x (* y (/ z (- a z)))) (+ x (* t (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.12e+18) || !(z <= 4.1e-137)) {
tmp = x - (y * (z / (a - 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.12d+18)) .or. (.not. (z <= 4.1d-137))) then
tmp = x - (y * (z / (a - 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.12e+18) || !(z <= 4.1e-137)) {
tmp = x - (y * (z / (a - z)));
} else {
tmp = x + (t * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.12e+18) or not (z <= 4.1e-137): tmp = x - (y * (z / (a - z))) else: tmp = x + (t * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.12e+18) || !(z <= 4.1e-137)) tmp = Float64(x - Float64(y * Float64(z / Float64(a - 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.12e+18) || ~((z <= 4.1e-137))) tmp = x - (y * (z / (a - z))); else tmp = x + (t * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.12e+18], N[Not[LessEqual[z, 4.1e-137]], $MachinePrecision]], N[(x - N[(y * N[(z / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.12 \cdot 10^{+18} \lor \neg \left(z \leq 4.1 \cdot 10^{-137}\right):\\
\;\;\;\;x - y \cdot \frac{z}{a - z}\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -1.12e18 or 4.0999999999999999e-137 < z Initial program 69.5%
Taylor expanded in t around 0 61.0%
+-commutative61.0%
associate-/l*80.0%
Simplified80.0%
if -1.12e18 < z < 4.0999999999999999e-137Initial program 92.0%
Taylor expanded in z around 0 85.4%
+-commutative85.4%
associate-/l*89.4%
Simplified89.4%
Final simplification83.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -6.5e+168) (not (<= z 1.8e+120))) (+ y x) (+ x (* t (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -6.5e+168) || !(z <= 1.8e+120)) {
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 <= (-6.5d+168)) .or. (.not. (z <= 1.8d+120))) 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 <= -6.5e+168) || !(z <= 1.8e+120)) {
tmp = y + x;
} else {
tmp = x + (t * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -6.5e+168) or not (z <= 1.8e+120): tmp = y + x else: tmp = x + (t * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -6.5e+168) || !(z <= 1.8e+120)) 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 <= -6.5e+168) || ~((z <= 1.8e+120))) tmp = y + x; else tmp = x + (t * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -6.5e+168], N[Not[LessEqual[z, 1.8e+120]], $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 -6.5 \cdot 10^{+168} \lor \neg \left(z \leq 1.8 \cdot 10^{+120}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -6.49999999999999999e168 or 1.80000000000000008e120 < z Initial program 56.5%
Taylor expanded in z around inf 84.0%
+-commutative84.0%
Simplified84.0%
if -6.49999999999999999e168 < z < 1.80000000000000008e120Initial program 87.7%
Taylor expanded in z around 0 71.7%
+-commutative71.7%
associate-/l*77.2%
Simplified77.2%
Final simplification79.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -4.6e+15) (not (<= z 9.6e+117))) (+ y x) (+ x (/ (* y t) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -4.6e+15) || !(z <= 9.6e+117)) {
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 <= (-4.6d+15)) .or. (.not. (z <= 9.6d+117))) 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 <= -4.6e+15) || !(z <= 9.6e+117)) {
tmp = y + x;
} else {
tmp = x + ((y * t) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -4.6e+15) or not (z <= 9.6e+117): tmp = y + x else: tmp = x + ((y * t) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -4.6e+15) || !(z <= 9.6e+117)) 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 <= -4.6e+15) || ~((z <= 9.6e+117))) tmp = y + x; else tmp = x + ((y * t) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -4.6e+15], N[Not[LessEqual[z, 9.6e+117]], $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 -4.6 \cdot 10^{+15} \lor \neg \left(z \leq 9.6 \cdot 10^{+117}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\end{array}
\end{array}
if z < -4.6e15 or 9.5999999999999996e117 < z Initial program 62.0%
Taylor expanded in z around inf 75.0%
+-commutative75.0%
Simplified75.0%
if -4.6e15 < z < 9.5999999999999996e117Initial program 91.1%
Taylor expanded in z around 0 77.0%
Final simplification76.1%
(FPCore (x y z t a) :precision binary64 (+ (/ y (/ (- z a) (- z t))) x))
double code(double x, double y, double z, double t, double a) {
return (y / ((z - a) / (z - t))) + 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 = (y / ((z - a) / (z - t))) + x
end function
public static double code(double x, double y, double z, double t, double a) {
return (y / ((z - a) / (z - t))) + x;
}
def code(x, y, z, t, a): return (y / ((z - a) / (z - t))) + x
function code(x, y, z, t, a) return Float64(Float64(y / Float64(Float64(z - a) / Float64(z - t))) + x) end
function tmp = code(x, y, z, t, a) tmp = (y / ((z - a) / (z - t))) + x; end
code[x_, y_, z_, t_, a_] := N[(N[(y / N[(N[(z - a), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\frac{y}{\frac{z - a}{z - t}} + x
\end{array}
Initial program 78.2%
+-commutative78.2%
associate-/l*97.2%
fma-define97.2%
Simplified97.2%
fma-undefine97.2%
associate-/l*78.2%
div-inv78.2%
*-commutative78.2%
associate-*r*96.2%
div-inv96.2%
Applied egg-rr96.2%
*-commutative96.2%
div-inv96.2%
associate-*r*97.2%
associate-/r/97.2%
un-div-inv97.6%
Applied egg-rr97.6%
(FPCore (x y z t a) :precision binary64 (+ y x))
double code(double x, double y, double z, double t, double a) {
return y + 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 = y + x
end function
public static double code(double x, double y, double z, double t, double a) {
return y + x;
}
def code(x, y, z, t, a): return y + x
function code(x, y, z, t, a) return Float64(y + x) end
function tmp = code(x, y, z, t, a) tmp = y + x; end
code[x_, y_, z_, t_, a_] := N[(y + x), $MachinePrecision]
\begin{array}{l}
\\
y + x
\end{array}
Initial program 78.2%
Taylor expanded in z around inf 58.7%
+-commutative58.7%
Simplified58.7%
(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 78.2%
Taylor expanded in x around inf 46.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 2024116
(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))))