
(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 9 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 (- (+ 0.918938533204673 (* y (- x 0.5))) x))
double code(double x, double y) {
return (0.918938533204673 + (y * (x - 0.5))) - x;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (0.918938533204673d0 + (y * (x - 0.5d0))) - x
end function
public static double code(double x, double y) {
return (0.918938533204673 + (y * (x - 0.5))) - x;
}
def code(x, y): return (0.918938533204673 + (y * (x - 0.5))) - x
function code(x, y) return Float64(Float64(0.918938533204673 + Float64(y * Float64(x - 0.5))) - x) end
function tmp = code(x, y) tmp = (0.918938533204673 + (y * (x - 0.5))) - x; end
code[x_, y_] := N[(N[(0.918938533204673 + N[(y * N[(x - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]
\begin{array}{l}
\\
\left(0.918938533204673 + y \cdot \left(x - 0.5\right)\right) - x
\end{array}
Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(if (<= y -1.0)
(* y x)
(if (<= y -4.4e-117)
(- x)
(if (<= y 4.5e-185)
0.918938533204673
(if (<= y 3.1e-130)
(- x)
(if (<= y 6.2e-92)
0.918938533204673
(if (<= y 1.0) (- x) (* y x))))))))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = y * x;
} else if (y <= -4.4e-117) {
tmp = -x;
} else if (y <= 4.5e-185) {
tmp = 0.918938533204673;
} else if (y <= 3.1e-130) {
tmp = -x;
} else if (y <= 6.2e-92) {
tmp = 0.918938533204673;
} else if (y <= 1.0) {
tmp = -x;
} 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 <= (-1.0d0)) then
tmp = y * x
else if (y <= (-4.4d-117)) then
tmp = -x
else if (y <= 4.5d-185) then
tmp = 0.918938533204673d0
else if (y <= 3.1d-130) then
tmp = -x
else if (y <= 6.2d-92) then
tmp = 0.918938533204673d0
else if (y <= 1.0d0) then
tmp = -x
else
tmp = y * x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = y * x;
} else if (y <= -4.4e-117) {
tmp = -x;
} else if (y <= 4.5e-185) {
tmp = 0.918938533204673;
} else if (y <= 3.1e-130) {
tmp = -x;
} else if (y <= 6.2e-92) {
tmp = 0.918938533204673;
} else if (y <= 1.0) {
tmp = -x;
} else {
tmp = y * x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = y * x elif y <= -4.4e-117: tmp = -x elif y <= 4.5e-185: tmp = 0.918938533204673 elif y <= 3.1e-130: tmp = -x elif y <= 6.2e-92: tmp = 0.918938533204673 elif y <= 1.0: tmp = -x else: tmp = y * x return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = Float64(y * x); elseif (y <= -4.4e-117) tmp = Float64(-x); elseif (y <= 4.5e-185) tmp = 0.918938533204673; elseif (y <= 3.1e-130) tmp = Float64(-x); elseif (y <= 6.2e-92) tmp = 0.918938533204673; elseif (y <= 1.0) tmp = Float64(-x); else tmp = Float64(y * x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.0) tmp = y * x; elseif (y <= -4.4e-117) tmp = -x; elseif (y <= 4.5e-185) tmp = 0.918938533204673; elseif (y <= 3.1e-130) tmp = -x; elseif (y <= 6.2e-92) tmp = 0.918938533204673; elseif (y <= 1.0) tmp = -x; else tmp = y * x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], N[(y * x), $MachinePrecision], If[LessEqual[y, -4.4e-117], (-x), If[LessEqual[y, 4.5e-185], 0.918938533204673, If[LessEqual[y, 3.1e-130], (-x), If[LessEqual[y, 6.2e-92], 0.918938533204673, If[LessEqual[y, 1.0], (-x), N[(y * x), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq -4.4 \cdot 10^{-117}:\\
\;\;\;\;-x\\
\mathbf{elif}\;y \leq 4.5 \cdot 10^{-185}:\\
\;\;\;\;0.918938533204673\\
\mathbf{elif}\;y \leq 3.1 \cdot 10^{-130}:\\
\;\;\;\;-x\\
\mathbf{elif}\;y \leq 6.2 \cdot 10^{-92}:\\
\;\;\;\;0.918938533204673\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;-x\\
\mathbf{else}:\\
\;\;\;\;y \cdot x\\
\end{array}
\end{array}
if y < -1 or 1 < y Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around inf 56.2%
mul-1-neg56.2%
distribute-lft-neg-in56.2%
distribute-lft-in56.2%
*-rgt-identity56.2%
distribute-lft-neg-in56.2%
mul-1-neg56.2%
distribute-rgt-neg-in56.2%
*-commutative56.2%
neg-mul-156.2%
remove-double-neg56.2%
distribute-rgt-in56.2%
+-commutative56.2%
Simplified56.2%
Taylor expanded in y around inf 55.4%
if -1 < y < -4.4000000000000002e-117 or 4.5000000000000001e-185 < y < 3.10000000000000011e-130 or 6.2000000000000002e-92 < y < 1Initial program 99.9%
+-commutative99.9%
cancel-sign-sub-inv99.9%
+-commutative99.9%
associate-+r+99.9%
cancel-sign-sub-inv99.9%
associate-+l-99.9%
sub-neg99.9%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 95.3%
Taylor expanded in x around inf 63.7%
neg-mul-163.7%
Simplified63.7%
if -4.4000000000000002e-117 < y < 4.5000000000000001e-185 or 3.10000000000000011e-130 < y < 6.2000000000000002e-92Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in x around 0 65.7%
Final simplification60.1%
(FPCore (x y) :precision binary64 (if (or (<= y -2e-15) (not (<= y 3.3e-6))) (* x (+ y -1.0)) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((y <= -2e-15) || !(y <= 3.3e-6)) {
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 <= (-2d-15)) .or. (.not. (y <= 3.3d-6))) 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 <= -2e-15) || !(y <= 3.3e-6)) {
tmp = x * (y + -1.0);
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -2e-15) or not (y <= 3.3e-6): tmp = x * (y + -1.0) else: tmp = 0.918938533204673 - x return tmp
function code(x, y) tmp = 0.0 if ((y <= -2e-15) || !(y <= 3.3e-6)) 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 <= -2e-15) || ~((y <= 3.3e-6))) tmp = x * (y + -1.0); else tmp = 0.918938533204673 - x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -2e-15], N[Not[LessEqual[y, 3.3e-6]], $MachinePrecision]], N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision], N[(0.918938533204673 - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2 \cdot 10^{-15} \lor \neg \left(y \leq 3.3 \cdot 10^{-6}\right):\\
\;\;\;\;x \cdot \left(y + -1\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x\\
\end{array}
\end{array}
if y < -2.0000000000000002e-15 or 3.30000000000000017e-6 < y Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around inf 57.5%
mul-1-neg57.5%
distribute-lft-neg-in57.5%
distribute-lft-in57.5%
*-rgt-identity57.5%
distribute-lft-neg-in57.5%
mul-1-neg57.5%
distribute-rgt-neg-in57.5%
*-commutative57.5%
neg-mul-157.5%
remove-double-neg57.5%
distribute-rgt-in57.5%
+-commutative57.5%
Simplified57.5%
if -2.0000000000000002e-15 < y < 3.30000000000000017e-6Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 99.3%
Final simplification77.7%
(FPCore (x y) :precision binary64 (if (or (<= y -1.75) (not (<= y 1.1))) (* y (- x 0.5)) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((y <= -1.75) || !(y <= 1.1)) {
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.75d0)) .or. (.not. (y <= 1.1d0))) 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.75) || !(y <= 1.1)) {
tmp = y * (x - 0.5);
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.75) or not (y <= 1.1): tmp = y * (x - 0.5) else: tmp = 0.918938533204673 - x return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.75) || !(y <= 1.1)) 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.75) || ~((y <= 1.1))) tmp = y * (x - 0.5); else tmp = 0.918938533204673 - x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.75], N[Not[LessEqual[y, 1.1]], $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.75 \lor \neg \left(y \leq 1.1\right):\\
\;\;\;\;y \cdot \left(x - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x\\
\end{array}
\end{array}
if y < -1.75 or 1.1000000000000001 < y Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around inf 98.6%
if -1.75 < y < 1.1000000000000001Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 97.3%
Final simplification97.9%
(FPCore (x y) :precision binary64 (if (or (<= x -0.78) (not (<= x 0.92))) (* x (+ y -1.0)) (- 0.918938533204673 (* y 0.5))))
double code(double x, double y) {
double tmp;
if ((x <= -0.78) || !(x <= 0.92)) {
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.78d0)) .or. (.not. (x <= 0.92d0))) 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.78) || !(x <= 0.92)) {
tmp = x * (y + -1.0);
} else {
tmp = 0.918938533204673 - (y * 0.5);
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -0.78) or not (x <= 0.92): tmp = x * (y + -1.0) else: tmp = 0.918938533204673 - (y * 0.5) return tmp
function code(x, y) tmp = 0.0 if ((x <= -0.78) || !(x <= 0.92)) 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.78) || ~((x <= 0.92))) 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.78], N[Not[LessEqual[x, 0.92]], $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.78 \lor \neg \left(x \leq 0.92\right):\\
\;\;\;\;x \cdot \left(y + -1\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - y \cdot 0.5\\
\end{array}
\end{array}
if x < -0.78000000000000003 or 0.92000000000000004 < x Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around inf 97.8%
mul-1-neg97.8%
distribute-lft-neg-in97.8%
distribute-lft-in97.9%
*-rgt-identity97.9%
distribute-lft-neg-in97.9%
mul-1-neg97.9%
distribute-rgt-neg-in97.9%
*-commutative97.9%
neg-mul-197.9%
remove-double-neg97.9%
distribute-rgt-in97.8%
+-commutative97.8%
Simplified97.8%
if -0.78000000000000003 < x < 0.92000000000000004Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 98.4%
Final simplification98.1%
(FPCore (x y) :precision binary64 (if (<= x -0.66) (- (* y x) x) (if (<= x 0.89) (- 0.918938533204673 (* y 0.5)) (* x (+ y -1.0)))))
double code(double x, double y) {
double tmp;
if (x <= -0.66) {
tmp = (y * x) - x;
} else if (x <= 0.89) {
tmp = 0.918938533204673 - (y * 0.5);
} else {
tmp = x * (y + -1.0);
}
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)) then
tmp = (y * x) - x
else if (x <= 0.89d0) then
tmp = 0.918938533204673d0 - (y * 0.5d0)
else
tmp = x * (y + (-1.0d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -0.66) {
tmp = (y * x) - x;
} else if (x <= 0.89) {
tmp = 0.918938533204673 - (y * 0.5);
} else {
tmp = x * (y + -1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -0.66: tmp = (y * x) - x elif x <= 0.89: tmp = 0.918938533204673 - (y * 0.5) else: tmp = x * (y + -1.0) return tmp
function code(x, y) tmp = 0.0 if (x <= -0.66) tmp = Float64(Float64(y * x) - x); elseif (x <= 0.89) tmp = Float64(0.918938533204673 - Float64(y * 0.5)); else tmp = Float64(x * Float64(y + -1.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -0.66) tmp = (y * x) - x; elseif (x <= 0.89) tmp = 0.918938533204673 - (y * 0.5); else tmp = x * (y + -1.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -0.66], N[(N[(y * x), $MachinePrecision] - x), $MachinePrecision], If[LessEqual[x, 0.89], N[(0.918938533204673 - N[(y * 0.5), $MachinePrecision]), $MachinePrecision], N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.66:\\
\;\;\;\;y \cdot x - x\\
\mathbf{elif}\;x \leq 0.89:\\
\;\;\;\;0.918938533204673 - y \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(y + -1\right)\\
\end{array}
\end{array}
if x < -0.660000000000000031Initial program 99.9%
+-commutative99.9%
cancel-sign-sub-inv99.9%
+-commutative99.9%
associate-+r+99.9%
cancel-sign-sub-inv99.9%
associate-+l-99.9%
sub-neg99.9%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around inf 97.6%
mul-1-neg97.6%
distribute-lft-neg-in97.6%
distribute-lft-in97.6%
*-rgt-identity97.6%
distribute-lft-neg-in97.6%
mul-1-neg97.6%
distribute-rgt-neg-in97.6%
*-commutative97.6%
neg-mul-197.6%
remove-double-neg97.6%
distribute-rgt-in97.6%
+-commutative97.6%
Simplified97.6%
distribute-rgt-in97.6%
neg-mul-197.6%
Applied egg-rr97.6%
unsub-neg97.6%
Applied egg-rr97.6%
if -0.660000000000000031 < x < 0.890000000000000013Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 98.4%
if 0.890000000000000013 < x Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around inf 98.2%
mul-1-neg98.2%
distribute-lft-neg-in98.2%
distribute-lft-in98.2%
*-rgt-identity98.2%
distribute-lft-neg-in98.2%
mul-1-neg98.2%
distribute-rgt-neg-in98.2%
*-commutative98.2%
neg-mul-198.2%
remove-double-neg98.2%
distribute-rgt-in98.2%
+-commutative98.2%
Simplified98.2%
Final simplification98.1%
(FPCore (x y) :precision binary64 (if (or (<= y -31.5) (not (<= y 1.05))) (* y x) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((y <= -31.5) || !(y <= 1.05)) {
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 <= (-31.5d0)) .or. (.not. (y <= 1.05d0))) 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 <= -31.5) || !(y <= 1.05)) {
tmp = y * x;
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -31.5) or not (y <= 1.05): tmp = y * x else: tmp = 0.918938533204673 - x return tmp
function code(x, y) tmp = 0.0 if ((y <= -31.5) || !(y <= 1.05)) 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 <= -31.5) || ~((y <= 1.05))) tmp = y * x; else tmp = 0.918938533204673 - x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -31.5], N[Not[LessEqual[y, 1.05]], $MachinePrecision]], N[(y * x), $MachinePrecision], N[(0.918938533204673 - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -31.5 \lor \neg \left(y \leq 1.05\right):\\
\;\;\;\;y \cdot x\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x\\
\end{array}
\end{array}
if y < -31.5 or 1.05000000000000004 < y Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around inf 56.6%
mul-1-neg56.6%
distribute-lft-neg-in56.6%
distribute-lft-in56.6%
*-rgt-identity56.6%
distribute-lft-neg-in56.6%
mul-1-neg56.6%
distribute-rgt-neg-in56.6%
*-commutative56.6%
neg-mul-156.6%
remove-double-neg56.6%
distribute-rgt-in56.6%
+-commutative56.6%
Simplified56.6%
Taylor expanded in y around inf 55.8%
if -31.5 < y < 1.05000000000000004Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 97.3%
Final simplification76.7%
(FPCore (x y) :precision binary64 (if (or (<= x -0.17) (not (<= x 3.9e-5))) (- x) 0.918938533204673))
double code(double x, double y) {
double tmp;
if ((x <= -0.17) || !(x <= 3.9e-5)) {
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.17d0)) .or. (.not. (x <= 3.9d-5))) 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.17) || !(x <= 3.9e-5)) {
tmp = -x;
} else {
tmp = 0.918938533204673;
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -0.17) or not (x <= 3.9e-5): tmp = -x else: tmp = 0.918938533204673 return tmp
function code(x, y) tmp = 0.0 if ((x <= -0.17) || !(x <= 3.9e-5)) tmp = Float64(-x); else tmp = 0.918938533204673; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -0.17) || ~((x <= 3.9e-5))) tmp = -x; else tmp = 0.918938533204673; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -0.17], N[Not[LessEqual[x, 3.9e-5]], $MachinePrecision]], (-x), 0.918938533204673]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.17 \lor \neg \left(x \leq 3.9 \cdot 10^{-5}\right):\\
\;\;\;\;-x\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673\\
\end{array}
\end{array}
if x < -0.170000000000000012 or 3.8999999999999999e-5 < x Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 46.6%
Taylor expanded in x around inf 45.2%
neg-mul-145.2%
Simplified45.2%
if -0.170000000000000012 < x < 3.8999999999999999e-5Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 54.7%
Taylor expanded in x around 0 54.3%
Final simplification49.4%
(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%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 50.4%
Taylor expanded in x around 0 26.6%
Final simplification26.6%
herbie shell --seed 2024031
(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))