
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- a t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - 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 - t) / (a - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - t)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (a - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(a - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (a - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{a - t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- a t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - 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 - t) / (a - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - t)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (a - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(a - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (a - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{a - t}
\end{array}
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- a t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - 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 - t) / (a - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - t)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (a - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(a - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (a - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{a - t}
\end{array}
Initial program 97.7%
Final simplification97.7%
(FPCore (x y z t a)
:precision binary64
(if (<= t -1.05e+97)
(+ x y)
(if (<= t -5.2e+14)
(- x (/ y (/ t z)))
(if (<= t -2300.0)
(* t (/ y (- t a)))
(if (<= t 5.3e-27) (+ x (/ (* y z) a)) (+ x y))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.05e+97) {
tmp = x + y;
} else if (t <= -5.2e+14) {
tmp = x - (y / (t / z));
} else if (t <= -2300.0) {
tmp = t * (y / (t - a));
} else if (t <= 5.3e-27) {
tmp = x + ((y * z) / a);
} 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 (t <= (-1.05d+97)) then
tmp = x + y
else if (t <= (-5.2d+14)) then
tmp = x - (y / (t / z))
else if (t <= (-2300.0d0)) then
tmp = t * (y / (t - a))
else if (t <= 5.3d-27) then
tmp = x + ((y * z) / a)
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 (t <= -1.05e+97) {
tmp = x + y;
} else if (t <= -5.2e+14) {
tmp = x - (y / (t / z));
} else if (t <= -2300.0) {
tmp = t * (y / (t - a));
} else if (t <= 5.3e-27) {
tmp = x + ((y * z) / a);
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1.05e+97: tmp = x + y elif t <= -5.2e+14: tmp = x - (y / (t / z)) elif t <= -2300.0: tmp = t * (y / (t - a)) elif t <= 5.3e-27: tmp = x + ((y * z) / a) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.05e+97) tmp = Float64(x + y); elseif (t <= -5.2e+14) tmp = Float64(x - Float64(y / Float64(t / z))); elseif (t <= -2300.0) tmp = Float64(t * Float64(y / Float64(t - a))); elseif (t <= 5.3e-27) tmp = Float64(x + Float64(Float64(y * z) / a)); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -1.05e+97) tmp = x + y; elseif (t <= -5.2e+14) tmp = x - (y / (t / z)); elseif (t <= -2300.0) tmp = t * (y / (t - a)); elseif (t <= 5.3e-27) tmp = x + ((y * z) / a); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.05e+97], N[(x + y), $MachinePrecision], If[LessEqual[t, -5.2e+14], N[(x - N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -2300.0], N[(t * N[(y / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 5.3e-27], N[(x + N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.05 \cdot 10^{+97}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq -5.2 \cdot 10^{+14}:\\
\;\;\;\;x - \frac{y}{\frac{t}{z}}\\
\mathbf{elif}\;t \leq -2300:\\
\;\;\;\;t \cdot \frac{y}{t - a}\\
\mathbf{elif}\;t \leq 5.3 \cdot 10^{-27}:\\
\;\;\;\;x + \frac{y \cdot z}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if t < -1.05000000000000006e97 or 5.30000000000000006e-27 < t Initial program 100.0%
Taylor expanded in t around inf 78.2%
if -1.05000000000000006e97 < t < -5.2e14Initial program 99.8%
Taylor expanded in z around inf 83.9%
Taylor expanded in a around 0 65.1%
+-commutative65.1%
mul-1-neg65.1%
unsub-neg65.1%
associate-/l*75.9%
Simplified75.9%
if -5.2e14 < t < -2300Initial program 99.7%
+-commutative99.7%
*-commutative99.7%
associate-*l/99.7%
sub-neg99.7%
+-commutative99.7%
neg-sub099.7%
associate-+l-99.7%
sub0-neg99.7%
neg-mul-199.7%
times-frac99.5%
fma-def99.5%
sub-neg99.5%
+-commutative99.5%
neg-sub099.5%
associate-+l-99.5%
sub0-neg99.5%
neg-mul-199.5%
*-commutative99.5%
associate-/l*99.5%
metadata-eval99.5%
/-rgt-identity99.5%
Simplified99.5%
Taylor expanded in y around -inf 99.7%
*-commutative99.7%
associate-/l*99.7%
Simplified99.7%
Taylor expanded in z around 0 67.9%
*-commutative67.9%
associate-*r/67.6%
Simplified67.6%
if -2300 < t < 5.30000000000000006e-27Initial program 94.8%
Taylor expanded in t around 0 76.3%
Final simplification77.0%
(FPCore (x y z t a)
:precision binary64
(if (<= t -9e+97)
(+ x y)
(if (<= t -5.2e+14)
(- x (/ y (/ t z)))
(if (<= t -3100000.0)
(/ y (/ t (- t z)))
(if (<= t 5e-25) (+ x (/ (* y z) a)) (+ x y))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -9e+97) {
tmp = x + y;
} else if (t <= -5.2e+14) {
tmp = x - (y / (t / z));
} else if (t <= -3100000.0) {
tmp = y / (t / (t - z));
} else if (t <= 5e-25) {
tmp = x + ((y * z) / a);
} 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 (t <= (-9d+97)) then
tmp = x + y
else if (t <= (-5.2d+14)) then
tmp = x - (y / (t / z))
else if (t <= (-3100000.0d0)) then
tmp = y / (t / (t - z))
else if (t <= 5d-25) then
tmp = x + ((y * z) / a)
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 (t <= -9e+97) {
tmp = x + y;
} else if (t <= -5.2e+14) {
tmp = x - (y / (t / z));
} else if (t <= -3100000.0) {
tmp = y / (t / (t - z));
} else if (t <= 5e-25) {
tmp = x + ((y * z) / a);
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -9e+97: tmp = x + y elif t <= -5.2e+14: tmp = x - (y / (t / z)) elif t <= -3100000.0: tmp = y / (t / (t - z)) elif t <= 5e-25: tmp = x + ((y * z) / a) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -9e+97) tmp = Float64(x + y); elseif (t <= -5.2e+14) tmp = Float64(x - Float64(y / Float64(t / z))); elseif (t <= -3100000.0) tmp = Float64(y / Float64(t / Float64(t - z))); elseif (t <= 5e-25) tmp = Float64(x + Float64(Float64(y * z) / a)); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -9e+97) tmp = x + y; elseif (t <= -5.2e+14) tmp = x - (y / (t / z)); elseif (t <= -3100000.0) tmp = y / (t / (t - z)); elseif (t <= 5e-25) tmp = x + ((y * z) / a); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -9e+97], N[(x + y), $MachinePrecision], If[LessEqual[t, -5.2e+14], N[(x - N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -3100000.0], N[(y / N[(t / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 5e-25], N[(x + N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9 \cdot 10^{+97}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq -5.2 \cdot 10^{+14}:\\
\;\;\;\;x - \frac{y}{\frac{t}{z}}\\
\mathbf{elif}\;t \leq -3100000:\\
\;\;\;\;\frac{y}{\frac{t}{t - z}}\\
\mathbf{elif}\;t \leq 5 \cdot 10^{-25}:\\
\;\;\;\;x + \frac{y \cdot z}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if t < -8.99999999999999952e97 or 4.99999999999999962e-25 < t Initial program 100.0%
Taylor expanded in t around inf 78.2%
if -8.99999999999999952e97 < t < -5.2e14Initial program 99.8%
Taylor expanded in z around inf 83.9%
Taylor expanded in a around 0 65.1%
+-commutative65.1%
mul-1-neg65.1%
unsub-neg65.1%
associate-/l*75.9%
Simplified75.9%
if -5.2e14 < t < -3.1e6Initial program 99.7%
+-commutative99.7%
*-commutative99.7%
associate-*l/99.7%
sub-neg99.7%
+-commutative99.7%
neg-sub099.7%
associate-+l-99.7%
sub0-neg99.7%
neg-mul-199.7%
times-frac99.4%
fma-def99.4%
sub-neg99.4%
+-commutative99.4%
neg-sub099.4%
associate-+l-99.4%
sub0-neg99.4%
neg-mul-199.4%
*-commutative99.4%
associate-/l*99.4%
metadata-eval99.4%
/-rgt-identity99.4%
Simplified99.4%
Taylor expanded in y around -inf 99.7%
*-commutative99.7%
associate-/l*99.7%
Simplified99.7%
Taylor expanded in a around 0 80.5%
associate-/l*80.8%
Simplified80.8%
if -3.1e6 < t < 4.99999999999999962e-25Initial program 94.9%
Taylor expanded in t around 0 75.7%
Final simplification77.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -6e+96) (not (<= t 1.9e+133))) (+ x y) (+ x (* y (/ z (- a t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -6e+96) || !(t <= 1.9e+133)) {
tmp = x + y;
} else {
tmp = x + (y * (z / (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) :: tmp
if ((t <= (-6d+96)) .or. (.not. (t <= 1.9d+133))) then
tmp = x + y
else
tmp = x + (y * (z / (a - t)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -6e+96) || !(t <= 1.9e+133)) {
tmp = x + y;
} else {
tmp = x + (y * (z / (a - t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -6e+96) or not (t <= 1.9e+133): tmp = x + y else: tmp = x + (y * (z / (a - t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -6e+96) || !(t <= 1.9e+133)) tmp = Float64(x + y); else tmp = Float64(x + Float64(y * Float64(z / Float64(a - t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -6e+96) || ~((t <= 1.9e+133))) tmp = x + y; else tmp = x + (y * (z / (a - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -6e+96], N[Not[LessEqual[t, 1.9e+133]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(x + N[(y * N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6 \cdot 10^{+96} \lor \neg \left(t \leq 1.9 \cdot 10^{+133}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{a - t}\\
\end{array}
\end{array}
if t < -6.0000000000000001e96 or 1.9000000000000001e133 < t Initial program 100.0%
Taylor expanded in t around inf 80.9%
if -6.0000000000000001e96 < t < 1.9000000000000001e133Initial program 96.6%
Taylor expanded in z around inf 84.9%
Final simplification83.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -6.5e+84) (not (<= z 4.7e+27))) (+ x (* y (/ z (- a t)))) (- x (/ y (+ (/ a t) -1.0)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -6.5e+84) || !(z <= 4.7e+27)) {
tmp = x + (y * (z / (a - t)));
} else {
tmp = x - (y / ((a / t) + -1.0));
}
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+84)) .or. (.not. (z <= 4.7d+27))) then
tmp = x + (y * (z / (a - t)))
else
tmp = x - (y / ((a / t) + (-1.0d0)))
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+84) || !(z <= 4.7e+27)) {
tmp = x + (y * (z / (a - t)));
} else {
tmp = x - (y / ((a / t) + -1.0));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -6.5e+84) or not (z <= 4.7e+27): tmp = x + (y * (z / (a - t))) else: tmp = x - (y / ((a / t) + -1.0)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -6.5e+84) || !(z <= 4.7e+27)) tmp = Float64(x + Float64(y * Float64(z / Float64(a - t)))); else tmp = Float64(x - Float64(y / Float64(Float64(a / t) + -1.0))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -6.5e+84) || ~((z <= 4.7e+27))) tmp = x + (y * (z / (a - t))); else tmp = x - (y / ((a / t) + -1.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -6.5e+84], N[Not[LessEqual[z, 4.7e+27]], $MachinePrecision]], N[(x + N[(y * N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(y / N[(N[(a / t), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.5 \cdot 10^{+84} \lor \neg \left(z \leq 4.7 \cdot 10^{+27}\right):\\
\;\;\;\;x + y \cdot \frac{z}{a - t}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{\frac{a}{t} + -1}\\
\end{array}
\end{array}
if z < -6.50000000000000027e84 or 4.69999999999999976e27 < z Initial program 95.3%
Taylor expanded in z around inf 89.4%
if -6.50000000000000027e84 < z < 4.69999999999999976e27Initial program 99.3%
Taylor expanded in z around 0 77.1%
+-commutative77.1%
mul-1-neg77.1%
unsub-neg77.1%
associate-/l*91.3%
div-sub91.3%
*-inverses91.3%
Simplified91.3%
Final simplification90.5%
(FPCore (x y z t a) :precision binary64 (if (<= t -1.2e-17) (+ x y) (if (<= t 2e-26) (+ x (* y (/ z a))) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.2e-17) {
tmp = x + y;
} else if (t <= 2e-26) {
tmp = x + (y * (z / a));
} 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 (t <= (-1.2d-17)) then
tmp = x + y
else if (t <= 2d-26) then
tmp = x + (y * (z / a))
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 (t <= -1.2e-17) {
tmp = x + y;
} else if (t <= 2e-26) {
tmp = x + (y * (z / a));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1.2e-17: tmp = x + y elif t <= 2e-26: tmp = x + (y * (z / a)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.2e-17) tmp = Float64(x + y); elseif (t <= 2e-26) tmp = Float64(x + Float64(y * Float64(z / a))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -1.2e-17) tmp = x + y; elseif (t <= 2e-26) tmp = x + (y * (z / a)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.2e-17], N[(x + y), $MachinePrecision], If[LessEqual[t, 2e-26], N[(x + N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.2 \cdot 10^{-17}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq 2 \cdot 10^{-26}:\\
\;\;\;\;x + y \cdot \frac{z}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if t < -1.19999999999999993e-17 or 2.0000000000000001e-26 < t Initial program 99.9%
Taylor expanded in t around inf 73.5%
if -1.19999999999999993e-17 < t < 2.0000000000000001e-26Initial program 94.6%
Taylor expanded in t around 0 76.1%
Final simplification74.6%
(FPCore (x y z t a) :precision binary64 (if (<= t -1.6e-21) (+ x y) (if (<= t 1.85e-22) (+ x (/ y (/ a z))) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.6e-21) {
tmp = x + y;
} else if (t <= 1.85e-22) {
tmp = x + (y / (a / 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 (t <= (-1.6d-21)) then
tmp = x + y
else if (t <= 1.85d-22) then
tmp = x + (y / (a / 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 (t <= -1.6e-21) {
tmp = x + y;
} else if (t <= 1.85e-22) {
tmp = x + (y / (a / z));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1.6e-21: tmp = x + y elif t <= 1.85e-22: tmp = x + (y / (a / z)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.6e-21) tmp = Float64(x + y); elseif (t <= 1.85e-22) tmp = Float64(x + Float64(y / Float64(a / z))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -1.6e-21) tmp = x + y; elseif (t <= 1.85e-22) tmp = x + (y / (a / z)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.6e-21], N[(x + y), $MachinePrecision], If[LessEqual[t, 1.85e-22], N[(x + N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.6 \cdot 10^{-21}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq 1.85 \cdot 10^{-22}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if t < -1.6000000000000001e-21 or 1.85e-22 < t Initial program 99.9%
Taylor expanded in t around inf 73.5%
if -1.6000000000000001e-21 < t < 1.85e-22Initial program 94.6%
Taylor expanded in t around 0 77.2%
associate-/l*76.7%
Simplified76.7%
Final simplification74.9%
(FPCore (x y z t a) :precision binary64 (if (<= t -2.3e-22) (+ x y) (if (<= t 1.2e-29) (+ x (/ (* y z) a)) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2.3e-22) {
tmp = x + y;
} else if (t <= 1.2e-29) {
tmp = x + ((y * z) / a);
} 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 (t <= (-2.3d-22)) then
tmp = x + y
else if (t <= 1.2d-29) then
tmp = x + ((y * z) / a)
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 (t <= -2.3e-22) {
tmp = x + y;
} else if (t <= 1.2e-29) {
tmp = x + ((y * z) / a);
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -2.3e-22: tmp = x + y elif t <= 1.2e-29: tmp = x + ((y * z) / a) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -2.3e-22) tmp = Float64(x + y); elseif (t <= 1.2e-29) tmp = Float64(x + Float64(Float64(y * z) / a)); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -2.3e-22) tmp = x + y; elseif (t <= 1.2e-29) tmp = x + ((y * z) / a); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -2.3e-22], N[(x + y), $MachinePrecision], If[LessEqual[t, 1.2e-29], N[(x + N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.3 \cdot 10^{-22}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq 1.2 \cdot 10^{-29}:\\
\;\;\;\;x + \frac{y \cdot z}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if t < -2.2999999999999998e-22 or 1.19999999999999996e-29 < t Initial program 99.9%
Taylor expanded in t around inf 73.5%
if -2.2999999999999998e-22 < t < 1.19999999999999996e-29Initial program 94.6%
Taylor expanded in t around 0 77.2%
Final simplification75.1%
(FPCore (x y z t a) :precision binary64 (if (<= z -7.8e+180) (* (- t z) (/ y t)) (+ x y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -7.8e+180) {
tmp = (t - z) * (y / 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 <= (-7.8d+180)) then
tmp = (t - z) * (y / 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 <= -7.8e+180) {
tmp = (t - z) * (y / t);
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -7.8e+180: tmp = (t - z) * (y / t) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -7.8e+180) tmp = Float64(Float64(t - z) * Float64(y / t)); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -7.8e+180) tmp = (t - z) * (y / t); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -7.8e+180], N[(N[(t - z), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.8 \cdot 10^{+180}:\\
\;\;\;\;\left(t - z\right) \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -7.8000000000000002e180Initial program 93.9%
+-commutative93.9%
*-commutative93.9%
associate-*l/80.2%
sub-neg80.2%
+-commutative80.2%
neg-sub080.2%
associate-+l-80.2%
sub0-neg80.2%
neg-mul-180.2%
times-frac92.5%
fma-def92.5%
sub-neg92.5%
+-commutative92.5%
neg-sub092.5%
associate-+l-92.5%
sub0-neg92.5%
neg-mul-192.5%
*-commutative92.5%
associate-/l*92.5%
metadata-eval92.5%
/-rgt-identity92.5%
Simplified92.5%
Taylor expanded in y around -inf 71.1%
*-commutative71.1%
associate-/l*73.7%
Simplified73.7%
Taylor expanded in a around 0 44.2%
associate-/l*49.8%
Simplified49.8%
Taylor expanded in y around 0 44.2%
associate-/l*49.8%
associate-/r/51.6%
Simplified51.6%
if -7.8000000000000002e180 < z Initial program 98.2%
Taylor expanded in t around inf 64.5%
Final simplification62.8%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.6e+182) (* y (/ (- z) t)) (+ x y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.6e+182) {
tmp = y * (-z / 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.6d+182)) then
tmp = y * (-z / 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.6e+182) {
tmp = y * (-z / t);
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.6e+182: tmp = y * (-z / t) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.6e+182) tmp = Float64(y * Float64(Float64(-z) / 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.6e+182) tmp = y * (-z / t); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.6e+182], N[(y * N[((-z) / t), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.6 \cdot 10^{+182}:\\
\;\;\;\;y \cdot \frac{-z}{t}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -1.5999999999999999e182Initial program 93.9%
+-commutative93.9%
*-commutative93.9%
associate-*l/80.2%
sub-neg80.2%
+-commutative80.2%
neg-sub080.2%
associate-+l-80.2%
sub0-neg80.2%
neg-mul-180.2%
times-frac92.5%
fma-def92.5%
sub-neg92.5%
+-commutative92.5%
neg-sub092.5%
associate-+l-92.5%
sub0-neg92.5%
neg-mul-192.5%
*-commutative92.5%
associate-/l*92.5%
metadata-eval92.5%
/-rgt-identity92.5%
Simplified92.5%
Taylor expanded in y around -inf 71.1%
*-commutative71.1%
associate-/l*73.7%
Simplified73.7%
Taylor expanded in a around 0 44.2%
associate-/l*49.8%
Simplified49.8%
Taylor expanded in t around 0 43.7%
mul-1-neg43.7%
associate-*r/46.5%
distribute-lft-neg-out46.5%
Simplified46.5%
if -1.5999999999999999e182 < z Initial program 98.2%
Taylor expanded in t around inf 64.5%
Final simplification62.2%
(FPCore (x y z t a) :precision binary64 (if (<= z -4.5e+181) (/ y (/ (- t) z)) (+ x y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.5e+181) {
tmp = y / (-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 (z <= (-4.5d+181)) then
tmp = y / (-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 (z <= -4.5e+181) {
tmp = y / (-t / z);
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -4.5e+181: tmp = y / (-t / z) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -4.5e+181) tmp = Float64(y / Float64(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 (z <= -4.5e+181) tmp = y / (-t / z); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4.5e+181], N[(y / N[((-t) / z), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.5 \cdot 10^{+181}:\\
\;\;\;\;\frac{y}{\frac{-t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -4.5e181Initial program 93.9%
+-commutative93.9%
*-commutative93.9%
associate-*l/80.2%
sub-neg80.2%
+-commutative80.2%
neg-sub080.2%
associate-+l-80.2%
sub0-neg80.2%
neg-mul-180.2%
times-frac92.5%
fma-def92.5%
sub-neg92.5%
+-commutative92.5%
neg-sub092.5%
associate-+l-92.5%
sub0-neg92.5%
neg-mul-192.5%
*-commutative92.5%
associate-/l*92.5%
metadata-eval92.5%
/-rgt-identity92.5%
Simplified92.5%
Taylor expanded in y around -inf 71.1%
*-commutative71.1%
associate-/l*73.7%
Simplified73.7%
Taylor expanded in a around 0 44.2%
associate-/l*49.8%
Simplified49.8%
Taylor expanded in t around 0 46.6%
associate-*r/46.6%
neg-mul-146.6%
Simplified46.6%
if -4.5e181 < z Initial program 98.2%
Taylor expanded in t around inf 64.5%
Final simplification62.2%
(FPCore (x y z t a) :precision binary64 (if (<= x -1.32e-141) x (if (<= x 3.2e-201) y x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -1.32e-141) {
tmp = x;
} else if (x <= 3.2e-201) {
tmp = 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 (x <= (-1.32d-141)) then
tmp = x
else if (x <= 3.2d-201) then
tmp = 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 (x <= -1.32e-141) {
tmp = x;
} else if (x <= 3.2e-201) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -1.32e-141: tmp = x elif x <= 3.2e-201: tmp = y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -1.32e-141) tmp = x; elseif (x <= 3.2e-201) tmp = y; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -1.32e-141) tmp = x; elseif (x <= 3.2e-201) tmp = y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -1.32e-141], x, If[LessEqual[x, 3.2e-201], y, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.32 \cdot 10^{-141}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 3.2 \cdot 10^{-201}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.3199999999999999e-141 or 3.2000000000000001e-201 < x Initial program 98.5%
Taylor expanded in x around inf 57.6%
if -1.3199999999999999e-141 < x < 3.2000000000000001e-201Initial program 94.8%
+-commutative94.8%
*-commutative94.8%
associate-*l/86.6%
sub-neg86.6%
+-commutative86.6%
neg-sub086.6%
associate-+l-86.6%
sub0-neg86.6%
neg-mul-186.6%
times-frac90.4%
fma-def90.4%
sub-neg90.4%
+-commutative90.4%
neg-sub090.4%
associate-+l-90.4%
sub0-neg90.4%
neg-mul-190.4%
*-commutative90.4%
associate-/l*90.4%
metadata-eval90.4%
/-rgt-identity90.4%
Simplified90.4%
Taylor expanded in y around -inf 73.8%
*-commutative73.8%
associate-/l*76.6%
Simplified76.6%
Taylor expanded in t around inf 39.2%
Final simplification53.5%
(FPCore (x y z t a) :precision binary64 (if (<= a -9e+128) x (+ x y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -9e+128) {
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 <= (-9d+128)) 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 <= -9e+128) {
tmp = x;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -9e+128: tmp = x else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -9e+128) 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 <= -9e+128) tmp = x; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -9e+128], x, N[(x + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -9 \cdot 10^{+128}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if a < -9.0000000000000003e128Initial program 97.6%
Taylor expanded in x around inf 73.7%
if -9.0000000000000003e128 < a Initial program 97.7%
Taylor expanded in t around inf 60.9%
Final simplification62.9%
(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 97.7%
Taylor expanded in x around inf 48.2%
Final simplification48.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* y (/ (- z t) (- a t))))))
(if (< y -8.508084860551241e-17)
t_1
(if (< y 2.894426862792089e-49)
(+ x (* (* y (- z t)) (/ 1.0 (- a t))))
t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (y * ((z - t) / (a - t)));
double tmp;
if (y < -8.508084860551241e-17) {
tmp = t_1;
} else if (y < 2.894426862792089e-49) {
tmp = x + ((y * (z - t)) * (1.0 / (a - t)));
} 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) :: tmp
t_1 = x + (y * ((z - t) / (a - t)))
if (y < (-8.508084860551241d-17)) then
tmp = t_1
else if (y < 2.894426862792089d-49) then
tmp = x + ((y * (z - t)) * (1.0d0 / (a - t)))
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 = x + (y * ((z - t) / (a - t)));
double tmp;
if (y < -8.508084860551241e-17) {
tmp = t_1;
} else if (y < 2.894426862792089e-49) {
tmp = x + ((y * (z - t)) * (1.0 / (a - t)));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (y * ((z - t) / (a - t))) tmp = 0 if y < -8.508084860551241e-17: tmp = t_1 elif y < 2.894426862792089e-49: tmp = x + ((y * (z - t)) * (1.0 / (a - t))) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(y * Float64(Float64(z - t) / Float64(a - t)))) tmp = 0.0 if (y < -8.508084860551241e-17) tmp = t_1; elseif (y < 2.894426862792089e-49) tmp = Float64(x + Float64(Float64(y * Float64(z - t)) * Float64(1.0 / Float64(a - t)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (y * ((z - t) / (a - t))); tmp = 0.0; if (y < -8.508084860551241e-17) tmp = t_1; elseif (y < 2.894426862792089e-49) tmp = x + ((y * (z - t)) * (1.0 / (a - t))); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[y, -8.508084860551241e-17], t$95$1, If[Less[y, 2.894426862792089e-49], N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + y \cdot \frac{z - t}{a - t}\\
\mathbf{if}\;y < -8.508084860551241 \cdot 10^{-17}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y < 2.894426862792089 \cdot 10^{-49}:\\
\;\;\;\;x + \left(y \cdot \left(z - t\right)\right) \cdot \frac{1}{a - t}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
herbie shell --seed 2023173
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisLine from plot-0.2.3.4, B"
:precision binary64
:herbie-target
(if (< y -8.508084860551241e-17) (+ x (* y (/ (- z t) (- a t)))) (if (< y 2.894426862792089e-49) (+ x (* (* y (- z t)) (/ 1.0 (- a t)))) (+ x (* y (/ (- z t) (- a t))))))
(+ x (* y (/ (- z t) (- a t)))))