
(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 13 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 (/ (* (- z t) y) (- z a))))
(if (<= t_1 (- INFINITY))
(* y (+ (/ (- z t) (- z a)) (/ x y)))
(if (<= t_1 2e-56) (+ x t_1) (+ x (/ (- z t) (/ (- z a) y)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((z - t) * y) / (z - a);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = y * (((z - t) / (z - a)) + (x / y));
} else if (t_1 <= 2e-56) {
tmp = x + t_1;
} else {
tmp = x + ((z - t) / ((z - a) / y));
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = ((z - t) * y) / (z - a);
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = y * (((z - t) / (z - a)) + (x / y));
} else if (t_1 <= 2e-56) {
tmp = x + t_1;
} else {
tmp = x + ((z - t) / ((z - a) / y));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = ((z - t) * y) / (z - a) tmp = 0 if t_1 <= -math.inf: tmp = y * (((z - t) / (z - a)) + (x / y)) elif t_1 <= 2e-56: tmp = x + t_1 else: tmp = x + ((z - t) / ((z - a) / y)) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(z - t) * y) / Float64(z - a)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(y * Float64(Float64(Float64(z - t) / Float64(z - a)) + Float64(x / y))); elseif (t_1 <= 2e-56) tmp = Float64(x + t_1); else tmp = Float64(x + Float64(Float64(z - t) / Float64(Float64(z - a) / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = ((z - t) * y) / (z - a); tmp = 0.0; if (t_1 <= -Inf) tmp = y * (((z - t) / (z - a)) + (x / y)); elseif (t_1 <= 2e-56) tmp = x + t_1; else tmp = x + ((z - t) / ((z - a) / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(y * N[(N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] + N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e-56], N[(x + t$95$1), $MachinePrecision], N[(x + N[(N[(z - t), $MachinePrecision] / N[(N[(z - a), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(z - t\right) \cdot y}{z - a}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;y \cdot \left(\frac{z - t}{z - a} + \frac{x}{y}\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-56}:\\
\;\;\;\;x + t\_1\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z - t}{\frac{z - a}{y}}\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < -inf.0Initial program 28.5%
Taylor expanded in y around inf 99.9%
associate--l+99.9%
div-sub99.9%
Simplified99.9%
if -inf.0 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < 2.0000000000000001e-56Initial program 99.2%
if 2.0000000000000001e-56 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) Initial program 83.7%
+-commutative83.7%
associate-/l*94.6%
fma-define94.6%
Simplified94.6%
fma-undefine94.6%
associate-/l*83.7%
div-inv83.6%
*-commutative83.6%
associate-*r*99.6%
div-inv99.7%
Applied egg-rr99.7%
clear-num99.6%
un-div-inv99.8%
Applied egg-rr99.8%
Final simplification99.5%
(FPCore (x y z t a) :precision binary64 (if (<= x -1.45e-147) (+ x (/ (- z t) (/ (- z a) y))) (fma y (/ (- z t) (- z a)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -1.45e-147) {
tmp = x + ((z - t) / ((z - a) / y));
} else {
tmp = fma(y, ((z - t) / (z - a)), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (x <= -1.45e-147) tmp = Float64(x + Float64(Float64(z - t) / Float64(Float64(z - a) / y))); else tmp = fma(y, Float64(Float64(z - t) / Float64(z - a)), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -1.45e-147], N[(x + N[(N[(z - t), $MachinePrecision] / N[(N[(z - a), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.45 \cdot 10^{-147}:\\
\;\;\;\;x + \frac{z - t}{\frac{z - a}{y}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z - t}{z - a}, x\right)\\
\end{array}
\end{array}
if x < -1.4500000000000001e-147Initial program 85.9%
+-commutative85.9%
associate-/l*94.7%
fma-define94.7%
Simplified94.7%
fma-undefine94.7%
associate-/l*85.9%
div-inv85.9%
*-commutative85.9%
associate-*r*98.9%
div-inv98.9%
Applied egg-rr98.9%
clear-num98.9%
un-div-inv99.0%
Applied egg-rr99.0%
if -1.4500000000000001e-147 < x Initial program 87.6%
+-commutative87.6%
associate-/l*99.2%
fma-define99.2%
Simplified99.2%
Final simplification99.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* y (/ (- z t) (- z a)))))
(if (<= z -3.2e+132)
(+ x y)
(if (<= z -1.95e+66)
t_1
(if (<= z -1.22e+28)
(+ x y)
(if (<= z 2.85e+23)
(+ x (/ (* t y) a))
(if (<= z 5e+99)
(- x (/ (* t y) z))
(if (<= z 1.12e+154) t_1 (+ x y)))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * ((z - t) / (z - a));
double tmp;
if (z <= -3.2e+132) {
tmp = x + y;
} else if (z <= -1.95e+66) {
tmp = t_1;
} else if (z <= -1.22e+28) {
tmp = x + y;
} else if (z <= 2.85e+23) {
tmp = x + ((t * y) / a);
} else if (z <= 5e+99) {
tmp = x - ((t * y) / z);
} else if (z <= 1.12e+154) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = y * ((z - t) / (z - a))
if (z <= (-3.2d+132)) then
tmp = x + y
else if (z <= (-1.95d+66)) then
tmp = t_1
else if (z <= (-1.22d+28)) then
tmp = x + y
else if (z <= 2.85d+23) then
tmp = x + ((t * y) / a)
else if (z <= 5d+99) then
tmp = x - ((t * y) / z)
else if (z <= 1.12d+154) then
tmp = t_1
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 t_1 = y * ((z - t) / (z - a));
double tmp;
if (z <= -3.2e+132) {
tmp = x + y;
} else if (z <= -1.95e+66) {
tmp = t_1;
} else if (z <= -1.22e+28) {
tmp = x + y;
} else if (z <= 2.85e+23) {
tmp = x + ((t * y) / a);
} else if (z <= 5e+99) {
tmp = x - ((t * y) / z);
} else if (z <= 1.12e+154) {
tmp = t_1;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y * ((z - t) / (z - a)) tmp = 0 if z <= -3.2e+132: tmp = x + y elif z <= -1.95e+66: tmp = t_1 elif z <= -1.22e+28: tmp = x + y elif z <= 2.85e+23: tmp = x + ((t * y) / a) elif z <= 5e+99: tmp = x - ((t * y) / z) elif z <= 1.12e+154: tmp = t_1 else: tmp = x + y return tmp
function code(x, y, z, t, a) t_1 = Float64(y * Float64(Float64(z - t) / Float64(z - a))) tmp = 0.0 if (z <= -3.2e+132) tmp = Float64(x + y); elseif (z <= -1.95e+66) tmp = t_1; elseif (z <= -1.22e+28) tmp = Float64(x + y); elseif (z <= 2.85e+23) tmp = Float64(x + Float64(Float64(t * y) / a)); elseif (z <= 5e+99) tmp = Float64(x - Float64(Float64(t * y) / z)); elseif (z <= 1.12e+154) tmp = t_1; else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y * ((z - t) / (z - a)); tmp = 0.0; if (z <= -3.2e+132) tmp = x + y; elseif (z <= -1.95e+66) tmp = t_1; elseif (z <= -1.22e+28) tmp = x + y; elseif (z <= 2.85e+23) tmp = x + ((t * y) / a); elseif (z <= 5e+99) tmp = x - ((t * y) / z); elseif (z <= 1.12e+154) tmp = t_1; else tmp = x + y; 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]}, If[LessEqual[z, -3.2e+132], N[(x + y), $MachinePrecision], If[LessEqual[z, -1.95e+66], t$95$1, If[LessEqual[z, -1.22e+28], N[(x + y), $MachinePrecision], If[LessEqual[z, 2.85e+23], N[(x + N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5e+99], N[(x - N[(N[(t * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.12e+154], t$95$1, N[(x + y), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z - t}{z - a}\\
\mathbf{if}\;z \leq -3.2 \cdot 10^{+132}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq -1.95 \cdot 10^{+66}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.22 \cdot 10^{+28}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 2.85 \cdot 10^{+23}:\\
\;\;\;\;x + \frac{t \cdot y}{a}\\
\mathbf{elif}\;z \leq 5 \cdot 10^{+99}:\\
\;\;\;\;x - \frac{t \cdot y}{z}\\
\mathbf{elif}\;z \leq 1.12 \cdot 10^{+154}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -3.1999999999999997e132 or -1.9500000000000002e66 < z < -1.2199999999999999e28 or 1.11999999999999994e154 < z Initial program 73.2%
Taylor expanded in z around inf 85.3%
+-commutative85.3%
Simplified85.3%
if -3.1999999999999997e132 < z < -1.9500000000000002e66 or 5.00000000000000008e99 < z < 1.11999999999999994e154Initial program 63.8%
Taylor expanded in x around 0 42.6%
associate-*r/78.6%
Simplified78.6%
if -1.2199999999999999e28 < z < 2.85e23Initial program 99.1%
Taylor expanded in z around 0 85.3%
if 2.85e23 < z < 5.00000000000000008e99Initial program 89.4%
+-commutative89.4%
associate-/l*99.8%
fma-define99.8%
Simplified99.8%
fma-undefine99.8%
associate-/l*89.4%
div-inv89.5%
*-commutative89.5%
associate-*r*89.8%
div-inv89.8%
Applied egg-rr89.8%
Taylor expanded in a around 0 84.4%
Taylor expanded in z around 0 73.3%
mul-1-neg73.3%
distribute-lft-neg-out73.3%
*-commutative73.3%
Simplified73.3%
Final simplification83.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* (- z t) y) (- z a))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 1e+261)))
(* y (/ (- z t) (- z a)))
(+ x t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((z - t) * y) / (z - a);
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 1e+261)) {
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 = ((z - t) * y) / (z - a);
double tmp;
if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 1e+261)) {
tmp = y * ((z - t) / (z - a));
} else {
tmp = x + t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = ((z - t) * y) / (z - a) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 1e+261): tmp = y * ((z - t) / (z - a)) else: tmp = x + t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(z - t) * y) / Float64(z - a)) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 1e+261)) 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 = ((z - t) * y) / (z - a); tmp = 0.0; if ((t_1 <= -Inf) || ~((t_1 <= 1e+261))) 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[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 1e+261]], $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{\left(z - t\right) \cdot y}{z - a}\\
\mathbf{if}\;t\_1 \leq -\infty \lor \neg \left(t\_1 \leq 10^{+261}\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 9.9999999999999993e260 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) Initial program 33.1%
Taylor expanded in x around 0 33.1%
associate-*r/87.8%
Simplified87.8%
if -inf.0 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < 9.9999999999999993e260Initial program 99.3%
Final simplification97.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* (- z t) y) (- z a))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 2e-56)))
(+ x (* (/ y (- a z)) (- t z)))
(+ x t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((z - t) * y) / (z - a);
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 2e-56)) {
tmp = x + ((y / (a - z)) * (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 = ((z - t) * y) / (z - a);
double tmp;
if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 2e-56)) {
tmp = x + ((y / (a - z)) * (t - z));
} else {
tmp = x + t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = ((z - t) * y) / (z - a) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 2e-56): tmp = x + ((y / (a - z)) * (t - z)) else: tmp = x + t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(z - t) * y) / Float64(z - a)) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 2e-56)) tmp = Float64(x + Float64(Float64(y / Float64(a - z)) * Float64(t - z))); else tmp = Float64(x + t_1); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = ((z - t) * y) / (z - a); tmp = 0.0; if ((t_1 <= -Inf) || ~((t_1 <= 2e-56))) tmp = x + ((y / (a - z)) * (t - z)); else tmp = x + t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 2e-56]], $MachinePrecision]], N[(x + N[(N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + t$95$1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(z - t\right) \cdot y}{z - a}\\
\mathbf{if}\;t\_1 \leq -\infty \lor \neg \left(t\_1 \leq 2 \cdot 10^{-56}\right):\\
\;\;\;\;x + \frac{y}{a - z} \cdot \left(t - z\right)\\
\mathbf{else}:\\
\;\;\;\;x + t\_1\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < -inf.0 or 2.0000000000000001e-56 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) Initial program 67.7%
+-commutative67.7%
associate-/l*96.1%
fma-define96.1%
Simplified96.1%
fma-undefine96.1%
associate-/l*67.7%
div-inv67.6%
*-commutative67.6%
associate-*r*99.7%
div-inv99.8%
Applied egg-rr99.8%
if -inf.0 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < 2.0000000000000001e-56Initial program 99.2%
Final simplification99.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* (- z t) y) (- z a))))
(if (<= t_1 (- INFINITY))
(+ x (* (/ y (- a z)) (- t z)))
(if (<= t_1 2e-56) (+ x t_1) (+ x (/ (- z t) (/ (- z a) y)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((z - t) * y) / (z - a);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = x + ((y / (a - z)) * (t - z));
} else if (t_1 <= 2e-56) {
tmp = x + t_1;
} else {
tmp = x + ((z - t) / ((z - a) / y));
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = ((z - t) * y) / (z - a);
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = x + ((y / (a - z)) * (t - z));
} else if (t_1 <= 2e-56) {
tmp = x + t_1;
} else {
tmp = x + ((z - t) / ((z - a) / y));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = ((z - t) * y) / (z - a) tmp = 0 if t_1 <= -math.inf: tmp = x + ((y / (a - z)) * (t - z)) elif t_1 <= 2e-56: tmp = x + t_1 else: tmp = x + ((z - t) / ((z - a) / y)) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(z - t) * y) / Float64(z - a)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(x + Float64(Float64(y / Float64(a - z)) * Float64(t - z))); elseif (t_1 <= 2e-56) tmp = Float64(x + t_1); else tmp = Float64(x + Float64(Float64(z - t) / Float64(Float64(z - a) / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = ((z - t) * y) / (z - a); tmp = 0.0; if (t_1 <= -Inf) tmp = x + ((y / (a - z)) * (t - z)); elseif (t_1 <= 2e-56) tmp = x + t_1; else tmp = x + ((z - t) / ((z - a) / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(x + N[(N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e-56], N[(x + t$95$1), $MachinePrecision], N[(x + N[(N[(z - t), $MachinePrecision] / N[(N[(z - a), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(z - t\right) \cdot y}{z - a}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;x + \frac{y}{a - z} \cdot \left(t - z\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-56}:\\
\;\;\;\;x + t\_1\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z - t}{\frac{z - a}{y}}\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < -inf.0Initial program 28.5%
+-commutative28.5%
associate-/l*99.9%
fma-define99.9%
Simplified99.9%
fma-undefine99.9%
associate-/l*28.5%
div-inv28.5%
*-commutative28.5%
associate-*r*99.7%
div-inv99.8%
Applied egg-rr99.8%
if -inf.0 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < 2.0000000000000001e-56Initial program 99.2%
if 2.0000000000000001e-56 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) Initial program 83.7%
+-commutative83.7%
associate-/l*94.6%
fma-define94.6%
Simplified94.6%
fma-undefine94.6%
associate-/l*83.7%
div-inv83.6%
*-commutative83.6%
associate-*r*99.6%
div-inv99.7%
Applied egg-rr99.7%
clear-num99.6%
un-div-inv99.8%
Applied egg-rr99.8%
Final simplification99.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -6.8e+22) (not (<= z 6.8e+22))) (+ x (* y (/ (- z t) z))) (+ x (/ (* t y) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -6.8e+22) || !(z <= 6.8e+22)) {
tmp = x + (y * ((z - t) / 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 <= (-6.8d+22)) .or. (.not. (z <= 6.8d+22))) then
tmp = x + (y * ((z - t) / 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 <= -6.8e+22) || !(z <= 6.8e+22)) {
tmp = x + (y * ((z - t) / z));
} else {
tmp = x + ((t * y) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -6.8e+22) or not (z <= 6.8e+22): tmp = x + (y * ((z - t) / z)) else: tmp = x + ((t * y) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -6.8e+22) || !(z <= 6.8e+22)) tmp = Float64(x + Float64(y * Float64(Float64(z - t) / z))); else tmp = Float64(x + Float64(Float64(t * y) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -6.8e+22) || ~((z <= 6.8e+22))) tmp = x + (y * ((z - t) / z)); else tmp = x + ((t * y) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -6.8e+22], N[Not[LessEqual[z, 6.8e+22]], $MachinePrecision]], N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.8 \cdot 10^{+22} \lor \neg \left(z \leq 6.8 \cdot 10^{+22}\right):\\
\;\;\;\;x + y \cdot \frac{z - t}{z}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{t \cdot y}{a}\\
\end{array}
\end{array}
if z < -6.8e22 or 6.8e22 < z Initial program 73.9%
Taylor expanded in a around 0 66.1%
+-commutative66.1%
associate-/l*86.2%
Simplified86.2%
if -6.8e22 < z < 6.8e22Initial program 99.1%
Taylor expanded in z around 0 85.3%
Final simplification85.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.35e-22) (not (<= a 1350000.0))) (+ x (* y (/ (- t z) a))) (+ x (* y (/ (- z t) z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.35e-22) || !(a <= 1350000.0)) {
tmp = x + (y * ((t - z) / a));
} else {
tmp = x + (y * ((z - 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 ((a <= (-1.35d-22)) .or. (.not. (a <= 1350000.0d0))) then
tmp = x + (y * ((t - z) / a))
else
tmp = x + (y * ((z - 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 ((a <= -1.35e-22) || !(a <= 1350000.0)) {
tmp = x + (y * ((t - z) / a));
} else {
tmp = x + (y * ((z - t) / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -1.35e-22) or not (a <= 1350000.0): tmp = x + (y * ((t - z) / a)) else: tmp = x + (y * ((z - t) / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.35e-22) || !(a <= 1350000.0)) tmp = Float64(x + Float64(y * Float64(Float64(t - z) / a))); else tmp = Float64(x + Float64(y * Float64(Float64(z - t) / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -1.35e-22) || ~((a <= 1350000.0))) tmp = x + (y * ((t - z) / a)); else tmp = x + (y * ((z - t) / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.35e-22], N[Not[LessEqual[a, 1350000.0]], $MachinePrecision]], N[(x + N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.35 \cdot 10^{-22} \lor \neg \left(a \leq 1350000\right):\\
\;\;\;\;x + y \cdot \frac{t - z}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z - t}{z}\\
\end{array}
\end{array}
if a < -1.3500000000000001e-22 or 1.35e6 < a Initial program 87.4%
Taylor expanded in a around inf 80.8%
mul-1-neg80.8%
unsub-neg80.8%
associate-/l*86.5%
Simplified86.5%
if -1.3500000000000001e-22 < a < 1.35e6Initial program 86.3%
Taylor expanded in a around 0 77.0%
+-commutative77.0%
associate-/l*86.1%
Simplified86.1%
Final simplification86.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.7e-22) (not (<= a 41000000.0))) (+ x (/ y (/ a (- t z)))) (+ x (* y (/ (- z t) z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.7e-22) || !(a <= 41000000.0)) {
tmp = x + (y / (a / (t - z)));
} else {
tmp = x + (y * ((z - 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 ((a <= (-1.7d-22)) .or. (.not. (a <= 41000000.0d0))) then
tmp = x + (y / (a / (t - z)))
else
tmp = x + (y * ((z - 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 ((a <= -1.7e-22) || !(a <= 41000000.0)) {
tmp = x + (y / (a / (t - z)));
} else {
tmp = x + (y * ((z - t) / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -1.7e-22) or not (a <= 41000000.0): tmp = x + (y / (a / (t - z))) else: tmp = x + (y * ((z - t) / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.7e-22) || !(a <= 41000000.0)) tmp = Float64(x + Float64(y / Float64(a / Float64(t - z)))); else tmp = Float64(x + Float64(y * Float64(Float64(z - t) / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -1.7e-22) || ~((a <= 41000000.0))) tmp = x + (y / (a / (t - z))); else tmp = x + (y * ((z - t) / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.7e-22], N[Not[LessEqual[a, 41000000.0]], $MachinePrecision]], N[(x + N[(y / N[(a / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.7 \cdot 10^{-22} \lor \neg \left(a \leq 41000000\right):\\
\;\;\;\;x + \frac{y}{\frac{a}{t - z}}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z - t}{z}\\
\end{array}
\end{array}
if a < -1.6999999999999999e-22 or 4.1e7 < a Initial program 87.4%
Taylor expanded in a around inf 80.8%
mul-1-neg80.8%
unsub-neg80.8%
associate-/l*86.5%
Simplified86.5%
clear-num86.5%
un-div-inv86.6%
Applied egg-rr86.6%
if -1.6999999999999999e-22 < a < 4.1e7Initial program 86.3%
Taylor expanded in a around 0 77.0%
+-commutative77.0%
associate-/l*86.1%
Simplified86.1%
Final simplification86.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -4e+27) (not (<= z 5e+49))) (+ x (* y (/ (- z t) z))) (- x (* t (/ y (- z a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -4e+27) || !(z <= 5e+49)) {
tmp = x + (y * ((z - t) / z));
} 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 <= (-4d+27)) .or. (.not. (z <= 5d+49))) then
tmp = x + (y * ((z - t) / z))
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 <= -4e+27) || !(z <= 5e+49)) {
tmp = x + (y * ((z - t) / z));
} else {
tmp = x - (t * (y / (z - a)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -4e+27) or not (z <= 5e+49): tmp = x + (y * ((z - t) / z)) else: tmp = x - (t * (y / (z - a))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -4e+27) || !(z <= 5e+49)) tmp = Float64(x + Float64(y * Float64(Float64(z - t) / z))); 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 <= -4e+27) || ~((z <= 5e+49))) tmp = x + (y * ((z - t) / z)); else tmp = x - (t * (y / (z - a))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -4e+27], N[Not[LessEqual[z, 5e+49]], $MachinePrecision]], N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / z), $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 -4 \cdot 10^{+27} \lor \neg \left(z \leq 5 \cdot 10^{+49}\right):\\
\;\;\;\;x + y \cdot \frac{z - t}{z}\\
\mathbf{else}:\\
\;\;\;\;x - t \cdot \frac{y}{z - a}\\
\end{array}
\end{array}
if z < -4.0000000000000001e27 or 5.0000000000000004e49 < z Initial program 73.2%
Taylor expanded in a around 0 65.7%
+-commutative65.7%
associate-/l*87.0%
Simplified87.0%
if -4.0000000000000001e27 < z < 5.0000000000000004e49Initial program 98.4%
Taylor expanded in t around inf 92.8%
mul-1-neg92.8%
associate-/l*92.5%
distribute-rgt-neg-in92.5%
distribute-frac-neg292.5%
sub-neg92.5%
distribute-neg-in92.5%
remove-double-neg92.5%
Simplified92.5%
Final simplification90.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.25e+21) (not (<= z 3.5e+49))) (+ x y) (+ x (/ (* t y) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.25e+21) || !(z <= 3.5e+49)) {
tmp = x + y;
} 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.25d+21)) .or. (.not. (z <= 3.5d+49))) then
tmp = x + y
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.25e+21) || !(z <= 3.5e+49)) {
tmp = x + y;
} else {
tmp = x + ((t * y) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.25e+21) or not (z <= 3.5e+49): tmp = x + y else: tmp = x + ((t * y) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.25e+21) || !(z <= 3.5e+49)) tmp = Float64(x + y); else tmp = Float64(x + Float64(Float64(t * y) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -2.25e+21) || ~((z <= 3.5e+49))) tmp = x + y; else tmp = x + ((t * y) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.25e+21], N[Not[LessEqual[z, 3.5e+49]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(x + N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.25 \cdot 10^{+21} \lor \neg \left(z \leq 3.5 \cdot 10^{+49}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + \frac{t \cdot y}{a}\\
\end{array}
\end{array}
if z < -2.25e21 or 3.49999999999999975e49 < z Initial program 73.2%
Taylor expanded in z around inf 76.6%
+-commutative76.6%
Simplified76.6%
if -2.25e21 < z < 3.49999999999999975e49Initial program 98.4%
Taylor expanded in z around 0 83.3%
Final simplification80.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.3e+20) (not (<= z 1e+43))) (+ x y) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.3e+20) || !(z <= 1e+43)) {
tmp = x + y;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-1.3d+20)) .or. (.not. (z <= 1d+43))) then
tmp = x + y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.3e+20) || !(z <= 1e+43)) {
tmp = x + y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.3e+20) or not (z <= 1e+43): tmp = x + y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.3e+20) || !(z <= 1e+43)) tmp = Float64(x + y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.3e+20) || ~((z <= 1e+43))) tmp = x + y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.3e+20], N[Not[LessEqual[z, 1e+43]], $MachinePrecision]], N[(x + y), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.3 \cdot 10^{+20} \lor \neg \left(z \leq 10^{+43}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.3e20 or 1.00000000000000001e43 < z Initial program 73.7%
Taylor expanded in z around inf 75.4%
+-commutative75.4%
Simplified75.4%
if -1.3e20 < z < 1.00000000000000001e43Initial program 98.4%
Taylor expanded in x around inf 59.7%
Final simplification67.0%
(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.9%
Taylor expanded in x around inf 53.1%
Final simplification53.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 2024055
(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))))