
(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%
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.00085)
t_0
(if (<= x 1.1e-297)
(* y -0.5)
(if (<= x 3.1e+14) (- 0.918938533204673 x) t_0)))))
double code(double x, double y) {
double t_0 = x * (y + -1.0);
double tmp;
if (x <= -0.00085) {
tmp = t_0;
} else if (x <= 1.1e-297) {
tmp = y * -0.5;
} else if (x <= 3.1e+14) {
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.00085d0)) then
tmp = t_0
else if (x <= 1.1d-297) then
tmp = y * (-0.5d0)
else if (x <= 3.1d+14) 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.00085) {
tmp = t_0;
} else if (x <= 1.1e-297) {
tmp = y * -0.5;
} else if (x <= 3.1e+14) {
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.00085: tmp = t_0 elif x <= 1.1e-297: tmp = y * -0.5 elif x <= 3.1e+14: 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.00085) tmp = t_0; elseif (x <= 1.1e-297) tmp = Float64(y * -0.5); elseif (x <= 3.1e+14) 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.00085) tmp = t_0; elseif (x <= 1.1e-297) tmp = y * -0.5; elseif (x <= 3.1e+14) 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.00085], t$95$0, If[LessEqual[x, 1.1e-297], N[(y * -0.5), $MachinePrecision], If[LessEqual[x, 3.1e+14], 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.00085:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{-297}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;x \leq 3.1 \cdot 10^{+14}:\\
\;\;\;\;0.918938533204673 - x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -8.49999999999999953e-4 or 3.1e14 < 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%
neg-sub097.7%
mul-1-neg97.7%
distribute-rgt-in97.8%
fma-define97.8%
distribute-lft-neg-in97.8%
fmm-def97.8%
*-lft-identity97.8%
associate-+l-97.8%
neg-sub097.8%
neg-mul-197.8%
distribute-rgt-in97.7%
+-commutative97.7%
Simplified97.7%
if -8.49999999999999953e-4 < x < 1.0999999999999999e-297Initial 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 61.3%
Taylor expanded in x around 0 59.7%
if 1.0999999999999999e-297 < x < 3.1e14Initial 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 59.0%
(FPCore (x y) :precision binary64 (if (or (<= y -0.053) (not (<= y 7e-7))) (+ (* y x) (- 0.918938533204673 (* y 0.5))) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((y <= -0.053) || !(y <= 7e-7)) {
tmp = (y * x) + (0.918938533204673 - (y * 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 <= (-0.053d0)) .or. (.not. (y <= 7d-7))) then
tmp = (y * x) + (0.918938533204673d0 - (y * 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 <= -0.053) || !(y <= 7e-7)) {
tmp = (y * x) + (0.918938533204673 - (y * 0.5));
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -0.053) or not (y <= 7e-7): tmp = (y * x) + (0.918938533204673 - (y * 0.5)) else: tmp = 0.918938533204673 - x return tmp
function code(x, y) tmp = 0.0 if ((y <= -0.053) || !(y <= 7e-7)) tmp = Float64(Float64(y * x) + Float64(0.918938533204673 - Float64(y * 0.5))); else tmp = Float64(0.918938533204673 - x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -0.053) || ~((y <= 7e-7))) tmp = (y * x) + (0.918938533204673 - (y * 0.5)); else tmp = 0.918938533204673 - x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -0.053], N[Not[LessEqual[y, 7e-7]], $MachinePrecision]], N[(N[(y * x), $MachinePrecision] + N[(0.918938533204673 - N[(y * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.918938533204673 - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.053 \lor \neg \left(y \leq 7 \cdot 10^{-7}\right):\\
\;\;\;\;y \cdot x + \left(0.918938533204673 - y \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x\\
\end{array}
\end{array}
if y < -0.0529999999999999985 or 6.99999999999999968e-7 < y Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 99.1%
if -0.0529999999999999985 < y < 6.99999999999999968e-7Initial 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 99.4%
Final simplification99.2%
(FPCore (x y)
:precision binary64
(if (<= y -540000000000.0)
(* y x)
(if (<= y 1.85)
(- 0.918938533204673 x)
(if (<= y 2.3e+215) (* y -0.5) (* y x)))))
double code(double x, double y) {
double tmp;
if (y <= -540000000000.0) {
tmp = y * x;
} else if (y <= 1.85) {
tmp = 0.918938533204673 - x;
} else if (y <= 2.3e+215) {
tmp = y * -0.5;
} 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 <= (-540000000000.0d0)) then
tmp = y * x
else if (y <= 1.85d0) then
tmp = 0.918938533204673d0 - x
else if (y <= 2.3d+215) then
tmp = y * (-0.5d0)
else
tmp = y * x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -540000000000.0) {
tmp = y * x;
} else if (y <= 1.85) {
tmp = 0.918938533204673 - x;
} else if (y <= 2.3e+215) {
tmp = y * -0.5;
} else {
tmp = y * x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -540000000000.0: tmp = y * x elif y <= 1.85: tmp = 0.918938533204673 - x elif y <= 2.3e+215: tmp = y * -0.5 else: tmp = y * x return tmp
function code(x, y) tmp = 0.0 if (y <= -540000000000.0) tmp = Float64(y * x); elseif (y <= 1.85) tmp = Float64(0.918938533204673 - x); elseif (y <= 2.3e+215) tmp = Float64(y * -0.5); else tmp = Float64(y * x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -540000000000.0) tmp = y * x; elseif (y <= 1.85) tmp = 0.918938533204673 - x; elseif (y <= 2.3e+215) tmp = y * -0.5; else tmp = y * x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -540000000000.0], N[(y * x), $MachinePrecision], If[LessEqual[y, 1.85], N[(0.918938533204673 - x), $MachinePrecision], If[LessEqual[y, 2.3e+215], N[(y * -0.5), $MachinePrecision], N[(y * x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -540000000000:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq 1.85:\\
\;\;\;\;0.918938533204673 - x\\
\mathbf{elif}\;y \leq 2.3 \cdot 10^{+215}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;y \cdot x\\
\end{array}
\end{array}
if y < -5.4e11 or 2.3000000000000001e215 < 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 inf 56.9%
*-commutative56.9%
Simplified56.9%
if -5.4e11 < 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 y around 0 97.5%
if 1.8500000000000001 < y < 2.3000000000000001e215Initial 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 94.2%
Taylor expanded in x around 0 61.9%
(FPCore (x y) :precision binary64 (if (<= x -0.5) (* y x) (if (<= x 0.85) (* y -0.5) (if (<= x 6.8e+139) (- x) (* y x)))))
double code(double x, double y) {
double tmp;
if (x <= -0.5) {
tmp = y * x;
} else if (x <= 0.85) {
tmp = y * -0.5;
} else if (x <= 6.8e+139) {
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 (x <= (-0.5d0)) then
tmp = y * x
else if (x <= 0.85d0) then
tmp = y * (-0.5d0)
else if (x <= 6.8d+139) then
tmp = -x
else
tmp = y * x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -0.5) {
tmp = y * x;
} else if (x <= 0.85) {
tmp = y * -0.5;
} else if (x <= 6.8e+139) {
tmp = -x;
} else {
tmp = y * x;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -0.5: tmp = y * x elif x <= 0.85: tmp = y * -0.5 elif x <= 6.8e+139: tmp = -x else: tmp = y * x return tmp
function code(x, y) tmp = 0.0 if (x <= -0.5) tmp = Float64(y * x); elseif (x <= 0.85) tmp = Float64(y * -0.5); elseif (x <= 6.8e+139) tmp = Float64(-x); else tmp = Float64(y * x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -0.5) tmp = y * x; elseif (x <= 0.85) tmp = y * -0.5; elseif (x <= 6.8e+139) tmp = -x; else tmp = y * x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -0.5], N[(y * x), $MachinePrecision], If[LessEqual[x, 0.85], N[(y * -0.5), $MachinePrecision], If[LessEqual[x, 6.8e+139], (-x), N[(y * x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.5:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;x \leq 0.85:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;x \leq 6.8 \cdot 10^{+139}:\\
\;\;\;\;-x\\
\mathbf{else}:\\
\;\;\;\;y \cdot x\\
\end{array}
\end{array}
if x < -0.5 or 6.8000000000000005e139 < 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 57.7%
Taylor expanded in x around inf 57.0%
*-commutative57.0%
Simplified57.0%
if -0.5 < x < 0.849999999999999978Initial 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 53.2%
Taylor expanded in x around 0 52.2%
if 0.849999999999999978 < x < 6.8000000000000005e139Initial 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 62.2%
Taylor expanded in x around inf 53.9%
neg-mul-153.9%
Simplified53.9%
(FPCore (x y) :precision binary64 (if (or (<= y -1.3) (not (<= y 1.25))) (* y (- x 0.5)) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((y <= -1.3) || !(y <= 1.25)) {
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.3d0)) .or. (.not. (y <= 1.25d0))) 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.3) || !(y <= 1.25)) {
tmp = y * (x - 0.5);
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.3) or not (y <= 1.25): tmp = y * (x - 0.5) else: tmp = 0.918938533204673 - x return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.3) || !(y <= 1.25)) 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.3) || ~((y <= 1.25))) tmp = y * (x - 0.5); else tmp = 0.918938533204673 - x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.3], N[Not[LessEqual[y, 1.25]], $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.3 \lor \neg \left(y \leq 1.25\right):\\
\;\;\;\;y \cdot \left(x - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x\\
\end{array}
\end{array}
if y < -1.30000000000000004 or 1.25 < 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.9%
if -1.30000000000000004 < y < 1.25Initial 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 98.2%
Final simplification98.1%
(FPCore (x y) :precision binary64 (if (or (<= y -24.5) (not (<= y 1.0))) (* y -0.5) (- x)))
double code(double x, double y) {
double tmp;
if ((y <= -24.5) || !(y <= 1.0)) {
tmp = y * -0.5;
} 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 ((y <= (-24.5d0)) .or. (.not. (y <= 1.0d0))) then
tmp = y * (-0.5d0)
else
tmp = -x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -24.5) || !(y <= 1.0)) {
tmp = y * -0.5;
} else {
tmp = -x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -24.5) or not (y <= 1.0): tmp = y * -0.5 else: tmp = -x return tmp
function code(x, y) tmp = 0.0 if ((y <= -24.5) || !(y <= 1.0)) tmp = Float64(y * -0.5); else tmp = Float64(-x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -24.5) || ~((y <= 1.0))) tmp = y * -0.5; else tmp = -x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -24.5], N[Not[LessEqual[y, 1.0]], $MachinePrecision]], N[(y * -0.5), $MachinePrecision], (-x)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -24.5 \lor \neg \left(y \leq 1\right):\\
\;\;\;\;y \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;-x\\
\end{array}
\end{array}
if y < -24.5 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%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around inf 97.9%
Taylor expanded in x around 0 50.7%
if -24.5 < y < 1Initial 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 98.2%
Taylor expanded in x around inf 47.8%
neg-mul-147.8%
Simplified47.8%
Final simplification49.3%
(FPCore (x y) :precision binary64 (- x))
double code(double x, double y) {
return -x;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = -x
end function
public static double code(double x, double y) {
return -x;
}
def code(x, y): return -x
function code(x, y) return Float64(-x) end
function tmp = code(x, y) tmp = -x; end
code[x_, y_] := (-x)
\begin{array}{l}
\\
-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 48.1%
Taylor expanded in x around inf 24.1%
neg-mul-124.1%
Simplified24.1%
(FPCore (x y) :precision binary64 x)
double code(double x, double y) {
return x;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x
end function
public static double code(double x, double y) {
return x;
}
def code(x, y): return x
function code(x, y) return x end
function tmp = code(x, y) tmp = x; end
code[x_, y_] := x
\begin{array}{l}
\\
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 48.1%
Taylor expanded in x around inf 24.1%
neg-mul-124.1%
Simplified24.1%
neg-sub024.1%
sub-neg24.1%
add-sqr-sqrt11.5%
sqrt-unprod12.7%
sqr-neg12.7%
sqrt-unprod1.5%
add-sqr-sqrt2.7%
Applied egg-rr2.7%
+-lft-identity2.7%
Simplified2.7%
herbie shell --seed 2024172
(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))