
(FPCore (x y z t) :precision binary64 (/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))
double code(double x, double y, double z, double t) {
return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
def code(x, y, z, t): return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0)
function code(x, y, z, t) return Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / Float64(Float64(t * z) - x))) / Float64(x + 1.0)) end
function tmp = code(x, y, z, t) tmp = (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0); end
code[x_, y_, z_, t_] := N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(N[(t * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))
double code(double x, double y, double z, double t) {
return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
def code(x, y, z, t): return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0)
function code(x, y, z, t) return Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / Float64(Float64(t * z) - x))) / Float64(x + 1.0)) end
function tmp = code(x, y, z, t) tmp = (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0); end
code[x_, y_, z_, t_] := N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(N[(t * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}
\end{array}
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* z t) x)) (t_2 (/ (+ x (/ (- (* y z) x) t_1)) (+ x 1.0))))
(if (<= t_2 -1e+43)
(/ (+ x (* y (+ (/ x (* y (- x (* z t)))) (/ z t_1)))) (+ x 1.0))
(if (<= t_2 1e+248)
t_2
(- (/ x (+ x 1.0)) (/ (- (/ (/ x z) (+ x 1.0)) (/ y (+ x 1.0))) t))))))
double code(double x, double y, double z, double t) {
double t_1 = (z * t) - x;
double t_2 = (x + (((y * z) - x) / t_1)) / (x + 1.0);
double tmp;
if (t_2 <= -1e+43) {
tmp = (x + (y * ((x / (y * (x - (z * t)))) + (z / t_1)))) / (x + 1.0);
} else if (t_2 <= 1e+248) {
tmp = t_2;
} else {
tmp = (x / (x + 1.0)) - ((((x / z) / (x + 1.0)) - (y / (x + 1.0))) / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (z * t) - x
t_2 = (x + (((y * z) - x) / t_1)) / (x + 1.0d0)
if (t_2 <= (-1d+43)) then
tmp = (x + (y * ((x / (y * (x - (z * t)))) + (z / t_1)))) / (x + 1.0d0)
else if (t_2 <= 1d+248) then
tmp = t_2
else
tmp = (x / (x + 1.0d0)) - ((((x / z) / (x + 1.0d0)) - (y / (x + 1.0d0))) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (z * t) - x;
double t_2 = (x + (((y * z) - x) / t_1)) / (x + 1.0);
double tmp;
if (t_2 <= -1e+43) {
tmp = (x + (y * ((x / (y * (x - (z * t)))) + (z / t_1)))) / (x + 1.0);
} else if (t_2 <= 1e+248) {
tmp = t_2;
} else {
tmp = (x / (x + 1.0)) - ((((x / z) / (x + 1.0)) - (y / (x + 1.0))) / t);
}
return tmp;
}
def code(x, y, z, t): t_1 = (z * t) - x t_2 = (x + (((y * z) - x) / t_1)) / (x + 1.0) tmp = 0 if t_2 <= -1e+43: tmp = (x + (y * ((x / (y * (x - (z * t)))) + (z / t_1)))) / (x + 1.0) elif t_2 <= 1e+248: tmp = t_2 else: tmp = (x / (x + 1.0)) - ((((x / z) / (x + 1.0)) - (y / (x + 1.0))) / t) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z * t) - x) t_2 = Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / t_1)) / Float64(x + 1.0)) tmp = 0.0 if (t_2 <= -1e+43) tmp = Float64(Float64(x + Float64(y * Float64(Float64(x / Float64(y * Float64(x - Float64(z * t)))) + Float64(z / t_1)))) / Float64(x + 1.0)); elseif (t_2 <= 1e+248) tmp = t_2; else tmp = Float64(Float64(x / Float64(x + 1.0)) - Float64(Float64(Float64(Float64(x / z) / Float64(x + 1.0)) - Float64(y / Float64(x + 1.0))) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z * t) - x; t_2 = (x + (((y * z) - x) / t_1)) / (x + 1.0); tmp = 0.0; if (t_2 <= -1e+43) tmp = (x + (y * ((x / (y * (x - (z * t)))) + (z / t_1)))) / (x + 1.0); elseif (t_2 <= 1e+248) tmp = t_2; else tmp = (x / (x + 1.0)) - ((((x / z) / (x + 1.0)) - (y / (x + 1.0))) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+43], N[(N[(x + N[(y * N[(N[(x / N[(y * N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(z / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+248], t$95$2, N[(N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(N[(x / z), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] - N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot t - x\\
t_2 := \frac{x + \frac{y \cdot z - x}{t\_1}}{x + 1}\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+43}:\\
\;\;\;\;\frac{x + y \cdot \left(\frac{x}{y \cdot \left(x - z \cdot t\right)} + \frac{z}{t\_1}\right)}{x + 1}\\
\mathbf{elif}\;t\_2 \leq 10^{+248}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x + 1} - \frac{\frac{\frac{x}{z}}{x + 1} - \frac{y}{x + 1}}{t}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < -1.00000000000000001e43Initial program 73.5%
*-commutative73.5%
Simplified73.5%
Taylor expanded in y around inf 99.7%
if -1.00000000000000001e43 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 1.00000000000000005e248Initial program 98.7%
if 1.00000000000000005e248 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) Initial program 22.9%
*-commutative22.9%
Simplified22.9%
Taylor expanded in t around -inf 100.0%
+-commutative100.0%
mul-1-neg100.0%
unsub-neg100.0%
+-commutative100.0%
sub-neg100.0%
mul-1-neg100.0%
distribute-neg-frac2100.0%
distribute-neg-in100.0%
metadata-eval100.0%
unsub-neg100.0%
mul-1-neg100.0%
remove-double-neg100.0%
associate-/r*100.0%
+-commutative100.0%
Simplified100.0%
Final simplification98.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (+ x (/ (- (* y z) x) (- (* z t) x))) (+ x 1.0))))
(if (<= t_1 -1e+43)
(/ y (* (+ x 1.0) (- t (/ x z))))
(if (<= t_1 1e+248)
t_1
(- (/ x (+ x 1.0)) (/ (- (/ (/ x z) (+ x 1.0)) (/ y (+ x 1.0))) t))))))
double code(double x, double y, double z, double t) {
double t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0);
double tmp;
if (t_1 <= -1e+43) {
tmp = y / ((x + 1.0) * (t - (x / z)));
} else if (t_1 <= 1e+248) {
tmp = t_1;
} else {
tmp = (x / (x + 1.0)) - ((((x / z) / (x + 1.0)) - (y / (x + 1.0))) / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0d0)
if (t_1 <= (-1d+43)) then
tmp = y / ((x + 1.0d0) * (t - (x / z)))
else if (t_1 <= 1d+248) then
tmp = t_1
else
tmp = (x / (x + 1.0d0)) - ((((x / z) / (x + 1.0d0)) - (y / (x + 1.0d0))) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0);
double tmp;
if (t_1 <= -1e+43) {
tmp = y / ((x + 1.0) * (t - (x / z)));
} else if (t_1 <= 1e+248) {
tmp = t_1;
} else {
tmp = (x / (x + 1.0)) - ((((x / z) / (x + 1.0)) - (y / (x + 1.0))) / t);
}
return tmp;
}
def code(x, y, z, t): t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0) tmp = 0 if t_1 <= -1e+43: tmp = y / ((x + 1.0) * (t - (x / z))) elif t_1 <= 1e+248: tmp = t_1 else: tmp = (x / (x + 1.0)) - ((((x / z) / (x + 1.0)) - (y / (x + 1.0))) / t) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / Float64(Float64(z * t) - x))) / Float64(x + 1.0)) tmp = 0.0 if (t_1 <= -1e+43) tmp = Float64(y / Float64(Float64(x + 1.0) * Float64(t - Float64(x / z)))); elseif (t_1 <= 1e+248) tmp = t_1; else tmp = Float64(Float64(x / Float64(x + 1.0)) - Float64(Float64(Float64(Float64(x / z) / Float64(x + 1.0)) - Float64(y / Float64(x + 1.0))) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0); tmp = 0.0; if (t_1 <= -1e+43) tmp = y / ((x + 1.0) * (t - (x / z))); elseif (t_1 <= 1e+248) tmp = t_1; else tmp = (x / (x + 1.0)) - ((((x / z) / (x + 1.0)) - (y / (x + 1.0))) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+43], N[(y / N[(N[(x + 1.0), $MachinePrecision] * N[(t - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+248], t$95$1, N[(N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(N[(x / z), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] - N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+43}:\\
\;\;\;\;\frac{y}{\left(x + 1\right) \cdot \left(t - \frac{x}{z}\right)}\\
\mathbf{elif}\;t\_1 \leq 10^{+248}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x + 1} - \frac{\frac{\frac{x}{z}}{x + 1} - \frac{y}{x + 1}}{t}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < -1.00000000000000001e43Initial program 73.5%
*-commutative73.5%
Simplified73.5%
Taylor expanded in z around inf 73.5%
mul-1-neg73.5%
unsub-neg73.5%
Simplified73.5%
Taylor expanded in y around inf 94.8%
if -1.00000000000000001e43 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 1.00000000000000005e248Initial program 98.7%
if 1.00000000000000005e248 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) Initial program 22.9%
*-commutative22.9%
Simplified22.9%
Taylor expanded in t around -inf 100.0%
+-commutative100.0%
mul-1-neg100.0%
unsub-neg100.0%
+-commutative100.0%
sub-neg100.0%
mul-1-neg100.0%
distribute-neg-frac2100.0%
distribute-neg-in100.0%
metadata-eval100.0%
unsub-neg100.0%
mul-1-neg100.0%
remove-double-neg100.0%
associate-/r*100.0%
+-commutative100.0%
Simplified100.0%
Final simplification98.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (+ x (/ (- (* y z) x) (- (* z t) x))) (+ x 1.0))))
(if (<= t_1 -1e+43)
(/ y (* (- -1.0 x) (- (/ x z) t)))
(if (<= t_1 1e+248) t_1 (/ (- x (/ (- (/ x z) y) t)) (+ x 1.0))))))
double code(double x, double y, double z, double t) {
double t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0);
double tmp;
if (t_1 <= -1e+43) {
tmp = y / ((-1.0 - x) * ((x / z) - t));
} else if (t_1 <= 1e+248) {
tmp = t_1;
} else {
tmp = (x - (((x / z) - y) / t)) / (x + 1.0);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0d0)
if (t_1 <= (-1d+43)) then
tmp = y / (((-1.0d0) - x) * ((x / z) - t))
else if (t_1 <= 1d+248) then
tmp = t_1
else
tmp = (x - (((x / z) - y) / t)) / (x + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0);
double tmp;
if (t_1 <= -1e+43) {
tmp = y / ((-1.0 - x) * ((x / z) - t));
} else if (t_1 <= 1e+248) {
tmp = t_1;
} else {
tmp = (x - (((x / z) - y) / t)) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0) tmp = 0 if t_1 <= -1e+43: tmp = y / ((-1.0 - x) * ((x / z) - t)) elif t_1 <= 1e+248: tmp = t_1 else: tmp = (x - (((x / z) - y) / t)) / (x + 1.0) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / Float64(Float64(z * t) - x))) / Float64(x + 1.0)) tmp = 0.0 if (t_1 <= -1e+43) tmp = Float64(y / Float64(Float64(-1.0 - x) * Float64(Float64(x / z) - t))); elseif (t_1 <= 1e+248) tmp = t_1; else tmp = Float64(Float64(x - Float64(Float64(Float64(x / z) - y) / t)) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0); tmp = 0.0; if (t_1 <= -1e+43) tmp = y / ((-1.0 - x) * ((x / z) - t)); elseif (t_1 <= 1e+248) tmp = t_1; else tmp = (x - (((x / z) - y) / t)) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+43], N[(y / N[(N[(-1.0 - x), $MachinePrecision] * N[(N[(x / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+248], t$95$1, N[(N[(x - N[(N[(N[(x / z), $MachinePrecision] - y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+43}:\\
\;\;\;\;\frac{y}{\left(-1 - x\right) \cdot \left(\frac{x}{z} - t\right)}\\
\mathbf{elif}\;t\_1 \leq 10^{+248}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x - \frac{\frac{x}{z} - y}{t}}{x + 1}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < -1.00000000000000001e43Initial program 73.5%
*-commutative73.5%
Simplified73.5%
Taylor expanded in z around inf 73.5%
mul-1-neg73.5%
unsub-neg73.5%
Simplified73.5%
Taylor expanded in y around inf 94.8%
if -1.00000000000000001e43 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 1.00000000000000005e248Initial program 98.7%
if 1.00000000000000005e248 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) Initial program 22.9%
*-commutative22.9%
Simplified22.9%
Taylor expanded in t around -inf 95.8%
mul-1-neg95.8%
distribute-lft-out--95.8%
Simplified95.8%
Final simplification98.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (+ x (/ y t)) (+ x 1.0))))
(if (<= z -8e+15)
t_1
(if (<= z 6.6e-242)
(/ (+ x (/ x (- x (* z t)))) (+ x 1.0))
(if (<= z 0.98) (+ 1.0 (* y (/ (/ z x) (- -1.0 x)))) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (x + (y / t)) / (x + 1.0);
double tmp;
if (z <= -8e+15) {
tmp = t_1;
} else if (z <= 6.6e-242) {
tmp = (x + (x / (x - (z * t)))) / (x + 1.0);
} else if (z <= 0.98) {
tmp = 1.0 + (y * ((z / x) / (-1.0 - x)));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (x + (y / t)) / (x + 1.0d0)
if (z <= (-8d+15)) then
tmp = t_1
else if (z <= 6.6d-242) then
tmp = (x + (x / (x - (z * t)))) / (x + 1.0d0)
else if (z <= 0.98d0) then
tmp = 1.0d0 + (y * ((z / x) / ((-1.0d0) - x)))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x + (y / t)) / (x + 1.0);
double tmp;
if (z <= -8e+15) {
tmp = t_1;
} else if (z <= 6.6e-242) {
tmp = (x + (x / (x - (z * t)))) / (x + 1.0);
} else if (z <= 0.98) {
tmp = 1.0 + (y * ((z / x) / (-1.0 - x)));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x + (y / t)) / (x + 1.0) tmp = 0 if z <= -8e+15: tmp = t_1 elif z <= 6.6e-242: tmp = (x + (x / (x - (z * t)))) / (x + 1.0) elif z <= 0.98: tmp = 1.0 + (y * ((z / x) / (-1.0 - x))) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)) tmp = 0.0 if (z <= -8e+15) tmp = t_1; elseif (z <= 6.6e-242) tmp = Float64(Float64(x + Float64(x / Float64(x - Float64(z * t)))) / Float64(x + 1.0)); elseif (z <= 0.98) tmp = Float64(1.0 + Float64(y * Float64(Float64(z / x) / Float64(-1.0 - x)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x + (y / t)) / (x + 1.0); tmp = 0.0; if (z <= -8e+15) tmp = t_1; elseif (z <= 6.6e-242) tmp = (x + (x / (x - (z * t)))) / (x + 1.0); elseif (z <= 0.98) tmp = 1.0 + (y * ((z / x) / (-1.0 - x))); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -8e+15], t$95$1, If[LessEqual[z, 6.6e-242], N[(N[(x + N[(x / N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.98], N[(1.0 + N[(y * N[(N[(z / x), $MachinePrecision] / N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{if}\;z \leq -8 \cdot 10^{+15}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 6.6 \cdot 10^{-242}:\\
\;\;\;\;\frac{x + \frac{x}{x - z \cdot t}}{x + 1}\\
\mathbf{elif}\;z \leq 0.98:\\
\;\;\;\;1 + y \cdot \frac{\frac{z}{x}}{-1 - x}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -8e15 or 0.97999999999999998 < z Initial program 78.1%
*-commutative78.1%
Simplified78.1%
Taylor expanded in z around inf 88.7%
+-commutative88.7%
+-commutative88.7%
Simplified88.7%
if -8e15 < z < 6.59999999999999963e-242Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in y around 0 86.1%
if 6.59999999999999963e-242 < z < 0.97999999999999998Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in t around 0 82.7%
mul-1-neg82.7%
unsub-neg82.7%
associate-/l*82.7%
+-commutative82.7%
Simplified82.7%
Taylor expanded in y around 0 82.7%
mul-1-neg82.7%
sub-neg82.7%
associate-/l*82.7%
associate-/r*82.7%
+-commutative82.7%
Simplified82.7%
Final simplification86.7%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.3e-29) (not (<= t 2.95e-61))) (/ (+ x (/ y t)) (+ x 1.0)) (/ (+ 1.0 (- x (* y (/ z x)))) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.3e-29) || !(t <= 2.95e-61)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (1.0 + (x - (y * (z / x)))) / (x + 1.0);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-2.3d-29)) .or. (.not. (t <= 2.95d-61))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = (1.0d0 + (x - (y * (z / x)))) / (x + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.3e-29) || !(t <= 2.95e-61)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (1.0 + (x - (y * (z / x)))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.3e-29) or not (t <= 2.95e-61): tmp = (x + (y / t)) / (x + 1.0) else: tmp = (1.0 + (x - (y * (z / x)))) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.3e-29) || !(t <= 2.95e-61)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(Float64(1.0 + Float64(x - Float64(y * Float64(z / x)))) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -2.3e-29) || ~((t <= 2.95e-61))) tmp = (x + (y / t)) / (x + 1.0); else tmp = (1.0 + (x - (y * (z / x)))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.3e-29], N[Not[LessEqual[t, 2.95e-61]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(x - N[(y * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.3 \cdot 10^{-29} \lor \neg \left(t \leq 2.95 \cdot 10^{-61}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \left(x - y \cdot \frac{z}{x}\right)}{x + 1}\\
\end{array}
\end{array}
if t < -2.29999999999999991e-29 or 2.94999999999999986e-61 < t Initial program 84.1%
*-commutative84.1%
Simplified84.1%
Taylor expanded in z around inf 88.3%
+-commutative88.3%
+-commutative88.3%
Simplified88.3%
if -2.29999999999999991e-29 < t < 2.94999999999999986e-61Initial program 96.3%
*-commutative96.3%
Simplified96.3%
Taylor expanded in t around 0 77.6%
mul-1-neg77.6%
unsub-neg77.6%
associate-/l*79.3%
+-commutative79.3%
Simplified79.3%
Final simplification84.5%
(FPCore (x y z t) :precision binary64 (if (or (<= t -7.2e-45) (not (<= t 2.5e-61))) (/ (+ x (/ y t)) (+ x 1.0)) (+ 1.0 (* y (/ (/ z x) (- -1.0 x))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -7.2e-45) || !(t <= 2.5e-61)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 + (y * ((z / x) / (-1.0 - x)));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-7.2d-45)) .or. (.not. (t <= 2.5d-61))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = 1.0d0 + (y * ((z / x) / ((-1.0d0) - x)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -7.2e-45) || !(t <= 2.5e-61)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 + (y * ((z / x) / (-1.0 - x)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -7.2e-45) or not (t <= 2.5e-61): tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 + (y * ((z / x) / (-1.0 - x))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -7.2e-45) || !(t <= 2.5e-61)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(1.0 + Float64(y * Float64(Float64(z / x) / Float64(-1.0 - x)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -7.2e-45) || ~((t <= 2.5e-61))) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0 + (y * ((z / x) / (-1.0 - x))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -7.2e-45], N[Not[LessEqual[t, 2.5e-61]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(y * N[(N[(z / x), $MachinePrecision] / N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.2 \cdot 10^{-45} \lor \neg \left(t \leq 2.5 \cdot 10^{-61}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1 + y \cdot \frac{\frac{z}{x}}{-1 - x}\\
\end{array}
\end{array}
if t < -7.20000000000000001e-45 or 2.4999999999999999e-61 < t Initial program 84.1%
*-commutative84.1%
Simplified84.1%
Taylor expanded in z around inf 88.3%
+-commutative88.3%
+-commutative88.3%
Simplified88.3%
if -7.20000000000000001e-45 < t < 2.4999999999999999e-61Initial program 96.3%
*-commutative96.3%
Simplified96.3%
Taylor expanded in t around 0 77.6%
mul-1-neg77.6%
unsub-neg77.6%
associate-/l*79.3%
+-commutative79.3%
Simplified79.3%
Taylor expanded in y around 0 77.6%
mul-1-neg77.6%
sub-neg77.6%
associate-/l*78.4%
associate-/r*79.3%
+-commutative79.3%
Simplified79.3%
Final simplification84.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -7.5e-220) (not (<= z 1.0))) (/ (+ x (/ y t)) (+ x 1.0)) 1.0))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.5e-220) || !(z <= 1.0)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-7.5d-220)) .or. (.not. (z <= 1.0d0))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.5e-220) || !(z <= 1.0)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -7.5e-220) or not (z <= 1.0): tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -7.5e-220) || !(z <= 1.0)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -7.5e-220) || ~((z <= 1.0))) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -7.5e-220], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.5 \cdot 10^{-220} \lor \neg \left(z \leq 1\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if z < -7.5000000000000002e-220 or 1 < z Initial program 83.3%
*-commutative83.3%
Simplified83.3%
Taylor expanded in z around inf 83.5%
+-commutative83.5%
+-commutative83.5%
Simplified83.5%
if -7.5000000000000002e-220 < z < 1Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in x around inf 76.8%
Final simplification81.1%
(FPCore (x y z t) :precision binary64 (if (<= x -1.5e-85) (/ x (+ x 1.0)) (if (<= x 6.8e-47) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.5e-85) {
tmp = x / (x + 1.0);
} else if (x <= 6.8e-47) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-1.5d-85)) then
tmp = x / (x + 1.0d0)
else if (x <= 6.8d-47) then
tmp = y / t
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.5e-85) {
tmp = x / (x + 1.0);
} else if (x <= 6.8e-47) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.5e-85: tmp = x / (x + 1.0) elif x <= 6.8e-47: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.5e-85) tmp = Float64(x / Float64(x + 1.0)); elseif (x <= 6.8e-47) tmp = Float64(y / t); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -1.5e-85) tmp = x / (x + 1.0); elseif (x <= 6.8e-47) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.5e-85], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 6.8e-47], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.5 \cdot 10^{-85}:\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{elif}\;x \leq 6.8 \cdot 10^{-47}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -1.50000000000000011e-85Initial program 85.6%
*-commutative85.6%
Simplified85.6%
Taylor expanded in t around inf 77.3%
+-commutative77.3%
Simplified77.3%
if -1.50000000000000011e-85 < x < 6.8000000000000003e-47Initial program 92.1%
*-commutative92.1%
Simplified92.1%
Taylor expanded in x around 0 53.4%
if 6.8000000000000003e-47 < x Initial program 90.1%
*-commutative90.1%
Simplified90.1%
Taylor expanded in x around inf 84.2%
(FPCore (x y z t) :precision binary64 (if (<= x -8.5e-25) 1.0 (if (<= x 1.3e-46) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -8.5e-25) {
tmp = 1.0;
} else if (x <= 1.3e-46) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-8.5d-25)) then
tmp = 1.0d0
else if (x <= 1.3d-46) then
tmp = y / t
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -8.5e-25) {
tmp = 1.0;
} else if (x <= 1.3e-46) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -8.5e-25: tmp = 1.0 elif x <= 1.3e-46: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -8.5e-25) tmp = 1.0; elseif (x <= 1.3e-46) tmp = Float64(y / t); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -8.5e-25) tmp = 1.0; elseif (x <= 1.3e-46) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -8.5e-25], 1.0, If[LessEqual[x, 1.3e-46], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.5 \cdot 10^{-25}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{-46}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -8.49999999999999981e-25 or 1.3000000000000001e-46 < x Initial program 87.4%
*-commutative87.4%
Simplified87.4%
Taylor expanded in x around inf 83.2%
if -8.49999999999999981e-25 < x < 1.3000000000000001e-46Initial program 92.7%
*-commutative92.7%
Simplified92.7%
Taylor expanded in x around 0 50.6%
(FPCore (x y z t) :precision binary64 1.0)
double code(double x, double y, double z, double t) {
return 1.0;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 1.0d0
end function
public static double code(double x, double y, double z, double t) {
return 1.0;
}
def code(x, y, z, t): return 1.0
function code(x, y, z, t) return 1.0 end
function tmp = code(x, y, z, t) tmp = 1.0; end
code[x_, y_, z_, t_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 89.3%
*-commutative89.3%
Simplified89.3%
Taylor expanded in x around inf 58.1%
(FPCore (x y z t) :precision binary64 (/ (+ x (- (/ y (- t (/ x z))) (/ x (- (* t z) x)))) (+ x 1.0)))
double code(double x, double y, double z, double t) {
return (x + ((y / (t - (x / z))) - (x / ((t * z) - x)))) / (x + 1.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x + ((y / (t - (x / z))) - (x / ((t * z) - x)))) / (x + 1.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x + ((y / (t - (x / z))) - (x / ((t * z) - x)))) / (x + 1.0);
}
def code(x, y, z, t): return (x + ((y / (t - (x / z))) - (x / ((t * z) - x)))) / (x + 1.0)
function code(x, y, z, t) return Float64(Float64(x + Float64(Float64(y / Float64(t - Float64(x / z))) - Float64(x / Float64(Float64(t * z) - x)))) / Float64(x + 1.0)) end
function tmp = code(x, y, z, t) tmp = (x + ((y / (t - (x / z))) - (x / ((t * z) - x)))) / (x + 1.0); end
code[x_, y_, z_, t_] := N[(N[(x + N[(N[(y / N[(t - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / N[(N[(t * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + \left(\frac{y}{t - \frac{x}{z}} - \frac{x}{t \cdot z - x}\right)}{x + 1}
\end{array}
herbie shell --seed 2024181
(FPCore (x y z t)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, A"
:precision binary64
:alt
(! :herbie-platform default (/ (+ x (- (/ y (- t (/ x z))) (/ x (- (* t z) x)))) (+ x 1)))
(/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))