
(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 (if (<= z -7.4e+109) (/ (+ x (/ y t)) (+ x 1.0)) (/ (+ x (/ (- x (* z y)) (- x (* z t)))) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7.4e+109) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (x + ((x - (z * y)) / (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 (z <= (-7.4d+109)) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = (x + ((x - (z * y)) / (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 (z <= -7.4e+109) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (x + ((x - (z * y)) / (x - (z * t)))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -7.4e+109: tmp = (x + (y / t)) / (x + 1.0) else: tmp = (x + ((x - (z * y)) / (x - (z * t)))) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -7.4e+109) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(Float64(x + Float64(Float64(x - Float64(z * y)) / 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 (z <= -7.4e+109) tmp = (x + (y / t)) / (x + 1.0); else tmp = (x + ((x - (z * y)) / (x - (z * t)))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -7.4e+109], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.4 \cdot 10^{+109}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{x - z \cdot y}{x - z \cdot t}}{x + 1}\\
\end{array}
\end{array}
if z < -7.40000000000000041e109Initial program 64.6%
*-commutative64.6%
Simplified64.6%
Taylor expanded in z around inf 89.6%
if -7.40000000000000041e109 < z Initial program 95.7%
Final simplification94.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (+ x (/ y t)) (+ x 1.0))))
(if (<= t -3.6e+43)
t_1
(if (<= t -5.5e-59)
(/ (+ x (/ x (- x (* z t)))) (+ x 1.0))
(if (<= t -1.35e-60)
(/ y t)
(if (<= t 2.65e-105)
(/ (- (+ x 1.0) (* y (/ z x))) (+ x 1.0))
t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = (x + (y / t)) / (x + 1.0);
double tmp;
if (t <= -3.6e+43) {
tmp = t_1;
} else if (t <= -5.5e-59) {
tmp = (x + (x / (x - (z * t)))) / (x + 1.0);
} else if (t <= -1.35e-60) {
tmp = y / t;
} else if (t <= 2.65e-105) {
tmp = ((x + 1.0) - (y * (z / x))) / (x + 1.0);
} 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 (t <= (-3.6d+43)) then
tmp = t_1
else if (t <= (-5.5d-59)) then
tmp = (x + (x / (x - (z * t)))) / (x + 1.0d0)
else if (t <= (-1.35d-60)) then
tmp = y / t
else if (t <= 2.65d-105) then
tmp = ((x + 1.0d0) - (y * (z / x))) / (x + 1.0d0)
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 (t <= -3.6e+43) {
tmp = t_1;
} else if (t <= -5.5e-59) {
tmp = (x + (x / (x - (z * t)))) / (x + 1.0);
} else if (t <= -1.35e-60) {
tmp = y / t;
} else if (t <= 2.65e-105) {
tmp = ((x + 1.0) - (y * (z / x))) / (x + 1.0);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x + (y / t)) / (x + 1.0) tmp = 0 if t <= -3.6e+43: tmp = t_1 elif t <= -5.5e-59: tmp = (x + (x / (x - (z * t)))) / (x + 1.0) elif t <= -1.35e-60: tmp = y / t elif t <= 2.65e-105: tmp = ((x + 1.0) - (y * (z / x))) / (x + 1.0) 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 (t <= -3.6e+43) tmp = t_1; elseif (t <= -5.5e-59) tmp = Float64(Float64(x + Float64(x / Float64(x - Float64(z * t)))) / Float64(x + 1.0)); elseif (t <= -1.35e-60) tmp = Float64(y / t); elseif (t <= 2.65e-105) tmp = Float64(Float64(Float64(x + 1.0) - Float64(y * Float64(z / x))) / Float64(x + 1.0)); 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 (t <= -3.6e+43) tmp = t_1; elseif (t <= -5.5e-59) tmp = (x + (x / (x - (z * t)))) / (x + 1.0); elseif (t <= -1.35e-60) tmp = y / t; elseif (t <= 2.65e-105) tmp = ((x + 1.0) - (y * (z / x))) / (x + 1.0); 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[t, -3.6e+43], t$95$1, If[LessEqual[t, -5.5e-59], N[(N[(x + N[(x / N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -1.35e-60], N[(y / t), $MachinePrecision], If[LessEqual[t, 2.65e-105], N[(N[(N[(x + 1.0), $MachinePrecision] - N[(y * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{if}\;t \leq -3.6 \cdot 10^{+43}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -5.5 \cdot 10^{-59}:\\
\;\;\;\;\frac{x + \frac{x}{x - z \cdot t}}{x + 1}\\
\mathbf{elif}\;t \leq -1.35 \cdot 10^{-60}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{elif}\;t \leq 2.65 \cdot 10^{-105}:\\
\;\;\;\;\frac{\left(x + 1\right) - y \cdot \frac{z}{x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -3.6000000000000001e43 or 2.6500000000000001e-105 < t Initial program 87.8%
*-commutative87.8%
Simplified87.8%
Taylor expanded in z around inf 91.5%
if -3.6000000000000001e43 < t < -5.50000000000000014e-59Initial program 90.9%
*-commutative90.9%
Simplified90.9%
Taylor expanded in y around 0 76.8%
+-commutative76.8%
Simplified76.8%
if -5.50000000000000014e-59 < t < -1.35e-60Initial program 99.5%
*-commutative99.5%
Simplified99.5%
Taylor expanded in z around inf 100.0%
Taylor expanded in x around 0 100.0%
if -1.35e-60 < t < 2.6500000000000001e-105Initial program 92.9%
*-commutative92.9%
Simplified92.9%
Taylor expanded in t around 0 82.9%
associate-+r+82.9%
mul-1-neg82.9%
unsub-neg82.9%
+-commutative82.9%
associate-/l*88.0%
+-commutative88.0%
Simplified88.0%
Final simplification89.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (/ y t))))
(if (<= t -1.12e+22)
(/ (- t_1 (/ x (* z t))) (+ x 1.0))
(if (<= t -5.2e-59)
(/ (+ x (/ x (- x (* z t)))) (+ x 1.0))
(if (<= t -6.6e-60)
(/ y t)
(if (<= t 2.15e-107)
(/ (- (+ x 1.0) (* y (/ z x))) (+ x 1.0))
(/ t_1 (+ x 1.0))))))))
double code(double x, double y, double z, double t) {
double t_1 = x + (y / t);
double tmp;
if (t <= -1.12e+22) {
tmp = (t_1 - (x / (z * t))) / (x + 1.0);
} else if (t <= -5.2e-59) {
tmp = (x + (x / (x - (z * t)))) / (x + 1.0);
} else if (t <= -6.6e-60) {
tmp = y / t;
} else if (t <= 2.15e-107) {
tmp = ((x + 1.0) - (y * (z / x))) / (x + 1.0);
} else {
tmp = t_1 / (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 / t)
if (t <= (-1.12d+22)) then
tmp = (t_1 - (x / (z * t))) / (x + 1.0d0)
else if (t <= (-5.2d-59)) then
tmp = (x + (x / (x - (z * t)))) / (x + 1.0d0)
else if (t <= (-6.6d-60)) then
tmp = y / t
else if (t <= 2.15d-107) then
tmp = ((x + 1.0d0) - (y * (z / x))) / (x + 1.0d0)
else
tmp = t_1 / (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 / t);
double tmp;
if (t <= -1.12e+22) {
tmp = (t_1 - (x / (z * t))) / (x + 1.0);
} else if (t <= -5.2e-59) {
tmp = (x + (x / (x - (z * t)))) / (x + 1.0);
} else if (t <= -6.6e-60) {
tmp = y / t;
} else if (t <= 2.15e-107) {
tmp = ((x + 1.0) - (y * (z / x))) / (x + 1.0);
} else {
tmp = t_1 / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (y / t) tmp = 0 if t <= -1.12e+22: tmp = (t_1 - (x / (z * t))) / (x + 1.0) elif t <= -5.2e-59: tmp = (x + (x / (x - (z * t)))) / (x + 1.0) elif t <= -6.6e-60: tmp = y / t elif t <= 2.15e-107: tmp = ((x + 1.0) - (y * (z / x))) / (x + 1.0) else: tmp = t_1 / (x + 1.0) return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(y / t)) tmp = 0.0 if (t <= -1.12e+22) tmp = Float64(Float64(t_1 - Float64(x / Float64(z * t))) / Float64(x + 1.0)); elseif (t <= -5.2e-59) tmp = Float64(Float64(x + Float64(x / Float64(x - Float64(z * t)))) / Float64(x + 1.0)); elseif (t <= -6.6e-60) tmp = Float64(y / t); elseif (t <= 2.15e-107) tmp = Float64(Float64(Float64(x + 1.0) - Float64(y * Float64(z / x))) / Float64(x + 1.0)); else tmp = Float64(t_1 / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + (y / t); tmp = 0.0; if (t <= -1.12e+22) tmp = (t_1 - (x / (z * t))) / (x + 1.0); elseif (t <= -5.2e-59) tmp = (x + (x / (x - (z * t)))) / (x + 1.0); elseif (t <= -6.6e-60) tmp = y / t; elseif (t <= 2.15e-107) tmp = ((x + 1.0) - (y * (z / x))) / (x + 1.0); else tmp = t_1 / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.12e+22], N[(N[(t$95$1 - N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -5.2e-59], N[(N[(x + N[(x / N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -6.6e-60], N[(y / t), $MachinePrecision], If[LessEqual[t, 2.15e-107], N[(N[(N[(x + 1.0), $MachinePrecision] - N[(y * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(t$95$1 / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y}{t}\\
\mathbf{if}\;t \leq -1.12 \cdot 10^{+22}:\\
\;\;\;\;\frac{t\_1 - \frac{x}{z \cdot t}}{x + 1}\\
\mathbf{elif}\;t \leq -5.2 \cdot 10^{-59}:\\
\;\;\;\;\frac{x + \frac{x}{x - z \cdot t}}{x + 1}\\
\mathbf{elif}\;t \leq -6.6 \cdot 10^{-60}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{elif}\;t \leq 2.15 \cdot 10^{-107}:\\
\;\;\;\;\frac{\left(x + 1\right) - y \cdot \frac{z}{x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{x + 1}\\
\end{array}
\end{array}
if t < -1.12e22Initial program 82.9%
*-commutative82.9%
Simplified82.9%
Taylor expanded in t around inf 92.6%
if -1.12e22 < t < -5.19999999999999996e-59Initial program 94.9%
*-commutative94.9%
Simplified94.9%
Taylor expanded in y around 0 78.3%
+-commutative78.3%
Simplified78.3%
if -5.19999999999999996e-59 < t < -6.5999999999999996e-60Initial program 99.5%
*-commutative99.5%
Simplified99.5%
Taylor expanded in z around inf 100.0%
Taylor expanded in x around 0 100.0%
if -6.5999999999999996e-60 < t < 2.1499999999999999e-107Initial program 92.9%
*-commutative92.9%
Simplified92.9%
Taylor expanded in t around 0 82.9%
associate-+r+82.9%
mul-1-neg82.9%
unsub-neg82.9%
+-commutative82.9%
associate-/l*88.0%
+-commutative88.0%
Simplified88.0%
if 2.1499999999999999e-107 < t Initial program 90.1%
*-commutative90.1%
Simplified90.1%
Taylor expanded in z around inf 91.2%
Final simplification89.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (+ x (/ y t)) (+ x 1.0))))
(if (<= t -1.85e+43)
t_1
(if (<= t -5.2e-59)
(/ (+ x (/ x (- x (* z t)))) (+ x 1.0))
(if (<= t -1.35e-60)
(/ y t)
(if (<= t 1.6e-107) (+ 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 (t <= -1.85e+43) {
tmp = t_1;
} else if (t <= -5.2e-59) {
tmp = (x + (x / (x - (z * t)))) / (x + 1.0);
} else if (t <= -1.35e-60) {
tmp = y / t;
} else if (t <= 1.6e-107) {
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 (t <= (-1.85d+43)) then
tmp = t_1
else if (t <= (-5.2d-59)) then
tmp = (x + (x / (x - (z * t)))) / (x + 1.0d0)
else if (t <= (-1.35d-60)) then
tmp = y / t
else if (t <= 1.6d-107) 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 (t <= -1.85e+43) {
tmp = t_1;
} else if (t <= -5.2e-59) {
tmp = (x + (x / (x - (z * t)))) / (x + 1.0);
} else if (t <= -1.35e-60) {
tmp = y / t;
} else if (t <= 1.6e-107) {
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 t <= -1.85e+43: tmp = t_1 elif t <= -5.2e-59: tmp = (x + (x / (x - (z * t)))) / (x + 1.0) elif t <= -1.35e-60: tmp = y / t elif t <= 1.6e-107: 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 (t <= -1.85e+43) tmp = t_1; elseif (t <= -5.2e-59) tmp = Float64(Float64(x + Float64(x / Float64(x - Float64(z * t)))) / Float64(x + 1.0)); elseif (t <= -1.35e-60) tmp = Float64(y / t); elseif (t <= 1.6e-107) 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 (t <= -1.85e+43) tmp = t_1; elseif (t <= -5.2e-59) tmp = (x + (x / (x - (z * t)))) / (x + 1.0); elseif (t <= -1.35e-60) tmp = y / t; elseif (t <= 1.6e-107) 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[t, -1.85e+43], t$95$1, If[LessEqual[t, -5.2e-59], N[(N[(x + N[(x / N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -1.35e-60], N[(y / t), $MachinePrecision], If[LessEqual[t, 1.6e-107], 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}\;t \leq -1.85 \cdot 10^{+43}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -5.2 \cdot 10^{-59}:\\
\;\;\;\;\frac{x + \frac{x}{x - z \cdot t}}{x + 1}\\
\mathbf{elif}\;t \leq -1.35 \cdot 10^{-60}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{elif}\;t \leq 1.6 \cdot 10^{-107}:\\
\;\;\;\;1 + y \cdot \frac{\frac{z}{x}}{-1 - x}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.85e43 or 1.60000000000000006e-107 < t Initial program 87.8%
*-commutative87.8%
Simplified87.8%
Taylor expanded in z around inf 91.5%
if -1.85e43 < t < -5.19999999999999996e-59Initial program 90.9%
*-commutative90.9%
Simplified90.9%
Taylor expanded in y around 0 76.8%
+-commutative76.8%
Simplified76.8%
if -5.19999999999999996e-59 < t < -1.35e-60Initial program 99.5%
*-commutative99.5%
Simplified99.5%
Taylor expanded in z around inf 100.0%
Taylor expanded in x around 0 100.0%
if -1.35e-60 < t < 1.60000000000000006e-107Initial program 92.9%
*-commutative92.9%
Simplified92.9%
Taylor expanded in t around 0 82.9%
associate-+r+82.9%
mul-1-neg82.9%
unsub-neg82.9%
+-commutative82.9%
associate-/l*88.0%
+-commutative88.0%
Simplified88.0%
Taylor expanded in y around 0 82.8%
mul-1-neg82.8%
unsub-neg82.8%
associate-/l*86.2%
+-commutative86.2%
distribute-lft-in86.2%
*-rgt-identity86.2%
fma-undefine86.2%
associate-/l*82.8%
sub-neg82.8%
associate-/l*86.2%
fma-undefine86.2%
*-rgt-identity86.2%
distribute-lft-in86.2%
+-commutative86.2%
associate-/r*88.0%
+-commutative88.0%
Simplified88.0%
Final simplification89.1%
(FPCore (x y z t) :precision binary64 (if (or (<= t -7e-10) (not (<= t 2.2e-109))) (/ (+ 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 <= -7e-10) || !(t <= 2.2e-109)) {
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 <= (-7d-10)) .or. (.not. (t <= 2.2d-109))) 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 <= -7e-10) || !(t <= 2.2e-109)) {
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 <= -7e-10) or not (t <= 2.2e-109): 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 <= -7e-10) || !(t <= 2.2e-109)) 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 <= -7e-10) || ~((t <= 2.2e-109))) 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, -7e-10], N[Not[LessEqual[t, 2.2e-109]], $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 \cdot 10^{-10} \lor \neg \left(t \leq 2.2 \cdot 10^{-109}\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 < -6.99999999999999961e-10 or 2.1999999999999999e-109 < t Initial program 87.5%
*-commutative87.5%
Simplified87.5%
Taylor expanded in z around inf 89.6%
if -6.99999999999999961e-10 < t < 2.1999999999999999e-109Initial program 93.7%
*-commutative93.7%
Simplified93.7%
Taylor expanded in t around 0 79.4%
associate-+r+79.4%
mul-1-neg79.4%
unsub-neg79.4%
+-commutative79.4%
associate-/l*83.8%
+-commutative83.8%
Simplified83.8%
Taylor expanded in y around 0 79.2%
mul-1-neg79.2%
unsub-neg79.2%
associate-/l*82.2%
+-commutative82.2%
distribute-lft-in82.2%
*-rgt-identity82.2%
fma-undefine82.2%
associate-/l*79.2%
sub-neg79.2%
associate-/l*82.2%
fma-undefine82.2%
*-rgt-identity82.2%
distribute-lft-in82.2%
+-commutative82.2%
associate-/r*83.8%
+-commutative83.8%
Simplified83.8%
Final simplification87.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -8e-130) (not (<= z 2.25e-127))) (/ (+ x (/ y t)) (+ x 1.0)) 1.0))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -8e-130) || !(z <= 2.25e-127)) {
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 <= (-8d-130)) .or. (.not. (z <= 2.25d-127))) 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 <= -8e-130) || !(z <= 2.25e-127)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -8e-130) or not (z <= 2.25e-127): tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -8e-130) || !(z <= 2.25e-127)) 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 <= -8e-130) || ~((z <= 2.25e-127))) 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, -8e-130], N[Not[LessEqual[z, 2.25e-127]], $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 -8 \cdot 10^{-130} \lor \neg \left(z \leq 2.25 \cdot 10^{-127}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if z < -8.0000000000000007e-130 or 2.25e-127 < z Initial program 86.6%
*-commutative86.6%
Simplified86.6%
Taylor expanded in z around inf 83.6%
if -8.0000000000000007e-130 < z < 2.25e-127Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around inf 43.0%
Taylor expanded in x around inf 73.4%
Final simplification80.9%
(FPCore (x y z t) :precision binary64 (if (<= x -140.0) 1.0 (if (<= x 4e-24) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -140.0) {
tmp = 1.0;
} else if (x <= 4e-24) {
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 <= (-140.0d0)) then
tmp = 1.0d0
else if (x <= 4d-24) 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 <= -140.0) {
tmp = 1.0;
} else if (x <= 4e-24) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -140.0: tmp = 1.0 elif x <= 4e-24: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -140.0) tmp = 1.0; elseif (x <= 4e-24) 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 <= -140.0) tmp = 1.0; elseif (x <= 4e-24) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -140.0], 1.0, If[LessEqual[x, 4e-24], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -140:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 4 \cdot 10^{-24}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -140 or 3.99999999999999969e-24 < x Initial program 89.2%
*-commutative89.2%
Simplified89.2%
Taylor expanded in z around inf 77.2%
Taylor expanded in x around inf 89.8%
if -140 < x < 3.99999999999999969e-24Initial program 91.0%
*-commutative91.0%
Simplified91.0%
Taylor expanded in z around inf 68.5%
Taylor expanded in x around 0 49.5%
Final simplification69.5%
(FPCore (x y z t) :precision binary64 (if (<= x -140.0) (+ 1.0 (/ -1.0 x)) (if (<= x 1.46e-20) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -140.0) {
tmp = 1.0 + (-1.0 / x);
} else if (x <= 1.46e-20) {
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 <= (-140.0d0)) then
tmp = 1.0d0 + ((-1.0d0) / x)
else if (x <= 1.46d-20) 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 <= -140.0) {
tmp = 1.0 + (-1.0 / x);
} else if (x <= 1.46e-20) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -140.0: tmp = 1.0 + (-1.0 / x) elif x <= 1.46e-20: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -140.0) tmp = Float64(1.0 + Float64(-1.0 / x)); elseif (x <= 1.46e-20) 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 <= -140.0) tmp = 1.0 + (-1.0 / x); elseif (x <= 1.46e-20) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -140.0], N[(1.0 + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.46e-20], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -140:\\
\;\;\;\;1 + \frac{-1}{x}\\
\mathbf{elif}\;x \leq 1.46 \cdot 10^{-20}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -140Initial program 92.0%
*-commutative92.0%
Simplified92.0%
Taylor expanded in t around inf 95.0%
+-commutative95.0%
Simplified95.0%
Taylor expanded in x around inf 95.0%
if -140 < x < 1.46000000000000002e-20Initial program 91.0%
*-commutative91.0%
Simplified91.0%
Taylor expanded in z around inf 68.5%
Taylor expanded in x around 0 49.5%
if 1.46000000000000002e-20 < x Initial program 86.7%
*-commutative86.7%
Simplified86.7%
Taylor expanded in z around inf 68.2%
Taylor expanded in x around inf 85.2%
Final simplification69.5%
(FPCore (x y z t) :precision binary64 (if (<= x -2.9e-86) (/ x (+ x 1.0)) (if (<= x 1.45e-20) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.9e-86) {
tmp = x / (x + 1.0);
} else if (x <= 1.45e-20) {
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 <= (-2.9d-86)) then
tmp = x / (x + 1.0d0)
else if (x <= 1.45d-20) 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 <= -2.9e-86) {
tmp = x / (x + 1.0);
} else if (x <= 1.45e-20) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.9e-86: tmp = x / (x + 1.0) elif x <= 1.45e-20: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.9e-86) tmp = Float64(x / Float64(x + 1.0)); elseif (x <= 1.45e-20) 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 <= -2.9e-86) tmp = x / (x + 1.0); elseif (x <= 1.45e-20) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.9e-86], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.45e-20], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.9 \cdot 10^{-86}:\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{elif}\;x \leq 1.45 \cdot 10^{-20}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -2.8999999999999999e-86Initial program 91.9%
*-commutative91.9%
Simplified91.9%
Taylor expanded in t around inf 86.8%
+-commutative86.8%
Simplified86.8%
if -2.8999999999999999e-86 < x < 1.45e-20Initial program 90.9%
*-commutative90.9%
Simplified90.9%
Taylor expanded in z around inf 67.8%
Taylor expanded in x around 0 51.6%
if 1.45e-20 < x Initial program 86.7%
*-commutative86.7%
Simplified86.7%
Taylor expanded in z around inf 68.2%
Taylor expanded in x around inf 85.2%
Final simplification70.3%
(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 90.1%
*-commutative90.1%
Simplified90.1%
Taylor expanded in z around inf 72.9%
Taylor expanded in x around inf 53.7%
Final simplification53.7%
(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 2024079
(FPCore (x y z t)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, A"
:precision binary64
:alt
(/ (+ x (- (/ y (- t (/ x z))) (/ x (- (* t z) x)))) (+ x 1.0))
(/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))