
(FPCore (x y) :precision binary64 (+ (- (* x (- y 1.0)) (* y 0.5)) 0.918938533204673))
double code(double x, double y) {
return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((x * (y - 1.0d0)) - (y * 0.5d0)) + 0.918938533204673d0
end function
public static double code(double x, double y) {
return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673;
}
def code(x, y): return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673
function code(x, y) return Float64(Float64(Float64(x * Float64(y - 1.0)) - Float64(y * 0.5)) + 0.918938533204673) end
function tmp = code(x, y) tmp = ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673; end
code[x_, y_] := N[(N[(N[(x * N[(y - 1.0), $MachinePrecision]), $MachinePrecision] - N[(y * 0.5), $MachinePrecision]), $MachinePrecision] + 0.918938533204673), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (+ (- (* x (- y 1.0)) (* y 0.5)) 0.918938533204673))
double code(double x, double y) {
return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((x * (y - 1.0d0)) - (y * 0.5d0)) + 0.918938533204673d0
end function
public static double code(double x, double y) {
return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673;
}
def code(x, y): return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673
function code(x, y) return Float64(Float64(Float64(x * Float64(y - 1.0)) - Float64(y * 0.5)) + 0.918938533204673) end
function tmp = code(x, y) tmp = ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673; end
code[x_, y_] := N[(N[(N[(x * N[(y - 1.0), $MachinePrecision]), $MachinePrecision] - N[(y * 0.5), $MachinePrecision]), $MachinePrecision] + 0.918938533204673), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673
\end{array}
(FPCore (x y) :precision binary64 (- (+ (* y (+ x -0.5)) 0.918938533204673) x))
double code(double x, double y) {
return ((y * (x + -0.5)) + 0.918938533204673) - x;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((y * (x + (-0.5d0))) + 0.918938533204673d0) - x
end function
public static double code(double x, double y) {
return ((y * (x + -0.5)) + 0.918938533204673) - x;
}
def code(x, y): return ((y * (x + -0.5)) + 0.918938533204673) - x
function code(x, y) return Float64(Float64(Float64(y * Float64(x + -0.5)) + 0.918938533204673) - x) end
function tmp = code(x, y) tmp = ((y * (x + -0.5)) + 0.918938533204673) - x; end
code[x_, y_] := N[(N[(N[(y * N[(x + -0.5), $MachinePrecision]), $MachinePrecision] + 0.918938533204673), $MachinePrecision] - x), $MachinePrecision]
\begin{array}{l}
\\
\left(y \cdot \left(x + -0.5\right) + 0.918938533204673\right) - x
\end{array}
Initial program 100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate-+r+100.0%
unsub-neg100.0%
associate-+l-100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
distribute-lft-out100.0%
fma-neg100.0%
+-commutative100.0%
metadata-eval100.0%
neg-sub0100.0%
associate-+l-100.0%
neg-sub0100.0%
+-commutative100.0%
unsub-neg100.0%
Simplified100.0%
fma-undefine100.0%
associate-+r-100.0%
Applied egg-rr100.0%
(FPCore (x y)
:precision binary64
(if (<= x -3e+59)
(- x)
(if (<= x -900.0)
(* y x)
(if (<= x 0.92) 0.918938533204673 (if (<= x 3.2e+230) (* y x) (- x))))))
double code(double x, double y) {
double tmp;
if (x <= -3e+59) {
tmp = -x;
} else if (x <= -900.0) {
tmp = y * x;
} else if (x <= 0.92) {
tmp = 0.918938533204673;
} else if (x <= 3.2e+230) {
tmp = y * x;
} else {
tmp = -x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-3d+59)) then
tmp = -x
else if (x <= (-900.0d0)) then
tmp = y * x
else if (x <= 0.92d0) then
tmp = 0.918938533204673d0
else if (x <= 3.2d+230) then
tmp = y * x
else
tmp = -x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -3e+59) {
tmp = -x;
} else if (x <= -900.0) {
tmp = y * x;
} else if (x <= 0.92) {
tmp = 0.918938533204673;
} else if (x <= 3.2e+230) {
tmp = y * x;
} else {
tmp = -x;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -3e+59: tmp = -x elif x <= -900.0: tmp = y * x elif x <= 0.92: tmp = 0.918938533204673 elif x <= 3.2e+230: tmp = y * x else: tmp = -x return tmp
function code(x, y) tmp = 0.0 if (x <= -3e+59) tmp = Float64(-x); elseif (x <= -900.0) tmp = Float64(y * x); elseif (x <= 0.92) tmp = 0.918938533204673; elseif (x <= 3.2e+230) tmp = Float64(y * x); else tmp = Float64(-x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -3e+59) tmp = -x; elseif (x <= -900.0) tmp = y * x; elseif (x <= 0.92) tmp = 0.918938533204673; elseif (x <= 3.2e+230) tmp = y * x; else tmp = -x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -3e+59], (-x), If[LessEqual[x, -900.0], N[(y * x), $MachinePrecision], If[LessEqual[x, 0.92], 0.918938533204673, If[LessEqual[x, 3.2e+230], N[(y * x), $MachinePrecision], (-x)]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3 \cdot 10^{+59}:\\
\;\;\;\;-x\\
\mathbf{elif}\;x \leq -900:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;x \leq 0.92:\\
\;\;\;\;0.918938533204673\\
\mathbf{elif}\;x \leq 3.2 \cdot 10^{+230}:\\
\;\;\;\;y \cdot x\\
\mathbf{else}:\\
\;\;\;\;-x\\
\end{array}
\end{array}
if x < -3e59 or 3.2e230 < x Initial program 100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate-+r+100.0%
unsub-neg100.0%
associate-+l-100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
distribute-lft-out100.0%
fma-neg100.0%
+-commutative100.0%
metadata-eval100.0%
neg-sub0100.0%
associate-+l-100.0%
neg-sub0100.0%
+-commutative100.0%
unsub-neg100.0%
Simplified100.0%
fma-undefine100.0%
associate-+r-100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 100.0%
Taylor expanded in y around 0 63.3%
mul-1-neg63.3%
Simplified63.3%
if -3e59 < x < -900 or 0.92000000000000004 < x < 3.2e230Initial program 99.9%
associate-+l-99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around inf 65.7%
Taylor expanded in x around inf 63.0%
if -900 < x < 0.92000000000000004Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 59.7%
neg-mul-159.7%
sub-neg59.7%
Simplified59.7%
Taylor expanded in x around 0 58.0%
(FPCore (x y) :precision binary64 (if (or (<= x -8e+15) (not (<= x 54000000.0))) (* x (+ y -1.0)) (+ (* y x) (- 0.918938533204673 (* y 0.5)))))
double code(double x, double y) {
double tmp;
if ((x <= -8e+15) || !(x <= 54000000.0)) {
tmp = x * (y + -1.0);
} else {
tmp = (y * x) + (0.918938533204673 - (y * 0.5));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((x <= (-8d+15)) .or. (.not. (x <= 54000000.0d0))) then
tmp = x * (y + (-1.0d0))
else
tmp = (y * x) + (0.918938533204673d0 - (y * 0.5d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -8e+15) || !(x <= 54000000.0)) {
tmp = x * (y + -1.0);
} else {
tmp = (y * x) + (0.918938533204673 - (y * 0.5));
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -8e+15) or not (x <= 54000000.0): tmp = x * (y + -1.0) else: tmp = (y * x) + (0.918938533204673 - (y * 0.5)) return tmp
function code(x, y) tmp = 0.0 if ((x <= -8e+15) || !(x <= 54000000.0)) tmp = Float64(x * Float64(y + -1.0)); else tmp = Float64(Float64(y * x) + Float64(0.918938533204673 - Float64(y * 0.5))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -8e+15) || ~((x <= 54000000.0))) tmp = x * (y + -1.0); else tmp = (y * x) + (0.918938533204673 - (y * 0.5)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -8e+15], N[Not[LessEqual[x, 54000000.0]], $MachinePrecision]], N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(y * x), $MachinePrecision] + N[(0.918938533204673 - N[(y * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8 \cdot 10^{+15} \lor \neg \left(x \leq 54000000\right):\\
\;\;\;\;x \cdot \left(y + -1\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot x + \left(0.918938533204673 - y \cdot 0.5\right)\\
\end{array}
\end{array}
if x < -8e15 or 5.4e7 < x Initial program 100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate-+r+100.0%
unsub-neg100.0%
associate-+l-100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
distribute-lft-out100.0%
fma-neg100.0%
+-commutative100.0%
metadata-eval100.0%
neg-sub0100.0%
associate-+l-100.0%
neg-sub0100.0%
+-commutative100.0%
unsub-neg100.0%
Simplified100.0%
fma-undefine100.0%
associate-+r-100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 100.0%
if -8e15 < x < 5.4e7Initial program 99.9%
associate-+l-99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around inf 98.3%
Final simplification99.2%
(FPCore (x y) :precision binary64 (if (or (<= x -0.66) (not (<= x 0.87))) (* x (+ y -1.0)) (- 0.918938533204673 (* y 0.5))))
double code(double x, double y) {
double tmp;
if ((x <= -0.66) || !(x <= 0.87)) {
tmp = x * (y + -1.0);
} else {
tmp = 0.918938533204673 - (y * 0.5);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((x <= (-0.66d0)) .or. (.not. (x <= 0.87d0))) then
tmp = x * (y + (-1.0d0))
else
tmp = 0.918938533204673d0 - (y * 0.5d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -0.66) || !(x <= 0.87)) {
tmp = x * (y + -1.0);
} else {
tmp = 0.918938533204673 - (y * 0.5);
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -0.66) or not (x <= 0.87): tmp = x * (y + -1.0) else: tmp = 0.918938533204673 - (y * 0.5) return tmp
function code(x, y) tmp = 0.0 if ((x <= -0.66) || !(x <= 0.87)) tmp = Float64(x * Float64(y + -1.0)); else tmp = Float64(0.918938533204673 - Float64(y * 0.5)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -0.66) || ~((x <= 0.87))) tmp = x * (y + -1.0); else tmp = 0.918938533204673 - (y * 0.5); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -0.66], N[Not[LessEqual[x, 0.87]], $MachinePrecision]], N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision], N[(0.918938533204673 - N[(y * 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.66 \lor \neg \left(x \leq 0.87\right):\\
\;\;\;\;x \cdot \left(y + -1\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - y \cdot 0.5\\
\end{array}
\end{array}
if x < -0.660000000000000031 or 0.869999999999999996 < x Initial program 100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate-+r+100.0%
unsub-neg100.0%
associate-+l-100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
distribute-lft-out100.0%
fma-neg100.0%
+-commutative100.0%
metadata-eval100.0%
neg-sub0100.0%
associate-+l-100.0%
neg-sub0100.0%
+-commutative100.0%
unsub-neg100.0%
Simplified100.0%
fma-undefine100.0%
associate-+r-100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 98.2%
if -0.660000000000000031 < x < 0.869999999999999996Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 98.3%
*-commutative98.3%
Simplified98.3%
Final simplification98.2%
(FPCore (x y) :precision binary64 (if (or (<= y -1.5) (not (<= y 1.26))) (* y (- x 0.5)) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((y <= -1.5) || !(y <= 1.26)) {
tmp = y * (x - 0.5);
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-1.5d0)) .or. (.not. (y <= 1.26d0))) then
tmp = y * (x - 0.5d0)
else
tmp = 0.918938533204673d0 - x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -1.5) || !(y <= 1.26)) {
tmp = y * (x - 0.5);
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.5) or not (y <= 1.26): tmp = y * (x - 0.5) else: tmp = 0.918938533204673 - x return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.5) || !(y <= 1.26)) tmp = Float64(y * Float64(x - 0.5)); else tmp = Float64(0.918938533204673 - x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -1.5) || ~((y <= 1.26))) tmp = y * (x - 0.5); else tmp = 0.918938533204673 - x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.5], N[Not[LessEqual[y, 1.26]], $MachinePrecision]], N[(y * N[(x - 0.5), $MachinePrecision]), $MachinePrecision], N[(0.918938533204673 - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.5 \lor \neg \left(y \leq 1.26\right):\\
\;\;\;\;y \cdot \left(x - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x\\
\end{array}
\end{array}
if y < -1.5 or 1.26000000000000001 < y Initial program 99.9%
associate-+l-99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around inf 96.1%
if -1.5 < y < 1.26000000000000001Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 98.2%
neg-mul-198.2%
sub-neg98.2%
Simplified98.2%
Final simplification97.2%
(FPCore (x y) :precision binary64 (if (or (<= x -7400000.0) (not (<= x 68000.0))) (* x (+ y -1.0)) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((x <= -7400000.0) || !(x <= 68000.0)) {
tmp = x * (y + -1.0);
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((x <= (-7400000.0d0)) .or. (.not. (x <= 68000.0d0))) then
tmp = x * (y + (-1.0d0))
else
tmp = 0.918938533204673d0 - x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -7400000.0) || !(x <= 68000.0)) {
tmp = x * (y + -1.0);
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -7400000.0) or not (x <= 68000.0): tmp = x * (y + -1.0) else: tmp = 0.918938533204673 - x return tmp
function code(x, y) tmp = 0.0 if ((x <= -7400000.0) || !(x <= 68000.0)) tmp = Float64(x * Float64(y + -1.0)); else tmp = Float64(0.918938533204673 - x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -7400000.0) || ~((x <= 68000.0))) tmp = x * (y + -1.0); else tmp = 0.918938533204673 - x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -7400000.0], N[Not[LessEqual[x, 68000.0]], $MachinePrecision]], N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision], N[(0.918938533204673 - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7400000 \lor \neg \left(x \leq 68000\right):\\
\;\;\;\;x \cdot \left(y + -1\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x\\
\end{array}
\end{array}
if x < -7.4e6 or 68000 < x Initial program 100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate-+r+100.0%
unsub-neg100.0%
associate-+l-100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
distribute-lft-out100.0%
fma-neg100.0%
+-commutative100.0%
metadata-eval100.0%
neg-sub0100.0%
associate-+l-100.0%
neg-sub0100.0%
+-commutative100.0%
unsub-neg100.0%
Simplified100.0%
fma-undefine100.0%
associate-+r-100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 98.7%
if -7.4e6 < x < 68000Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 59.7%
neg-mul-159.7%
sub-neg59.7%
Simplified59.7%
Final simplification81.0%
(FPCore (x y) :precision binary64 (if (or (<= y -230.0) (not (<= y 1.26))) (* y x) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((y <= -230.0) || !(y <= 1.26)) {
tmp = y * x;
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-230.0d0)) .or. (.not. (y <= 1.26d0))) then
tmp = y * x
else
tmp = 0.918938533204673d0 - x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -230.0) || !(y <= 1.26)) {
tmp = y * x;
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -230.0) or not (y <= 1.26): tmp = y * x else: tmp = 0.918938533204673 - x return tmp
function code(x, y) tmp = 0.0 if ((y <= -230.0) || !(y <= 1.26)) tmp = Float64(y * x); else tmp = Float64(0.918938533204673 - x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -230.0) || ~((y <= 1.26))) tmp = y * x; else tmp = 0.918938533204673 - x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -230.0], N[Not[LessEqual[y, 1.26]], $MachinePrecision]], N[(y * x), $MachinePrecision], N[(0.918938533204673 - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -230 \lor \neg \left(y \leq 1.26\right):\\
\;\;\;\;y \cdot x\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x\\
\end{array}
\end{array}
if y < -230 or 1.26000000000000001 < y Initial program 99.9%
associate-+l-99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around inf 97.4%
Taylor expanded in x around inf 59.7%
if -230 < y < 1.26000000000000001Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 97.0%
neg-mul-197.0%
sub-neg97.0%
Simplified97.0%
Final simplification80.1%
(FPCore (x y) :precision binary64 (if (or (<= x -0.92) (not (<= x 9e+29))) (- x) 0.918938533204673))
double code(double x, double y) {
double tmp;
if ((x <= -0.92) || !(x <= 9e+29)) {
tmp = -x;
} else {
tmp = 0.918938533204673;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((x <= (-0.92d0)) .or. (.not. (x <= 9d+29))) then
tmp = -x
else
tmp = 0.918938533204673d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -0.92) || !(x <= 9e+29)) {
tmp = -x;
} else {
tmp = 0.918938533204673;
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -0.92) or not (x <= 9e+29): tmp = -x else: tmp = 0.918938533204673 return tmp
function code(x, y) tmp = 0.0 if ((x <= -0.92) || !(x <= 9e+29)) tmp = Float64(-x); else tmp = 0.918938533204673; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -0.92) || ~((x <= 9e+29))) tmp = -x; else tmp = 0.918938533204673; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -0.92], N[Not[LessEqual[x, 9e+29]], $MachinePrecision]], (-x), 0.918938533204673]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.92 \lor \neg \left(x \leq 9 \cdot 10^{+29}\right):\\
\;\;\;\;-x\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673\\
\end{array}
\end{array}
if x < -0.92000000000000004 or 9.0000000000000005e29 < x Initial program 100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate-+r+100.0%
unsub-neg100.0%
associate-+l-100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
distribute-lft-out100.0%
fma-neg100.0%
+-commutative100.0%
metadata-eval100.0%
neg-sub0100.0%
associate-+l-100.0%
neg-sub0100.0%
+-commutative100.0%
unsub-neg100.0%
Simplified100.0%
fma-undefine100.0%
associate-+r-100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 98.9%
Taylor expanded in y around 0 51.4%
mul-1-neg51.4%
Simplified51.4%
if -0.92000000000000004 < x < 9.0000000000000005e29Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 57.5%
neg-mul-157.5%
sub-neg57.5%
Simplified57.5%
Taylor expanded in x around 0 56.5%
Final simplification53.7%
(FPCore (x y) :precision binary64 0.918938533204673)
double code(double x, double y) {
return 0.918938533204673;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 0.918938533204673d0
end function
public static double code(double x, double y) {
return 0.918938533204673;
}
def code(x, y): return 0.918938533204673
function code(x, y) return 0.918938533204673 end
function tmp = code(x, y) tmp = 0.918938533204673; end
code[x_, y_] := 0.918938533204673
\begin{array}{l}
\\
0.918938533204673
\end{array}
Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 54.5%
neg-mul-154.5%
sub-neg54.5%
Simplified54.5%
Taylor expanded in x around 0 27.7%
(FPCore (x y) :precision binary64 0.0)
double code(double x, double y) {
return 0.0;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 0.0d0
end function
public static double code(double x, double y) {
return 0.0;
}
def code(x, y): return 0.0
function code(x, y) return 0.0 end
function tmp = code(x, y) tmp = 0.0; end
code[x_, y_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate-+r+100.0%
unsub-neg100.0%
associate-+l-100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
distribute-lft-out100.0%
fma-neg100.0%
+-commutative100.0%
metadata-eval100.0%
neg-sub0100.0%
associate-+l-100.0%
neg-sub0100.0%
+-commutative100.0%
unsub-neg100.0%
Simplified100.0%
fma-undefine100.0%
associate-+r-100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 55.5%
Taylor expanded in y around 0 28.9%
mul-1-neg28.9%
Simplified28.9%
add-sqr-sqrt14.8%
sqrt-unprod15.0%
sqr-neg15.0%
sqrt-unprod1.6%
add-log-exp6.2%
add-sqr-sqrt9.3%
add-sqr-sqrt9.3%
sqrt-unprod9.3%
add-sqr-sqrt6.2%
sqrt-unprod6.7%
sqr-neg6.7%
sqrt-unprod0.5%
add-sqr-sqrt1.3%
exp-neg1.3%
rgt-mult-inverse2.4%
metadata-eval2.4%
metadata-eval2.4%
Applied egg-rr2.4%
herbie shell --seed 2024145
(FPCore (x y)
:name "Numeric.SpecFunctions:logGamma from math-functions-0.1.5.2, A"
:precision binary64
(+ (- (* x (- y 1.0)) (* y 0.5)) 0.918938533204673))