
(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 (* (/ (- 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}
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 -9.5e+21)
(- x a)
(if (<= z -1.55e-36)
t_2
(if (<= z 3.7e-250)
t_1
(if (<= z 1.75e-225) t_2 (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 t_2 = x - (a * (y / t));
double tmp;
if (z <= -9.5e+21) {
tmp = x - a;
} else if (z <= -1.55e-36) {
tmp = t_2;
} else if (z <= 3.7e-250) {
tmp = t_1;
} else if (z <= 1.75e-225) {
tmp = t_2;
} 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) :: t_2
real(8) :: tmp
t_1 = x + (a * (z - y))
t_2 = x - (a * (y / t))
if (z <= (-9.5d+21)) then
tmp = x - a
else if (z <= (-1.55d-36)) then
tmp = t_2
else if (z <= 3.7d-250) then
tmp = t_1
else if (z <= 1.75d-225) then
tmp = t_2
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 t_2 = x - (a * (y / t));
double tmp;
if (z <= -9.5e+21) {
tmp = x - a;
} else if (z <= -1.55e-36) {
tmp = t_2;
} else if (z <= 3.7e-250) {
tmp = t_1;
} else if (z <= 1.75e-225) {
tmp = t_2;
} 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)) t_2 = x - (a * (y / t)) tmp = 0 if z <= -9.5e+21: tmp = x - a elif z <= -1.55e-36: tmp = t_2 elif z <= 3.7e-250: tmp = t_1 elif z <= 1.75e-225: tmp = t_2 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))) t_2 = Float64(x - Float64(a * Float64(y / t))) tmp = 0.0 if (z <= -9.5e+21) tmp = Float64(x - a); elseif (z <= -1.55e-36) tmp = t_2; elseif (z <= 3.7e-250) tmp = t_1; elseif (z <= 1.75e-225) tmp = t_2; 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)); t_2 = x - (a * (y / t)); tmp = 0.0; if (z <= -9.5e+21) tmp = x - a; elseif (z <= -1.55e-36) tmp = t_2; elseif (z <= 3.7e-250) tmp = t_1; elseif (z <= 1.75e-225) tmp = t_2; 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]}, Block[{t$95$2 = N[(x - N[(a * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -9.5e+21], N[(x - a), $MachinePrecision], If[LessEqual[z, -1.55e-36], t$95$2, If[LessEqual[z, 3.7e-250], t$95$1, If[LessEqual[z, 1.75e-225], t$95$2, 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)\\
t_2 := x - a \cdot \frac{y}{t}\\
\mathbf{if}\;z \leq -9.5 \cdot 10^{+21}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq -1.55 \cdot 10^{-36}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq 3.7 \cdot 10^{-250}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.75 \cdot 10^{-225}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq 1.08 \cdot 10^{-7}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -9.500000000000001e21 or 1.08000000000000001e-7 < z Initial program 94.8%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around inf 76.1%
if -9.500000000000001e21 < z < -1.5499999999999999e-36 or 3.6999999999999998e-250 < z < 1.7499999999999999e-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 -1.5499999999999999e-36 < z < 3.6999999999999998e-250 or 1.7499999999999999e-225 < z < 1.08000000000000001e-7Initial program 99.9%
Taylor expanded in z around 0 99.2%
Taylor expanded in t around 0 77.1%
Final simplification77.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* a (- z y)))))
(if (<= z -3.8e+25)
(- x a)
(if (<= z -4.1e-26)
(- x (/ y (/ t a)))
(if (<= z 1.75e-255)
t_1
(if (<= z 3.2e-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 <= -3.8e+25) {
tmp = x - a;
} else if (z <= -4.1e-26) {
tmp = x - (y / (t / a));
} else if (z <= 1.75e-255) {
tmp = t_1;
} else if (z <= 3.2e-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 <= (-3.8d+25)) then
tmp = x - a
else if (z <= (-4.1d-26)) then
tmp = x - (y / (t / a))
else if (z <= 1.75d-255) then
tmp = t_1
else if (z <= 3.2d-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 <= -3.8e+25) {
tmp = x - a;
} else if (z <= -4.1e-26) {
tmp = x - (y / (t / a));
} else if (z <= 1.75e-255) {
tmp = t_1;
} else if (z <= 3.2e-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 <= -3.8e+25: tmp = x - a elif z <= -4.1e-26: tmp = x - (y / (t / a)) elif z <= 1.75e-255: tmp = t_1 elif z <= 3.2e-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 <= -3.8e+25) tmp = Float64(x - a); elseif (z <= -4.1e-26) tmp = Float64(x - Float64(y / Float64(t / a))); elseif (z <= 1.75e-255) tmp = t_1; elseif (z <= 3.2e-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 <= -3.8e+25) tmp = x - a; elseif (z <= -4.1e-26) tmp = x - (y / (t / a)); elseif (z <= 1.75e-255) tmp = t_1; elseif (z <= 3.2e-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, -3.8e+25], N[(x - a), $MachinePrecision], If[LessEqual[z, -4.1e-26], N[(x - N[(y / N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.75e-255], t$95$1, If[LessEqual[z, 3.2e-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 -3.8 \cdot 10^{+25}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq -4.1 \cdot 10^{-26}:\\
\;\;\;\;x - \frac{y}{\frac{t}{a}}\\
\mathbf{elif}\;z \leq 1.75 \cdot 10^{-255}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.2 \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 < -3.8e25 or 1.08000000000000001e-7 < z Initial program 94.8%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around inf 76.1%
if -3.8e25 < z < -4.0999999999999999e-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 -4.0999999999999999e-26 < z < 1.74999999999999989e-255 or 3.19999999999999975e-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 1.74999999999999989e-255 < z < 3.19999999999999975e-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.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -5.7e-61) (not (<= z 2.6e-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.7e-61) || !(z <= 2.6e-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.7d-61)) .or. (.not. (z <= 2.6d-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.7e-61) || !(z <= 2.6e-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.7e-61) or not (z <= 2.6e-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.7e-61) || !(z <= 2.6e-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.7e-61) || ~((z <= 2.6e-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.7e-61], N[Not[LessEqual[z, 2.6e-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.7 \cdot 10^{-61} \lor \neg \left(z \leq 2.6 \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.70000000000000005e-61 or 2.6000000000000001e-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.8%
sub-neg64.8%
mul-1-neg64.8%
remove-double-neg64.8%
associate-/l*83.6%
associate--l+83.6%
Simplified83.6%
if -5.70000000000000005e-61 < z < 2.6000000000000001e-8Initial program 99.9%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around 0 94.1%
Final simplification87.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.4e+23) (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 <= -2.4e+23) || !(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 <= (-2.4d+23)) .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 <= -2.4e+23) || !(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 <= -2.4e+23) 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 <= -2.4e+23) || !(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 <= -2.4e+23) || ~((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, -2.4e+23], 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 -2.4 \cdot 10^{+23} \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 < -2.4e23 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 63.4%
sub-neg63.4%
mul-1-neg63.4%
remove-double-neg63.4%
associate-/l*84.9%
associate--l+84.9%
Simplified84.9%
if -2.4e23 < z < 3.50000000000000024e-8Initial program 99.9%
Taylor expanded in z around 0 98.6%
Final simplification91.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -4.6e+21) (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 <= -4.6e+21) || !(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 <= (-4.6d+21)) .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 <= -4.6e+21) || !(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 <= -4.6e+21) 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 <= -4.6e+21) || !(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 <= -4.6e+21) || ~((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, -4.6e+21], 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 -4.6 \cdot 10^{+21} \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 < -4.6e21 or 3.50000000000000024e-8 < z Initial program 94.9%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in y around 0 84.9%
associate-*r/84.9%
neg-mul-184.9%
associate--l+84.9%
Simplified84.9%
if -4.6e21 < z < 3.50000000000000024e-8Initial program 99.9%
Taylor expanded in z around 0 98.6%
Final simplification91.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.8e+27) (not (<= z 9e+31))) (+ 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 <= -1.8e+27) || !(z <= 9e+31)) {
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 <= (-1.8d+27)) .or. (.not. (z <= 9d+31))) 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 <= -1.8e+27) || !(z <= 9e+31)) {
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 <= -1.8e+27) or not (z <= 9e+31): 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 <= -1.8e+27) || !(z <= 9e+31)) 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 <= -1.8e+27) || ~((z <= 9e+31))) 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, -1.8e+27], N[Not[LessEqual[z, 9e+31]], $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 -1.8 \cdot 10^{+27} \lor \neg \left(z \leq 9 \cdot 10^{+31}\right):\\
\;\;\;\;x + \frac{z - y}{\frac{-z}{a}}\\
\mathbf{else}:\\
\;\;\;\;x - a \cdot \frac{y}{t + 1}\\
\end{array}
\end{array}
if z < -1.79999999999999991e27 or 8.9999999999999992e31 < z Initial program 94.6%
Taylor expanded in z around inf 81.9%
mul-1-neg81.9%
distribute-neg-frac81.9%
Simplified81.9%
if -1.79999999999999991e27 < z < 8.9999999999999992e31Initial program 99.9%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around 0 88.7%
Final simplification85.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.45e+27) (not (<= z 9.5e+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 <= -1.45e+27) || !(z <= 9.5e+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 <= (-1.45d+27)) .or. (.not. (z <= 9.5d+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 <= -1.45e+27) || !(z <= 9.5e+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 <= -1.45e+27) or not (z <= 9.5e+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 <= -1.45e+27) || !(z <= 9.5e+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 <= -1.45e+27) || ~((z <= 9.5e+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, -1.45e+27], N[Not[LessEqual[z, 9.5e+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 -1.45 \cdot 10^{+27} \lor \neg \left(z \leq 9.5 \cdot 10^{+114}\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;x - a \cdot \frac{y}{t + 1}\\
\end{array}
\end{array}
if z < -1.4500000000000001e27 or 9.5000000000000001e114 < z Initial program 93.6%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around inf 81.9%
if -1.4500000000000001e27 < z < 9.5000000000000001e114Initial program 99.9%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around 0 85.0%
Final simplification83.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -3.5e+20) (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 <= -3.5e+20) || !(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 <= (-3.5d+20)) .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 <= -3.5e+20) || !(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 <= -3.5e+20) 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 <= -3.5e+20) || !(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 <= -3.5e+20) || ~((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, -3.5e+20], 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 -3.5 \cdot 10^{+20} \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 < -3.5e20 or 1.08000000000000001e-7 < z Initial program 94.8%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around inf 76.1%
if -3.5e20 < 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.5%
(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.1%
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 simplification71.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.55e+28) (not (<= z 1.08e-7))) (- x a) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.55e+28) || !(z <= 1.08e-7)) {
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 <= (-1.55d+28)) .or. (.not. (z <= 1.08d-7))) 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 <= -1.55e+28) || !(z <= 1.08e-7)) {
tmp = x - a;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.55e+28) or not (z <= 1.08e-7): tmp = x - a else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.55e+28) || !(z <= 1.08e-7)) 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 <= -1.55e+28) || ~((z <= 1.08e-7))) tmp = x - a; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.55e+28], N[Not[LessEqual[z, 1.08e-7]], $MachinePrecision]], N[(x - a), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.55 \cdot 10^{+28} \lor \neg \left(z \leq 1.08 \cdot 10^{-7}\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.55e28 or 1.08000000000000001e-7 < z Initial program 94.8%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around inf 75.9%
if -1.55e28 < z < 1.08000000000000001e-7Initial program 99.9%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in x around inf 55.2%
Final simplification65.7%
(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))))