
(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 12 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 (+ 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.3%
associate-/r/99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* a (- z y)))) (t_2 (- x (* a (/ y t)))))
(if (<= z -1.05e+21)
(- x a)
(if (<= z -7.2e-31)
t_2
(if (<= z 3.9e-260)
t_1
(if (<= z 1.7e-225) t_2 (if (<= z 1.02e-7) 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 - (a * (y / t));
double tmp;
if (z <= -1.05e+21) {
tmp = x - a;
} else if (z <= -7.2e-31) {
tmp = t_2;
} else if (z <= 3.9e-260) {
tmp = t_1;
} else if (z <= 1.7e-225) {
tmp = t_2;
} else if (z <= 1.02e-7) {
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 - (a * (y / t))
if (z <= (-1.05d+21)) then
tmp = x - a
else if (z <= (-7.2d-31)) then
tmp = t_2
else if (z <= 3.9d-260) then
tmp = t_1
else if (z <= 1.7d-225) then
tmp = t_2
else if (z <= 1.02d-7) 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 - (a * (y / t));
double tmp;
if (z <= -1.05e+21) {
tmp = x - a;
} else if (z <= -7.2e-31) {
tmp = t_2;
} else if (z <= 3.9e-260) {
tmp = t_1;
} else if (z <= 1.7e-225) {
tmp = t_2;
} else if (z <= 1.02e-7) {
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 - (a * (y / t)) tmp = 0 if z <= -1.05e+21: tmp = x - a elif z <= -7.2e-31: tmp = t_2 elif z <= 3.9e-260: tmp = t_1 elif z <= 1.7e-225: tmp = t_2 elif z <= 1.02e-7: 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(a * Float64(y / t))) tmp = 0.0 if (z <= -1.05e+21) tmp = Float64(x - a); elseif (z <= -7.2e-31) tmp = t_2; elseif (z <= 3.9e-260) tmp = t_1; elseif (z <= 1.7e-225) tmp = t_2; elseif (z <= 1.02e-7) 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 - (a * (y / t)); tmp = 0.0; if (z <= -1.05e+21) tmp = x - a; elseif (z <= -7.2e-31) tmp = t_2; elseif (z <= 3.9e-260) tmp = t_1; elseif (z <= 1.7e-225) tmp = t_2; elseif (z <= 1.02e-7) 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[(a * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.05e+21], N[(x - a), $MachinePrecision], If[LessEqual[z, -7.2e-31], t$95$2, If[LessEqual[z, 3.9e-260], t$95$1, If[LessEqual[z, 1.7e-225], t$95$2, If[LessEqual[z, 1.02e-7], 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 - a \cdot \frac{y}{t}\\
\mathbf{if}\;z \leq -1.05 \cdot 10^{+21}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq -7.2 \cdot 10^{-31}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq 3.9 \cdot 10^{-260}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{-225}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq 1.02 \cdot 10^{-7}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -1.05e21 or 1.02e-7 < z Initial program 94.8%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around inf 76.6%
if -1.05e21 < z < -7.20000000000000007e-31 or 3.89999999999999972e-260 < z < 1.7e-225Initial program 99.8%
associate-/r/99.8%
Simplified99.8%
Taylor expanded in t around inf 93.8%
Taylor expanded in y around inf 88.9%
if -7.20000000000000007e-31 < z < 3.89999999999999972e-260 or 1.7e-225 < z < 1.02e-7Initial program 99.9%
Taylor expanded in z around 0 99.2%
Taylor expanded in t around 0 77.1%
Final simplification77.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* a (- z y)))))
(if (<= z -9.8e+26)
(- x a)
(if (<= z -3e-26)
(- x (/ y (/ t a)))
(if (<= z 3.1e-251)
t_1
(if (<= z 2.6e-225)
(- x (* a (/ y t)))
(if (<= z 1.08e-7) 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 <= -9.8e+26) {
tmp = x - a;
} else if (z <= -3e-26) {
tmp = x - (y / (t / a));
} else if (z <= 3.1e-251) {
tmp = t_1;
} else if (z <= 2.6e-225) {
tmp = x - (a * (y / t));
} else if (z <= 1.08e-7) {
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 <= (-9.8d+26)) then
tmp = x - a
else if (z <= (-3d-26)) then
tmp = x - (y / (t / a))
else if (z <= 3.1d-251) then
tmp = t_1
else if (z <= 2.6d-225) then
tmp = x - (a * (y / t))
else if (z <= 1.08d-7) 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 <= -9.8e+26) {
tmp = x - a;
} else if (z <= -3e-26) {
tmp = x - (y / (t / a));
} else if (z <= 3.1e-251) {
tmp = t_1;
} else if (z <= 2.6e-225) {
tmp = x - (a * (y / t));
} else if (z <= 1.08e-7) {
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 <= -9.8e+26: tmp = x - a elif z <= -3e-26: tmp = x - (y / (t / a)) elif z <= 3.1e-251: tmp = t_1 elif z <= 2.6e-225: tmp = x - (a * (y / t)) elif z <= 1.08e-7: 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 <= -9.8e+26) tmp = Float64(x - a); elseif (z <= -3e-26) tmp = Float64(x - Float64(y / Float64(t / a))); elseif (z <= 3.1e-251) tmp = t_1; elseif (z <= 2.6e-225) tmp = Float64(x - Float64(a * Float64(y / t))); elseif (z <= 1.08e-7) 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 <= -9.8e+26) tmp = x - a; elseif (z <= -3e-26) tmp = x - (y / (t / a)); elseif (z <= 3.1e-251) tmp = t_1; elseif (z <= 2.6e-225) tmp = x - (a * (y / t)); elseif (z <= 1.08e-7) 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, -9.8e+26], N[(x - a), $MachinePrecision], If[LessEqual[z, -3e-26], N[(x - N[(y / N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.1e-251], t$95$1, If[LessEqual[z, 2.6e-225], N[(x - N[(a * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.08e-7], 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 -9.8 \cdot 10^{+26}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq -3 \cdot 10^{-26}:\\
\;\;\;\;x - \frac{y}{\frac{t}{a}}\\
\mathbf{elif}\;z \leq 3.1 \cdot 10^{-251}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{-225}:\\
\;\;\;\;x - a \cdot \frac{y}{t}\\
\mathbf{elif}\;z \leq 1.08 \cdot 10^{-7}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -9.79999999999999947e26 or 1.08000000000000001e-7 < z Initial program 94.8%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around inf 76.6%
if -9.79999999999999947e26 < z < -3.00000000000000012e-26Initial program 99.7%
associate-/r/99.6%
Simplified99.6%
Taylor expanded in t around inf 89.7%
Taylor expanded in y around inf 81.5%
associate-*l/73.9%
associate-/l*81.6%
Applied egg-rr81.6%
if -3.00000000000000012e-26 < z < 3.10000000000000003e-251 or 2.60000000000000013e-225 < z < 1.08000000000000001e-7Initial program 99.9%
Taylor expanded in z around 0 99.2%
Taylor expanded in t around 0 77.1%
if 3.10000000000000003e-251 < z < 2.60000000000000013e-225Initial program 99.8%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in t around inf 100.0%
Taylor expanded in y around inf 100.0%
Final simplification77.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -5.9e-61) (not (<= z 1.05e-8))) (+ x (/ a (/ (+ (- t z) 1.0) z))) (- x (* a (/ y (+ t 1.0))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -5.9e-61) || !(z <= 1.05e-8)) {
tmp = x + (a / (((t - z) + 1.0) / z));
} 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 <= (-5.9d-61)) .or. (.not. (z <= 1.05d-8))) then
tmp = x + (a / (((t - z) + 1.0d0) / z))
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 <= -5.9e-61) || !(z <= 1.05e-8)) {
tmp = x + (a / (((t - z) + 1.0) / z));
} else {
tmp = x - (a * (y / (t + 1.0)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -5.9e-61) or not (z <= 1.05e-8): tmp = x + (a / (((t - z) + 1.0) / z)) else: tmp = x - (a * (y / (t + 1.0))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -5.9e-61) || !(z <= 1.05e-8)) tmp = Float64(x + Float64(a / Float64(Float64(Float64(t - z) + 1.0) / z))); 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 <= -5.9e-61) || ~((z <= 1.05e-8))) tmp = x + (a / (((t - z) + 1.0) / z)); else tmp = x - (a * (y / (t + 1.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -5.9e-61], N[Not[LessEqual[z, 1.05e-8]], $MachinePrecision]], N[(x + N[(a / N[(N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision] / z), $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 -5.9 \cdot 10^{-61} \lor \neg \left(z \leq 1.05 \cdot 10^{-8}\right):\\
\;\;\;\;x + \frac{a}{\frac{\left(t - z\right) + 1}{z}}\\
\mathbf{else}:\\
\;\;\;\;x - a \cdot \frac{y}{t + 1}\\
\end{array}
\end{array}
if z < -5.89999999999999972e-61 or 1.04999999999999997e-8 < z Initial program 95.5%
associate-/r/99.9%
Simplified99.9%
associate-/r/95.5%
div-inv95.4%
associate-/r*99.7%
Applied egg-rr99.7%
Taylor expanded in y around 0 64.2%
sub-neg64.2%
mul-1-neg64.2%
remove-double-neg64.2%
associate-/l*84.2%
associate--l+84.2%
Simplified84.2%
if -5.89999999999999972e-61 < z < 1.04999999999999997e-8Initial program 99.9%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around 0 94.1%
Final simplification88.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -6.5e+20) (not (<= z 3.5e-8))) (+ x (/ a (/ (+ (- t z) 1.0) z))) (+ x (/ (- z y) (/ (+ t 1.0) a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -6.5e+20) || !(z <= 3.5e-8)) {
tmp = x + (a / (((t - z) + 1.0) / 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 <= (-6.5d+20)) .or. (.not. (z <= 3.5d-8))) then
tmp = x + (a / (((t - z) + 1.0d0) / 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 <= -6.5e+20) || !(z <= 3.5e-8)) {
tmp = x + (a / (((t - z) + 1.0) / z));
} else {
tmp = x + ((z - y) / ((t + 1.0) / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -6.5e+20) or not (z <= 3.5e-8): tmp = x + (a / (((t - z) + 1.0) / z)) else: tmp = x + ((z - y) / ((t + 1.0) / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -6.5e+20) || !(z <= 3.5e-8)) tmp = Float64(x + Float64(a / Float64(Float64(Float64(t - z) + 1.0) / 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 <= -6.5e+20) || ~((z <= 3.5e-8))) tmp = x + (a / (((t - z) + 1.0) / 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, -6.5e+20], N[Not[LessEqual[z, 3.5e-8]], $MachinePrecision]], N[(x + N[(a / N[(N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision] / z), $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 -6.5 \cdot 10^{+20} \lor \neg \left(z \leq 3.5 \cdot 10^{-8}\right):\\
\;\;\;\;x + \frac{a}{\frac{\left(t - z\right) + 1}{z}}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z - y}{\frac{t + 1}{a}}\\
\end{array}
\end{array}
if z < -6.5e20 or 3.50000000000000024e-8 < z Initial program 94.9%
associate-/r/99.9%
Simplified99.9%
associate-/r/94.9%
div-inv94.8%
associate-/r*99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 62.7%
sub-neg62.7%
mul-1-neg62.7%
remove-double-neg62.7%
associate-/l*85.5%
associate--l+85.5%
Simplified85.5%
if -6.5e20 < z < 3.50000000000000024e-8Initial program 99.9%
Taylor expanded in z around 0 98.6%
Final simplification91.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -9.5e+20) (not (<= z 3.5e-8))) (+ x (* a (/ z (+ (- t z) 1.0)))) (+ x (/ (- z y) (/ (+ t 1.0) a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -9.5e+20) || !(z <= 3.5e-8)) {
tmp = x + (a * (z / ((t - z) + 1.0)));
} 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 <= (-9.5d+20)) .or. (.not. (z <= 3.5d-8))) then
tmp = x + (a * (z / ((t - z) + 1.0d0)))
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 <= -9.5e+20) || !(z <= 3.5e-8)) {
tmp = x + (a * (z / ((t - z) + 1.0)));
} else {
tmp = x + ((z - y) / ((t + 1.0) / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -9.5e+20) or not (z <= 3.5e-8): tmp = x + (a * (z / ((t - z) + 1.0))) else: tmp = x + ((z - y) / ((t + 1.0) / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -9.5e+20) || !(z <= 3.5e-8)) tmp = Float64(x + Float64(a * Float64(z / Float64(Float64(t - z) + 1.0)))); 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 <= -9.5e+20) || ~((z <= 3.5e-8))) tmp = x + (a * (z / ((t - z) + 1.0))); else tmp = x + ((z - y) / ((t + 1.0) / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -9.5e+20], N[Not[LessEqual[z, 3.5e-8]], $MachinePrecision]], N[(x + N[(a * N[(z / N[(N[(t - z), $MachinePrecision] + 1.0), $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 -9.5 \cdot 10^{+20} \lor \neg \left(z \leq 3.5 \cdot 10^{-8}\right):\\
\;\;\;\;x + a \cdot \frac{z}{\left(t - z\right) + 1}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z - y}{\frac{t + 1}{a}}\\
\end{array}
\end{array}
if z < -9.5e20 or 3.50000000000000024e-8 < z Initial program 94.9%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in y around 0 85.6%
associate-*r/85.6%
neg-mul-185.6%
associate--l+85.6%
Simplified85.6%
if -9.5e20 < z < 3.50000000000000024e-8Initial program 99.9%
Taylor expanded in z around 0 98.6%
Final simplification91.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.9e+22) (not (<= z 1.75e+33))) (+ 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.9e+22) || !(z <= 1.75e+33)) {
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.9d+22)) .or. (.not. (z <= 1.75d+33))) 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.9e+22) || !(z <= 1.75e+33)) {
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.9e+22) or not (z <= 1.75e+33): 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.9e+22) || !(z <= 1.75e+33)) 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.9e+22) || ~((z <= 1.75e+33))) 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.9e+22], N[Not[LessEqual[z, 1.75e+33]], $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.9 \cdot 10^{+22} \lor \neg \left(z \leq 1.75 \cdot 10^{+33}\right):\\
\;\;\;\;x + \frac{z - y}{\frac{-z}{a}}\\
\mathbf{else}:\\
\;\;\;\;x - a \cdot \frac{y}{t + 1}\\
\end{array}
\end{array}
if z < -2.9e22 or 1.75000000000000005e33 < z Initial program 94.6%
Taylor expanded in z around inf 81.7%
mul-1-neg81.7%
distribute-neg-frac81.7%
Simplified81.7%
if -2.9e22 < z < 1.75000000000000005e33Initial program 99.9%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around 0 88.7%
Final simplification85.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -6.2e+26) (not (<= z 8e+114))) (- x a) (- x (* a (/ y (+ t 1.0))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -6.2e+26) || !(z <= 8e+114)) {
tmp = x - 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 <= (-6.2d+26)) .or. (.not. (z <= 8d+114))) then
tmp = x - 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 <= -6.2e+26) || !(z <= 8e+114)) {
tmp = x - a;
} else {
tmp = x - (a * (y / (t + 1.0)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -6.2e+26) or not (z <= 8e+114): tmp = x - a else: tmp = x - (a * (y / (t + 1.0))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -6.2e+26) || !(z <= 8e+114)) tmp = Float64(x - 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 <= -6.2e+26) || ~((z <= 8e+114))) tmp = x - a; else tmp = x - (a * (y / (t + 1.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -6.2e+26], N[Not[LessEqual[z, 8e+114]], $MachinePrecision]], N[(x - a), $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 -6.2 \cdot 10^{+26} \lor \neg \left(z \leq 8 \cdot 10^{+114}\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;x - a \cdot \frac{y}{t + 1}\\
\end{array}
\end{array}
if z < -6.1999999999999999e26 or 8e114 < z Initial program 93.6%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around inf 82.6%
if -6.1999999999999999e26 < z < 8e114Initial program 99.9%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around 0 85.0%
Final simplification84.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.85e+25) (not (<= z 1.08e-7))) (- x a) (+ x (* a (- z y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.85e+25) || !(z <= 1.08e-7)) {
tmp = x - a;
} else {
tmp = x + (a * (z - 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.85d+25)) .or. (.not. (z <= 1.08d-7))) then
tmp = x - a
else
tmp = x + (a * (z - 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.85e+25) || !(z <= 1.08e-7)) {
tmp = x - a;
} else {
tmp = x + (a * (z - y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.85e+25) or not (z <= 1.08e-7): tmp = x - a else: tmp = x + (a * (z - y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.85e+25) || !(z <= 1.08e-7)) tmp = Float64(x - a); else tmp = Float64(x + Float64(a * Float64(z - y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.85e+25) || ~((z <= 1.08e-7))) tmp = x - a; else tmp = x + (a * (z - y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.85e+25], N[Not[LessEqual[z, 1.08e-7]], $MachinePrecision]], N[(x - a), $MachinePrecision], N[(x + N[(a * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.85 \cdot 10^{+25} \lor \neg \left(z \leq 1.08 \cdot 10^{-7}\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;x + a \cdot \left(z - y\right)\\
\end{array}
\end{array}
if z < -1.8499999999999999e25 or 1.08000000000000001e-7 < z Initial program 94.8%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around inf 76.6%
if -1.8499999999999999e25 < z < 1.08000000000000001e-7Initial program 99.9%
Taylor expanded in z around 0 98.4%
Taylor expanded in t around 0 70.8%
Final simplification73.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.02e+21) (not (<= z 1.08e-7))) (- x a) (- x (* y a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.02e+21) || !(z <= 1.08e-7)) {
tmp = x - a;
} else {
tmp = x - (y * a);
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-1.02d+21)) .or. (.not. (z <= 1.08d-7))) then
tmp = x - a
else
tmp = x - (y * a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.02e+21) || !(z <= 1.08e-7)) {
tmp = x - a;
} else {
tmp = x - (y * a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.02e+21) or not (z <= 1.08e-7): tmp = x - a else: tmp = x - (y * a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.02e+21) || !(z <= 1.08e-7)) tmp = Float64(x - a); else tmp = Float64(x - Float64(y * a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.02e+21) || ~((z <= 1.08e-7))) tmp = x - a; else tmp = x - (y * a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.02e+21], N[Not[LessEqual[z, 1.08e-7]], $MachinePrecision]], N[(x - a), $MachinePrecision], N[(x - N[(y * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.02 \cdot 10^{+21} \lor \neg \left(z \leq 1.08 \cdot 10^{-7}\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot a\\
\end{array}
\end{array}
if z < -1.02e21 or 1.08000000000000001e-7 < z Initial program 94.8%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around inf 76.6%
if -1.02e21 < z < 1.08000000000000001e-7Initial program 99.9%
Taylor expanded in t around 0 72.1%
Taylor expanded in z around 0 67.5%
Final simplification72.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.9e+28) (not (<= z 9.5e-8))) (- x a) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.9e+28) || !(z <= 9.5e-8)) {
tmp = x - 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 ((z <= (-2.9d+28)) .or. (.not. (z <= 9.5d-8))) then
tmp = x - 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 ((z <= -2.9e+28) || !(z <= 9.5e-8)) {
tmp = x - a;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.9e+28) or not (z <= 9.5e-8): tmp = x - a else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.9e+28) || !(z <= 9.5e-8)) tmp = Float64(x - a); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -2.9e+28) || ~((z <= 9.5e-8))) tmp = x - a; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.9e+28], N[Not[LessEqual[z, 9.5e-8]], $MachinePrecision]], N[(x - a), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.9 \cdot 10^{+28} \lor \neg \left(z \leq 9.5 \cdot 10^{-8}\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.9000000000000001e28 or 9.50000000000000036e-8 < z Initial program 94.8%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around inf 76.4%
if -2.9000000000000001e28 < z < 9.50000000000000036e-8Initial program 99.9%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in x around inf 55.9%
Final simplification66.3%
(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.3%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in x around inf 48.9%
Final simplification48.9%
(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 2024031
(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))))