
(FPCore (x y z) :precision binary64 (+ x (/ y (- (* 1.1283791670955126 (exp z)) (* x y)))))
double code(double x, double y, double z) {
return x + (y / ((1.1283791670955126 * exp(z)) - (x * y)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + (y / ((1.1283791670955126d0 * exp(z)) - (x * y)))
end function
public static double code(double x, double y, double z) {
return x + (y / ((1.1283791670955126 * Math.exp(z)) - (x * y)));
}
def code(x, y, z): return x + (y / ((1.1283791670955126 * math.exp(z)) - (x * y)))
function code(x, y, z) return Float64(x + Float64(y / Float64(Float64(1.1283791670955126 * exp(z)) - Float64(x * y)))) end
function tmp = code(x, y, z) tmp = x + (y / ((1.1283791670955126 * exp(z)) - (x * y))); end
code[x_, y_, z_] := N[(x + N[(y / N[(N[(1.1283791670955126 * N[Exp[z], $MachinePrecision]), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ x (/ y (- (* 1.1283791670955126 (exp z)) (* x y)))))
double code(double x, double y, double z) {
return x + (y / ((1.1283791670955126 * exp(z)) - (x * y)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + (y / ((1.1283791670955126d0 * exp(z)) - (x * y)))
end function
public static double code(double x, double y, double z) {
return x + (y / ((1.1283791670955126 * Math.exp(z)) - (x * y)));
}
def code(x, y, z): return x + (y / ((1.1283791670955126 * math.exp(z)) - (x * y)))
function code(x, y, z) return Float64(x + Float64(y / Float64(Float64(1.1283791670955126 * exp(z)) - Float64(x * y)))) end
function tmp = code(x, y, z) tmp = x + (y / ((1.1283791670955126 * exp(z)) - (x * y))); end
code[x_, y_, z_] := N[(x + N[(y / N[(N[(1.1283791670955126 * N[Exp[z], $MachinePrecision]), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}
\end{array}
(FPCore (x y z) :precision binary64 (- x (/ -1.0 (- (* 1.1283791670955126 (/ (exp z) y)) x))))
double code(double x, double y, double z) {
return x - (-1.0 / ((1.1283791670955126 * (exp(z) / y)) - x));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x - ((-1.0d0) / ((1.1283791670955126d0 * (exp(z) / y)) - x))
end function
public static double code(double x, double y, double z) {
return x - (-1.0 / ((1.1283791670955126 * (Math.exp(z) / y)) - x));
}
def code(x, y, z): return x - (-1.0 / ((1.1283791670955126 * (math.exp(z) / y)) - x))
function code(x, y, z) return Float64(x - Float64(-1.0 / Float64(Float64(1.1283791670955126 * Float64(exp(z) / y)) - x))) end
function tmp = code(x, y, z) tmp = x - (-1.0 / ((1.1283791670955126 * (exp(z) / y)) - x)); end
code[x_, y_, z_] := N[(x - N[(-1.0 / N[(N[(1.1283791670955126 * N[(N[Exp[z], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{-1}{1.1283791670955126 \cdot \frac{e^{z}}{y} - x}
\end{array}
Initial program 95.1%
Simplified99.9%
Taylor expanded in z around inf 99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(if (<= (exp z) 0.0)
(+ x (/ -1.0 x))
(if (<= (exp z) 1.001)
(+ x (/ y (- (+ 1.1283791670955126 (* 1.1283791670955126 z)) (* x y))))
x)))
double code(double x, double y, double z) {
double tmp;
if (exp(z) <= 0.0) {
tmp = x + (-1.0 / x);
} else if (exp(z) <= 1.001) {
tmp = x + (y / ((1.1283791670955126 + (1.1283791670955126 * z)) - (x * y)));
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (exp(z) <= 0.0d0) then
tmp = x + ((-1.0d0) / x)
else if (exp(z) <= 1.001d0) then
tmp = x + (y / ((1.1283791670955126d0 + (1.1283791670955126d0 * z)) - (x * y)))
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (Math.exp(z) <= 0.0) {
tmp = x + (-1.0 / x);
} else if (Math.exp(z) <= 1.001) {
tmp = x + (y / ((1.1283791670955126 + (1.1283791670955126 * z)) - (x * y)));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if math.exp(z) <= 0.0: tmp = x + (-1.0 / x) elif math.exp(z) <= 1.001: tmp = x + (y / ((1.1283791670955126 + (1.1283791670955126 * z)) - (x * y))) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (exp(z) <= 0.0) tmp = Float64(x + Float64(-1.0 / x)); elseif (exp(z) <= 1.001) tmp = Float64(x + Float64(y / Float64(Float64(1.1283791670955126 + Float64(1.1283791670955126 * z)) - Float64(x * y)))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (exp(z) <= 0.0) tmp = x + (-1.0 / x); elseif (exp(z) <= 1.001) tmp = x + (y / ((1.1283791670955126 + (1.1283791670955126 * z)) - (x * y))); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[Exp[z], $MachinePrecision], 0.0], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Exp[z], $MachinePrecision], 1.001], N[(x + N[(y / N[(N[(1.1283791670955126 + N[(1.1283791670955126 * z), $MachinePrecision]), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{z} \leq 0:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;e^{z} \leq 1.001:\\
\;\;\;\;x + \frac{y}{\left(1.1283791670955126 + 1.1283791670955126 \cdot z\right) - x \cdot y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if (exp.f64 z) < 0.0Initial program 86.5%
Taylor expanded in x around inf 100.0%
if 0.0 < (exp.f64 z) < 1.0009999999999999Initial program 99.8%
Taylor expanded in z around 0 99.4%
*-commutative99.4%
Simplified99.4%
if 1.0009999999999999 < (exp.f64 z) Initial program 97.1%
Taylor expanded in x around inf 100.0%
Final simplification99.7%
(FPCore (x y z) :precision binary64 (if (<= (exp z) 0.0) (+ x (/ -1.0 x)) (+ x (/ y (- (* 1.1283791670955126 (exp z)) (* x y))))))
double code(double x, double y, double z) {
double tmp;
if (exp(z) <= 0.0) {
tmp = x + (-1.0 / x);
} else {
tmp = x + (y / ((1.1283791670955126 * exp(z)) - (x * y)));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (exp(z) <= 0.0d0) then
tmp = x + ((-1.0d0) / x)
else
tmp = x + (y / ((1.1283791670955126d0 * exp(z)) - (x * y)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (Math.exp(z) <= 0.0) {
tmp = x + (-1.0 / x);
} else {
tmp = x + (y / ((1.1283791670955126 * Math.exp(z)) - (x * y)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if math.exp(z) <= 0.0: tmp = x + (-1.0 / x) else: tmp = x + (y / ((1.1283791670955126 * math.exp(z)) - (x * y))) return tmp
function code(x, y, z) tmp = 0.0 if (exp(z) <= 0.0) tmp = Float64(x + Float64(-1.0 / x)); else tmp = Float64(x + Float64(y / Float64(Float64(1.1283791670955126 * exp(z)) - Float64(x * y)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (exp(z) <= 0.0) tmp = x + (-1.0 / x); else tmp = x + (y / ((1.1283791670955126 * exp(z)) - (x * y))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[Exp[z], $MachinePrecision], 0.0], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(N[(1.1283791670955126 * N[Exp[z], $MachinePrecision]), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{z} \leq 0:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\\
\end{array}
\end{array}
if (exp.f64 z) < 0.0Initial program 86.5%
Taylor expanded in x around inf 100.0%
if 0.0 < (exp.f64 z) Initial program 98.8%
Final simplification99.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ x (/ -1.0 x))) (t_1 (+ x (/ y 1.1283791670955126))))
(if (<= z -8.5e-10)
t_0
(if (<= z -1.75e-48)
t_1
(if (<= z -9.5e-135)
t_0
(if (<= z -1.2e-226)
t_1
(if (<= z -8e-301) t_0 (if (<= z 8e-18) t_1 x))))))))
double code(double x, double y, double z) {
double t_0 = x + (-1.0 / x);
double t_1 = x + (y / 1.1283791670955126);
double tmp;
if (z <= -8.5e-10) {
tmp = t_0;
} else if (z <= -1.75e-48) {
tmp = t_1;
} else if (z <= -9.5e-135) {
tmp = t_0;
} else if (z <= -1.2e-226) {
tmp = t_1;
} else if (z <= -8e-301) {
tmp = t_0;
} else if (z <= 8e-18) {
tmp = t_1;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x + ((-1.0d0) / x)
t_1 = x + (y / 1.1283791670955126d0)
if (z <= (-8.5d-10)) then
tmp = t_0
else if (z <= (-1.75d-48)) then
tmp = t_1
else if (z <= (-9.5d-135)) then
tmp = t_0
else if (z <= (-1.2d-226)) then
tmp = t_1
else if (z <= (-8d-301)) then
tmp = t_0
else if (z <= 8d-18) then
tmp = t_1
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x + (-1.0 / x);
double t_1 = x + (y / 1.1283791670955126);
double tmp;
if (z <= -8.5e-10) {
tmp = t_0;
} else if (z <= -1.75e-48) {
tmp = t_1;
} else if (z <= -9.5e-135) {
tmp = t_0;
} else if (z <= -1.2e-226) {
tmp = t_1;
} else if (z <= -8e-301) {
tmp = t_0;
} else if (z <= 8e-18) {
tmp = t_1;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): t_0 = x + (-1.0 / x) t_1 = x + (y / 1.1283791670955126) tmp = 0 if z <= -8.5e-10: tmp = t_0 elif z <= -1.75e-48: tmp = t_1 elif z <= -9.5e-135: tmp = t_0 elif z <= -1.2e-226: tmp = t_1 elif z <= -8e-301: tmp = t_0 elif z <= 8e-18: tmp = t_1 else: tmp = x return tmp
function code(x, y, z) t_0 = Float64(x + Float64(-1.0 / x)) t_1 = Float64(x + Float64(y / 1.1283791670955126)) tmp = 0.0 if (z <= -8.5e-10) tmp = t_0; elseif (z <= -1.75e-48) tmp = t_1; elseif (z <= -9.5e-135) tmp = t_0; elseif (z <= -1.2e-226) tmp = t_1; elseif (z <= -8e-301) tmp = t_0; elseif (z <= 8e-18) tmp = t_1; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x + (-1.0 / x); t_1 = x + (y / 1.1283791670955126); tmp = 0.0; if (z <= -8.5e-10) tmp = t_0; elseif (z <= -1.75e-48) tmp = t_1; elseif (z <= -9.5e-135) tmp = t_0; elseif (z <= -1.2e-226) tmp = t_1; elseif (z <= -8e-301) tmp = t_0; elseif (z <= 8e-18) tmp = t_1; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x + N[(y / 1.1283791670955126), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -8.5e-10], t$95$0, If[LessEqual[z, -1.75e-48], t$95$1, If[LessEqual[z, -9.5e-135], t$95$0, If[LessEqual[z, -1.2e-226], t$95$1, If[LessEqual[z, -8e-301], t$95$0, If[LessEqual[z, 8e-18], t$95$1, x]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \frac{-1}{x}\\
t_1 := x + \frac{y}{1.1283791670955126}\\
\mathbf{if}\;z \leq -8.5 \cdot 10^{-10}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -1.75 \cdot 10^{-48}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -9.5 \cdot 10^{-135}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -1.2 \cdot 10^{-226}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -8 \cdot 10^{-301}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 8 \cdot 10^{-18}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -8.4999999999999996e-10 or -1.74999999999999996e-48 < z < -9.50000000000000007e-135 or -1.2e-226 < z < -8.00000000000000053e-301Initial program 90.2%
Taylor expanded in x around inf 95.1%
if -8.4999999999999996e-10 < z < -1.74999999999999996e-48 or -9.50000000000000007e-135 < z < -1.2e-226 or -8.00000000000000053e-301 < z < 8.0000000000000006e-18Initial program 99.9%
Taylor expanded in z around 0 99.0%
*-commutative99.0%
Simplified99.0%
Taylor expanded in y around 0 82.8%
if 8.0000000000000006e-18 < z Initial program 97.2%
Taylor expanded in x around inf 98.7%
Final simplification92.4%
(FPCore (x y z) :precision binary64 (if (<= z -270.0) (+ x (/ -1.0 x)) (if (<= z 0.00185) (+ x (/ y (- 1.1283791670955126 (* x y)))) x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -270.0) {
tmp = x + (-1.0 / x);
} else if (z <= 0.00185) {
tmp = x + (y / (1.1283791670955126 - (x * y)));
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-270.0d0)) then
tmp = x + ((-1.0d0) / x)
else if (z <= 0.00185d0) then
tmp = x + (y / (1.1283791670955126d0 - (x * y)))
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -270.0) {
tmp = x + (-1.0 / x);
} else if (z <= 0.00185) {
tmp = x + (y / (1.1283791670955126 - (x * y)));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -270.0: tmp = x + (-1.0 / x) elif z <= 0.00185: tmp = x + (y / (1.1283791670955126 - (x * y))) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -270.0) tmp = Float64(x + Float64(-1.0 / x)); elseif (z <= 0.00185) tmp = Float64(x + Float64(y / Float64(1.1283791670955126 - Float64(x * y)))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -270.0) tmp = x + (-1.0 / x); elseif (z <= 0.00185) tmp = x + (y / (1.1283791670955126 - (x * y))); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -270.0], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.00185], N[(x + N[(y / N[(1.1283791670955126 - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -270:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq 0.00185:\\
\;\;\;\;x + \frac{y}{1.1283791670955126 - x \cdot y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -270Initial program 86.5%
Taylor expanded in x around inf 100.0%
if -270 < z < 0.0018500000000000001Initial program 99.8%
Taylor expanded in z around 0 98.3%
*-commutative98.3%
Simplified98.3%
if 0.0018500000000000001 < z Initial program 97.1%
Taylor expanded in x around inf 100.0%
Final simplification99.3%
(FPCore (x y z) :precision binary64 (if (<= z -150.0) (+ x (/ -1.0 x)) (if (<= z 0.00185) (- x (/ -1.0 (- (/ 1.1283791670955126 y) x))) x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -150.0) {
tmp = x + (-1.0 / x);
} else if (z <= 0.00185) {
tmp = x - (-1.0 / ((1.1283791670955126 / y) - x));
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-150.0d0)) then
tmp = x + ((-1.0d0) / x)
else if (z <= 0.00185d0) then
tmp = x - ((-1.0d0) / ((1.1283791670955126d0 / y) - x))
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -150.0) {
tmp = x + (-1.0 / x);
} else if (z <= 0.00185) {
tmp = x - (-1.0 / ((1.1283791670955126 / y) - x));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -150.0: tmp = x + (-1.0 / x) elif z <= 0.00185: tmp = x - (-1.0 / ((1.1283791670955126 / y) - x)) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -150.0) tmp = Float64(x + Float64(-1.0 / x)); elseif (z <= 0.00185) tmp = Float64(x - Float64(-1.0 / Float64(Float64(1.1283791670955126 / y) - x))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -150.0) tmp = x + (-1.0 / x); elseif (z <= 0.00185) tmp = x - (-1.0 / ((1.1283791670955126 / y) - x)); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -150.0], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.00185], N[(x - N[(-1.0 / N[(N[(1.1283791670955126 / y), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -150:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq 0.00185:\\
\;\;\;\;x - \frac{-1}{\frac{1.1283791670955126}{y} - x}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -150Initial program 86.5%
Taylor expanded in x around inf 100.0%
if -150 < z < 0.0018500000000000001Initial program 99.8%
Simplified99.8%
Taylor expanded in z around 0 98.3%
associate-*r/98.3%
metadata-eval98.3%
Simplified98.3%
if 0.0018500000000000001 < z Initial program 97.1%
Taylor expanded in x around inf 100.0%
Final simplification99.3%
(FPCore (x y z)
:precision binary64
(if (<= x -3e-73)
x
(if (<= x -1.95e-280)
(/ -1.0 x)
(if (<= x 2.9e-156)
(* y 0.8862269254527579)
(if (<= x 1.35e-88) (/ -1.0 x) x)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -3e-73) {
tmp = x;
} else if (x <= -1.95e-280) {
tmp = -1.0 / x;
} else if (x <= 2.9e-156) {
tmp = y * 0.8862269254527579;
} else if (x <= 1.35e-88) {
tmp = -1.0 / x;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-3d-73)) then
tmp = x
else if (x <= (-1.95d-280)) then
tmp = (-1.0d0) / x
else if (x <= 2.9d-156) then
tmp = y * 0.8862269254527579d0
else if (x <= 1.35d-88) then
tmp = (-1.0d0) / x
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -3e-73) {
tmp = x;
} else if (x <= -1.95e-280) {
tmp = -1.0 / x;
} else if (x <= 2.9e-156) {
tmp = y * 0.8862269254527579;
} else if (x <= 1.35e-88) {
tmp = -1.0 / x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -3e-73: tmp = x elif x <= -1.95e-280: tmp = -1.0 / x elif x <= 2.9e-156: tmp = y * 0.8862269254527579 elif x <= 1.35e-88: tmp = -1.0 / x else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -3e-73) tmp = x; elseif (x <= -1.95e-280) tmp = Float64(-1.0 / x); elseif (x <= 2.9e-156) tmp = Float64(y * 0.8862269254527579); elseif (x <= 1.35e-88) tmp = Float64(-1.0 / x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -3e-73) tmp = x; elseif (x <= -1.95e-280) tmp = -1.0 / x; elseif (x <= 2.9e-156) tmp = y * 0.8862269254527579; elseif (x <= 1.35e-88) tmp = -1.0 / x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -3e-73], x, If[LessEqual[x, -1.95e-280], N[(-1.0 / x), $MachinePrecision], If[LessEqual[x, 2.9e-156], N[(y * 0.8862269254527579), $MachinePrecision], If[LessEqual[x, 1.35e-88], N[(-1.0 / x), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3 \cdot 10^{-73}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -1.95 \cdot 10^{-280}:\\
\;\;\;\;\frac{-1}{x}\\
\mathbf{elif}\;x \leq 2.9 \cdot 10^{-156}:\\
\;\;\;\;y \cdot 0.8862269254527579\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{-88}:\\
\;\;\;\;\frac{-1}{x}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -3e-73 or 1.34999999999999997e-88 < x Initial program 98.6%
Taylor expanded in x around inf 90.3%
if -3e-73 < x < -1.94999999999999999e-280 or 2.90000000000000021e-156 < x < 1.34999999999999997e-88Initial program 89.7%
Taylor expanded in x around inf 59.0%
Taylor expanded in x around 0 59.0%
if -1.94999999999999999e-280 < x < 2.90000000000000021e-156Initial program 90.4%
Simplified99.6%
Taylor expanded in z around 0 59.5%
Taylor expanded in y around 0 52.8%
*-commutative52.8%
Simplified52.8%
Taylor expanded in x around 0 52.8%
*-commutative52.8%
Simplified52.8%
Final simplification76.7%
(FPCore (x y z)
:precision binary64
(if (<= x -1.4e-72)
x
(if (<= x -6.2e-280)
(/ -1.0 x)
(if (<= x 2.9e-156)
(/ y 1.1283791670955126)
(if (<= x 1.22e-88) (/ -1.0 x) x)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.4e-72) {
tmp = x;
} else if (x <= -6.2e-280) {
tmp = -1.0 / x;
} else if (x <= 2.9e-156) {
tmp = y / 1.1283791670955126;
} else if (x <= 1.22e-88) {
tmp = -1.0 / x;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-1.4d-72)) then
tmp = x
else if (x <= (-6.2d-280)) then
tmp = (-1.0d0) / x
else if (x <= 2.9d-156) then
tmp = y / 1.1283791670955126d0
else if (x <= 1.22d-88) then
tmp = (-1.0d0) / x
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.4e-72) {
tmp = x;
} else if (x <= -6.2e-280) {
tmp = -1.0 / x;
} else if (x <= 2.9e-156) {
tmp = y / 1.1283791670955126;
} else if (x <= 1.22e-88) {
tmp = -1.0 / x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.4e-72: tmp = x elif x <= -6.2e-280: tmp = -1.0 / x elif x <= 2.9e-156: tmp = y / 1.1283791670955126 elif x <= 1.22e-88: tmp = -1.0 / x else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.4e-72) tmp = x; elseif (x <= -6.2e-280) tmp = Float64(-1.0 / x); elseif (x <= 2.9e-156) tmp = Float64(y / 1.1283791670955126); elseif (x <= 1.22e-88) tmp = Float64(-1.0 / x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.4e-72) tmp = x; elseif (x <= -6.2e-280) tmp = -1.0 / x; elseif (x <= 2.9e-156) tmp = y / 1.1283791670955126; elseif (x <= 1.22e-88) tmp = -1.0 / x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.4e-72], x, If[LessEqual[x, -6.2e-280], N[(-1.0 / x), $MachinePrecision], If[LessEqual[x, 2.9e-156], N[(y / 1.1283791670955126), $MachinePrecision], If[LessEqual[x, 1.22e-88], N[(-1.0 / x), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \cdot 10^{-72}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -6.2 \cdot 10^{-280}:\\
\;\;\;\;\frac{-1}{x}\\
\mathbf{elif}\;x \leq 2.9 \cdot 10^{-156}:\\
\;\;\;\;\frac{y}{1.1283791670955126}\\
\mathbf{elif}\;x \leq 1.22 \cdot 10^{-88}:\\
\;\;\;\;\frac{-1}{x}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.3999999999999999e-72 or 1.2200000000000001e-88 < x Initial program 98.6%
Taylor expanded in x around inf 90.3%
if -1.3999999999999999e-72 < x < -6.20000000000000042e-280 or 2.90000000000000021e-156 < x < 1.2200000000000001e-88Initial program 89.7%
Taylor expanded in x around inf 59.0%
Taylor expanded in x around 0 59.0%
if -6.20000000000000042e-280 < x < 2.90000000000000021e-156Initial program 90.4%
Simplified99.6%
Taylor expanded in z around 0 59.5%
Taylor expanded in y around 0 52.8%
*-commutative52.8%
Simplified52.8%
Taylor expanded in x around 0 52.8%
*-commutative52.8%
Simplified52.8%
metadata-eval52.8%
div-inv53.0%
Applied egg-rr53.0%
Final simplification76.7%
(FPCore (x y z) :precision binary64 (if (<= x -6.4e-137) x (if (<= x 3.5e-129) (* y 0.8862269254527579) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -6.4e-137) {
tmp = x;
} else if (x <= 3.5e-129) {
tmp = y * 0.8862269254527579;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-6.4d-137)) then
tmp = x
else if (x <= 3.5d-129) then
tmp = y * 0.8862269254527579d0
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -6.4e-137) {
tmp = x;
} else if (x <= 3.5e-129) {
tmp = y * 0.8862269254527579;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -6.4e-137: tmp = x elif x <= 3.5e-129: tmp = y * 0.8862269254527579 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -6.4e-137) tmp = x; elseif (x <= 3.5e-129) tmp = Float64(y * 0.8862269254527579); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -6.4e-137) tmp = x; elseif (x <= 3.5e-129) tmp = y * 0.8862269254527579; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -6.4e-137], x, If[LessEqual[x, 3.5e-129], N[(y * 0.8862269254527579), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.4 \cdot 10^{-137}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{-129}:\\
\;\;\;\;y \cdot 0.8862269254527579\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -6.40000000000000043e-137 or 3.4999999999999997e-129 < x Initial program 97.7%
Taylor expanded in x around inf 81.1%
if -6.40000000000000043e-137 < x < 3.4999999999999997e-129Initial program 88.6%
Simplified99.7%
Taylor expanded in z around 0 51.4%
Taylor expanded in y around 0 38.8%
*-commutative38.8%
Simplified38.8%
Taylor expanded in x around 0 38.9%
*-commutative38.9%
Simplified38.9%
Final simplification68.9%
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
return x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x
end function
public static double code(double x, double y, double z) {
return x;
}
def code(x, y, z): return x
function code(x, y, z) return x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 95.1%
Taylor expanded in x around inf 63.0%
Final simplification63.0%
(FPCore (x y z) :precision binary64 (+ x (/ 1.0 (- (* (/ 1.1283791670955126 y) (exp z)) x))))
double code(double x, double y, double z) {
return x + (1.0 / (((1.1283791670955126 / y) * exp(z)) - x));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + (1.0d0 / (((1.1283791670955126d0 / y) * exp(z)) - x))
end function
public static double code(double x, double y, double z) {
return x + (1.0 / (((1.1283791670955126 / y) * Math.exp(z)) - x));
}
def code(x, y, z): return x + (1.0 / (((1.1283791670955126 / y) * math.exp(z)) - x))
function code(x, y, z) return Float64(x + Float64(1.0 / Float64(Float64(Float64(1.1283791670955126 / y) * exp(z)) - x))) end
function tmp = code(x, y, z) tmp = x + (1.0 / (((1.1283791670955126 / y) * exp(z)) - x)); end
code[x_, y_, z_] := N[(x + N[(1.0 / N[(N[(N[(1.1283791670955126 / y), $MachinePrecision] * N[Exp[z], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{1}{\frac{1.1283791670955126}{y} \cdot e^{z} - x}
\end{array}
herbie shell --seed 2023318
(FPCore (x y z)
:name "Numeric.SpecFunctions:invErfc from math-functions-0.1.5.2, A"
:precision binary64
:herbie-target
(+ x (/ 1.0 (- (* (/ 1.1283791670955126 y) (exp z)) x)))
(+ x (/ y (- (* 1.1283791670955126 (exp z)) (* x y)))))