
(FPCore (x y z t a) :precision binary64 (- x (/ (- y z) (/ (+ (- t z) 1.0) a))))
double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / 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) + 1.0d0) / a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / a));
}
def code(x, y, z, t, a): return x - ((y - z) / (((t - z) + 1.0) / a))
function code(x, y, z, t, a) return Float64(x - Float64(Float64(y - z) / Float64(Float64(Float64(t - z) + 1.0) / a))) end
function tmp = code(x, y, z, t, a) tmp = x - ((y - z) / (((t - z) + 1.0) / a)); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(y - z), $MachinePrecision] / N[(N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y - z}{\frac{\left(t - z\right) + 1}{a}}
\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 z) 1.0) a))))
double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / 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) + 1.0d0) / a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / a));
}
def code(x, y, z, t, a): return x - ((y - z) / (((t - z) + 1.0) / a))
function code(x, y, z, t, a) return Float64(x - Float64(Float64(y - z) / Float64(Float64(Float64(t - z) + 1.0) / a))) end
function tmp = code(x, y, z, t, a) tmp = x - ((y - z) / (((t - z) + 1.0) / a)); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(y - z), $MachinePrecision] / N[(N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y - z}{\frac{\left(t - z\right) + 1}{a}}
\end{array}
(FPCore (x y z t a) :precision binary64 (fma (/ (- z y) (+ (- t z) 1.0)) a x))
double code(double x, double y, double z, double t, double a) {
return fma(((z - y) / ((t - z) + 1.0)), a, x);
}
function code(x, y, z, t, a) return fma(Float64(Float64(z - y) / Float64(Float64(t - z) + 1.0)), a, x) end
code[x_, y_, z_, t_, a_] := N[(N[(N[(z - y), $MachinePrecision] / N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{z - y}{\left(t - z\right) + 1}, a, x\right)
\end{array}
Initial program 98.3%
sub-neg98.3%
+-commutative98.3%
associate-/r/99.9%
distribute-lft-neg-in99.9%
fma-def99.9%
distribute-neg-frac99.9%
sub-neg99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
+-commutative99.9%
sub-neg99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* a (- z y)))) (t_2 (- x (* y (/ a t)))))
(if (<= z -7.2e+70)
(- x a)
(if (<= z -1.75e-40)
t_2
(if (<= z -1.85e-202)
t_1
(if (<= z -7.8e-235) t_2 (if (<= z 4.8e-43) t_1 (- x a))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (a * (z - y));
double t_2 = x - (y * (a / t));
double tmp;
if (z <= -7.2e+70) {
tmp = x - a;
} else if (z <= -1.75e-40) {
tmp = t_2;
} else if (z <= -1.85e-202) {
tmp = t_1;
} else if (z <= -7.8e-235) {
tmp = t_2;
} else if (z <= 4.8e-43) {
tmp = t_1;
} else {
tmp = x - 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = x + (a * (z - y))
t_2 = x - (y * (a / t))
if (z <= (-7.2d+70)) then
tmp = x - a
else if (z <= (-1.75d-40)) then
tmp = t_2
else if (z <= (-1.85d-202)) then
tmp = t_1
else if (z <= (-7.8d-235)) then
tmp = t_2
else if (z <= 4.8d-43) then
tmp = t_1
else
tmp = x - a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x + (a * (z - y));
double t_2 = x - (y * (a / t));
double tmp;
if (z <= -7.2e+70) {
tmp = x - a;
} else if (z <= -1.75e-40) {
tmp = t_2;
} else if (z <= -1.85e-202) {
tmp = t_1;
} else if (z <= -7.8e-235) {
tmp = t_2;
} else if (z <= 4.8e-43) {
tmp = t_1;
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (a * (z - y)) t_2 = x - (y * (a / t)) tmp = 0 if z <= -7.2e+70: tmp = x - a elif z <= -1.75e-40: tmp = t_2 elif z <= -1.85e-202: tmp = t_1 elif z <= -7.8e-235: tmp = t_2 elif z <= 4.8e-43: tmp = t_1 else: tmp = x - a return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(a * Float64(z - y))) t_2 = Float64(x - Float64(y * Float64(a / t))) tmp = 0.0 if (z <= -7.2e+70) tmp = Float64(x - a); elseif (z <= -1.75e-40) tmp = t_2; elseif (z <= -1.85e-202) tmp = t_1; elseif (z <= -7.8e-235) tmp = t_2; elseif (z <= 4.8e-43) tmp = t_1; else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (a * (z - y)); t_2 = x - (y * (a / t)); tmp = 0.0; if (z <= -7.2e+70) tmp = x - a; elseif (z <= -1.75e-40) tmp = t_2; elseif (z <= -1.85e-202) tmp = t_1; elseif (z <= -7.8e-235) tmp = t_2; elseif (z <= 4.8e-43) tmp = t_1; else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(a * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x - N[(y * N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7.2e+70], N[(x - a), $MachinePrecision], If[LessEqual[z, -1.75e-40], t$95$2, If[LessEqual[z, -1.85e-202], t$95$1, If[LessEqual[z, -7.8e-235], t$95$2, If[LessEqual[z, 4.8e-43], t$95$1, N[(x - a), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + a \cdot \left(z - y\right)\\
t_2 := x - y \cdot \frac{a}{t}\\
\mathbf{if}\;z \leq -7.2 \cdot 10^{+70}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq -1.75 \cdot 10^{-40}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq -1.85 \cdot 10^{-202}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -7.8 \cdot 10^{-235}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{-43}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -7.1999999999999999e70 or 4.8000000000000004e-43 < z Initial program 96.3%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around inf 81.8%
if -7.1999999999999999e70 < z < -1.7500000000000001e-40 or -1.84999999999999995e-202 < z < -7.79999999999999939e-235Initial program 99.9%
associate-/r/99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in t around inf 74.8%
associate-/l*85.2%
Simplified85.2%
Taylor expanded in y around inf 74.7%
associate-*r/85.0%
Simplified85.0%
if -1.7500000000000001e-40 < z < -1.84999999999999995e-202 or -7.79999999999999939e-235 < z < 4.8000000000000004e-43Initial program 99.8%
Taylor expanded in z around 0 99.8%
Taylor expanded in t around 0 83.6%
Final simplification83.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* a (- z y)))))
(if (<= z -1.55e+69)
(- x a)
(if (<= z -3.3e-39)
(- x (/ a (/ t y)))
(if (<= z -4.5e-202)
t_1
(if (<= z -1.7e-235)
(- x (* y (/ a t)))
(if (<= z 4.8e-43) t_1 (- x a))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (a * (z - y));
double tmp;
if (z <= -1.55e+69) {
tmp = x - a;
} else if (z <= -3.3e-39) {
tmp = x - (a / (t / y));
} else if (z <= -4.5e-202) {
tmp = t_1;
} else if (z <= -1.7e-235) {
tmp = x - (y * (a / t));
} else if (z <= 4.8e-43) {
tmp = t_1;
} else {
tmp = x - 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) :: t_1
real(8) :: tmp
t_1 = x + (a * (z - y))
if (z <= (-1.55d+69)) then
tmp = x - a
else if (z <= (-3.3d-39)) then
tmp = x - (a / (t / y))
else if (z <= (-4.5d-202)) then
tmp = t_1
else if (z <= (-1.7d-235)) then
tmp = x - (y * (a / t))
else if (z <= 4.8d-43) then
tmp = t_1
else
tmp = x - a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x + (a * (z - y));
double tmp;
if (z <= -1.55e+69) {
tmp = x - a;
} else if (z <= -3.3e-39) {
tmp = x - (a / (t / y));
} else if (z <= -4.5e-202) {
tmp = t_1;
} else if (z <= -1.7e-235) {
tmp = x - (y * (a / t));
} else if (z <= 4.8e-43) {
tmp = t_1;
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (a * (z - y)) tmp = 0 if z <= -1.55e+69: tmp = x - a elif z <= -3.3e-39: tmp = x - (a / (t / y)) elif z <= -4.5e-202: tmp = t_1 elif z <= -1.7e-235: tmp = x - (y * (a / t)) elif z <= 4.8e-43: tmp = t_1 else: tmp = x - a return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(a * Float64(z - y))) tmp = 0.0 if (z <= -1.55e+69) tmp = Float64(x - a); elseif (z <= -3.3e-39) tmp = Float64(x - Float64(a / Float64(t / y))); elseif (z <= -4.5e-202) tmp = t_1; elseif (z <= -1.7e-235) tmp = Float64(x - Float64(y * Float64(a / t))); elseif (z <= 4.8e-43) tmp = t_1; else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (a * (z - y)); tmp = 0.0; if (z <= -1.55e+69) tmp = x - a; elseif (z <= -3.3e-39) tmp = x - (a / (t / y)); elseif (z <= -4.5e-202) tmp = t_1; elseif (z <= -1.7e-235) tmp = x - (y * (a / t)); elseif (z <= 4.8e-43) tmp = t_1; else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(a * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.55e+69], N[(x - a), $MachinePrecision], If[LessEqual[z, -3.3e-39], N[(x - N[(a / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -4.5e-202], t$95$1, If[LessEqual[z, -1.7e-235], N[(x - N[(y * N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.8e-43], t$95$1, N[(x - a), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + a \cdot \left(z - y\right)\\
\mathbf{if}\;z \leq -1.55 \cdot 10^{+69}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq -3.3 \cdot 10^{-39}:\\
\;\;\;\;x - \frac{a}{\frac{t}{y}}\\
\mathbf{elif}\;z \leq -4.5 \cdot 10^{-202}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -1.7 \cdot 10^{-235}:\\
\;\;\;\;x - y \cdot \frac{a}{t}\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{-43}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -1.5499999999999999e69 or 4.8000000000000004e-43 < z Initial program 96.3%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around inf 81.8%
if -1.5499999999999999e69 < z < -3.29999999999999985e-39Initial program 99.9%
associate-/r/99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in t around inf 67.3%
associate-/l*77.8%
Simplified77.8%
Taylor expanded in y around inf 67.1%
*-commutative67.1%
associate-/l*77.5%
Simplified77.5%
if -3.29999999999999985e-39 < z < -4.50000000000000039e-202 or -1.69999999999999986e-235 < z < 4.8000000000000004e-43Initial program 99.8%
Taylor expanded in z around 0 99.8%
Taylor expanded in t around 0 83.6%
if -4.50000000000000039e-202 < z < -1.69999999999999986e-235Initial program 99.8%
associate-/r/99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in t around inf 89.8%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around inf 89.8%
associate-*r/100.0%
Simplified100.0%
Final simplification83.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -17000000.0) (not (<= z 5.9e+78))) (- x (/ a (/ (- 1.0 z) (- y z)))) (+ x (/ (- z y) (/ (+ t 1.0) a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -17000000.0) || !(z <= 5.9e+78)) {
tmp = x - (a / ((1.0 - z) / (y - z)));
} else {
tmp = x + ((z - y) / ((t + 1.0) / 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 <= (-17000000.0d0)) .or. (.not. (z <= 5.9d+78))) then
tmp = x - (a / ((1.0d0 - z) / (y - z)))
else
tmp = x + ((z - y) / ((t + 1.0d0) / 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 <= -17000000.0) || !(z <= 5.9e+78)) {
tmp = x - (a / ((1.0 - z) / (y - z)));
} else {
tmp = x + ((z - y) / ((t + 1.0) / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -17000000.0) or not (z <= 5.9e+78): tmp = x - (a / ((1.0 - z) / (y - z))) else: tmp = x + ((z - y) / ((t + 1.0) / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -17000000.0) || !(z <= 5.9e+78)) tmp = Float64(x - Float64(a / Float64(Float64(1.0 - z) / Float64(y - z)))); else tmp = Float64(x + Float64(Float64(z - y) / Float64(Float64(t + 1.0) / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -17000000.0) || ~((z <= 5.9e+78))) tmp = x - (a / ((1.0 - z) / (y - z))); else tmp = x + ((z - y) / ((t + 1.0) / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -17000000.0], N[Not[LessEqual[z, 5.9e+78]], $MachinePrecision]], N[(x - N[(a / N[(N[(1.0 - z), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(z - y), $MachinePrecision] / N[(N[(t + 1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -17000000 \lor \neg \left(z \leq 5.9 \cdot 10^{+78}\right):\\
\;\;\;\;x - \frac{a}{\frac{1 - z}{y - z}}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z - y}{\frac{t + 1}{a}}\\
\end{array}
\end{array}
if z < -1.7e7 or 5.9e78 < z Initial program 95.8%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in t around 0 71.4%
associate-/l*93.3%
Simplified93.3%
if -1.7e7 < z < 5.9e78Initial program 99.8%
Taylor expanded in z around 0 96.6%
Final simplification95.3%
(FPCore (x y z t a) :precision binary64 (if (<= t -3.6e+18) (- x (/ a (/ t (- y z)))) (if (<= t 5.5e+27) (- x (/ a (/ (- 1.0 z) (- y z)))) (- x (/ a (/ t y))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -3.6e+18) {
tmp = x - (a / (t / (y - z)));
} else if (t <= 5.5e+27) {
tmp = x - (a / ((1.0 - z) / (y - z)));
} else {
tmp = x - (a / (t / 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 <= (-3.6d+18)) then
tmp = x - (a / (t / (y - z)))
else if (t <= 5.5d+27) then
tmp = x - (a / ((1.0d0 - z) / (y - z)))
else
tmp = x - (a / (t / 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 <= -3.6e+18) {
tmp = x - (a / (t / (y - z)));
} else if (t <= 5.5e+27) {
tmp = x - (a / ((1.0 - z) / (y - z)));
} else {
tmp = x - (a / (t / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -3.6e+18: tmp = x - (a / (t / (y - z))) elif t <= 5.5e+27: tmp = x - (a / ((1.0 - z) / (y - z))) else: tmp = x - (a / (t / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -3.6e+18) tmp = Float64(x - Float64(a / Float64(t / Float64(y - z)))); elseif (t <= 5.5e+27) tmp = Float64(x - Float64(a / Float64(Float64(1.0 - z) / Float64(y - z)))); else tmp = Float64(x - Float64(a / Float64(t / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -3.6e+18) tmp = x - (a / (t / (y - z))); elseif (t <= 5.5e+27) tmp = x - (a / ((1.0 - z) / (y - z))); else tmp = x - (a / (t / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -3.6e+18], N[(x - N[(a / N[(t / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 5.5e+27], N[(x - N[(a / N[(N[(1.0 - z), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(a / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.6 \cdot 10^{+18}:\\
\;\;\;\;x - \frac{a}{\frac{t}{y - z}}\\
\mathbf{elif}\;t \leq 5.5 \cdot 10^{+27}:\\
\;\;\;\;x - \frac{a}{\frac{1 - z}{y - z}}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{a}{\frac{t}{y}}\\
\end{array}
\end{array}
if t < -3.6e18Initial program 99.9%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in t around inf 80.1%
associate-/l*92.4%
Simplified92.4%
if -3.6e18 < t < 5.49999999999999966e27Initial program 98.3%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in t around 0 87.9%
associate-/l*98.6%
Simplified98.6%
if 5.49999999999999966e27 < t Initial program 96.5%
associate-/r/99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in t around inf 74.6%
associate-/l*88.0%
Simplified88.0%
Taylor expanded in y around inf 76.4%
*-commutative76.4%
associate-/l*88.1%
Simplified88.1%
Final simplification95.0%
(FPCore (x y z t a) :precision binary64 (if (<= z -2e+74) (- x a) (if (<= z 0.000102) (- x (* a (/ y (+ t 1.0)))) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2e+74) {
tmp = x - a;
} else if (z <= 0.000102) {
tmp = x - (a * (y / (t + 1.0)));
} else {
tmp = x - 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 <= (-2d+74)) then
tmp = x - a
else if (z <= 0.000102d0) then
tmp = x - (a * (y / (t + 1.0d0)))
else
tmp = x - 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 <= -2e+74) {
tmp = x - a;
} else if (z <= 0.000102) {
tmp = x - (a * (y / (t + 1.0)));
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2e+74: tmp = x - a elif z <= 0.000102: tmp = x - (a * (y / (t + 1.0))) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2e+74) tmp = Float64(x - a); elseif (z <= 0.000102) tmp = Float64(x - Float64(a * Float64(y / Float64(t + 1.0)))); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2e+74) tmp = x - a; elseif (z <= 0.000102) tmp = x - (a * (y / (t + 1.0))); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2e+74], N[(x - a), $MachinePrecision], If[LessEqual[z, 0.000102], N[(x - N[(a * N[(y / N[(t + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2 \cdot 10^{+74}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 0.000102:\\
\;\;\;\;x - a \cdot \frac{y}{t + 1}\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -1.9999999999999999e74 or 1.01999999999999999e-4 < z Initial program 96.0%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around inf 82.3%
if -1.9999999999999999e74 < z < 1.01999999999999999e-4Initial program 99.8%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around 0 91.2%
Final simplification87.5%
(FPCore (x y z t a) :precision binary64 (if (<= z -46000000.0) (+ x (/ (- z y) (/ (- z) a))) (if (<= z 0.000102) (- x (* a (/ y (+ t 1.0)))) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -46000000.0) {
tmp = x + ((z - y) / (-z / a));
} else if (z <= 0.000102) {
tmp = x - (a * (y / (t + 1.0)));
} else {
tmp = x - 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 <= (-46000000.0d0)) then
tmp = x + ((z - y) / (-z / a))
else if (z <= 0.000102d0) then
tmp = x - (a * (y / (t + 1.0d0)))
else
tmp = x - 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 <= -46000000.0) {
tmp = x + ((z - y) / (-z / a));
} else if (z <= 0.000102) {
tmp = x - (a * (y / (t + 1.0)));
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -46000000.0: tmp = x + ((z - y) / (-z / a)) elif z <= 0.000102: tmp = x - (a * (y / (t + 1.0))) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -46000000.0) tmp = Float64(x + Float64(Float64(z - y) / Float64(Float64(-z) / a))); elseif (z <= 0.000102) tmp = Float64(x - Float64(a * Float64(y / Float64(t + 1.0)))); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -46000000.0) tmp = x + ((z - y) / (-z / a)); elseif (z <= 0.000102) tmp = x - (a * (y / (t + 1.0))); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -46000000.0], N[(x + N[(N[(z - y), $MachinePrecision] / N[((-z) / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.000102], N[(x - N[(a * N[(y / N[(t + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -46000000:\\
\;\;\;\;x + \frac{z - y}{\frac{-z}{a}}\\
\mathbf{elif}\;z \leq 0.000102:\\
\;\;\;\;x - a \cdot \frac{y}{t + 1}\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -4.6e7Initial program 98.0%
Taylor expanded in z around inf 88.9%
mul-1-neg88.9%
distribute-neg-frac88.9%
Simplified88.9%
if -4.6e7 < z < 1.01999999999999999e-4Initial program 99.8%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around 0 93.1%
if 1.01999999999999999e-4 < z Initial program 94.2%
associate-/r/100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in z around inf 83.4%
Final simplification90.1%
(FPCore (x y z t a) :precision binary64 (+ x (* a (/ (- z y) (+ (- t z) 1.0)))))
double code(double x, double y, double z, double t, double a) {
return x + (a * ((z - y) / ((t - z) + 1.0)));
}
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 + (a * ((z - y) / ((t - z) + 1.0d0)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (a * ((z - y) / ((t - z) + 1.0)));
}
def code(x, y, z, t, a): return x + (a * ((z - y) / ((t - z) + 1.0)))
function code(x, y, z, t, a) return Float64(x + Float64(a * Float64(Float64(z - y) / Float64(Float64(t - z) + 1.0)))) end
function tmp = code(x, y, z, t, a) tmp = x + (a * ((z - y) / ((t - z) + 1.0))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(a * N[(N[(z - y), $MachinePrecision] / N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + a \cdot \frac{z - y}{\left(t - z\right) + 1}
\end{array}
Initial program 98.3%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.06e+54) (- x a) (if (<= z 4.8e-43) (+ x (* a (- z y))) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.06e+54) {
tmp = x - a;
} else if (z <= 4.8e-43) {
tmp = x + (a * (z - y));
} else {
tmp = x - 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.06d+54)) then
tmp = x - a
else if (z <= 4.8d-43) then
tmp = x + (a * (z - y))
else
tmp = x - 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.06e+54) {
tmp = x - a;
} else if (z <= 4.8e-43) {
tmp = x + (a * (z - y));
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.06e+54: tmp = x - a elif z <= 4.8e-43: tmp = x + (a * (z - y)) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.06e+54) tmp = Float64(x - a); elseif (z <= 4.8e-43) tmp = Float64(x + Float64(a * Float64(z - y))); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.06e+54) tmp = x - a; elseif (z <= 4.8e-43) tmp = x + (a * (z - y)); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.06e+54], N[(x - a), $MachinePrecision], If[LessEqual[z, 4.8e-43], N[(x + N[(a * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.06 \cdot 10^{+54}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{-43}:\\
\;\;\;\;x + a \cdot \left(z - y\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -1.06e54 or 4.8000000000000004e-43 < z Initial program 96.4%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around inf 81.4%
if -1.06e54 < z < 4.8000000000000004e-43Initial program 99.8%
Taylor expanded in z around 0 97.9%
Taylor expanded in t around 0 76.7%
Final simplification78.8%
(FPCore (x y z t a) :precision binary64 (if (<= z -3.25e-9) (- x a) (if (<= z 1.9e-52) (+ x (* z a)) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.25e-9) {
tmp = x - a;
} else if (z <= 1.9e-52) {
tmp = x + (z * a);
} else {
tmp = x - a;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z <= (-3.25d-9)) then
tmp = x - a
else if (z <= 1.9d-52) then
tmp = x + (z * a)
else
tmp = x - a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.25e-9) {
tmp = x - a;
} else if (z <= 1.9e-52) {
tmp = x + (z * a);
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3.25e-9: tmp = x - a elif z <= 1.9e-52: tmp = x + (z * a) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.25e-9) tmp = Float64(x - a); elseif (z <= 1.9e-52) tmp = Float64(x + Float64(z * a)); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -3.25e-9) tmp = x - a; elseif (z <= 1.9e-52) tmp = x + (z * a); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.25e-9], N[(x - a), $MachinePrecision], If[LessEqual[z, 1.9e-52], N[(x + N[(z * a), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.25 \cdot 10^{-9}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 1.9 \cdot 10^{-52}:\\
\;\;\;\;x + z \cdot a\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -3.2500000000000002e-9 or 1.9000000000000002e-52 < z Initial program 96.7%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around inf 78.2%
if -3.2500000000000002e-9 < z < 1.9000000000000002e-52Initial program 99.8%
sub-neg99.8%
+-commutative99.8%
associate-/r/99.9%
distribute-lft-neg-in99.9%
fma-def99.9%
distribute-neg-frac99.9%
sub-neg99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
+-commutative99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in t around 0 77.0%
Taylor expanded in y around 0 59.9%
Taylor expanded in z around 0 59.9%
Final simplification69.2%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.1e+54) (- x a) (if (<= z 0.000102) (- x (* y a)) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.1e+54) {
tmp = x - a;
} else if (z <= 0.000102) {
tmp = x - (y * a);
} else {
tmp = x - 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.1d+54)) then
tmp = x - a
else if (z <= 0.000102d0) then
tmp = x - (y * a)
else
tmp = x - 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.1e+54) {
tmp = x - a;
} else if (z <= 0.000102) {
tmp = x - (y * a);
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.1e+54: tmp = x - a elif z <= 0.000102: tmp = x - (y * a) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.1e+54) tmp = Float64(x - a); elseif (z <= 0.000102) tmp = Float64(x - Float64(y * a)); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.1e+54) tmp = x - a; elseif (z <= 0.000102) tmp = x - (y * a); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.1e+54], N[(x - a), $MachinePrecision], If[LessEqual[z, 0.000102], N[(x - N[(y * a), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.1 \cdot 10^{+54}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 0.000102:\\
\;\;\;\;x - y \cdot a\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -1.09999999999999995e54 or 1.01999999999999999e-4 < z Initial program 96.1%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around inf 81.8%
if -1.09999999999999995e54 < z < 1.01999999999999999e-4Initial program 99.8%
sub-neg99.8%
+-commutative99.8%
associate-/r/99.9%
distribute-lft-neg-in99.9%
fma-def99.9%
distribute-neg-frac99.9%
sub-neg99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
+-commutative99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in t around 0 78.0%
Taylor expanded in z around 0 72.4%
mul-1-neg72.4%
distribute-lft-neg-out72.4%
+-commutative72.4%
distribute-lft-neg-out72.4%
unsub-neg72.4%
*-commutative72.4%
Applied egg-rr72.4%
Final simplification76.3%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.75e-9) (- x a) (if (<= z 205000000.0) x (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.75e-9) {
tmp = x - a;
} else if (z <= 205000000.0) {
tmp = x;
} else {
tmp = x - 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.75d-9)) then
tmp = x - a
else if (z <= 205000000.0d0) then
tmp = x
else
tmp = x - 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.75e-9) {
tmp = x - a;
} else if (z <= 205000000.0) {
tmp = x;
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.75e-9: tmp = x - a elif z <= 205000000.0: tmp = x else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.75e-9) tmp = Float64(x - a); elseif (z <= 205000000.0) tmp = x; else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.75e-9) tmp = x - a; elseif (z <= 205000000.0) tmp = x; else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.75e-9], N[(x - a), $MachinePrecision], If[LessEqual[z, 205000000.0], x, N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.75 \cdot 10^{-9}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 205000000:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -1.75e-9 or 2.05e8 < z Initial program 96.4%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around inf 78.9%
if -1.75e-9 < z < 2.05e8Initial program 99.8%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in x around inf 60.0%
Final simplification68.6%
(FPCore (x y z t a) :precision binary64 (if (<= a -8e+135) (- a) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -8e+135) {
tmp = -a;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (a <= (-8d+135)) then
tmp = -a
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -8e+135) {
tmp = -a;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -8e+135: tmp = -a else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -8e+135) tmp = Float64(-a); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -8e+135) tmp = -a; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -8e+135], (-a), x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -8 \cdot 10^{+135}:\\
\;\;\;\;-a\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -7.99999999999999969e135Initial program 99.8%
associate-/r/99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in a around inf 89.7%
associate--l+89.7%
+-commutative89.7%
associate--l+89.7%
+-commutative89.7%
div-sub89.7%
+-commutative89.7%
Simplified89.7%
Taylor expanded in z around inf 36.4%
neg-mul-136.4%
Simplified36.4%
if -7.99999999999999969e135 < a Initial program 98.0%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in x around inf 67.1%
Final simplification62.2%
(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 98.3%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in x around inf 58.3%
Final simplification58.3%
(FPCore (x y z t a) :precision binary64 (- x (* (/ (- y z) (+ (- t z) 1.0)) a)))
double code(double x, double y, double z, double t, double a) {
return x - (((y - z) / ((t - z) + 1.0)) * 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) + 1.0d0)) * a)
end function
public static double code(double x, double y, double z, double t, double a) {
return x - (((y - z) / ((t - z) + 1.0)) * a);
}
def code(x, y, z, t, a): return x - (((y - z) / ((t - z) + 1.0)) * a)
function code(x, y, z, t, a) return Float64(x - Float64(Float64(Float64(y - z) / Float64(Float64(t - z) + 1.0)) * a)) end
function tmp = code(x, y, z, t, a) tmp = x - (((y - z) / ((t - z) + 1.0)) * a); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(N[(y - z), $MachinePrecision] / N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y - z}{\left(t - z\right) + 1} \cdot a
\end{array}
herbie shell --seed 2023279
(FPCore (x y z t a)
:name "Graphics.Rendering.Chart.SparkLine:renderSparkLine from Chart-1.5.3"
:precision binary64
:herbie-target
(- x (* (/ (- y z) (+ (- t z) 1.0)) a))
(- x (/ (- y z) (/ (+ (- t z) 1.0) a))))