
(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 10 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 a (/ (- z y) (+ (- t z) 1.0)) x))
double code(double x, double y, double z, double t, double a) {
return fma(a, ((z - y) / ((t - z) + 1.0)), x);
}
function code(x, y, z, t, a) return fma(a, Float64(Float64(z - y) / Float64(Float64(t - z) + 1.0)), x) end
code[x_, y_, z_, t_, a_] := N[(a * N[(N[(z - y), $MachinePrecision] / N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(a, \frac{z - y}{\left(t - z\right) + 1}, x\right)
\end{array}
Initial program 97.2%
sub-neg97.2%
+-commutative97.2%
associate-/r/99.4%
*-commutative99.4%
distribute-rgt-neg-in99.4%
fma-def99.4%
div-sub99.4%
sub-neg99.4%
+-commutative99.4%
distribute-neg-in99.4%
remove-double-neg99.4%
sub-neg99.4%
div-sub99.4%
Simplified99.4%
Final simplification99.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- x (/ a (/ t y)))) (t_2 (- x (* a y))))
(if (<= z -2.55e+33)
(- x a)
(if (<= z -6.8e-208)
t_2
(if (<= z 7.2e-224)
t_1
(if (<= z 1.1e-73) t_2 (if (<= z 6.4e+16) t_1 (- x a))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x - (a / (t / y));
double t_2 = x - (a * y);
double tmp;
if (z <= -2.55e+33) {
tmp = x - a;
} else if (z <= -6.8e-208) {
tmp = t_2;
} else if (z <= 7.2e-224) {
tmp = t_1;
} else if (z <= 1.1e-73) {
tmp = t_2;
} else if (z <= 6.4e+16) {
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 / (t / y))
t_2 = x - (a * y)
if (z <= (-2.55d+33)) then
tmp = x - a
else if (z <= (-6.8d-208)) then
tmp = t_2
else if (z <= 7.2d-224) then
tmp = t_1
else if (z <= 1.1d-73) then
tmp = t_2
else if (z <= 6.4d+16) 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 / (t / y));
double t_2 = x - (a * y);
double tmp;
if (z <= -2.55e+33) {
tmp = x - a;
} else if (z <= -6.8e-208) {
tmp = t_2;
} else if (z <= 7.2e-224) {
tmp = t_1;
} else if (z <= 1.1e-73) {
tmp = t_2;
} else if (z <= 6.4e+16) {
tmp = t_1;
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x - (a / (t / y)) t_2 = x - (a * y) tmp = 0 if z <= -2.55e+33: tmp = x - a elif z <= -6.8e-208: tmp = t_2 elif z <= 7.2e-224: tmp = t_1 elif z <= 1.1e-73: tmp = t_2 elif z <= 6.4e+16: tmp = t_1 else: tmp = x - a return tmp
function code(x, y, z, t, a) t_1 = Float64(x - Float64(a / Float64(t / y))) t_2 = Float64(x - Float64(a * y)) tmp = 0.0 if (z <= -2.55e+33) tmp = Float64(x - a); elseif (z <= -6.8e-208) tmp = t_2; elseif (z <= 7.2e-224) tmp = t_1; elseif (z <= 1.1e-73) tmp = t_2; elseif (z <= 6.4e+16) 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 / (t / y)); t_2 = x - (a * y); tmp = 0.0; if (z <= -2.55e+33) tmp = x - a; elseif (z <= -6.8e-208) tmp = t_2; elseif (z <= 7.2e-224) tmp = t_1; elseif (z <= 1.1e-73) tmp = t_2; elseif (z <= 6.4e+16) 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[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x - N[(a * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.55e+33], N[(x - a), $MachinePrecision], If[LessEqual[z, -6.8e-208], t$95$2, If[LessEqual[z, 7.2e-224], t$95$1, If[LessEqual[z, 1.1e-73], t$95$2, If[LessEqual[z, 6.4e+16], t$95$1, N[(x - a), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - \frac{a}{\frac{t}{y}}\\
t_2 := x - a \cdot y\\
\mathbf{if}\;z \leq -2.55 \cdot 10^{+33}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq -6.8 \cdot 10^{-208}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{-224}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{-73}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq 6.4 \cdot 10^{+16}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -2.5499999999999999e33 or 6.4e16 < z Initial program 96.0%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around inf 77.7%
if -2.5499999999999999e33 < z < -6.8e-208 or 7.1999999999999999e-224 < z < 1.1e-73Initial program 99.8%
associate-/r/98.2%
Simplified98.2%
associate-/r/99.8%
div-inv99.7%
associate-/r*98.1%
+-commutative98.1%
associate-+r-98.1%
Applied egg-rr98.1%
Taylor expanded in t around 0 72.8%
Taylor expanded in z around 0 70.1%
if -6.8e-208 < z < 7.1999999999999999e-224 or 1.1e-73 < z < 6.4e16Initial program 96.9%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in t around inf 67.6%
associate-/l*78.0%
Simplified78.0%
Taylor expanded in y around inf 69.3%
*-commutative69.3%
associate-/l*79.8%
Simplified79.8%
Final simplification76.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -7.2e+42) (not (<= z 102.0))) (+ x (* (/ a (- 1.0 z)) (- z y))) (- x (* a (/ y (+ t 1.0))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -7.2e+42) || !(z <= 102.0)) {
tmp = x + ((a / (1.0 - z)) * (z - y));
} else {
tmp = x - (a * (y / (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 <= (-7.2d+42)) .or. (.not. (z <= 102.0d0))) then
tmp = x + ((a / (1.0d0 - z)) * (z - y))
else
tmp = x - (a * (y / (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 <= -7.2e+42) || !(z <= 102.0)) {
tmp = x + ((a / (1.0 - z)) * (z - y));
} else {
tmp = x - (a * (y / (t + 1.0)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -7.2e+42) or not (z <= 102.0): tmp = x + ((a / (1.0 - z)) * (z - y)) else: tmp = x - (a * (y / (t + 1.0))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -7.2e+42) || !(z <= 102.0)) tmp = Float64(x + Float64(Float64(a / Float64(1.0 - z)) * Float64(z - y))); else tmp = Float64(x - Float64(a * Float64(y / Float64(t + 1.0)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -7.2e+42) || ~((z <= 102.0))) tmp = x + ((a / (1.0 - z)) * (z - y)); else tmp = x - (a * (y / (t + 1.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -7.2e+42], N[Not[LessEqual[z, 102.0]], $MachinePrecision]], N[(x + N[(N[(a / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(a * N[(y / N[(t + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.2 \cdot 10^{+42} \lor \neg \left(z \leq 102\right):\\
\;\;\;\;x + \frac{a}{1 - z} \cdot \left(z - y\right)\\
\mathbf{else}:\\
\;\;\;\;x - a \cdot \frac{y}{t + 1}\\
\end{array}
\end{array}
if z < -7.2000000000000002e42 or 102 < z Initial program 96.1%
associate-/r/99.9%
Simplified99.9%
associate-/r/96.1%
div-inv96.0%
associate-/r*99.8%
+-commutative99.8%
associate-+r-99.8%
Applied egg-rr99.8%
Taylor expanded in t around 0 66.1%
associate-/l*88.8%
associate-/r/86.9%
Applied egg-rr86.9%
if -7.2000000000000002e42 < z < 102Initial program 98.4%
associate-/r/99.0%
Simplified99.0%
Taylor expanded in z around 0 92.3%
Final simplification89.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.3e+35) (not (<= z 3150000.0))) (+ x (/ (- z y) (/ (- z) a))) (- x (* a (/ y (+ t 1.0))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.3e+35) || !(z <= 3150000.0)) {
tmp = x + ((z - y) / (-z / a));
} else {
tmp = x - (a * (y / (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 <= (-2.3d+35)) .or. (.not. (z <= 3150000.0d0))) then
tmp = x + ((z - y) / (-z / a))
else
tmp = x - (a * (y / (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 <= -2.3e+35) || !(z <= 3150000.0)) {
tmp = x + ((z - y) / (-z / a));
} else {
tmp = x - (a * (y / (t + 1.0)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.3e+35) or not (z <= 3150000.0): tmp = x + ((z - y) / (-z / a)) else: tmp = x - (a * (y / (t + 1.0))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.3e+35) || !(z <= 3150000.0)) tmp = Float64(x + Float64(Float64(z - y) / Float64(Float64(-z) / a))); else tmp = Float64(x - Float64(a * Float64(y / Float64(t + 1.0)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -2.3e+35) || ~((z <= 3150000.0))) tmp = x + ((z - y) / (-z / a)); else tmp = x - (a * (y / (t + 1.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.3e+35], N[Not[LessEqual[z, 3150000.0]], $MachinePrecision]], N[(x + N[(N[(z - y), $MachinePrecision] / N[((-z) / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(a * N[(y / N[(t + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.3 \cdot 10^{+35} \lor \neg \left(z \leq 3150000\right):\\
\;\;\;\;x + \frac{z - y}{\frac{-z}{a}}\\
\mathbf{else}:\\
\;\;\;\;x - a \cdot \frac{y}{t + 1}\\
\end{array}
\end{array}
if z < -2.2999999999999998e35 or 3.15e6 < z Initial program 96.1%
Taylor expanded in z around inf 86.8%
mul-1-neg86.8%
distribute-neg-frac86.8%
Simplified86.8%
if -2.2999999999999998e35 < z < 3.15e6Initial program 98.4%
associate-/r/99.0%
Simplified99.0%
Taylor expanded in z around 0 92.3%
Final simplification89.6%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.42e+44) (- x a) (if (<= z 2100000.0) (- x (* a (/ y (+ t 1.0)))) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.42e+44) {
tmp = x - a;
} else if (z <= 2100000.0) {
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 <= (-1.42d+44)) then
tmp = x - a
else if (z <= 2100000.0d0) 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 <= -1.42e+44) {
tmp = x - a;
} else if (z <= 2100000.0) {
tmp = x - (a * (y / (t + 1.0)));
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.42e+44: tmp = x - a elif z <= 2100000.0: 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 <= -1.42e+44) tmp = Float64(x - a); elseif (z <= 2100000.0) 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 <= -1.42e+44) tmp = x - a; elseif (z <= 2100000.0) 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, -1.42e+44], N[(x - a), $MachinePrecision], If[LessEqual[z, 2100000.0], 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 -1.42 \cdot 10^{+44}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 2100000:\\
\;\;\;\;x - a \cdot \frac{y}{t + 1}\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -1.41999999999999994e44 or 2.1e6 < z Initial program 96.1%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around inf 77.5%
if -1.41999999999999994e44 < z < 2.1e6Initial program 98.4%
associate-/r/99.0%
Simplified99.0%
Taylor expanded in z around 0 92.3%
Final simplification84.9%
(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 97.2%
associate-/r/99.4%
Simplified99.4%
Final simplification99.4%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.65e+37) (- x a) (if (<= z 54000.0) (- x (* a y)) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.65e+37) {
tmp = x - a;
} else if (z <= 54000.0) {
tmp = x - (a * 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.65d+37)) then
tmp = x - a
else if (z <= 54000.0d0) then
tmp = x - (a * 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.65e+37) {
tmp = x - a;
} else if (z <= 54000.0) {
tmp = x - (a * y);
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.65e+37: tmp = x - a elif z <= 54000.0: tmp = x - (a * y) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.65e+37) tmp = Float64(x - a); elseif (z <= 54000.0) tmp = Float64(x - Float64(a * 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.65e+37) tmp = x - a; elseif (z <= 54000.0) tmp = x - (a * y); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.65e+37], N[(x - a), $MachinePrecision], If[LessEqual[z, 54000.0], N[(x - N[(a * y), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.65 \cdot 10^{+37}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 54000:\\
\;\;\;\;x - a \cdot y\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -1.65e37 or 54000 < z Initial program 96.1%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around inf 77.5%
if -1.65e37 < z < 54000Initial program 98.4%
associate-/r/99.0%
Simplified99.0%
associate-/r/98.4%
div-inv98.3%
associate-/r*98.9%
+-commutative98.9%
associate-+r-98.9%
Applied egg-rr98.9%
Taylor expanded in t around 0 69.0%
Taylor expanded in z around 0 65.7%
Final simplification71.6%
(FPCore (x y z t a) :precision binary64 (if (<= z -3.8e+43) (- x a) (if (<= z 5.6e+16) x (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.8e+43) {
tmp = x - a;
} else if (z <= 5.6e+16) {
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 <= (-3.8d+43)) then
tmp = x - a
else if (z <= 5.6d+16) 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 <= -3.8e+43) {
tmp = x - a;
} else if (z <= 5.6e+16) {
tmp = x;
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3.8e+43: tmp = x - a elif z <= 5.6e+16: tmp = x else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.8e+43) tmp = Float64(x - a); elseif (z <= 5.6e+16) 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 <= -3.8e+43) tmp = x - a; elseif (z <= 5.6e+16) tmp = x; else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.8e+43], N[(x - a), $MachinePrecision], If[LessEqual[z, 5.6e+16], x, N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{+43}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 5.6 \cdot 10^{+16}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -3.80000000000000008e43 or 5.6e16 < z Initial program 96.0%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around inf 77.7%
if -3.80000000000000008e43 < z < 5.6e16Initial program 98.4%
associate-/r/99.0%
Simplified99.0%
Taylor expanded in x around inf 53.9%
Final simplification65.5%
(FPCore (x y z t a) :precision binary64 (if (<= x -7e-190) x (if (<= x 3.8e-151) (- a) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -7e-190) {
tmp = x;
} else if (x <= 3.8e-151) {
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 (x <= (-7d-190)) then
tmp = x
else if (x <= 3.8d-151) 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 (x <= -7e-190) {
tmp = x;
} else if (x <= 3.8e-151) {
tmp = -a;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -7e-190: tmp = x elif x <= 3.8e-151: tmp = -a else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -7e-190) tmp = x; elseif (x <= 3.8e-151) tmp = Float64(-a); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -7e-190) tmp = x; elseif (x <= 3.8e-151) tmp = -a; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -7e-190], x, If[LessEqual[x, 3.8e-151], (-a), x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7 \cdot 10^{-190}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 3.8 \cdot 10^{-151}:\\
\;\;\;\;-a\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -6.9999999999999999e-190 or 3.7999999999999997e-151 < x Initial program 99.8%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in x around inf 62.8%
if -6.9999999999999999e-190 < x < 3.7999999999999997e-151Initial program 89.0%
associate-/r/97.9%
Simplified97.9%
Taylor expanded in x around 0 71.8%
mul-1-neg71.8%
associate-*r/89.8%
div-sub89.8%
distribute-rgt-out--89.8%
sub-neg89.8%
+-commutative89.8%
distribute-neg-in89.8%
remove-double-neg89.8%
distribute-lft-neg-in89.8%
distribute-rgt-in89.8%
sub-neg89.8%
div-sub89.8%
associate--l+89.8%
Simplified89.8%
Taylor expanded in z around inf 40.4%
mul-1-neg40.4%
Simplified40.4%
Final simplification57.5%
(FPCore (x y z t a) :precision binary64 x)
double code(double x, double y, double z, double t, double a) {
return x;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x
end function
public static double code(double x, double y, double z, double t, double a) {
return x;
}
def code(x, y, z, t, a): return x
function code(x, y, z, t, a) return x end
function tmp = code(x, y, z, t, a) tmp = x; end
code[x_, y_, z_, t_, a_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 97.2%
associate-/r/99.4%
Simplified99.4%
Taylor expanded in x around inf 50.5%
Final simplification50.5%
(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 2023181
(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))))