
(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 (- (+ 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%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* x (+ y -1.0))))
(if (<= x -0.00011)
t_0
(if (<= x -2.1e-173)
(- 0.918938533204673 x)
(if (<= x 5.2e-251)
(* y -0.5)
(if (<= x 13500000000.0) (- 0.918938533204673 x) t_0))))))
double code(double x, double y) {
double t_0 = x * (y + -1.0);
double tmp;
if (x <= -0.00011) {
tmp = t_0;
} else if (x <= -2.1e-173) {
tmp = 0.918938533204673 - x;
} else if (x <= 5.2e-251) {
tmp = y * -0.5;
} else if (x <= 13500000000.0) {
tmp = 0.918938533204673 - x;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = x * (y + (-1.0d0))
if (x <= (-0.00011d0)) then
tmp = t_0
else if (x <= (-2.1d-173)) then
tmp = 0.918938533204673d0 - x
else if (x <= 5.2d-251) then
tmp = y * (-0.5d0)
else if (x <= 13500000000.0d0) then
tmp = 0.918938533204673d0 - x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x * (y + -1.0);
double tmp;
if (x <= -0.00011) {
tmp = t_0;
} else if (x <= -2.1e-173) {
tmp = 0.918938533204673 - x;
} else if (x <= 5.2e-251) {
tmp = y * -0.5;
} else if (x <= 13500000000.0) {
tmp = 0.918938533204673 - x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = x * (y + -1.0) tmp = 0 if x <= -0.00011: tmp = t_0 elif x <= -2.1e-173: tmp = 0.918938533204673 - x elif x <= 5.2e-251: tmp = y * -0.5 elif x <= 13500000000.0: tmp = 0.918938533204673 - x else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(x * Float64(y + -1.0)) tmp = 0.0 if (x <= -0.00011) tmp = t_0; elseif (x <= -2.1e-173) tmp = Float64(0.918938533204673 - x); elseif (x <= 5.2e-251) tmp = Float64(y * -0.5); elseif (x <= 13500000000.0) tmp = Float64(0.918938533204673 - x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = x * (y + -1.0); tmp = 0.0; if (x <= -0.00011) tmp = t_0; elseif (x <= -2.1e-173) tmp = 0.918938533204673 - x; elseif (x <= 5.2e-251) tmp = y * -0.5; elseif (x <= 13500000000.0) tmp = 0.918938533204673 - x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -0.00011], t$95$0, If[LessEqual[x, -2.1e-173], N[(0.918938533204673 - x), $MachinePrecision], If[LessEqual[x, 5.2e-251], N[(y * -0.5), $MachinePrecision], If[LessEqual[x, 13500000000.0], N[(0.918938533204673 - x), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(y + -1\right)\\
\mathbf{if}\;x \leq -0.00011:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -2.1 \cdot 10^{-173}:\\
\;\;\;\;0.918938533204673 - x\\
\mathbf{elif}\;x \leq 5.2 \cdot 10^{-251}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;x \leq 13500000000:\\
\;\;\;\;0.918938533204673 - x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1.10000000000000004e-4 or 1.35e10 < 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%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around inf 98.4%
mul-1-neg98.4%
*-commutative98.4%
mul-1-neg98.4%
sub-neg98.4%
*-commutative98.4%
distribute-rgt-neg-in98.4%
sub-neg98.4%
+-commutative98.4%
metadata-eval98.4%
distribute-neg-in98.4%
remove-double-neg98.4%
Simplified98.4%
if -1.10000000000000004e-4 < x < -2.10000000000000001e-173 or 5.1999999999999998e-251 < x < 1.35e10Initial 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%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 61.0%
if -2.10000000000000001e-173 < x < 5.1999999999999998e-251Initial 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%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around inf 67.3%
Taylor expanded in x around 0 67.3%
(FPCore (x y)
:precision binary64
(if (<= y -7.6e+259)
(* y -0.5)
(if (<= y -920.0)
(* y x)
(if (<= y 1.45)
(- 0.918938533204673 x)
(if (<= y 4.6e+48) (* y x) (* y -0.5))))))
double code(double x, double y) {
double tmp;
if (y <= -7.6e+259) {
tmp = y * -0.5;
} else if (y <= -920.0) {
tmp = y * x;
} else if (y <= 1.45) {
tmp = 0.918938533204673 - x;
} else if (y <= 4.6e+48) {
tmp = y * x;
} else {
tmp = 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 (y <= (-7.6d+259)) then
tmp = y * (-0.5d0)
else if (y <= (-920.0d0)) then
tmp = y * x
else if (y <= 1.45d0) then
tmp = 0.918938533204673d0 - x
else if (y <= 4.6d+48) then
tmp = y * x
else
tmp = y * (-0.5d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -7.6e+259) {
tmp = y * -0.5;
} else if (y <= -920.0) {
tmp = y * x;
} else if (y <= 1.45) {
tmp = 0.918938533204673 - x;
} else if (y <= 4.6e+48) {
tmp = y * x;
} else {
tmp = y * -0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -7.6e+259: tmp = y * -0.5 elif y <= -920.0: tmp = y * x elif y <= 1.45: tmp = 0.918938533204673 - x elif y <= 4.6e+48: tmp = y * x else: tmp = y * -0.5 return tmp
function code(x, y) tmp = 0.0 if (y <= -7.6e+259) tmp = Float64(y * -0.5); elseif (y <= -920.0) tmp = Float64(y * x); elseif (y <= 1.45) tmp = Float64(0.918938533204673 - x); elseif (y <= 4.6e+48) tmp = Float64(y * x); else tmp = Float64(y * -0.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -7.6e+259) tmp = y * -0.5; elseif (y <= -920.0) tmp = y * x; elseif (y <= 1.45) tmp = 0.918938533204673 - x; elseif (y <= 4.6e+48) tmp = y * x; else tmp = y * -0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -7.6e+259], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, -920.0], N[(y * x), $MachinePrecision], If[LessEqual[y, 1.45], N[(0.918938533204673 - x), $MachinePrecision], If[LessEqual[y, 4.6e+48], N[(y * x), $MachinePrecision], N[(y * -0.5), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.6 \cdot 10^{+259}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq -920:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq 1.45:\\
\;\;\;\;0.918938533204673 - x\\
\mathbf{elif}\;y \leq 4.6 \cdot 10^{+48}:\\
\;\;\;\;y \cdot x\\
\mathbf{else}:\\
\;\;\;\;y \cdot -0.5\\
\end{array}
\end{array}
if y < -7.6e259 or 4.6e48 < 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%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
Taylor expanded in x around 0 60.5%
if -7.6e259 < y < -920 or 1.44999999999999996 < y < 4.6e48Initial 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%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around inf 96.4%
Taylor expanded in x around inf 58.6%
*-commutative58.6%
Simplified58.6%
if -920 < y < 1.44999999999999996Initial 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%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 96.5%
(FPCore (x y)
:precision binary64
(if (<= x -0.00011)
(* y x)
(if (<= x -9.2e-175)
0.918938533204673
(if (<= x 2.85e-251)
(* y -0.5)
(if (<= x 0.7) 0.918938533204673 (* y x))))))
double code(double x, double y) {
double tmp;
if (x <= -0.00011) {
tmp = y * x;
} else if (x <= -9.2e-175) {
tmp = 0.918938533204673;
} else if (x <= 2.85e-251) {
tmp = y * -0.5;
} else if (x <= 0.7) {
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 (x <= (-0.00011d0)) then
tmp = y * x
else if (x <= (-9.2d-175)) then
tmp = 0.918938533204673d0
else if (x <= 2.85d-251) then
tmp = y * (-0.5d0)
else if (x <= 0.7d0) 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 (x <= -0.00011) {
tmp = y * x;
} else if (x <= -9.2e-175) {
tmp = 0.918938533204673;
} else if (x <= 2.85e-251) {
tmp = y * -0.5;
} else if (x <= 0.7) {
tmp = 0.918938533204673;
} else {
tmp = y * x;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -0.00011: tmp = y * x elif x <= -9.2e-175: tmp = 0.918938533204673 elif x <= 2.85e-251: tmp = y * -0.5 elif x <= 0.7: tmp = 0.918938533204673 else: tmp = y * x return tmp
function code(x, y) tmp = 0.0 if (x <= -0.00011) tmp = Float64(y * x); elseif (x <= -9.2e-175) tmp = 0.918938533204673; elseif (x <= 2.85e-251) tmp = Float64(y * -0.5); elseif (x <= 0.7) tmp = 0.918938533204673; else tmp = Float64(y * x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -0.00011) tmp = y * x; elseif (x <= -9.2e-175) tmp = 0.918938533204673; elseif (x <= 2.85e-251) tmp = y * -0.5; elseif (x <= 0.7) tmp = 0.918938533204673; else tmp = y * x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -0.00011], N[(y * x), $MachinePrecision], If[LessEqual[x, -9.2e-175], 0.918938533204673, If[LessEqual[x, 2.85e-251], N[(y * -0.5), $MachinePrecision], If[LessEqual[x, 0.7], 0.918938533204673, N[(y * x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.00011:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;x \leq -9.2 \cdot 10^{-175}:\\
\;\;\;\;0.918938533204673\\
\mathbf{elif}\;x \leq 2.85 \cdot 10^{-251}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;x \leq 0.7:\\
\;\;\;\;0.918938533204673\\
\mathbf{else}:\\
\;\;\;\;y \cdot x\\
\end{array}
\end{array}
if x < -1.10000000000000004e-4 or 0.69999999999999996 < 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%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around inf 58.9%
Taylor expanded in x around inf 56.7%
*-commutative56.7%
Simplified56.7%
if -1.10000000000000004e-4 < x < -9.2e-175 or 2.85000000000000017e-251 < x < 0.69999999999999996Initial 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%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 99.5%
*-commutative99.5%
Simplified99.5%
Taylor expanded in y around inf 99.1%
sub-neg99.1%
associate-*r/99.3%
metadata-eval99.3%
metadata-eval99.3%
Simplified99.3%
Taylor expanded in y around 0 60.4%
if -9.2e-175 < x < 2.85000000000000017e-251Initial 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%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around inf 67.3%
Taylor expanded in x around 0 67.3%
(FPCore (x y) :precision binary64 (if (or (<= x -0.6) (not (<= x 0.52))) (* x (+ y -1.0)) (- 0.918938533204673 (* y 0.5))))
double code(double x, double y) {
double tmp;
if ((x <= -0.6) || !(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.6d0)) .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.6) || !(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.6) 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.6) || !(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.6) || ~((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.6], 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.6 \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.599999999999999978 or 0.52000000000000002 < 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%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around inf 97.7%
mul-1-neg97.7%
*-commutative97.7%
mul-1-neg97.7%
sub-neg97.7%
*-commutative97.7%
distribute-rgt-neg-in97.7%
sub-neg97.7%
+-commutative97.7%
metadata-eval97.7%
distribute-neg-in97.7%
remove-double-neg97.7%
Simplified97.7%
if -0.599999999999999978 < x < 0.52000000000000002Initial 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%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 99.2%
*-commutative99.2%
Simplified99.2%
Final simplification98.5%
(FPCore (x y) :precision binary64 (if (or (<= y -1.4) (not (<= y 1.8))) (* y (- x 0.5)) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((y <= -1.4) || !(y <= 1.8)) {
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.8d0))) 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.8)) {
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.8): 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.8)) 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.8))) 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.8]], $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.8\right):\\
\;\;\;\;y \cdot \left(x - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x\\
\end{array}
\end{array}
if y < -1.3999999999999999 or 1.80000000000000004 < 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%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around inf 97.5%
if -1.3999999999999999 < y < 1.80000000000000004Initial 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%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 97.2%
Final simplification97.4%
(FPCore (x y) :precision binary64 (if (<= x -0.62) (- (* y x) x) (if (<= x 0.6) (- 0.918938533204673 (* y 0.5)) (* x (+ y -1.0)))))
double code(double x, double y) {
double tmp;
if (x <= -0.62) {
tmp = (y * x) - x;
} else if (x <= 0.6) {
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.62d0)) then
tmp = (y * x) - x
else if (x <= 0.6d0) 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.62) {
tmp = (y * x) - x;
} else if (x <= 0.6) {
tmp = 0.918938533204673 - (y * 0.5);
} else {
tmp = x * (y + -1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -0.62: tmp = (y * x) - x elif x <= 0.6: tmp = 0.918938533204673 - (y * 0.5) else: tmp = x * (y + -1.0) return tmp
function code(x, y) tmp = 0.0 if (x <= -0.62) tmp = Float64(Float64(y * x) - x); elseif (x <= 0.6) 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.62) tmp = (y * x) - x; elseif (x <= 0.6) tmp = 0.918938533204673 - (y * 0.5); else tmp = x * (y + -1.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -0.62], N[(N[(y * x), $MachinePrecision] - x), $MachinePrecision], If[LessEqual[x, 0.6], 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.62:\\
\;\;\;\;y \cdot x - x\\
\mathbf{elif}\;x \leq 0.6:\\
\;\;\;\;0.918938533204673 - y \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(y + -1\right)\\
\end{array}
\end{array}
if x < -0.619999999999999996Initial 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%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around inf 98.5%
mul-1-neg98.5%
*-commutative98.5%
mul-1-neg98.5%
sub-neg98.5%
*-commutative98.5%
distribute-rgt-neg-in98.5%
sub-neg98.5%
+-commutative98.5%
metadata-eval98.5%
distribute-neg-in98.5%
remove-double-neg98.5%
Simplified98.5%
distribute-rgt-in98.5%
neg-mul-198.5%
Applied egg-rr98.5%
unsub-neg98.5%
Applied egg-rr98.5%
if -0.619999999999999996 < x < 0.599999999999999978Initial 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%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 99.2%
*-commutative99.2%
Simplified99.2%
if 0.599999999999999978 < 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%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around inf 97.0%
mul-1-neg97.0%
*-commutative97.0%
mul-1-neg97.0%
sub-neg97.0%
*-commutative97.0%
distribute-rgt-neg-in97.0%
sub-neg97.0%
+-commutative97.0%
metadata-eval97.0%
distribute-neg-in97.0%
remove-double-neg97.0%
Simplified97.0%
(FPCore (x y) :precision binary64 (if (or (<= y -1.82) (not (<= y 1.85))) (* y -0.5) 0.918938533204673))
double code(double x, double y) {
double tmp;
if ((y <= -1.82) || !(y <= 1.85)) {
tmp = y * -0.5;
} 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 ((y <= (-1.82d0)) .or. (.not. (y <= 1.85d0))) then
tmp = y * (-0.5d0)
else
tmp = 0.918938533204673d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -1.82) || !(y <= 1.85)) {
tmp = y * -0.5;
} else {
tmp = 0.918938533204673;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.82) or not (y <= 1.85): tmp = y * -0.5 else: tmp = 0.918938533204673 return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.82) || !(y <= 1.85)) tmp = Float64(y * -0.5); else tmp = 0.918938533204673; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -1.82) || ~((y <= 1.85))) tmp = y * -0.5; else tmp = 0.918938533204673; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.82], N[Not[LessEqual[y, 1.85]], $MachinePrecision]], N[(y * -0.5), $MachinePrecision], 0.918938533204673]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.82 \lor \neg \left(y \leq 1.85\right):\\
\;\;\;\;y \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673\\
\end{array}
\end{array}
if y < -1.82000000000000006 or 1.8500000000000001 < 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%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around inf 97.5%
Taylor expanded in x around 0 49.0%
if -1.82000000000000006 < y < 1.8500000000000001Initial 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%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 60.5%
*-commutative60.5%
Simplified60.5%
Taylor expanded in y around inf 60.1%
sub-neg60.1%
associate-*r/60.2%
metadata-eval60.2%
metadata-eval60.2%
Simplified60.2%
Taylor expanded in y around 0 58.8%
Final simplification53.7%
(FPCore (x y) :precision binary64 (if (or (<= x -0.00011) (not (<= x 17.0))) (- x) 0.918938533204673))
double code(double x, double y) {
double tmp;
if ((x <= -0.00011) || !(x <= 17.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 <= (-0.00011d0)) .or. (.not. (x <= 17.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 <= -0.00011) || !(x <= 17.0)) {
tmp = -x;
} else {
tmp = 0.918938533204673;
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -0.00011) or not (x <= 17.0): tmp = -x else: tmp = 0.918938533204673 return tmp
function code(x, y) tmp = 0.0 if ((x <= -0.00011) || !(x <= 17.0)) tmp = Float64(-x); else tmp = 0.918938533204673; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -0.00011) || ~((x <= 17.0))) tmp = -x; else tmp = 0.918938533204673; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -0.00011], N[Not[LessEqual[x, 17.0]], $MachinePrecision]], (-x), 0.918938533204673]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.00011 \lor \neg \left(x \leq 17\right):\\
\;\;\;\;-x\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673\\
\end{array}
\end{array}
if x < -1.10000000000000004e-4 or 17 < 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%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 42.8%
Taylor expanded in x around inf 41.9%
neg-mul-141.9%
Simplified41.9%
if -1.10000000000000004e-4 < x < 17Initial 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%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 98.9%
*-commutative98.9%
Simplified98.9%
Taylor expanded in y around inf 98.6%
sub-neg98.6%
associate-*r/98.7%
metadata-eval98.7%
metadata-eval98.7%
Simplified98.7%
Taylor expanded in y around 0 52.4%
Final simplification47.6%
(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%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 55.3%
*-commutative55.3%
Simplified55.3%
Taylor expanded in y around inf 55.1%
sub-neg55.1%
associate-*r/55.1%
metadata-eval55.1%
metadata-eval55.1%
Simplified55.1%
Taylor expanded in y around 0 29.5%
herbie shell --seed 2024151
(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))