
(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 11 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 (fma y (+ x -0.5) (- 0.918938533204673 x)))
double code(double x, double y) {
return fma(y, (x + -0.5), (0.918938533204673 - x));
}
function code(x, y) return fma(y, Float64(x + -0.5), Float64(0.918938533204673 - x)) end
code[x_, y_] := N[(y * N[(x + -0.5), $MachinePrecision] + N[(0.918938533204673 - x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, x + -0.5, 0.918938533204673 - x\right)
\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%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(if (<= y -0.0004)
(* y x)
(if (<= y -6e-248)
0.918938533204673
(if (<= y 4.8e-60) (- x) (if (<= y 1.22) 0.918938533204673 (* y x))))))
double code(double x, double y) {
double tmp;
if (y <= -0.0004) {
tmp = y * x;
} else if (y <= -6e-248) {
tmp = 0.918938533204673;
} else if (y <= 4.8e-60) {
tmp = -x;
} else if (y <= 1.22) {
tmp = 0.918938533204673;
} else {
tmp = y * x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-0.0004d0)) then
tmp = y * x
else if (y <= (-6d-248)) then
tmp = 0.918938533204673d0
else if (y <= 4.8d-60) then
tmp = -x
else if (y <= 1.22d0) then
tmp = 0.918938533204673d0
else
tmp = y * x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -0.0004) {
tmp = y * x;
} else if (y <= -6e-248) {
tmp = 0.918938533204673;
} else if (y <= 4.8e-60) {
tmp = -x;
} else if (y <= 1.22) {
tmp = 0.918938533204673;
} else {
tmp = y * x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -0.0004: tmp = y * x elif y <= -6e-248: tmp = 0.918938533204673 elif y <= 4.8e-60: tmp = -x elif y <= 1.22: tmp = 0.918938533204673 else: tmp = y * x return tmp
function code(x, y) tmp = 0.0 if (y <= -0.0004) tmp = Float64(y * x); elseif (y <= -6e-248) tmp = 0.918938533204673; elseif (y <= 4.8e-60) tmp = Float64(-x); elseif (y <= 1.22) tmp = 0.918938533204673; else tmp = Float64(y * x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -0.0004) tmp = y * x; elseif (y <= -6e-248) tmp = 0.918938533204673; elseif (y <= 4.8e-60) tmp = -x; elseif (y <= 1.22) tmp = 0.918938533204673; else tmp = y * x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -0.0004], N[(y * x), $MachinePrecision], If[LessEqual[y, -6e-248], 0.918938533204673, If[LessEqual[y, 4.8e-60], (-x), If[LessEqual[y, 1.22], 0.918938533204673, N[(y * x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.0004:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq -6 \cdot 10^{-248}:\\
\;\;\;\;0.918938533204673\\
\mathbf{elif}\;y \leq 4.8 \cdot 10^{-60}:\\
\;\;\;\;-x\\
\mathbf{elif}\;y \leq 1.22:\\
\;\;\;\;0.918938533204673\\
\mathbf{else}:\\
\;\;\;\;y \cdot x\\
\end{array}
\end{array}
if y < -4.00000000000000019e-4 or 1.21999999999999997 < y 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%
+-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 61.0%
Taylor expanded in y around inf 58.3%
if -4.00000000000000019e-4 < y < -6.00000000000000027e-248 or 4.80000000000000019e-60 < y < 1.21999999999999997Initial 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%
+-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 99.1%
*-commutative99.1%
Simplified99.1%
Taylor expanded in x around 0 62.4%
if -6.00000000000000027e-248 < y < 4.80000000000000019e-60Initial 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%
+-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 69.4%
Taylor expanded in y around 0 69.4%
neg-mul-169.4%
Simplified69.4%
Final simplification61.8%
(FPCore (x y)
:precision binary64
(if (<= x -0.7)
(- (* y x) x)
(if (<= x 1.52e-15)
(+ 0.918938533204673 (* y -0.5))
(+ (- 0.918938533204673 x) (* y x)))))
double code(double x, double y) {
double tmp;
if (x <= -0.7) {
tmp = (y * x) - x;
} else if (x <= 1.52e-15) {
tmp = 0.918938533204673 + (y * -0.5);
} else {
tmp = (0.918938533204673 - x) + (y * x);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-0.7d0)) then
tmp = (y * x) - x
else if (x <= 1.52d-15) then
tmp = 0.918938533204673d0 + (y * (-0.5d0))
else
tmp = (0.918938533204673d0 - x) + (y * x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -0.7) {
tmp = (y * x) - x;
} else if (x <= 1.52e-15) {
tmp = 0.918938533204673 + (y * -0.5);
} else {
tmp = (0.918938533204673 - x) + (y * x);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -0.7: tmp = (y * x) - x elif x <= 1.52e-15: tmp = 0.918938533204673 + (y * -0.5) else: tmp = (0.918938533204673 - x) + (y * x) return tmp
function code(x, y) tmp = 0.0 if (x <= -0.7) tmp = Float64(Float64(y * x) - x); elseif (x <= 1.52e-15) tmp = Float64(0.918938533204673 + Float64(y * -0.5)); else tmp = Float64(Float64(0.918938533204673 - x) + Float64(y * x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -0.7) tmp = (y * x) - x; elseif (x <= 1.52e-15) tmp = 0.918938533204673 + (y * -0.5); else tmp = (0.918938533204673 - x) + (y * x); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -0.7], N[(N[(y * x), $MachinePrecision] - x), $MachinePrecision], If[LessEqual[x, 1.52e-15], N[(0.918938533204673 + N[(y * -0.5), $MachinePrecision]), $MachinePrecision], N[(N[(0.918938533204673 - x), $MachinePrecision] + N[(y * x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.7:\\
\;\;\;\;y \cdot x - x\\
\mathbf{elif}\;x \leq 1.52 \cdot 10^{-15}:\\
\;\;\;\;0.918938533204673 + y \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;\left(0.918938533204673 - x\right) + y \cdot x\\
\end{array}
\end{array}
if x < -0.69999999999999996Initial program 99.9%
cancel-sign-sub-inv99.9%
+-commutative99.9%
sub-neg99.9%
distribute-rgt-in99.9%
metadata-eval99.9%
neg-mul-199.9%
associate-+r+99.9%
unsub-neg99.9%
associate-+l-99.9%
distribute-lft-neg-out99.9%
distribute-rgt-neg-in99.9%
distribute-lft-out99.9%
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-undefine99.9%
+-commutative99.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 98.0%
sub-neg98.0%
distribute-rgt-in98.0%
*-commutative98.0%
metadata-eval98.0%
neg-mul-198.0%
Applied egg-rr98.0%
unsub-neg98.0%
*-commutative98.0%
Applied egg-rr98.0%
if -0.69999999999999996 < x < 1.52000000000000005e-15Initial 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%
Taylor expanded in x around 0 99.3%
*-commutative99.3%
Simplified99.3%
if 1.52000000000000005e-15 < 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%
+-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 99.0%
*-commutative99.0%
Simplified99.0%
Final simplification98.9%
(FPCore (x y) :precision binary64 (if (or (<= y -1.3e-5) (not (<= y 3.3e-13))) (* x (+ y -1.0)) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((y <= -1.3e-5) || !(y <= 3.3e-13)) {
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 ((y <= (-1.3d-5)) .or. (.not. (y <= 3.3d-13))) 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 ((y <= -1.3e-5) || !(y <= 3.3e-13)) {
tmp = x * (y + -1.0);
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.3e-5) or not (y <= 3.3e-13): tmp = x * (y + -1.0) else: tmp = 0.918938533204673 - x return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.3e-5) || !(y <= 3.3e-13)) 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 ((y <= -1.3e-5) || ~((y <= 3.3e-13))) tmp = x * (y + -1.0); else tmp = 0.918938533204673 - x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.3e-5], N[Not[LessEqual[y, 3.3e-13]], $MachinePrecision]], N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision], N[(0.918938533204673 - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.3 \cdot 10^{-5} \lor \neg \left(y \leq 3.3 \cdot 10^{-13}\right):\\
\;\;\;\;x \cdot \left(y + -1\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x\\
\end{array}
\end{array}
if y < -1.29999999999999992e-5 or 3.3000000000000001e-13 < y 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%
+-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 61.6%
if -1.29999999999999992e-5 < y < 3.3000000000000001e-13Initial 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%
Taylor expanded in y around 0 99.5%
Final simplification79.1%
(FPCore (x y) :precision binary64 (if (or (<= y -1.4) (not (<= y 1.02))) (* y (- x 0.5)) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((y <= -1.4) || !(y <= 1.02)) {
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.4d0)) .or. (.not. (y <= 1.02d0))) 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.4) || !(y <= 1.02)) {
tmp = y * (x - 0.5);
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.4) or not (y <= 1.02): tmp = y * (x - 0.5) else: tmp = 0.918938533204673 - x return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.4) || !(y <= 1.02)) 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.4) || ~((y <= 1.02))) tmp = y * (x - 0.5); else tmp = 0.918938533204673 - x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.4], N[Not[LessEqual[y, 1.02]], $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.4 \lor \neg \left(y \leq 1.02\right):\\
\;\;\;\;y \cdot \left(x - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x\\
\end{array}
\end{array}
if y < -1.3999999999999999 or 1.02 < y 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%
Taylor expanded in y around inf 96.4%
if -1.3999999999999999 < y < 1.02Initial 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%
Taylor expanded in y around 0 97.9%
Final simplification97.1%
(FPCore (x y) :precision binary64 (if (or (<= x -0.68) (not (<= x 0.52))) (* x (+ y -1.0)) (+ 0.918938533204673 (* y -0.5))))
double code(double x, double y) {
double tmp;
if ((x <= -0.68) || !(x <= 0.52)) {
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.68d0)) .or. (.not. (x <= 0.52d0))) 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.68) || !(x <= 0.52)) {
tmp = x * (y + -1.0);
} else {
tmp = 0.918938533204673 + (y * -0.5);
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -0.68) or not (x <= 0.52): tmp = x * (y + -1.0) else: tmp = 0.918938533204673 + (y * -0.5) return tmp
function code(x, y) tmp = 0.0 if ((x <= -0.68) || !(x <= 0.52)) 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.68) || ~((x <= 0.52))) 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.68], N[Not[LessEqual[x, 0.52]], $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.68 \lor \neg \left(x \leq 0.52\right):\\
\;\;\;\;x \cdot \left(y + -1\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 + y \cdot -0.5\\
\end{array}
\end{array}
if x < -0.680000000000000049 or 0.52000000000000002 < 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%
+-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 98.3%
if -0.680000000000000049 < x < 0.52000000000000002Initial 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%
Taylor expanded in x around 0 98.1%
*-commutative98.1%
Simplified98.1%
Final simplification98.2%
(FPCore (x y) :precision binary64 (if (or (<= x -0.7) (not (<= x 0.62))) (- (* y x) x) (+ 0.918938533204673 (* y -0.5))))
double code(double x, double y) {
double tmp;
if ((x <= -0.7) || !(x <= 0.62)) {
tmp = (y * x) - x;
} 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.7d0)) .or. (.not. (x <= 0.62d0))) then
tmp = (y * x) - x
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.7) || !(x <= 0.62)) {
tmp = (y * x) - x;
} else {
tmp = 0.918938533204673 + (y * -0.5);
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -0.7) or not (x <= 0.62): tmp = (y * x) - x else: tmp = 0.918938533204673 + (y * -0.5) return tmp
function code(x, y) tmp = 0.0 if ((x <= -0.7) || !(x <= 0.62)) tmp = Float64(Float64(y * x) - x); 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.7) || ~((x <= 0.62))) tmp = (y * x) - x; else tmp = 0.918938533204673 + (y * -0.5); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -0.7], N[Not[LessEqual[x, 0.62]], $MachinePrecision]], N[(N[(y * x), $MachinePrecision] - x), $MachinePrecision], N[(0.918938533204673 + N[(y * -0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.7 \lor \neg \left(x \leq 0.62\right):\\
\;\;\;\;y \cdot x - x\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 + y \cdot -0.5\\
\end{array}
\end{array}
if x < -0.69999999999999996 or 0.619999999999999996 < 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%
+-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 98.3%
sub-neg98.3%
distribute-rgt-in98.3%
*-commutative98.3%
metadata-eval98.3%
neg-mul-198.3%
Applied egg-rr98.3%
unsub-neg98.3%
*-commutative98.3%
Applied egg-rr98.3%
if -0.69999999999999996 < x < 0.619999999999999996Initial 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%
Taylor expanded in x around 0 98.1%
*-commutative98.1%
Simplified98.1%
Final simplification98.2%
(FPCore (x y) :precision binary64 (if (or (<= y -128000000.0) (not (<= y 1.15))) (* y x) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((y <= -128000000.0) || !(y <= 1.15)) {
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 <= (-128000000.0d0)) .or. (.not. (y <= 1.15d0))) 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 <= -128000000.0) || !(y <= 1.15)) {
tmp = y * x;
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -128000000.0) or not (y <= 1.15): tmp = y * x else: tmp = 0.918938533204673 - x return tmp
function code(x, y) tmp = 0.0 if ((y <= -128000000.0) || !(y <= 1.15)) 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 <= -128000000.0) || ~((y <= 1.15))) tmp = y * x; else tmp = 0.918938533204673 - x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -128000000.0], N[Not[LessEqual[y, 1.15]], $MachinePrecision]], N[(y * x), $MachinePrecision], N[(0.918938533204673 - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -128000000 \lor \neg \left(y \leq 1.15\right):\\
\;\;\;\;y \cdot x\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x\\
\end{array}
\end{array}
if y < -1.28e8 or 1.1499999999999999 < y 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%
+-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 61.3%
Taylor expanded in y around inf 59.8%
if -1.28e8 < y < 1.1499999999999999Initial 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%
Taylor expanded in y around 0 96.5%
Final simplification77.6%
(FPCore (x y) :precision binary64 (if (or (<= x -5800.0) (not (<= x 185000000.0))) (- x) 0.918938533204673))
double code(double x, double y) {
double tmp;
if ((x <= -5800.0) || !(x <= 185000000.0)) {
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 <= (-5800.0d0)) .or. (.not. (x <= 185000000.0d0))) 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 <= -5800.0) || !(x <= 185000000.0)) {
tmp = -x;
} else {
tmp = 0.918938533204673;
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -5800.0) or not (x <= 185000000.0): tmp = -x else: tmp = 0.918938533204673 return tmp
function code(x, y) tmp = 0.0 if ((x <= -5800.0) || !(x <= 185000000.0)) tmp = Float64(-x); else tmp = 0.918938533204673; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -5800.0) || ~((x <= 185000000.0))) tmp = -x; else tmp = 0.918938533204673; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -5800.0], N[Not[LessEqual[x, 185000000.0]], $MachinePrecision]], (-x), 0.918938533204673]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5800 \lor \neg \left(x \leq 185000000\right):\\
\;\;\;\;-x\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673\\
\end{array}
\end{array}
if x < -5800 or 1.85e8 < 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%
+-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 99.0%
Taylor expanded in y around 0 45.0%
neg-mul-145.0%
Simplified45.0%
if -5800 < x < 1.85e8Initial 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%
+-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 53.6%
*-commutative53.6%
Simplified53.6%
Taylor expanded in x around 0 51.1%
Final simplification47.7%
(FPCore (x y) :precision binary64 (+ (- 0.918938533204673 x) (* y (+ x -0.5))))
double code(double x, double y) {
return (0.918938533204673 - x) + (y * (x + -0.5));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (0.918938533204673d0 - x) + (y * (x + (-0.5d0)))
end function
public static double code(double x, double y) {
return (0.918938533204673 - x) + (y * (x + -0.5));
}
def code(x, y): return (0.918938533204673 - x) + (y * (x + -0.5))
function code(x, y) return Float64(Float64(0.918938533204673 - x) + Float64(y * Float64(x + -0.5))) end
function tmp = code(x, y) tmp = (0.918938533204673 - x) + (y * (x + -0.5)); end
code[x_, y_] := N[(N[(0.918938533204673 - x), $MachinePrecision] + N[(y * N[(x + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.918938533204673 - x\right) + y \cdot \left(x + -0.5\right)
\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%
+-commutative100.0%
Applied egg-rr100.0%
Final simplification100.0%
(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%
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%
+-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 79.1%
*-commutative79.1%
Simplified79.1%
Taylor expanded in x around 0 23.9%
Final simplification23.9%
herbie shell --seed 2024079
(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))