
(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 (/ (+ x (/ (- (* y z) x) (- (* z t) x))) (+ x 1.0)))) (if (<= t_1 4e+201) t_1 (/ (+ x (/ 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 <= 4e+201) {
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 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0d0)
if (t_1 <= 4d+201) 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 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0);
double tmp;
if (t_1 <= 4e+201) {
tmp = t_1;
} else {
tmp = (x + (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 <= 4e+201: tmp = t_1 else: tmp = (x + (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 <= 4e+201) 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 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0); tmp = 0.0; if (t_1 <= 4e+201) 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[(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, 4e+201], 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{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}\\
\mathbf{if}\;t_1 \leq 4 \cdot 10^{+201}:\\
\;\;\;\;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 1)) < 4.00000000000000015e201Initial program 96.2%
if 4.00000000000000015e201 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) Initial program 52.5%
*-commutative52.5%
Simplified52.5%
Taylor expanded in z around inf 91.5%
Final simplification95.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (+ x (/ y t)) (+ x 1.0))))
(if (<= t -1.4e-9)
t_1
(if (<= t -5.4e-77)
(/ (- x (/ x (- (* z t) x))) (+ x 1.0))
(if (or (<= t -2.3e-117) (not (<= t 2.55e-105)))
t_1
(/ (+ x (- 1.0 (/ y (/ x z)))) (+ x 1.0)))))))
double code(double x, double y, double z, double t) {
double t_1 = (x + (y / t)) / (x + 1.0);
double tmp;
if (t <= -1.4e-9) {
tmp = t_1;
} else if (t <= -5.4e-77) {
tmp = (x - (x / ((z * t) - x))) / (x + 1.0);
} else if ((t <= -2.3e-117) || !(t <= 2.55e-105)) {
tmp = t_1;
} else {
tmp = (x + (1.0 - (y / (x / 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) :: tmp
t_1 = (x + (y / t)) / (x + 1.0d0)
if (t <= (-1.4d-9)) then
tmp = t_1
else if (t <= (-5.4d-77)) then
tmp = (x - (x / ((z * t) - x))) / (x + 1.0d0)
else if ((t <= (-2.3d-117)) .or. (.not. (t <= 2.55d-105))) then
tmp = t_1
else
tmp = (x + (1.0d0 - (y / (x / 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 = (x + (y / t)) / (x + 1.0);
double tmp;
if (t <= -1.4e-9) {
tmp = t_1;
} else if (t <= -5.4e-77) {
tmp = (x - (x / ((z * t) - x))) / (x + 1.0);
} else if ((t <= -2.3e-117) || !(t <= 2.55e-105)) {
tmp = t_1;
} else {
tmp = (x + (1.0 - (y / (x / z)))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): t_1 = (x + (y / t)) / (x + 1.0) tmp = 0 if t <= -1.4e-9: tmp = t_1 elif t <= -5.4e-77: tmp = (x - (x / ((z * t) - x))) / (x + 1.0) elif (t <= -2.3e-117) or not (t <= 2.55e-105): tmp = t_1 else: tmp = (x + (1.0 - (y / (x / z)))) / (x + 1.0) 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.4e-9) tmp = t_1; elseif (t <= -5.4e-77) tmp = Float64(Float64(x - Float64(x / Float64(Float64(z * t) - x))) / Float64(x + 1.0)); elseif ((t <= -2.3e-117) || !(t <= 2.55e-105)) tmp = t_1; else tmp = Float64(Float64(x + Float64(1.0 - Float64(y / Float64(x / z)))) / Float64(x + 1.0)); 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.4e-9) tmp = t_1; elseif (t <= -5.4e-77) tmp = (x - (x / ((z * t) - x))) / (x + 1.0); elseif ((t <= -2.3e-117) || ~((t <= 2.55e-105))) tmp = t_1; else tmp = (x + (1.0 - (y / (x / z)))) / (x + 1.0); 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.4e-9], t$95$1, If[LessEqual[t, -5.4e-77], N[(N[(x - N[(x / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t, -2.3e-117], N[Not[LessEqual[t, 2.55e-105]], $MachinePrecision]], t$95$1, N[(N[(x + N[(1.0 - N[(y / N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{if}\;t \leq -1.4 \cdot 10^{-9}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq -5.4 \cdot 10^{-77}:\\
\;\;\;\;\frac{x - \frac{x}{z \cdot t - x}}{x + 1}\\
\mathbf{elif}\;t \leq -2.3 \cdot 10^{-117} \lor \neg \left(t \leq 2.55 \cdot 10^{-105}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \left(1 - \frac{y}{\frac{x}{z}}\right)}{x + 1}\\
\end{array}
\end{array}
if t < -1.39999999999999992e-9 or -5.4000000000000001e-77 < t < -2.29999999999999994e-117 or 2.55000000000000004e-105 < t Initial program 89.8%
*-commutative89.8%
Simplified89.8%
Taylor expanded in z around inf 90.2%
if -1.39999999999999992e-9 < t < -5.4000000000000001e-77Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in y around 0 77.9%
+-commutative77.9%
Simplified77.9%
if -2.29999999999999994e-117 < t < 2.55000000000000004e-105Initial program 95.5%
*-commutative95.5%
Simplified95.5%
Taylor expanded in t around 0 79.2%
+-commutative79.2%
+-commutative79.2%
associate-+l+79.2%
+-commutative79.2%
mul-1-neg79.2%
unsub-neg79.2%
associate-/l*81.4%
+-commutative81.4%
Simplified81.4%
Final simplification86.6%
(FPCore (x y z t) :precision binary64 (if (or (<= t -9.2e-119) (not (<= t 7.5e-106))) (/ (+ x (/ y t)) (+ x 1.0)) (/ (+ x (- 1.0 (/ y (/ x z)))) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -9.2e-119) || !(t <= 7.5e-106)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (x + (1.0 - (y / (x / 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) :: tmp
if ((t <= (-9.2d-119)) .or. (.not. (t <= 7.5d-106))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = (x + (1.0d0 - (y / (x / z)))) / (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 <= -9.2e-119) || !(t <= 7.5e-106)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (x + (1.0 - (y / (x / z)))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -9.2e-119) or not (t <= 7.5e-106): tmp = (x + (y / t)) / (x + 1.0) else: tmp = (x + (1.0 - (y / (x / z)))) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -9.2e-119) || !(t <= 7.5e-106)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(Float64(x + Float64(1.0 - Float64(y / Float64(x / z)))) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -9.2e-119) || ~((t <= 7.5e-106))) tmp = (x + (y / t)) / (x + 1.0); else tmp = (x + (1.0 - (y / (x / z)))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -9.2e-119], N[Not[LessEqual[t, 7.5e-106]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(1.0 - N[(y / N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9.2 \cdot 10^{-119} \lor \neg \left(t \leq 7.5 \cdot 10^{-106}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \left(1 - \frac{y}{\frac{x}{z}}\right)}{x + 1}\\
\end{array}
\end{array}
if t < -9.19999999999999973e-119 or 7.5000000000000002e-106 < t Initial program 90.6%
*-commutative90.6%
Simplified90.6%
Taylor expanded in z around inf 86.4%
if -9.19999999999999973e-119 < t < 7.5000000000000002e-106Initial program 95.5%
*-commutative95.5%
Simplified95.5%
Taylor expanded in t around 0 79.2%
+-commutative79.2%
+-commutative79.2%
associate-+l+79.2%
+-commutative79.2%
mul-1-neg79.2%
unsub-neg79.2%
associate-/l*81.4%
+-commutative81.4%
Simplified81.4%
Final simplification84.7%
(FPCore (x y z t) :precision binary64 (if (or (<= t -4.6e-125) (not (<= t 5.4e-105))) (/ (+ x (/ y t)) (+ x 1.0)) (- 1.0 (/ (* y z) (* x (+ x 1.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -4.6e-125) || !(t <= 5.4e-105)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 - ((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 <= (-4.6d-125)) .or. (.not. (t <= 5.4d-105))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = 1.0d0 - ((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 <= -4.6e-125) || !(t <= 5.4e-105)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 - ((y * z) / (x * (x + 1.0)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -4.6e-125) or not (t <= 5.4e-105): tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 - ((y * z) / (x * (x + 1.0))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -4.6e-125) || !(t <= 5.4e-105)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(1.0 - Float64(Float64(y * z) / Float64(x * Float64(x + 1.0)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -4.6e-125) || ~((t <= 5.4e-105))) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0 - ((y * z) / (x * (x + 1.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -4.6e-125], N[Not[LessEqual[t, 5.4e-105]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(y * z), $MachinePrecision] / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.6 \cdot 10^{-125} \lor \neg \left(t \leq 5.4 \cdot 10^{-105}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{y \cdot z}{x \cdot \left(x + 1\right)}\\
\end{array}
\end{array}
if t < -4.5999999999999998e-125 or 5.39999999999999985e-105 < t Initial program 90.6%
*-commutative90.6%
Simplified90.6%
Taylor expanded in z around inf 86.4%
if -4.5999999999999998e-125 < t < 5.39999999999999985e-105Initial program 95.5%
*-commutative95.5%
Simplified95.5%
Taylor expanded in t around 0 79.2%
+-commutative79.2%
+-commutative79.2%
associate-+l+79.2%
+-commutative79.2%
mul-1-neg79.2%
unsub-neg79.2%
associate-/l*81.4%
+-commutative81.4%
Simplified81.4%
Taylor expanded in y around 0 79.2%
mul-1-neg79.2%
unsub-neg79.2%
*-commutative79.2%
Simplified79.2%
Final simplification84.0%
(FPCore (x y z t)
:precision binary64
(if (<= x -5.5e+90)
(- 1.0 (/ 1.0 x))
(if (<= x 52000000000.0)
(/ (+ x (/ y t)) (+ x 1.0))
(/ (+ x 1.0) (+ x 1.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -5.5e+90) {
tmp = 1.0 - (1.0 / x);
} else if (x <= 52000000000.0) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (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 (x <= (-5.5d+90)) then
tmp = 1.0d0 - (1.0d0 / x)
else if (x <= 52000000000.0d0) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = (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 (x <= -5.5e+90) {
tmp = 1.0 - (1.0 / x);
} else if (x <= 52000000000.0) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (x + 1.0) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -5.5e+90: tmp = 1.0 - (1.0 / x) elif x <= 52000000000.0: tmp = (x + (y / t)) / (x + 1.0) else: tmp = (x + 1.0) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -5.5e+90) tmp = Float64(1.0 - Float64(1.0 / x)); elseif (x <= 52000000000.0) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(Float64(x + 1.0) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -5.5e+90) tmp = 1.0 - (1.0 / x); elseif (x <= 52000000000.0) tmp = (x + (y / t)) / (x + 1.0); else tmp = (x + 1.0) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -5.5e+90], N[(1.0 - N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 52000000000.0], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x + 1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.5 \cdot 10^{+90}:\\
\;\;\;\;1 - \frac{1}{x}\\
\mathbf{elif}\;x \leq 52000000000:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + 1}{x + 1}\\
\end{array}
\end{array}
if x < -5.49999999999999999e90Initial program 95.1%
*-commutative95.1%
Simplified95.1%
Taylor expanded in t around inf 100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
if -5.49999999999999999e90 < x < 5.2e10Initial program 89.5%
*-commutative89.5%
Simplified89.5%
Taylor expanded in z around inf 71.1%
if 5.2e10 < x Initial program 96.9%
*-commutative96.9%
Simplified96.9%
Taylor expanded in z around 0 95.6%
Final simplification81.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4e-41) (not (<= x 9e-41))) (/ x (+ x 1.0)) (/ y (* t (+ x 1.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4e-41) || !(x <= 9e-41)) {
tmp = x / (x + 1.0);
} else {
tmp = 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) :: tmp
if ((x <= (-4d-41)) .or. (.not. (x <= 9d-41))) then
tmp = x / (x + 1.0d0)
else
tmp = y / (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 <= -4e-41) || !(x <= 9e-41)) {
tmp = x / (x + 1.0);
} else {
tmp = y / (t * (x + 1.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -4e-41) or not (x <= 9e-41): tmp = x / (x + 1.0) else: tmp = y / (t * (x + 1.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -4e-41) || !(x <= 9e-41)) tmp = Float64(x / Float64(x + 1.0)); else tmp = Float64(y / Float64(t * Float64(x + 1.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -4e-41) || ~((x <= 9e-41))) tmp = x / (x + 1.0); else tmp = y / (t * (x + 1.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -4e-41], N[Not[LessEqual[x, 9e-41]], $MachinePrecision]], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(y / N[(t * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{-41} \lor \neg \left(x \leq 9 \cdot 10^{-41}\right):\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t \cdot \left(x + 1\right)}\\
\end{array}
\end{array}
if x < -4.00000000000000002e-41 or 9e-41 < x Initial program 93.7%
*-commutative93.7%
Simplified93.7%
Taylor expanded in t around inf 87.2%
+-commutative87.2%
Simplified87.2%
if -4.00000000000000002e-41 < x < 9e-41Initial program 90.5%
*-commutative90.5%
Simplified90.5%
Taylor expanded in z around inf 71.3%
Taylor expanded in y around inf 57.3%
Final simplification73.6%
(FPCore (x y z t) :precision binary64 (if (or (<= x -9.5e-5) (not (<= x 27500000.0))) (- 1.0 (/ 1.0 x)) (/ y t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -9.5e-5) || !(x <= 27500000.0)) {
tmp = 1.0 - (1.0 / x);
} else {
tmp = y / 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) :: tmp
if ((x <= (-9.5d-5)) .or. (.not. (x <= 27500000.0d0))) then
tmp = 1.0d0 - (1.0d0 / x)
else
tmp = y / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -9.5e-5) || !(x <= 27500000.0)) {
tmp = 1.0 - (1.0 / x);
} else {
tmp = y / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -9.5e-5) or not (x <= 27500000.0): tmp = 1.0 - (1.0 / x) else: tmp = y / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -9.5e-5) || !(x <= 27500000.0)) tmp = Float64(1.0 - Float64(1.0 / x)); else tmp = Float64(y / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -9.5e-5) || ~((x <= 27500000.0))) tmp = 1.0 - (1.0 / x); else tmp = y / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -9.5e-5], N[Not[LessEqual[x, 27500000.0]], $MachinePrecision]], N[(1.0 - N[(1.0 / x), $MachinePrecision]), $MachinePrecision], N[(y / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.5 \cdot 10^{-5} \lor \neg \left(x \leq 27500000\right):\\
\;\;\;\;1 - \frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t}\\
\end{array}
\end{array}
if x < -9.5000000000000005e-5 or 2.75e7 < x Initial program 94.4%
*-commutative94.4%
Simplified94.4%
Taylor expanded in t around inf 93.5%
+-commutative93.5%
Simplified93.5%
Taylor expanded in x around inf 92.9%
if -9.5000000000000005e-5 < x < 2.75e7Initial program 90.4%
*-commutative90.4%
Simplified90.4%
add-cube-cbrt89.3%
pow389.4%
Applied egg-rr89.4%
Taylor expanded in x around 0 51.9%
pow-base-151.9%
*-lft-identity51.9%
Simplified51.9%
Final simplification71.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.25e-41) (not (<= x 5.2e-41))) (/ x (+ x 1.0)) (/ y t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.25e-41) || !(x <= 5.2e-41)) {
tmp = x / (x + 1.0);
} else {
tmp = y / 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) :: tmp
if ((x <= (-2.25d-41)) .or. (.not. (x <= 5.2d-41))) then
tmp = x / (x + 1.0d0)
else
tmp = y / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.25e-41) || !(x <= 5.2e-41)) {
tmp = x / (x + 1.0);
} else {
tmp = y / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.25e-41) or not (x <= 5.2e-41): tmp = x / (x + 1.0) else: tmp = y / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.25e-41) || !(x <= 5.2e-41)) tmp = Float64(x / Float64(x + 1.0)); else tmp = Float64(y / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -2.25e-41) || ~((x <= 5.2e-41))) tmp = x / (x + 1.0); else tmp = y / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.25e-41], N[Not[LessEqual[x, 5.2e-41]], $MachinePrecision]], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(y / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.25 \cdot 10^{-41} \lor \neg \left(x \leq 5.2 \cdot 10^{-41}\right):\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t}\\
\end{array}
\end{array}
if x < -2.25e-41 or 5.1999999999999999e-41 < x Initial program 93.7%
*-commutative93.7%
Simplified93.7%
Taylor expanded in t around inf 87.2%
+-commutative87.2%
Simplified87.2%
if -2.25e-41 < x < 5.1999999999999999e-41Initial program 90.5%
*-commutative90.5%
Simplified90.5%
add-cube-cbrt89.5%
pow389.5%
Applied egg-rr89.5%
Taylor expanded in x around 0 57.3%
pow-base-157.3%
*-lft-identity57.3%
Simplified57.3%
Final simplification73.6%
(FPCore (x y z t) :precision binary64 (if (<= t -3.4e+217) x (/ y t)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -3.4e+217) {
tmp = x;
} else {
tmp = y / 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) :: tmp
if (t <= (-3.4d+217)) then
tmp = x
else
tmp = y / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -3.4e+217) {
tmp = x;
} else {
tmp = y / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -3.4e+217: tmp = x else: tmp = y / t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -3.4e+217) tmp = x; else tmp = Float64(y / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -3.4e+217) tmp = x; else tmp = y / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -3.4e+217], x, N[(y / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.4 \cdot 10^{+217}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t}\\
\end{array}
\end{array}
if t < -3.3999999999999999e217Initial program 93.8%
*-commutative93.8%
Simplified93.8%
Taylor expanded in t around inf 87.9%
+-commutative87.9%
Simplified87.9%
Taylor expanded in x around 0 61.1%
if -3.3999999999999999e217 < t Initial program 92.1%
*-commutative92.1%
Simplified92.1%
add-cube-cbrt91.6%
pow391.6%
Applied egg-rr91.6%
Taylor expanded in x around 0 30.4%
pow-base-130.4%
*-lft-identity30.4%
Simplified30.4%
Final simplification32.3%
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
return x;
}
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
end function
public static double code(double x, double y, double z, double t) {
return x;
}
def code(x, y, z, t): return x
function code(x, y, z, t) return x end
function tmp = code(x, y, z, t) tmp = x; end
code[x_, y_, z_, t_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 92.2%
*-commutative92.2%
Simplified92.2%
Taylor expanded in t around inf 55.2%
+-commutative55.2%
Simplified55.2%
Taylor expanded in x around 0 12.6%
Final simplification12.6%
(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 2023230
(FPCore (x y z t)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, A"
:precision binary64
:herbie-target
(/ (+ x (- (/ y (- t (/ x z))) (/ x (- (* t z) x)))) (+ x 1.0))
(/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))