
(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
(if (<= x -8e+249)
(* y x)
(if (<= x -1.6)
(- x)
(if (<= x 0.9) (* y -0.5) (if (<= x 2.3e+166) (- x) (* y x))))))
double code(double x, double y) {
double tmp;
if (x <= -8e+249) {
tmp = y * x;
} else if (x <= -1.6) {
tmp = -x;
} else if (x <= 0.9) {
tmp = y * -0.5;
} else if (x <= 2.3e+166) {
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 <= (-8d+249)) then
tmp = y * x
else if (x <= (-1.6d0)) then
tmp = -x
else if (x <= 0.9d0) then
tmp = y * (-0.5d0)
else if (x <= 2.3d+166) 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 <= -8e+249) {
tmp = y * x;
} else if (x <= -1.6) {
tmp = -x;
} else if (x <= 0.9) {
tmp = y * -0.5;
} else if (x <= 2.3e+166) {
tmp = -x;
} else {
tmp = y * x;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -8e+249: tmp = y * x elif x <= -1.6: tmp = -x elif x <= 0.9: tmp = y * -0.5 elif x <= 2.3e+166: tmp = -x else: tmp = y * x return tmp
function code(x, y) tmp = 0.0 if (x <= -8e+249) tmp = Float64(y * x); elseif (x <= -1.6) tmp = Float64(-x); elseif (x <= 0.9) tmp = Float64(y * -0.5); elseif (x <= 2.3e+166) tmp = Float64(-x); else tmp = Float64(y * x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -8e+249) tmp = y * x; elseif (x <= -1.6) tmp = -x; elseif (x <= 0.9) tmp = y * -0.5; elseif (x <= 2.3e+166) tmp = -x; else tmp = y * x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -8e+249], N[(y * x), $MachinePrecision], If[LessEqual[x, -1.6], (-x), If[LessEqual[x, 0.9], N[(y * -0.5), $MachinePrecision], If[LessEqual[x, 2.3e+166], (-x), N[(y * x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8 \cdot 10^{+249}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;x \leq -1.6:\\
\;\;\;\;-x\\
\mathbf{elif}\;x \leq 0.9:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{+166}:\\
\;\;\;\;-x\\
\mathbf{else}:\\
\;\;\;\;y \cdot x\\
\end{array}
\end{array}
if x < -7.9999999999999994e249 or 2.30000000000000008e166 < 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 74.2%
Taylor expanded in x around inf 74.2%
*-commutative74.2%
Simplified74.2%
if -7.9999999999999994e249 < x < -1.6000000000000001 or 0.900000000000000022 < x < 2.30000000000000008e166Initial 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 66.8%
Taylor expanded in x around inf 62.2%
neg-mul-162.2%
Simplified62.2%
if -1.6000000000000001 < x < 0.900000000000000022Initial 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 55.7%
Taylor expanded in x around 0 53.1%
(FPCore (x y)
:precision binary64
(if (<= y -130.0)
(* y -0.5)
(if (<= y 6e-8)
(- 0.918938533204673 x)
(if (<= y 5.2e+167) (* x (+ y -1.0)) (* y -0.5)))))
double code(double x, double y) {
double tmp;
if (y <= -130.0) {
tmp = y * -0.5;
} else if (y <= 6e-8) {
tmp = 0.918938533204673 - x;
} else if (y <= 5.2e+167) {
tmp = x * (y + -1.0);
} 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 <= (-130.0d0)) then
tmp = y * (-0.5d0)
else if (y <= 6d-8) then
tmp = 0.918938533204673d0 - x
else if (y <= 5.2d+167) then
tmp = x * (y + (-1.0d0))
else
tmp = y * (-0.5d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -130.0) {
tmp = y * -0.5;
} else if (y <= 6e-8) {
tmp = 0.918938533204673 - x;
} else if (y <= 5.2e+167) {
tmp = x * (y + -1.0);
} else {
tmp = y * -0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -130.0: tmp = y * -0.5 elif y <= 6e-8: tmp = 0.918938533204673 - x elif y <= 5.2e+167: tmp = x * (y + -1.0) else: tmp = y * -0.5 return tmp
function code(x, y) tmp = 0.0 if (y <= -130.0) tmp = Float64(y * -0.5); elseif (y <= 6e-8) tmp = Float64(0.918938533204673 - x); elseif (y <= 5.2e+167) tmp = Float64(x * Float64(y + -1.0)); else tmp = Float64(y * -0.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -130.0) tmp = y * -0.5; elseif (y <= 6e-8) tmp = 0.918938533204673 - x; elseif (y <= 5.2e+167) tmp = x * (y + -1.0); else tmp = y * -0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -130.0], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 6e-8], N[(0.918938533204673 - x), $MachinePrecision], If[LessEqual[y, 5.2e+167], N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision], N[(y * -0.5), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -130:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 6 \cdot 10^{-8}:\\
\;\;\;\;0.918938533204673 - x\\
\mathbf{elif}\;y \leq 5.2 \cdot 10^{+167}:\\
\;\;\;\;x \cdot \left(y + -1\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot -0.5\\
\end{array}
\end{array}
if y < -130 or 5.2000000000000004e167 < 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 98.0%
Taylor expanded in x around 0 62.2%
if -130 < y < 5.99999999999999946e-8Initial 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.7%
if 5.99999999999999946e-8 < y < 5.2000000000000004e167Initial 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 61.2%
mul-1-neg61.2%
neg-sub061.2%
mul-1-neg61.2%
distribute-rgt-in61.3%
fma-define61.3%
distribute-lft-neg-in61.3%
fmm-def61.3%
*-lft-identity61.3%
associate-+l-61.3%
neg-sub061.3%
neg-mul-161.3%
distribute-rgt-in61.2%
+-commutative61.2%
Simplified61.2%
(FPCore (x y) :precision binary64 (if (or (<= y -7.4e-11) (not (<= y 1.05e-5))) (+ (* y x) (- 0.918938533204673 (* y 0.5))) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((y <= -7.4e-11) || !(y <= 1.05e-5)) {
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 <= (-7.4d-11)) .or. (.not. (y <= 1.05d-5))) 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 <= -7.4e-11) || !(y <= 1.05e-5)) {
tmp = (y * x) + (0.918938533204673 - (y * 0.5));
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -7.4e-11) or not (y <= 1.05e-5): tmp = (y * x) + (0.918938533204673 - (y * 0.5)) else: tmp = 0.918938533204673 - x return tmp
function code(x, y) tmp = 0.0 if ((y <= -7.4e-11) || !(y <= 1.05e-5)) 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 <= -7.4e-11) || ~((y <= 1.05e-5))) 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, -7.4e-11], N[Not[LessEqual[y, 1.05e-5]], $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 -7.4 \cdot 10^{-11} \lor \neg \left(y \leq 1.05 \cdot 10^{-5}\right):\\
\;\;\;\;y \cdot x + \left(0.918938533204673 - y \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x\\
\end{array}
\end{array}
if y < -7.4000000000000003e-11 or 1.04999999999999994e-5 < y Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 99.2%
if -7.4000000000000003e-11 < y < 1.04999999999999994e-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%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 99.0%
Final simplification99.1%
(FPCore (x y)
:precision binary64
(if (<= y -45.0)
(* y -0.5)
(if (<= y 1.42)
(- 0.918938533204673 x)
(if (<= y 1.3e+168) (* y x) (* y -0.5)))))
double code(double x, double y) {
double tmp;
if (y <= -45.0) {
tmp = y * -0.5;
} else if (y <= 1.42) {
tmp = 0.918938533204673 - x;
} else if (y <= 1.3e+168) {
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 <= (-45.0d0)) then
tmp = y * (-0.5d0)
else if (y <= 1.42d0) then
tmp = 0.918938533204673d0 - x
else if (y <= 1.3d+168) 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 <= -45.0) {
tmp = y * -0.5;
} else if (y <= 1.42) {
tmp = 0.918938533204673 - x;
} else if (y <= 1.3e+168) {
tmp = y * x;
} else {
tmp = y * -0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -45.0: tmp = y * -0.5 elif y <= 1.42: tmp = 0.918938533204673 - x elif y <= 1.3e+168: tmp = y * x else: tmp = y * -0.5 return tmp
function code(x, y) tmp = 0.0 if (y <= -45.0) tmp = Float64(y * -0.5); elseif (y <= 1.42) tmp = Float64(0.918938533204673 - x); elseif (y <= 1.3e+168) 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 <= -45.0) tmp = y * -0.5; elseif (y <= 1.42) tmp = 0.918938533204673 - x; elseif (y <= 1.3e+168) tmp = y * x; else tmp = y * -0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -45.0], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 1.42], N[(0.918938533204673 - x), $MachinePrecision], If[LessEqual[y, 1.3e+168], N[(y * x), $MachinePrecision], N[(y * -0.5), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -45:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 1.42:\\
\;\;\;\;0.918938533204673 - x\\
\mathbf{elif}\;y \leq 1.3 \cdot 10^{+168}:\\
\;\;\;\;y \cdot x\\
\mathbf{else}:\\
\;\;\;\;y \cdot -0.5\\
\end{array}
\end{array}
if y < -45 or 1.3e168 < 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 98.0%
Taylor expanded in x around 0 62.2%
if -45 < y < 1.4199999999999999Initial 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.8%
if 1.4199999999999999 < y < 1.3e168Initial 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 inf 60.3%
*-commutative60.3%
Simplified60.3%
(FPCore (x y) :precision binary64 (if (or (<= y -1.45) (not (<= y 1.62))) (* y (- x 0.5)) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((y <= -1.45) || !(y <= 1.62)) {
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.45d0)) .or. (.not. (y <= 1.62d0))) 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.45) || !(y <= 1.62)) {
tmp = y * (x - 0.5);
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.45) or not (y <= 1.62): tmp = y * (x - 0.5) else: tmp = 0.918938533204673 - x return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.45) || !(y <= 1.62)) 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.45) || ~((y <= 1.62))) tmp = y * (x - 0.5); else tmp = 0.918938533204673 - x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.45], N[Not[LessEqual[y, 1.62]], $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.45 \lor \neg \left(y \leq 1.62\right):\\
\;\;\;\;y \cdot \left(x - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x\\
\end{array}
\end{array}
if y < -1.44999999999999996 or 1.6200000000000001 < 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.44999999999999996 < y < 1.6200000000000001Initial 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.8%
Final simplification97.9%
(FPCore (x y) :precision binary64 (if (or (<= x -0.76) (not (<= x 0.75))) (- x) (* y -0.5)))
double code(double x, double y) {
double tmp;
if ((x <= -0.76) || !(x <= 0.75)) {
tmp = -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 ((x <= (-0.76d0)) .or. (.not. (x <= 0.75d0))) then
tmp = -x
else
tmp = y * (-0.5d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -0.76) || !(x <= 0.75)) {
tmp = -x;
} else {
tmp = y * -0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -0.76) or not (x <= 0.75): tmp = -x else: tmp = y * -0.5 return tmp
function code(x, y) tmp = 0.0 if ((x <= -0.76) || !(x <= 0.75)) tmp = Float64(-x); else tmp = Float64(y * -0.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -0.76) || ~((x <= 0.75))) tmp = -x; else tmp = y * -0.5; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -0.76], N[Not[LessEqual[x, 0.75]], $MachinePrecision]], (-x), N[(y * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.76 \lor \neg \left(x \leq 0.75\right):\\
\;\;\;\;-x\\
\mathbf{else}:\\
\;\;\;\;y \cdot -0.5\\
\end{array}
\end{array}
if x < -0.76000000000000001 or 0.75 < 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 53.9%
Taylor expanded in x around inf 50.8%
neg-mul-150.8%
Simplified50.8%
if -0.76000000000000001 < x < 0.75Initial 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 55.7%
Taylor expanded in x around 0 53.1%
Final simplification52.0%
(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 49.1%
Taylor expanded in x around inf 24.4%
neg-mul-124.4%
Simplified24.4%
(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 49.1%
Taylor expanded in x around inf 24.4%
neg-mul-124.4%
Simplified24.4%
neg-sub024.4%
sub-neg24.4%
add-sqr-sqrt13.3%
sqrt-unprod12.5%
sqr-neg12.5%
sqrt-unprod1.6%
add-sqr-sqrt2.8%
Applied egg-rr2.8%
+-lft-identity2.8%
Simplified2.8%
herbie shell --seed 2024165
(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))