
(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 8 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 (/ (- (/ (- (* y z) x) (- x (* z t))) x) (- -1.0 x))))
(if (<= t_1 -2e+181)
(* (/ z (fma t z (- x))) (/ y (+ x 1.0)))
(if (<= t_1 2e+208) t_1 (/ (+ x (/ y t)) (+ x 1.0))))))
double code(double x, double y, double z, double t) {
double t_1 = ((((y * z) - x) / (x - (z * t))) - x) / (-1.0 - x);
double tmp;
if (t_1 <= -2e+181) {
tmp = (z / fma(t, z, -x)) * (y / (x + 1.0));
} else if (t_1 <= 2e+208) {
tmp = t_1;
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(Float64(Float64(Float64(y * z) - x) / Float64(x - Float64(z * t))) - x) / Float64(-1.0 - x)) tmp = 0.0 if (t_1 <= -2e+181) tmp = Float64(Float64(z / fma(t, z, Float64(-x))) * Float64(y / Float64(x + 1.0))); elseif (t_1 <= 2e+208) tmp = t_1; else tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+181], N[(N[(z / N[(t * z + (-x)), $MachinePrecision]), $MachinePrecision] * N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+208], t$95$1, N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{y \cdot z - x}{x - z \cdot t} - x}{-1 - x}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+181}:\\
\;\;\;\;\frac{z}{\mathsf{fma}\left(t, z, -x\right)} \cdot \frac{y}{x + 1}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+208}:\\
\;\;\;\;t\_1\\
\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))) < -1.9999999999999998e181Initial program 39.9%
*-commutative39.9%
Simplified39.9%
div-inv39.9%
fma-neg39.9%
Applied egg-rr39.9%
Taylor expanded in y around inf 39.3%
times-frac81.5%
+-commutative81.5%
fma-neg81.5%
Simplified81.5%
if -1.9999999999999998e181 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 2e208Initial program 99.4%
if 2e208 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) Initial program 42.4%
*-commutative42.4%
Simplified42.4%
Taylor expanded in z around inf 83.1%
Final simplification97.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (- (/ (- (* y z) x) (- x (* z t))) x) (- -1.0 x))))
(if (<= t_1 -1e+297)
(+ (/ x (+ x 1.0)) (/ (+ (/ y (+ x 1.0)) (/ x (* z (- -1.0 x)))) t))
(if (<= t_1 2e+208) t_1 (/ (+ x (/ y t)) (+ x 1.0))))))
double code(double x, double y, double z, double t) {
double t_1 = ((((y * z) - x) / (x - (z * t))) - x) / (-1.0 - x);
double tmp;
if (t_1 <= -1e+297) {
tmp = (x / (x + 1.0)) + (((y / (x + 1.0)) + (x / (z * (-1.0 - x)))) / t);
} else if (t_1 <= 2e+208) {
tmp = t_1;
} 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) :: tmp
t_1 = ((((y * z) - x) / (x - (z * t))) - x) / ((-1.0d0) - x)
if (t_1 <= (-1d+297)) then
tmp = (x / (x + 1.0d0)) + (((y / (x + 1.0d0)) + (x / (z * ((-1.0d0) - x)))) / t)
else if (t_1 <= 2d+208) then
tmp = t_1
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 = ((((y * z) - x) / (x - (z * t))) - x) / (-1.0 - x);
double tmp;
if (t_1 <= -1e+297) {
tmp = (x / (x + 1.0)) + (((y / (x + 1.0)) + (x / (z * (-1.0 - x)))) / t);
} else if (t_1 <= 2e+208) {
tmp = t_1;
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): t_1 = ((((y * z) - x) / (x - (z * t))) - x) / (-1.0 - x) tmp = 0 if t_1 <= -1e+297: tmp = (x / (x + 1.0)) + (((y / (x + 1.0)) + (x / (z * (-1.0 - x)))) / t) elif t_1 <= 2e+208: tmp = t_1 else: tmp = (x + (y / t)) / (x + 1.0) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(Float64(Float64(Float64(y * z) - x) / Float64(x - Float64(z * t))) - x) / Float64(-1.0 - x)) tmp = 0.0 if (t_1 <= -1e+297) tmp = Float64(Float64(x / Float64(x + 1.0)) + Float64(Float64(Float64(y / Float64(x + 1.0)) + Float64(x / Float64(z * Float64(-1.0 - x)))) / t)); elseif (t_1 <= 2e+208) tmp = t_1; 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 = ((((y * z) - x) / (x - (z * t))) - x) / (-1.0 - x); tmp = 0.0; if (t_1 <= -1e+297) tmp = (x / (x + 1.0)) + (((y / (x + 1.0)) + (x / (z * (-1.0 - x)))) / t); elseif (t_1 <= 2e+208) tmp = t_1; else tmp = (x + (y / t)) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+297], N[(N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] + N[(x / N[(z * N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+208], t$95$1, N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{y \cdot z - x}{x - z \cdot t} - x}{-1 - x}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+297}:\\
\;\;\;\;\frac{x}{x + 1} + \frac{\frac{y}{x + 1} + \frac{x}{z \cdot \left(-1 - x\right)}}{t}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+208}:\\
\;\;\;\;t\_1\\
\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))) < -1e297Initial program 20.1%
*-commutative20.1%
Simplified20.1%
Taylor expanded in t around -inf 61.2%
+-commutative61.2%
mul-1-neg61.2%
unsub-neg61.2%
+-commutative61.2%
Simplified61.2%
if -1e297 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 2e208Initial program 99.4%
if 2e208 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) Initial program 42.4%
*-commutative42.4%
Simplified42.4%
Taylor expanded in z around inf 83.1%
Final simplification96.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (- (/ (- (* y z) x) (- x (* z t))) x) (- -1.0 x))))
(if (<= t_1 (- INFINITY))
(+ 1.0 (* y (/ (/ z x) (- -1.0 x))))
(if (<= t_1 2e+208) t_1 (/ (+ x (/ y t)) (+ x 1.0))))))
double code(double x, double y, double z, double t) {
double t_1 = ((((y * z) - x) / (x - (z * t))) - x) / (-1.0 - x);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = 1.0 + (y * ((z / x) / (-1.0 - x)));
} else if (t_1 <= 2e+208) {
tmp = t_1;
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = ((((y * z) - x) / (x - (z * t))) - x) / (-1.0 - x);
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = 1.0 + (y * ((z / x) / (-1.0 - x)));
} else if (t_1 <= 2e+208) {
tmp = t_1;
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): t_1 = ((((y * z) - x) / (x - (z * t))) - x) / (-1.0 - x) tmp = 0 if t_1 <= -math.inf: tmp = 1.0 + (y * ((z / x) / (-1.0 - x))) elif t_1 <= 2e+208: tmp = t_1 else: tmp = (x + (y / t)) / (x + 1.0) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(Float64(Float64(Float64(y * z) - x) / Float64(x - Float64(z * t))) - x) / Float64(-1.0 - x)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(1.0 + Float64(y * Float64(Float64(z / x) / Float64(-1.0 - x)))); elseif (t_1 <= 2e+208) tmp = t_1; 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 = ((((y * z) - x) / (x - (z * t))) - x) / (-1.0 - x); tmp = 0.0; if (t_1 <= -Inf) tmp = 1.0 + (y * ((z / x) / (-1.0 - x))); elseif (t_1 <= 2e+208) tmp = t_1; else tmp = (x + (y / t)) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(1.0 + N[(y * N[(N[(z / x), $MachinePrecision] / N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+208], t$95$1, N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{y \cdot z - x}{x - z \cdot t} - x}{-1 - x}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;1 + y \cdot \frac{\frac{z}{x}}{-1 - x}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+208}:\\
\;\;\;\;t\_1\\
\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))) < -inf.0Initial program 13.0%
*-commutative13.0%
Simplified13.0%
Taylor expanded in t around 0 12.6%
associate-+r+12.6%
mul-1-neg12.6%
unsub-neg12.6%
+-commutative12.6%
associate-/l*56.3%
+-commutative56.3%
Simplified56.3%
div-sub56.3%
*-inverses56.3%
associate-/l*57.1%
Applied egg-rr57.1%
if -inf.0 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 2e208Initial program 99.4%
if 2e208 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) Initial program 42.4%
*-commutative42.4%
Simplified42.4%
Taylor expanded in z around inf 83.1%
Final simplification96.5%
(FPCore (x y z t)
:precision binary64
(if (<= x -8.5e-35)
(+ 1.0 (* y (/ (/ z x) (- -1.0 x))))
(if (<= x 1.65e-66)
(/ (+ x (/ (- y (/ x z)) t)) (+ x 1.0))
(/ (+ x (/ x (- x (* z t)))) (+ x 1.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -8.5e-35) {
tmp = 1.0 + (y * ((z / x) / (-1.0 - x)));
} else if (x <= 1.65e-66) {
tmp = (x + ((y - (x / z)) / t)) / (x + 1.0);
} else {
tmp = (x + (x / (x - (z * 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) :: tmp
if (x <= (-8.5d-35)) then
tmp = 1.0d0 + (y * ((z / x) / ((-1.0d0) - x)))
else if (x <= 1.65d-66) then
tmp = (x + ((y - (x / z)) / t)) / (x + 1.0d0)
else
tmp = (x + (x / (x - (z * t)))) / (x + 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-35) {
tmp = 1.0 + (y * ((z / x) / (-1.0 - x)));
} else if (x <= 1.65e-66) {
tmp = (x + ((y - (x / z)) / t)) / (x + 1.0);
} else {
tmp = (x + (x / (x - (z * t)))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -8.5e-35: tmp = 1.0 + (y * ((z / x) / (-1.0 - x))) elif x <= 1.65e-66: tmp = (x + ((y - (x / z)) / t)) / (x + 1.0) else: tmp = (x + (x / (x - (z * t)))) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -8.5e-35) tmp = Float64(1.0 + Float64(y * Float64(Float64(z / x) / Float64(-1.0 - x)))); elseif (x <= 1.65e-66) tmp = Float64(Float64(x + Float64(Float64(y - Float64(x / z)) / t)) / Float64(x + 1.0)); else tmp = Float64(Float64(x + Float64(x / Float64(x - Float64(z * t)))) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -8.5e-35) tmp = 1.0 + (y * ((z / x) / (-1.0 - x))); elseif (x <= 1.65e-66) tmp = (x + ((y - (x / z)) / t)) / (x + 1.0); else tmp = (x + (x / (x - (z * t)))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -8.5e-35], N[(1.0 + N[(y * N[(N[(z / x), $MachinePrecision] / N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.65e-66], N[(N[(x + N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(x / N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.5 \cdot 10^{-35}:\\
\;\;\;\;1 + y \cdot \frac{\frac{z}{x}}{-1 - x}\\
\mathbf{elif}\;x \leq 1.65 \cdot 10^{-66}:\\
\;\;\;\;\frac{x + \frac{y - \frac{x}{z}}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{x}{x - z \cdot t}}{x + 1}\\
\end{array}
\end{array}
if x < -8.5000000000000001e-35Initial program 86.6%
*-commutative86.6%
Simplified86.6%
Taylor expanded in t around 0 80.1%
associate-+r+80.1%
mul-1-neg80.1%
unsub-neg80.1%
+-commutative80.1%
associate-/l*88.6%
+-commutative88.6%
Simplified88.6%
div-sub88.6%
*-inverses88.6%
associate-/l*88.7%
Applied egg-rr88.7%
if -8.5000000000000001e-35 < x < 1.6499999999999999e-66Initial program 91.1%
*-commutative91.1%
Simplified91.1%
Taylor expanded in t around -inf 78.7%
mul-1-neg78.7%
unsub-neg78.7%
sub-neg78.7%
mul-1-neg78.7%
remove-double-neg78.7%
+-commutative78.7%
mul-1-neg78.7%
unsub-neg78.7%
Simplified78.7%
if 1.6499999999999999e-66 < x Initial program 98.7%
*-commutative98.7%
Simplified98.7%
Taylor expanded in y around 0 91.5%
Final simplification85.6%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.45e-49) (not (<= t 5.9e-92))) (/ (+ 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 <= -1.45e-49) || !(t <= 5.9e-92)) {
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 <= (-1.45d-49)) .or. (.not. (t <= 5.9d-92))) 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 <= -1.45e-49) || !(t <= 5.9e-92)) {
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 <= -1.45e-49) or not (t <= 5.9e-92): 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 <= -1.45e-49) || !(t <= 5.9e-92)) 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 <= -1.45e-49) || ~((t <= 5.9e-92))) 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, -1.45e-49], N[Not[LessEqual[t, 5.9e-92]], $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 -1.45 \cdot 10^{-49} \lor \neg \left(t \leq 5.9 \cdot 10^{-92}\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 < -1.45e-49 or 5.9e-92 < t Initial program 91.1%
*-commutative91.1%
Simplified91.1%
Taylor expanded in z around inf 85.8%
if -1.45e-49 < t < 5.9e-92Initial program 93.2%
*-commutative93.2%
Simplified93.2%
Taylor expanded in t around 0 76.1%
associate-+r+76.1%
mul-1-neg76.1%
unsub-neg76.1%
+-commutative76.1%
associate-/l*80.9%
+-commutative80.9%
Simplified80.9%
div-sub80.9%
*-inverses80.9%
associate-/l*81.0%
Applied egg-rr81.0%
Final simplification83.9%
(FPCore (x y z t) :precision binary64 (if (<= x -0.118) 1.0 (if (<= x 3e-50) (/ (+ x (/ y t)) (+ x 1.0)) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -0.118) {
tmp = 1.0;
} else if (x <= 3e-50) {
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 <= (-0.118d0)) then
tmp = 1.0d0
else if (x <= 3d-50) 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 <= -0.118) {
tmp = 1.0;
} else if (x <= 3e-50) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -0.118: tmp = 1.0 elif x <= 3e-50: tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -0.118) tmp = 1.0; elseif (x <= 3e-50) 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 <= -0.118) tmp = 1.0; elseif (x <= 3e-50) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -0.118], 1.0, If[LessEqual[x, 3e-50], 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 -0.118:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 3 \cdot 10^{-50}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -0.11799999999999999 or 2.9999999999999999e-50 < x Initial program 92.6%
*-commutative92.6%
Simplified92.6%
Taylor expanded in z around inf 70.6%
Taylor expanded in x around inf 88.2%
if -0.11799999999999999 < x < 2.9999999999999999e-50Initial program 91.0%
*-commutative91.0%
Simplified91.0%
Taylor expanded in z around inf 67.6%
(FPCore (x y z t) :precision binary64 (if (<= x -1.32e-73) 1.0 (if (<= x 7.1e-211) (/ y t) (if (<= x 4.8e-76) x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.32e-73) {
tmp = 1.0;
} else if (x <= 7.1e-211) {
tmp = y / t;
} else if (x <= 4.8e-76) {
tmp = 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 <= (-1.32d-73)) then
tmp = 1.0d0
else if (x <= 7.1d-211) then
tmp = y / t
else if (x <= 4.8d-76) then
tmp = 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 <= -1.32e-73) {
tmp = 1.0;
} else if (x <= 7.1e-211) {
tmp = y / t;
} else if (x <= 4.8e-76) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.32e-73: tmp = 1.0 elif x <= 7.1e-211: tmp = y / t elif x <= 4.8e-76: tmp = x else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.32e-73) tmp = 1.0; elseif (x <= 7.1e-211) tmp = Float64(y / t); elseif (x <= 4.8e-76) tmp = x; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -1.32e-73) tmp = 1.0; elseif (x <= 7.1e-211) tmp = y / t; elseif (x <= 4.8e-76) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.32e-73], 1.0, If[LessEqual[x, 7.1e-211], N[(y / t), $MachinePrecision], If[LessEqual[x, 4.8e-76], x, 1.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.32 \cdot 10^{-73}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 7.1 \cdot 10^{-211}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{elif}\;x \leq 4.8 \cdot 10^{-76}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -1.31999999999999998e-73 or 4.80000000000000026e-76 < x Initial program 92.8%
*-commutative92.8%
Simplified92.8%
Taylor expanded in z around inf 66.9%
Taylor expanded in x around inf 81.2%
if -1.31999999999999998e-73 < x < 7.09999999999999987e-211Initial program 87.5%
*-commutative87.5%
Simplified87.5%
Taylor expanded in y around inf 54.6%
Taylor expanded in z around inf 63.0%
+-commutative63.0%
Simplified63.0%
Taylor expanded in x around 0 63.0%
if 7.09999999999999987e-211 < x < 4.80000000000000026e-76Initial program 98.7%
*-commutative98.7%
Simplified98.7%
Taylor expanded in t around inf 45.1%
+-commutative45.1%
Simplified45.1%
Taylor expanded in x around 0 45.1%
neg-mul-145.1%
sub-neg45.1%
Simplified45.1%
Taylor expanded in x around 0 45.1%
(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 91.9%
*-commutative91.9%
Simplified91.9%
Taylor expanded in z around inf 69.3%
Taylor expanded in x around inf 57.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 2024123
(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)))