
(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 (/ (- y z) (+ -1.0 (- z t))) a x))
double code(double x, double y, double z, double t, double a) {
return fma(((y - z) / (-1.0 + (z - t))), a, x);
}
function code(x, y, z, t, a) return fma(Float64(Float64(y - z) / Float64(-1.0 + Float64(z - t))), a, x) end
code[x_, y_, z_, t_, a_] := N[(N[(N[(y - z), $MachinePrecision] / N[(-1.0 + N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{y - z}{-1 + \left(z - t\right)}, a, x\right)
\end{array}
Initial program 96.9%
sub-neg96.9%
+-commutative96.9%
associate-/r/99.9%
distribute-lft-neg-in99.9%
fma-define99.9%
distribute-neg-frac299.9%
distribute-neg-in99.9%
sub-neg99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
+-commutative99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* a (/ (- y z) z)))))
(if (<= z -0.00031)
t_1
(if (<= z 5e-49)
(+ x (* a (/ y (- -1.0 t))))
(if (<= z 6.4e+109) (- x (/ (* z a) (- (+ z -1.0) t))) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (a * ((y - z) / z));
double tmp;
if (z <= -0.00031) {
tmp = t_1;
} else if (z <= 5e-49) {
tmp = x + (a * (y / (-1.0 - t)));
} else if (z <= 6.4e+109) {
tmp = x - ((z * a) / ((z + -1.0) - t));
} else {
tmp = t_1;
}
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 * ((y - z) / z))
if (z <= (-0.00031d0)) then
tmp = t_1
else if (z <= 5d-49) then
tmp = x + (a * (y / ((-1.0d0) - t)))
else if (z <= 6.4d+109) then
tmp = x - ((z * a) / ((z + (-1.0d0)) - t))
else
tmp = t_1
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 * ((y - z) / z));
double tmp;
if (z <= -0.00031) {
tmp = t_1;
} else if (z <= 5e-49) {
tmp = x + (a * (y / (-1.0 - t)));
} else if (z <= 6.4e+109) {
tmp = x - ((z * a) / ((z + -1.0) - t));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (a * ((y - z) / z)) tmp = 0 if z <= -0.00031: tmp = t_1 elif z <= 5e-49: tmp = x + (a * (y / (-1.0 - t))) elif z <= 6.4e+109: tmp = x - ((z * a) / ((z + -1.0) - t)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(a * Float64(Float64(y - z) / z))) tmp = 0.0 if (z <= -0.00031) tmp = t_1; elseif (z <= 5e-49) tmp = Float64(x + Float64(a * Float64(y / Float64(-1.0 - t)))); elseif (z <= 6.4e+109) tmp = Float64(x - Float64(Float64(z * a) / Float64(Float64(z + -1.0) - t))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (a * ((y - z) / z)); tmp = 0.0; if (z <= -0.00031) tmp = t_1; elseif (z <= 5e-49) tmp = x + (a * (y / (-1.0 - t))); elseif (z <= 6.4e+109) tmp = x - ((z * a) / ((z + -1.0) - t)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(a * N[(N[(y - z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -0.00031], t$95$1, If[LessEqual[z, 5e-49], N[(x + N[(a * N[(y / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.4e+109], N[(x - N[(N[(z * a), $MachinePrecision] / N[(N[(z + -1.0), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + a \cdot \frac{y - z}{z}\\
\mathbf{if}\;z \leq -0.00031:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 5 \cdot 10^{-49}:\\
\;\;\;\;x + a \cdot \frac{y}{-1 - t}\\
\mathbf{elif}\;z \leq 6.4 \cdot 10^{+109}:\\
\;\;\;\;x - \frac{z \cdot a}{\left(z + -1\right) - t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.1e-4 or 6.4000000000000002e109 < z Initial program 92.8%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around inf 92.2%
neg-mul-192.2%
Simplified92.2%
if -3.1e-4 < z < 4.9999999999999999e-49Initial program 99.9%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in z around 0 96.4%
if 4.9999999999999999e-49 < z < 6.4000000000000002e109Initial program 99.8%
associate-/r/99.7%
Simplified99.7%
Taylor expanded in y around 0 81.6%
sub-neg81.6%
mul-1-neg81.6%
*-commutative81.6%
associate--l+81.6%
+-commutative81.6%
associate-*r/85.9%
remove-double-neg85.9%
associate-*r/81.6%
*-commutative81.6%
metadata-eval81.6%
sub-neg81.6%
associate--r+81.6%
+-commutative81.6%
Simplified81.6%
Final simplification92.2%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.05e+52)
(- x a)
(if (<= z 1.4e-63)
(- x (* y a))
(if (<= z 6.8e+22) (- x (* a (/ y t))) (- x a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.05e+52) {
tmp = x - a;
} else if (z <= 1.4e-63) {
tmp = x - (y * a);
} else if (z <= 6.8e+22) {
tmp = x - (a * (y / t));
} 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.05d+52)) then
tmp = x - a
else if (z <= 1.4d-63) then
tmp = x - (y * a)
else if (z <= 6.8d+22) then
tmp = x - (a * (y / t))
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.05e+52) {
tmp = x - a;
} else if (z <= 1.4e-63) {
tmp = x - (y * a);
} else if (z <= 6.8e+22) {
tmp = x - (a * (y / t));
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.05e+52: tmp = x - a elif z <= 1.4e-63: tmp = x - (y * a) elif z <= 6.8e+22: tmp = x - (a * (y / t)) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.05e+52) tmp = Float64(x - a); elseif (z <= 1.4e-63) tmp = Float64(x - Float64(y * a)); elseif (z <= 6.8e+22) tmp = Float64(x - Float64(a * Float64(y / t))); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.05e+52) tmp = x - a; elseif (z <= 1.4e-63) tmp = x - (y * a); elseif (z <= 6.8e+22) tmp = x - (a * (y / t)); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.05e+52], N[(x - a), $MachinePrecision], If[LessEqual[z, 1.4e-63], N[(x - N[(y * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.8e+22], N[(x - N[(a * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.05 \cdot 10^{+52}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{-63}:\\
\;\;\;\;x - y \cdot a\\
\mathbf{elif}\;z \leq 6.8 \cdot 10^{+22}:\\
\;\;\;\;x - a \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -1.05e52 or 6.8e22 < z Initial program 93.4%
associate-/r/99.8%
Simplified99.8%
Taylor expanded in z around inf 80.7%
if -1.05e52 < z < 1.4000000000000001e-63Initial program 99.8%
Taylor expanded in t around 0 80.6%
Taylor expanded in z around 0 75.2%
if 1.4000000000000001e-63 < z < 6.8e22Initial program 99.9%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in t around inf 72.1%
Taylor expanded in y around inf 70.0%
associate-/l*73.6%
Simplified73.6%
Final simplification77.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -8.5e+50) (not (<= t 3e+99))) (+ x (/ (- z y) (/ t a))) (+ x (/ (- y z) (/ (+ z -1.0) a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -8.5e+50) || !(t <= 3e+99)) {
tmp = x + ((z - y) / (t / a));
} else {
tmp = x + ((y - z) / ((z + -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 ((t <= (-8.5d+50)) .or. (.not. (t <= 3d+99))) then
tmp = x + ((z - y) / (t / a))
else
tmp = x + ((y - z) / ((z + (-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 ((t <= -8.5e+50) || !(t <= 3e+99)) {
tmp = x + ((z - y) / (t / a));
} else {
tmp = x + ((y - z) / ((z + -1.0) / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -8.5e+50) or not (t <= 3e+99): tmp = x + ((z - y) / (t / a)) else: tmp = x + ((y - z) / ((z + -1.0) / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -8.5e+50) || !(t <= 3e+99)) tmp = Float64(x + Float64(Float64(z - y) / Float64(t / a))); else tmp = Float64(x + Float64(Float64(y - z) / Float64(Float64(z + -1.0) / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -8.5e+50) || ~((t <= 3e+99))) tmp = x + ((z - y) / (t / a)); else tmp = x + ((y - z) / ((z + -1.0) / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -8.5e+50], N[Not[LessEqual[t, 3e+99]], $MachinePrecision]], N[(x + N[(N[(z - y), $MachinePrecision] / N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y - z), $MachinePrecision] / N[(N[(z + -1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.5 \cdot 10^{+50} \lor \neg \left(t \leq 3 \cdot 10^{+99}\right):\\
\;\;\;\;x + \frac{z - y}{\frac{t}{a}}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y - z}{\frac{z + -1}{a}}\\
\end{array}
\end{array}
if t < -8.49999999999999961e50 or 3.00000000000000014e99 < t Initial program 98.0%
Taylor expanded in t around inf 93.6%
if -8.49999999999999961e50 < t < 3.00000000000000014e99Initial program 96.3%
Taylor expanded in t around 0 93.6%
Final simplification93.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -0.00031) (not (<= z 220000000000.0))) (+ x (* a (/ (- y z) z))) (+ x (* a (/ y (- -1.0 t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -0.00031) || !(z <= 220000000000.0)) {
tmp = x + (a * ((y - z) / z));
} else {
tmp = x + (a * (y / (-1.0 - t)));
}
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 <= (-0.00031d0)) .or. (.not. (z <= 220000000000.0d0))) then
tmp = x + (a * ((y - z) / z))
else
tmp = x + (a * (y / ((-1.0d0) - t)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -0.00031) || !(z <= 220000000000.0)) {
tmp = x + (a * ((y - z) / z));
} else {
tmp = x + (a * (y / (-1.0 - t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -0.00031) or not (z <= 220000000000.0): tmp = x + (a * ((y - z) / z)) else: tmp = x + (a * (y / (-1.0 - t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -0.00031) || !(z <= 220000000000.0)) tmp = Float64(x + Float64(a * Float64(Float64(y - z) / z))); else tmp = Float64(x + Float64(a * Float64(y / Float64(-1.0 - t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -0.00031) || ~((z <= 220000000000.0))) tmp = x + (a * ((y - z) / z)); else tmp = x + (a * (y / (-1.0 - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -0.00031], N[Not[LessEqual[z, 220000000000.0]], $MachinePrecision]], N[(x + N[(a * N[(N[(y - z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(a * N[(y / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.00031 \lor \neg \left(z \leq 220000000000\right):\\
\;\;\;\;x + a \cdot \frac{y - z}{z}\\
\mathbf{else}:\\
\;\;\;\;x + a \cdot \frac{y}{-1 - t}\\
\end{array}
\end{array}
if z < -3.1e-4 or 2.2e11 < z Initial program 94.0%
associate-/r/99.8%
Simplified99.8%
Taylor expanded in z around inf 88.6%
neg-mul-188.6%
Simplified88.6%
if -3.1e-4 < z < 2.2e11Initial program 99.9%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in z around 0 92.4%
Final simplification90.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.4e+76) (not (<= z 1.76e+21))) (- x a) (+ x (* a (/ y (- -1.0 t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.4e+76) || !(z <= 1.76e+21)) {
tmp = x - a;
} else {
tmp = x + (a * (y / (-1.0 - t)));
}
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+76)) .or. (.not. (z <= 1.76d+21))) then
tmp = x - a
else
tmp = x + (a * (y / ((-1.0d0) - t)))
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+76) || !(z <= 1.76e+21)) {
tmp = x - a;
} else {
tmp = x + (a * (y / (-1.0 - t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.4e+76) or not (z <= 1.76e+21): tmp = x - a else: tmp = x + (a * (y / (-1.0 - t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.4e+76) || !(z <= 1.76e+21)) tmp = Float64(x - a); else tmp = Float64(x + Float64(a * Float64(y / Float64(-1.0 - t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -2.4e+76) || ~((z <= 1.76e+21))) tmp = x - a; else tmp = x + (a * (y / (-1.0 - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.4e+76], N[Not[LessEqual[z, 1.76e+21]], $MachinePrecision]], N[(x - a), $MachinePrecision], N[(x + N[(a * N[(y / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.4 \cdot 10^{+76} \lor \neg \left(z \leq 1.76 \cdot 10^{+21}\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;x + a \cdot \frac{y}{-1 - t}\\
\end{array}
\end{array}
if z < -2.4e76 or 1.76e21 < z Initial program 93.2%
associate-/r/99.8%
Simplified99.8%
Taylor expanded in z around inf 81.2%
if -2.4e76 < z < 1.76e21Initial program 99.9%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around 0 88.8%
Final simplification85.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -7.2e+52) (not (<= z 1.8e+20))) (- x a) (- x (* y a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -7.2e+52) || !(z <= 1.8e+20)) {
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 <= (-7.2d+52)) .or. (.not. (z <= 1.8d+20))) 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 <= -7.2e+52) || !(z <= 1.8e+20)) {
tmp = x - a;
} else {
tmp = x - (y * a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -7.2e+52) or not (z <= 1.8e+20): tmp = x - a else: tmp = x - (y * a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -7.2e+52) || !(z <= 1.8e+20)) 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 <= -7.2e+52) || ~((z <= 1.8e+20))) tmp = x - a; else tmp = x - (y * a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -7.2e+52], N[Not[LessEqual[z, 1.8e+20]], $MachinePrecision]], N[(x - a), $MachinePrecision], N[(x - N[(y * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.2 \cdot 10^{+52} \lor \neg \left(z \leq 1.8 \cdot 10^{+20}\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot a\\
\end{array}
\end{array}
if z < -7.2e52 or 1.8e20 < z Initial program 93.4%
associate-/r/99.8%
Simplified99.8%
Taylor expanded in z around inf 80.7%
if -7.2e52 < z < 1.8e20Initial program 99.9%
Taylor expanded in t around 0 77.8%
Taylor expanded in z around 0 70.8%
Final simplification75.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.12e-46) (not (<= z 8e+20))) (- x a) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.12e-46) || !(z <= 8e+20)) {
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.12d-46)) .or. (.not. (z <= 8d+20))) 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.12e-46) || !(z <= 8e+20)) {
tmp = x - a;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.12e-46) or not (z <= 8e+20): tmp = x - a else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.12e-46) || !(z <= 8e+20)) 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.12e-46) || ~((z <= 8e+20))) tmp = x - a; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.12e-46], N[Not[LessEqual[z, 8e+20]], $MachinePrecision]], N[(x - a), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.12 \cdot 10^{-46} \lor \neg \left(z \leq 8 \cdot 10^{+20}\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.11999999999999997e-46 or 8e20 < z Initial program 94.2%
associate-/r/99.8%
Simplified99.8%
Taylor expanded in z around inf 75.7%
if -1.11999999999999997e-46 < z < 8e20Initial program 99.9%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in x around inf 55.7%
Final simplification66.0%
(FPCore (x y z t a) :precision binary64 (+ x (* a (/ (- y z) (+ -1.0 (- z t))))))
double code(double x, double y, double z, double t, double a) {
return x + (a * ((y - z) / (-1.0 + (z - t))));
}
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 * ((y - z) / ((-1.0d0) + (z - t))))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (a * ((y - z) / (-1.0 + (z - t))));
}
def code(x, y, z, t, a): return x + (a * ((y - z) / (-1.0 + (z - t))))
function code(x, y, z, t, a) return Float64(x + Float64(a * Float64(Float64(y - z) / Float64(-1.0 + Float64(z - t))))) end
function tmp = code(x, y, z, t, a) tmp = x + (a * ((y - z) / (-1.0 + (z - t)))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(a * N[(N[(y - z), $MachinePrecision] / N[(-1.0 + N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + a \cdot \frac{y - z}{-1 + \left(z - t\right)}
\end{array}
Initial program 96.9%
associate-/r/99.9%
Simplified99.9%
Final simplification99.9%
(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 96.9%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in x around inf 53.6%
(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 2024116
(FPCore (x y z t a)
:name "Graphics.Rendering.Chart.SparkLine:renderSparkLine from Chart-1.5.3"
:precision binary64
:alt
(! :herbie-platform default (- x (* (/ (- y z) (+ (- t z) 1)) a)))
(- x (/ (- y z) (/ (+ (- t z) 1.0) a))))