
(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 11 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+112)
(* (/ y (+ x 1.0)) (/ z t_1))
(if (<= t_2 5e+240)
(/ (+ x (/ (fma z y (- x)) t_1)) (+ x 1.0))
(-
(+ (/ x (+ x 1.0)) (/ y (* t (+ x 1.0))))
(/ x (* t (* z (+ x 1.0)))))))))
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+112) {
tmp = (y / (x + 1.0)) * (z / t_1);
} else if (t_2 <= 5e+240) {
tmp = (x + (fma(z, y, -x) / t_1)) / (x + 1.0);
} else {
tmp = ((x / (x + 1.0)) + (y / (t * (x + 1.0)))) - (x / (t * (z * (x + 1.0))));
}
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+112) tmp = Float64(Float64(y / Float64(x + 1.0)) * Float64(z / t_1)); elseif (t_2 <= 5e+240) tmp = Float64(Float64(x + Float64(fma(z, y, Float64(-x)) / t_1)) / Float64(x + 1.0)); else tmp = Float64(Float64(Float64(x / Float64(x + 1.0)) + Float64(y / Float64(t * Float64(x + 1.0)))) - Float64(x / Float64(t * Float64(z * Float64(x + 1.0))))); end return 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+112], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] * N[(z / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 5e+240], N[(N[(x + N[(N[(z * y + (-x)), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] + N[(y / N[(t * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / N[(t * N[(z * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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^{+112}:\\
\;\;\;\;\frac{y}{x + 1} \cdot \frac{z}{t\_1}\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+240}:\\
\;\;\;\;\frac{x + \frac{\mathsf{fma}\left(z, y, -x\right)}{t\_1}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{x}{x + 1} + \frac{y}{t \cdot \left(x + 1\right)}\right) - \frac{x}{t \cdot \left(z \cdot \left(x + 1\right)\right)}\\
\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))) < -9.9999999999999993e111Initial program 73.5%
*-commutative73.5%
Simplified73.5%
Taylor expanded in y around inf 73.3%
times-frac92.3%
+-commutative92.3%
Simplified92.3%
if -9.9999999999999993e111 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 5.0000000000000003e240Initial program 99.4%
*-commutative99.4%
Simplified99.4%
*-commutative99.4%
fmm-def99.4%
Applied egg-rr99.4%
if 5.0000000000000003e240 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) Initial program 29.7%
*-commutative29.7%
Simplified29.7%
Taylor expanded in t around inf 84.9%
+-commutative84.9%
+-commutative84.9%
+-commutative84.9%
Simplified84.9%
Final simplification96.9%
(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+112)
(* (/ y (+ x 1.0)) (/ z t_1))
(if (<= t_2 5e+240)
t_2
(-
(+ (/ x (+ x 1.0)) (/ y (* t (+ x 1.0))))
(/ x (* t (* z (+ x 1.0)))))))))
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+112) {
tmp = (y / (x + 1.0)) * (z / t_1);
} else if (t_2 <= 5e+240) {
tmp = t_2;
} else {
tmp = ((x / (x + 1.0)) + (y / (t * (x + 1.0)))) - (x / (t * (z * (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) :: 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+112)) then
tmp = (y / (x + 1.0d0)) * (z / t_1)
else if (t_2 <= 5d+240) then
tmp = t_2
else
tmp = ((x / (x + 1.0d0)) + (y / (t * (x + 1.0d0)))) - (x / (t * (z * (x + 1.0d0))))
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+112) {
tmp = (y / (x + 1.0)) * (z / t_1);
} else if (t_2 <= 5e+240) {
tmp = t_2;
} else {
tmp = ((x / (x + 1.0)) + (y / (t * (x + 1.0)))) - (x / (t * (z * (x + 1.0))));
}
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+112: tmp = (y / (x + 1.0)) * (z / t_1) elif t_2 <= 5e+240: tmp = t_2 else: tmp = ((x / (x + 1.0)) + (y / (t * (x + 1.0)))) - (x / (t * (z * (x + 1.0)))) 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+112) tmp = Float64(Float64(y / Float64(x + 1.0)) * Float64(z / t_1)); elseif (t_2 <= 5e+240) tmp = t_2; else tmp = Float64(Float64(Float64(x / Float64(x + 1.0)) + Float64(y / Float64(t * Float64(x + 1.0)))) - Float64(x / Float64(t * Float64(z * Float64(x + 1.0))))); 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+112) tmp = (y / (x + 1.0)) * (z / t_1); elseif (t_2 <= 5e+240) tmp = t_2; else tmp = ((x / (x + 1.0)) + (y / (t * (x + 1.0)))) - (x / (t * (z * (x + 1.0)))); 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+112], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] * N[(z / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 5e+240], t$95$2, N[(N[(N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] + N[(y / N[(t * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / N[(t * N[(z * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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^{+112}:\\
\;\;\;\;\frac{y}{x + 1} \cdot \frac{z}{t\_1}\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+240}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{x}{x + 1} + \frac{y}{t \cdot \left(x + 1\right)}\right) - \frac{x}{t \cdot \left(z \cdot \left(x + 1\right)\right)}\\
\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))) < -9.9999999999999993e111Initial program 73.5%
*-commutative73.5%
Simplified73.5%
Taylor expanded in y around inf 73.3%
times-frac92.3%
+-commutative92.3%
Simplified92.3%
if -9.9999999999999993e111 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 5.0000000000000003e240Initial program 99.4%
if 5.0000000000000003e240 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) Initial program 29.7%
*-commutative29.7%
Simplified29.7%
Taylor expanded in t around inf 84.9%
+-commutative84.9%
+-commutative84.9%
+-commutative84.9%
Simplified84.9%
Final simplification96.9%
(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+112)
(* (/ y (+ x 1.0)) (/ z t_1))
(if (<= t_2 5e+240) t_2 (/ (+ x (/ y t)) (+ x 1.0))))))
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+112) {
tmp = (y / (x + 1.0)) * (z / t_1);
} else if (t_2 <= 5e+240) {
tmp = t_2;
} else {
tmp = (x + (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) :: 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+112)) then
tmp = (y / (x + 1.0d0)) * (z / t_1)
else if (t_2 <= 5d+240) then
tmp = t_2
else
tmp = (x + (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 = (z * t) - x;
double t_2 = (x + (((y * z) - x) / t_1)) / (x + 1.0);
double tmp;
if (t_2 <= -1e+112) {
tmp = (y / (x + 1.0)) * (z / t_1);
} else if (t_2 <= 5e+240) {
tmp = t_2;
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
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+112: tmp = (y / (x + 1.0)) * (z / t_1) elif t_2 <= 5e+240: tmp = t_2 else: tmp = (x + (y / t)) / (x + 1.0) 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+112) tmp = Float64(Float64(y / Float64(x + 1.0)) * Float64(z / t_1)); elseif (t_2 <= 5e+240) tmp = t_2; else tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); 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+112) tmp = (y / (x + 1.0)) * (z / t_1); elseif (t_2 <= 5e+240) tmp = t_2; else tmp = (x + (y / t)) / (x + 1.0); 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+112], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] * N[(z / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 5e+240], t$95$2, N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $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^{+112}:\\
\;\;\;\;\frac{y}{x + 1} \cdot \frac{z}{t\_1}\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+240}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{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))) < -9.9999999999999993e111Initial program 73.5%
*-commutative73.5%
Simplified73.5%
Taylor expanded in y around inf 73.3%
times-frac92.3%
+-commutative92.3%
Simplified92.3%
if -9.9999999999999993e111 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 5.0000000000000003e240Initial program 99.4%
if 5.0000000000000003e240 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) Initial program 29.7%
*-commutative29.7%
Simplified29.7%
Taylor expanded in z around inf 84.8%
+-commutative84.8%
+-commutative84.8%
Simplified84.8%
Final simplification96.9%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.6e-5) (not (<= t 0.076))) (/ (+ x (/ y t)) (+ x 1.0)) (/ (+ (- x (* y (/ z x))) 1.0) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.6e-5) || !(t <= 0.076)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = ((x - (y * (z / x))) + 1.0) / (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 <= (-1.6d-5)) .or. (.not. (t <= 0.076d0))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = ((x - (y * (z / x))) + 1.0d0) / (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 <= -1.6e-5) || !(t <= 0.076)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = ((x - (y * (z / x))) + 1.0) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.6e-5) or not (t <= 0.076): tmp = (x + (y / t)) / (x + 1.0) else: tmp = ((x - (y * (z / x))) + 1.0) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.6e-5) || !(t <= 0.076)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(Float64(Float64(x - Float64(y * Float64(z / x))) + 1.0) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.6e-5) || ~((t <= 0.076))) tmp = (x + (y / t)) / (x + 1.0); else tmp = ((x - (y * (z / x))) + 1.0) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.6e-5], N[Not[LessEqual[t, 0.076]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x - N[(y * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.6 \cdot 10^{-5} \lor \neg \left(t \leq 0.076\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x - y \cdot \frac{z}{x}\right) + 1}{x + 1}\\
\end{array}
\end{array}
if t < -1.59999999999999993e-5 or 0.0759999999999999981 < t Initial program 83.1%
*-commutative83.1%
Simplified83.1%
Taylor expanded in z around inf 91.4%
+-commutative91.4%
+-commutative91.4%
Simplified91.4%
if -1.59999999999999993e-5 < t < 0.0759999999999999981Initial program 92.2%
*-commutative92.2%
Simplified92.2%
Taylor expanded in t around 0 77.1%
mul-1-neg77.1%
unsub-neg77.1%
associate-/l*81.9%
+-commutative81.9%
Simplified81.9%
Final simplification86.2%
(FPCore (x y z t)
:precision binary64
(if (<= x -3.5e-9)
1.0
(if (<= x 5.6e-33)
(/ (+ x (/ (- y (/ x z)) 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 (x <= -3.5e-9) {
tmp = 1.0;
} else if (x <= 5.6e-33) {
tmp = (x + ((y - (x / z)) / 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 (x <= (-3.5d-9)) then
tmp = 1.0d0
else if (x <= 5.6d-33) then
tmp = (x + ((y - (x / z)) / 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 (x <= -3.5e-9) {
tmp = 1.0;
} else if (x <= 5.6e-33) {
tmp = (x + ((y - (x / z)) / 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 x <= -3.5e-9: tmp = 1.0 elif x <= 5.6e-33: tmp = (x + ((y - (x / z)) / 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 (x <= -3.5e-9) tmp = 1.0; elseif (x <= 5.6e-33) tmp = Float64(Float64(x + Float64(Float64(y - Float64(x / z)) / t)) / Float64(x + 1.0)); else tmp = Float64(1.0 + Float64(y * Float64(z / Float64(x * Float64(-1.0 - x))))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -3.5e-9) tmp = 1.0; elseif (x <= 5.6e-33) tmp = (x + ((y - (x / z)) / 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[LessEqual[x, -3.5e-9], 1.0, If[LessEqual[x, 5.6e-33], N[(N[(x + N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(y * N[(z / N[(x * N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.5 \cdot 10^{-9}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 5.6 \cdot 10^{-33}:\\
\;\;\;\;\frac{x + \frac{y - \frac{x}{z}}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1 + y \cdot \frac{z}{x \cdot \left(-1 - x\right)}\\
\end{array}
\end{array}
if x < -3.4999999999999999e-9Initial program 89.1%
*-commutative89.1%
Simplified89.1%
Taylor expanded in x around inf 94.7%
if -3.4999999999999999e-9 < x < 5.6e-33Initial program 87.2%
*-commutative87.2%
Simplified87.2%
Taylor expanded in t around -inf 75.5%
mul-1-neg75.5%
unsub-neg75.5%
cancel-sign-sub-inv75.5%
metadata-eval75.5%
*-lft-identity75.5%
+-commutative75.5%
mul-1-neg75.5%
unsub-neg75.5%
Simplified75.5%
if 5.6e-33 < x Initial program 88.2%
*-commutative88.2%
Simplified88.2%
clear-num88.1%
inv-pow88.1%
Applied egg-rr88.1%
unpow-188.1%
*-commutative88.1%
Simplified88.1%
Taylor expanded in t around 0 84.3%
+-commutative84.3%
associate-+r+84.3%
+-commutative84.3%
mul-1-neg84.3%
associate-/l*90.2%
Simplified90.2%
Taylor expanded in y around 0 84.1%
mul-1-neg84.1%
times-frac91.4%
distribute-lft-neg-in91.4%
cancel-sign-sub-inv91.4%
times-frac84.1%
associate-/l*94.2%
+-commutative94.2%
Simplified94.2%
Final simplification86.9%
(FPCore (x y z t) :precision binary64 (if (or (<= t -0.0015) (not (<= t 8.5e-32))) (/ (+ 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 <= -0.0015) || !(t <= 8.5e-32)) {
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 <= (-0.0015d0)) .or. (.not. (t <= 8.5d-32))) 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 <= -0.0015) || !(t <= 8.5e-32)) {
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 <= -0.0015) or not (t <= 8.5e-32): 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 <= -0.0015) || !(t <= 8.5e-32)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(1.0 + Float64(y * Float64(z / Float64(x * Float64(-1.0 - x))))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -0.0015) || ~((t <= 8.5e-32))) 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, -0.0015], N[Not[LessEqual[t, 8.5e-32]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(y * N[(z / N[(x * N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -0.0015 \lor \neg \left(t \leq 8.5 \cdot 10^{-32}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1 + y \cdot \frac{z}{x \cdot \left(-1 - x\right)}\\
\end{array}
\end{array}
if t < -0.0015 or 8.5000000000000003e-32 < t Initial program 82.5%
*-commutative82.5%
Simplified82.5%
Taylor expanded in z around inf 90.3%
+-commutative90.3%
+-commutative90.3%
Simplified90.3%
if -0.0015 < t < 8.5000000000000003e-32Initial program 93.3%
*-commutative93.3%
Simplified93.3%
clear-num93.3%
inv-pow93.3%
Applied egg-rr93.3%
unpow-193.3%
*-commutative93.3%
Simplified93.3%
Taylor expanded in t around 0 77.3%
+-commutative77.3%
associate-+r+77.3%
+-commutative77.3%
mul-1-neg77.3%
associate-/l*82.5%
Simplified82.5%
Taylor expanded in y around 0 77.2%
mul-1-neg77.2%
times-frac79.6%
distribute-lft-neg-in79.6%
cancel-sign-sub-inv79.6%
times-frac77.2%
associate-/l*82.4%
+-commutative82.4%
Simplified82.4%
Final simplification86.2%
(FPCore (x y z t) :precision binary64 (if (<= x -1.2e-9) 1.0 (if (<= x 2.12e-32) (/ (+ x (/ y t)) (+ x 1.0)) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.2e-9) {
tmp = 1.0;
} else if (x <= 2.12e-32) {
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 (x <= (-1.2d-9)) then
tmp = 1.0d0
else if (x <= 2.12d-32) 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 (x <= -1.2e-9) {
tmp = 1.0;
} else if (x <= 2.12e-32) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.2e-9: tmp = 1.0 elif x <= 2.12e-32: tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.2e-9) tmp = 1.0; elseif (x <= 2.12e-32) 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 (x <= -1.2e-9) tmp = 1.0; elseif (x <= 2.12e-32) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.2e-9], 1.0, If[LessEqual[x, 2.12e-32], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.2 \cdot 10^{-9}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 2.12 \cdot 10^{-32}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -1.2e-9 or 2.11999999999999987e-32 < x Initial program 88.6%
*-commutative88.6%
Simplified88.6%
Taylor expanded in x around inf 91.6%
if -1.2e-9 < x < 2.11999999999999987e-32Initial program 87.2%
*-commutative87.2%
Simplified87.2%
Taylor expanded in z around inf 72.4%
+-commutative72.4%
+-commutative72.4%
Simplified72.4%
Final simplification84.0%
(FPCore (x y z t) :precision binary64 (if (<= x -7.2e-18) 1.0 (if (<= x 6.6e-19) (* y (/ z (- (* z t) x))) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -7.2e-18) {
tmp = 1.0;
} else if (x <= 6.6e-19) {
tmp = y * (z / ((z * t) - x));
} 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 <= (-7.2d-18)) then
tmp = 1.0d0
else if (x <= 6.6d-19) then
tmp = y * (z / ((z * t) - x))
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 <= -7.2e-18) {
tmp = 1.0;
} else if (x <= 6.6e-19) {
tmp = y * (z / ((z * t) - x));
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -7.2e-18: tmp = 1.0 elif x <= 6.6e-19: tmp = y * (z / ((z * t) - x)) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -7.2e-18) tmp = 1.0; elseif (x <= 6.6e-19) tmp = Float64(y * Float64(z / Float64(Float64(z * t) - x))); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -7.2e-18) tmp = 1.0; elseif (x <= 6.6e-19) tmp = y * (z / ((z * t) - x)); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -7.2e-18], 1.0, If[LessEqual[x, 6.6e-19], N[(y * N[(z / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.2 \cdot 10^{-18}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 6.6 \cdot 10^{-19}:\\
\;\;\;\;y \cdot \frac{z}{z \cdot t - x}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -7.20000000000000021e-18 or 6.5999999999999995e-19 < x Initial program 88.4%
*-commutative88.4%
Simplified88.4%
Taylor expanded in x around inf 92.7%
if -7.20000000000000021e-18 < x < 6.5999999999999995e-19Initial program 87.6%
*-commutative87.6%
Simplified87.6%
Taylor expanded in y around inf 54.6%
times-frac58.4%
+-commutative58.4%
Simplified58.4%
Taylor expanded in x around 0 58.4%
Final simplification78.6%
(FPCore (x y z t) :precision binary64 (if (<= x -3.6e-22) 1.0 (if (<= x 5e-37) (/ y (* t (+ x 1.0))) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.6e-22) {
tmp = 1.0;
} else if (x <= 5e-37) {
tmp = 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 (x <= (-3.6d-22)) then
tmp = 1.0d0
else if (x <= 5d-37) then
tmp = 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 (x <= -3.6e-22) {
tmp = 1.0;
} else if (x <= 5e-37) {
tmp = y / (t * (x + 1.0));
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -3.6e-22: tmp = 1.0 elif x <= 5e-37: tmp = y / (t * (x + 1.0)) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -3.6e-22) tmp = 1.0; elseif (x <= 5e-37) tmp = Float64(y / Float64(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 (x <= -3.6e-22) tmp = 1.0; elseif (x <= 5e-37) tmp = y / (t * (x + 1.0)); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -3.6e-22], 1.0, If[LessEqual[x, 5e-37], N[(y / N[(t * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.6 \cdot 10^{-22}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 5 \cdot 10^{-37}:\\
\;\;\;\;\frac{y}{t \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -3.5999999999999998e-22 or 4.9999999999999997e-37 < x Initial program 88.6%
*-commutative88.6%
Simplified88.6%
Taylor expanded in x around inf 91.6%
if -3.5999999999999998e-22 < x < 4.9999999999999997e-37Initial program 87.2%
*-commutative87.2%
Simplified87.2%
Taylor expanded in z around inf 72.4%
+-commutative72.4%
+-commutative72.4%
Simplified72.4%
Taylor expanded in y around inf 54.2%
+-commutative54.2%
Simplified54.2%
(FPCore (x y z t) :precision binary64 (if (<= x -9.5e-19) 1.0 (if (<= x 1.15e-35) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -9.5e-19) {
tmp = 1.0;
} else if (x <= 1.15e-35) {
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 <= (-9.5d-19)) then
tmp = 1.0d0
else if (x <= 1.15d-35) 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 <= -9.5e-19) {
tmp = 1.0;
} else if (x <= 1.15e-35) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -9.5e-19: tmp = 1.0 elif x <= 1.15e-35: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -9.5e-19) tmp = 1.0; elseif (x <= 1.15e-35) 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 <= -9.5e-19) tmp = 1.0; elseif (x <= 1.15e-35) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -9.5e-19], 1.0, If[LessEqual[x, 1.15e-35], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.5 \cdot 10^{-19}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.15 \cdot 10^{-35}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -9.4999999999999995e-19 or 1.1499999999999999e-35 < x Initial program 88.6%
*-commutative88.6%
Simplified88.6%
Taylor expanded in x around inf 91.6%
if -9.4999999999999995e-19 < x < 1.1499999999999999e-35Initial program 87.2%
*-commutative87.2%
Simplified87.2%
Taylor expanded in x around 0 54.2%
(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 88.1%
*-commutative88.1%
Simplified88.1%
Taylor expanded in x around inf 60.5%
(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 2024150
(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)))