
(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 11 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 98.0%
sub-neg98.0%
+-commutative98.0%
associate-/r/99.6%
*-commutative99.6%
distribute-rgt-neg-in99.6%
fma-def99.6%
div-sub99.6%
sub-neg99.6%
+-commutative99.6%
distribute-neg-in99.6%
remove-double-neg99.6%
sub-neg99.6%
div-sub99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -8.3e+43) (not (<= z 2.05e+72))) (+ x (* a (/ z (+ (- t z) 1.0)))) (- x (* a (/ y (+ t 1.0))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -8.3e+43) || !(z <= 2.05e+72)) {
tmp = x + (a * (z / ((t - z) + 1.0)));
} 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 <= (-8.3d+43)) .or. (.not. (z <= 2.05d+72))) then
tmp = x + (a * (z / ((t - z) + 1.0d0)))
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 <= -8.3e+43) || !(z <= 2.05e+72)) {
tmp = x + (a * (z / ((t - z) + 1.0)));
} else {
tmp = x - (a * (y / (t + 1.0)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -8.3e+43) or not (z <= 2.05e+72): tmp = x + (a * (z / ((t - z) + 1.0))) else: tmp = x - (a * (y / (t + 1.0))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -8.3e+43) || !(z <= 2.05e+72)) tmp = Float64(x + Float64(a * Float64(z / Float64(Float64(t - z) + 1.0)))); 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 <= -8.3e+43) || ~((z <= 2.05e+72))) tmp = x + (a * (z / ((t - z) + 1.0))); else tmp = x - (a * (y / (t + 1.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -8.3e+43], N[Not[LessEqual[z, 2.05e+72]], $MachinePrecision]], N[(x + N[(a * N[(z / N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision]), $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 -8.3 \cdot 10^{+43} \lor \neg \left(z \leq 2.05 \cdot 10^{+72}\right):\\
\;\;\;\;x + a \cdot \frac{z}{\left(t - z\right) + 1}\\
\mathbf{else}:\\
\;\;\;\;x - a \cdot \frac{y}{t + 1}\\
\end{array}
\end{array}
if z < -8.29999999999999958e43 or 2.04999999999999982e72 < z Initial program 95.0%
sub-neg95.0%
+-commutative95.0%
associate-/r/99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-def99.9%
div-sub99.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
sub-neg99.9%
div-sub99.9%
Simplified99.9%
Taylor expanded in y around 0 68.7%
expm1-log1p-u64.6%
expm1-udef52.8%
associate-/l*63.4%
associate--l+63.4%
Applied egg-rr63.4%
expm1-def75.2%
expm1-log1p90.1%
associate-/r/86.3%
*-commutative86.3%
associate-*r/68.7%
*-commutative68.7%
associate-*r/90.0%
Simplified90.0%
if -8.29999999999999958e43 < z < 2.04999999999999982e72Initial program 99.9%
associate-/r/99.5%
Simplified99.5%
Taylor expanded in z around 0 91.7%
Final simplification91.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (- t z) 1.0)))
(if (or (<= z -3.2e+61) (not (<= z 1.6e+94)))
(+ x (* a (/ z t_1)))
(- x (/ y (/ t_1 a))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t - z) + 1.0;
double tmp;
if ((z <= -3.2e+61) || !(z <= 1.6e+94)) {
tmp = x + (a * (z / t_1));
} else {
tmp = x - (y / (t_1 / 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 = (t - z) + 1.0d0
if ((z <= (-3.2d+61)) .or. (.not. (z <= 1.6d+94))) then
tmp = x + (a * (z / t_1))
else
tmp = x - (y / (t_1 / a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (t - z) + 1.0;
double tmp;
if ((z <= -3.2e+61) || !(z <= 1.6e+94)) {
tmp = x + (a * (z / t_1));
} else {
tmp = x - (y / (t_1 / a));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (t - z) + 1.0 tmp = 0 if (z <= -3.2e+61) or not (z <= 1.6e+94): tmp = x + (a * (z / t_1)) else: tmp = x - (y / (t_1 / a)) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(t - z) + 1.0) tmp = 0.0 if ((z <= -3.2e+61) || !(z <= 1.6e+94)) tmp = Float64(x + Float64(a * Float64(z / t_1))); else tmp = Float64(x - Float64(y / Float64(t_1 / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (t - z) + 1.0; tmp = 0.0; if ((z <= -3.2e+61) || ~((z <= 1.6e+94))) tmp = x + (a * (z / t_1)); else tmp = x - (y / (t_1 / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision]}, If[Or[LessEqual[z, -3.2e+61], N[Not[LessEqual[z, 1.6e+94]], $MachinePrecision]], N[(x + N[(a * N[(z / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(y / N[(t$95$1 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t - z\right) + 1\\
\mathbf{if}\;z \leq -3.2 \cdot 10^{+61} \lor \neg \left(z \leq 1.6 \cdot 10^{+94}\right):\\
\;\;\;\;x + a \cdot \frac{z}{t_1}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{\frac{t_1}{a}}\\
\end{array}
\end{array}
if z < -3.1999999999999998e61 or 1.60000000000000007e94 < z Initial program 94.6%
sub-neg94.6%
+-commutative94.6%
associate-/r/99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-def99.9%
div-sub99.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
sub-neg99.9%
div-sub99.9%
Simplified99.9%
Taylor expanded in y around 0 69.2%
expm1-log1p-u64.7%
expm1-udef54.1%
associate-/l*65.6%
associate--l+65.6%
Applied egg-rr65.6%
expm1-def76.3%
expm1-log1p92.5%
associate-/r/88.4%
*-commutative88.4%
associate-*r/69.2%
*-commutative69.2%
associate-*r/92.5%
Simplified92.5%
if -3.1999999999999998e61 < z < 1.60000000000000007e94Initial program 99.8%
clear-num99.8%
associate-/r/99.8%
+-commutative99.8%
associate-+r-99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 89.9%
associate-+r-89.9%
associate-/l*94.3%
Simplified94.3%
Final simplification93.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.65e+20) (not (<= z 3.1e+21))) (+ 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.65e+20) || !(z <= 3.1e+21)) {
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.65d+20)) .or. (.not. (z <= 3.1d+21))) 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.65e+20) || !(z <= 3.1e+21)) {
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.65e+20) or not (z <= 3.1e+21): 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.65e+20) || !(z <= 3.1e+21)) 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.65e+20) || ~((z <= 3.1e+21))) 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.65e+20], N[Not[LessEqual[z, 3.1e+21]], $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.65 \cdot 10^{+20} \lor \neg \left(z \leq 3.1 \cdot 10^{+21}\right):\\
\;\;\;\;x + \frac{z - y}{\frac{-z}{a}}\\
\mathbf{else}:\\
\;\;\;\;x - a \cdot \frac{y}{t + 1}\\
\end{array}
\end{array}
if z < -2.65e20 or 3.1e21 < z Initial program 95.9%
Taylor expanded in z around inf 80.9%
mul-1-neg80.9%
distribute-neg-frac80.9%
Simplified80.9%
if -2.65e20 < z < 3.1e21Initial program 99.9%
associate-/r/99.4%
Simplified99.4%
Taylor expanded in z around 0 94.5%
Final simplification88.2%
(FPCore (x y z t a) :precision binary64 (if (<= t -7.2e+172) (+ x (/ a (/ t z))) (if (<= t 1.6e+21) (+ x (/ a (/ (- 1.0 z) z))) (- x (/ a (/ t y))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -7.2e+172) {
tmp = x + (a / (t / z));
} else if (t <= 1.6e+21) {
tmp = x + (a / ((1.0 - z) / 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 <= (-7.2d+172)) then
tmp = x + (a / (t / z))
else if (t <= 1.6d+21) then
tmp = x + (a / ((1.0d0 - z) / 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 <= -7.2e+172) {
tmp = x + (a / (t / z));
} else if (t <= 1.6e+21) {
tmp = x + (a / ((1.0 - z) / z));
} else {
tmp = x - (a / (t / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -7.2e+172: tmp = x + (a / (t / z)) elif t <= 1.6e+21: tmp = x + (a / ((1.0 - z) / z)) else: tmp = x - (a / (t / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -7.2e+172) tmp = Float64(x + Float64(a / Float64(t / z))); elseif (t <= 1.6e+21) tmp = Float64(x + Float64(a / Float64(Float64(1.0 - z) / 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 <= -7.2e+172) tmp = x + (a / (t / z)); elseif (t <= 1.6e+21) tmp = x + (a / ((1.0 - z) / z)); else tmp = x - (a / (t / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -7.2e+172], N[(x + N[(a / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.6e+21], N[(x + N[(a / N[(N[(1.0 - z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(a / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.2 \cdot 10^{+172}:\\
\;\;\;\;x + \frac{a}{\frac{t}{z}}\\
\mathbf{elif}\;t \leq 1.6 \cdot 10^{+21}:\\
\;\;\;\;x + \frac{a}{\frac{1 - z}{z}}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{a}{\frac{t}{y}}\\
\end{array}
\end{array}
if t < -7.1999999999999995e172Initial program 97.3%
sub-neg97.3%
+-commutative97.3%
associate-/r/99.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
fma-def99.8%
div-sub99.8%
sub-neg99.8%
+-commutative99.8%
distribute-neg-in99.8%
remove-double-neg99.8%
sub-neg99.8%
div-sub99.8%
Simplified99.8%
Taylor expanded in y around 0 89.0%
Taylor expanded in t around inf 88.6%
associate-/l*88.8%
Simplified88.8%
if -7.1999999999999995e172 < t < 1.6e21Initial program 98.1%
sub-neg98.1%
+-commutative98.1%
associate-/r/99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-def99.9%
div-sub99.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
sub-neg99.9%
div-sub99.9%
Simplified99.9%
Taylor expanded in y around 0 59.8%
Taylor expanded in t around 0 59.9%
associate-/l*69.5%
Simplified69.5%
if 1.6e21 < t Initial program 98.4%
associate-/r/98.7%
Simplified98.7%
Taylor expanded in t around inf 82.6%
Taylor expanded in y around inf 81.0%
*-commutative81.0%
associate-/l*85.7%
Simplified85.7%
Final simplification76.2%
(FPCore (x y z t a) :precision binary64 (if (<= z -4.5e+125) (- x a) (if (<= z 2.8e+74) (- x (* a (/ y (+ t 1.0)))) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.5e+125) {
tmp = x - a;
} else if (z <= 2.8e+74) {
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 <= (-4.5d+125)) then
tmp = x - a
else if (z <= 2.8d+74) 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 <= -4.5e+125) {
tmp = x - a;
} else if (z <= 2.8e+74) {
tmp = x - (a * (y / (t + 1.0)));
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -4.5e+125: tmp = x - a elif z <= 2.8e+74: 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 <= -4.5e+125) tmp = Float64(x - a); elseif (z <= 2.8e+74) 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 <= -4.5e+125) tmp = x - a; elseif (z <= 2.8e+74) 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, -4.5e+125], N[(x - a), $MachinePrecision], If[LessEqual[z, 2.8e+74], 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 -4.5 \cdot 10^{+125}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{+74}:\\
\;\;\;\;x - a \cdot \frac{y}{t + 1}\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -4.5e125 or 2.80000000000000002e74 < z Initial program 93.4%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around inf 83.8%
if -4.5e125 < z < 2.80000000000000002e74Initial program 99.8%
associate-/r/99.5%
Simplified99.5%
Taylor expanded in z around 0 88.2%
Final simplification86.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 98.0%
associate-/r/99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -3.3e+172) (not (<= t 5.2e+103))) (+ x (/ a (/ t z))) (- x a)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -3.3e+172) || !(t <= 5.2e+103)) {
tmp = x + (a / (t / z));
} 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 ((t <= (-3.3d+172)) .or. (.not. (t <= 5.2d+103))) then
tmp = x + (a / (t / z))
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 ((t <= -3.3e+172) || !(t <= 5.2e+103)) {
tmp = x + (a / (t / z));
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -3.3e+172) or not (t <= 5.2e+103): tmp = x + (a / (t / z)) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -3.3e+172) || !(t <= 5.2e+103)) tmp = Float64(x + Float64(a / Float64(t / z))); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -3.3e+172) || ~((t <= 5.2e+103))) tmp = x + (a / (t / z)); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -3.3e+172], N[Not[LessEqual[t, 5.2e+103]], $MachinePrecision]], N[(x + N[(a / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.3 \cdot 10^{+172} \lor \neg \left(t \leq 5.2 \cdot 10^{+103}\right):\\
\;\;\;\;x + \frac{a}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if t < -3.29999999999999983e172 or 5.2000000000000003e103 < t Initial program 97.7%
sub-neg97.7%
+-commutative97.7%
associate-/r/99.0%
*-commutative99.0%
distribute-rgt-neg-in99.0%
fma-def99.0%
div-sub99.0%
sub-neg99.0%
+-commutative99.0%
distribute-neg-in99.0%
remove-double-neg99.0%
sub-neg99.0%
div-sub99.0%
Simplified99.0%
Taylor expanded in y around 0 79.0%
Taylor expanded in t around inf 78.8%
associate-/l*80.1%
Simplified80.1%
if -3.29999999999999983e172 < t < 5.2000000000000003e103Initial program 98.2%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around inf 61.2%
Final simplification67.4%
(FPCore (x y z t a) :precision binary64 (if (<= z -5.3e+60) (- x a) (if (<= z 4.6e+89) (- x (/ a (/ t y))) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5.3e+60) {
tmp = x - a;
} else if (z <= 4.6e+89) {
tmp = x - (a / (t / 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 <= (-5.3d+60)) then
tmp = x - a
else if (z <= 4.6d+89) then
tmp = x - (a / (t / 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 <= -5.3e+60) {
tmp = x - a;
} else if (z <= 4.6e+89) {
tmp = x - (a / (t / y));
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -5.3e+60: tmp = x - a elif z <= 4.6e+89: tmp = x - (a / (t / y)) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -5.3e+60) tmp = Float64(x - a); elseif (z <= 4.6e+89) tmp = Float64(x - Float64(a / Float64(t / y))); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -5.3e+60) tmp = x - a; elseif (z <= 4.6e+89) tmp = x - (a / (t / y)); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -5.3e+60], N[(x - a), $MachinePrecision], If[LessEqual[z, 4.6e+89], N[(x - N[(a / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.3 \cdot 10^{+60}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 4.6 \cdot 10^{+89}:\\
\;\;\;\;x - \frac{a}{\frac{t}{y}}\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -5.2999999999999997e60 or 4.5999999999999998e89 < z Initial program 94.7%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around inf 80.6%
if -5.2999999999999997e60 < z < 4.5999999999999998e89Initial program 99.8%
associate-/r/99.5%
Simplified99.5%
Taylor expanded in t around inf 65.6%
Taylor expanded in y around inf 66.8%
*-commutative66.8%
associate-/l*68.6%
Simplified68.6%
Final simplification72.8%
(FPCore (x y z t a) :precision binary64 (if (<= z -4.2e+57) (- x a) (if (<= z 2.4e+27) x (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.2e+57) {
tmp = x - a;
} else if (z <= 2.4e+27) {
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 <= (-4.2d+57)) then
tmp = x - a
else if (z <= 2.4d+27) 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 <= -4.2e+57) {
tmp = x - a;
} else if (z <= 2.4e+27) {
tmp = x;
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -4.2e+57: tmp = x - a elif z <= 2.4e+27: tmp = x else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -4.2e+57) tmp = Float64(x - a); elseif (z <= 2.4e+27) 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 <= -4.2e+57) tmp = x - a; elseif (z <= 2.4e+27) tmp = x; else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4.2e+57], N[(x - a), $MachinePrecision], If[LessEqual[z, 2.4e+27], x, N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.2 \cdot 10^{+57}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 2.4 \cdot 10^{+27}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -4.19999999999999982e57 or 2.39999999999999998e27 < z Initial program 95.4%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around inf 78.6%
if -4.19999999999999982e57 < z < 2.39999999999999998e27Initial program 99.8%
associate-/r/99.4%
Simplified99.4%
Taylor expanded in x around inf 57.4%
Final simplification66.0%
(FPCore (x y z t a) :precision binary64 x)
double code(double x, double y, double z, double t, double a) {
return x;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x
end function
public static double code(double x, double y, double z, double t, double a) {
return x;
}
def code(x, y, z, t, a): return x
function code(x, y, z, t, a) return x end
function tmp = code(x, y, z, t, a) tmp = x; end
code[x_, y_, z_, t_, a_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 98.0%
associate-/r/99.6%
Simplified99.6%
Taylor expanded in x around inf 56.4%
Final simplification56.4%
(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 2023199
(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))))