
(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 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%
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 (<= y -1.45e+156)
(* y x)
(if (<= y -5.4)
(* y -0.5)
(if (<= y -1.36e-244)
(- x)
(if (<= y 1.85) 0.918938533204673 (* y -0.5))))))
double code(double x, double y) {
double tmp;
if (y <= -1.45e+156) {
tmp = y * x;
} else if (y <= -5.4) {
tmp = y * -0.5;
} else if (y <= -1.36e-244) {
tmp = -x;
} else if (y <= 1.85) {
tmp = 0.918938533204673;
} 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 <= (-1.45d+156)) then
tmp = y * x
else if (y <= (-5.4d0)) then
tmp = y * (-0.5d0)
else if (y <= (-1.36d-244)) then
tmp = -x
else if (y <= 1.85d0) then
tmp = 0.918938533204673d0
else
tmp = y * (-0.5d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.45e+156) {
tmp = y * x;
} else if (y <= -5.4) {
tmp = y * -0.5;
} else if (y <= -1.36e-244) {
tmp = -x;
} else if (y <= 1.85) {
tmp = 0.918938533204673;
} else {
tmp = y * -0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.45e+156: tmp = y * x elif y <= -5.4: tmp = y * -0.5 elif y <= -1.36e-244: tmp = -x elif y <= 1.85: tmp = 0.918938533204673 else: tmp = y * -0.5 return tmp
function code(x, y) tmp = 0.0 if (y <= -1.45e+156) tmp = Float64(y * x); elseif (y <= -5.4) tmp = Float64(y * -0.5); elseif (y <= -1.36e-244) tmp = Float64(-x); elseif (y <= 1.85) tmp = 0.918938533204673; else tmp = Float64(y * -0.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.45e+156) tmp = y * x; elseif (y <= -5.4) tmp = y * -0.5; elseif (y <= -1.36e-244) tmp = -x; elseif (y <= 1.85) tmp = 0.918938533204673; else tmp = y * -0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.45e+156], N[(y * x), $MachinePrecision], If[LessEqual[y, -5.4], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, -1.36e-244], (-x), If[LessEqual[y, 1.85], 0.918938533204673, N[(y * -0.5), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.45 \cdot 10^{+156}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq -5.4:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq -1.36 \cdot 10^{-244}:\\
\;\;\;\;-x\\
\mathbf{elif}\;y \leq 1.85:\\
\;\;\;\;0.918938533204673\\
\mathbf{else}:\\
\;\;\;\;y \cdot -0.5\\
\end{array}
\end{array}
if y < -1.45000000000000005e156Initial program 99.8%
+-commutative99.8%
cancel-sign-sub-inv99.8%
+-commutative99.8%
associate-+r+99.8%
cancel-sign-sub-inv99.8%
associate-+l-99.8%
sub-neg99.8%
distribute-rgt-in99.8%
metadata-eval99.8%
neg-mul-199.8%
associate--r+99.8%
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 62.6%
*-commutative62.8%
Simplified62.6%
if -1.45000000000000005e156 < y < -5.4000000000000004 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 99.3%
Taylor expanded in x around 0 61.1%
if -5.4000000000000004 < y < -1.36e-244Initial 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%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 95.1%
Taylor expanded in x around inf 57.5%
neg-mul-157.5%
Simplified57.5%
if -1.36e-244 < 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 inf 60.1%
Taylor expanded in y around 0 58.9%
(FPCore (x y)
:precision binary64
(if (<= y -1.65e+156)
(* y x)
(if (or (<= y -220.0) (not (<= y 1.85)))
(* y -0.5)
(- 0.918938533204673 x))))
double code(double x, double y) {
double tmp;
if (y <= -1.65e+156) {
tmp = y * x;
} else if ((y <= -220.0) || !(y <= 1.85)) {
tmp = 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 <= (-1.65d+156)) then
tmp = y * x
else if ((y <= (-220.0d0)) .or. (.not. (y <= 1.85d0))) then
tmp = 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 <= -1.65e+156) {
tmp = y * x;
} else if ((y <= -220.0) || !(y <= 1.85)) {
tmp = y * -0.5;
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.65e+156: tmp = y * x elif (y <= -220.0) or not (y <= 1.85): tmp = y * -0.5 else: tmp = 0.918938533204673 - x return tmp
function code(x, y) tmp = 0.0 if (y <= -1.65e+156) tmp = Float64(y * x); elseif ((y <= -220.0) || !(y <= 1.85)) tmp = 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 <= -1.65e+156) tmp = y * x; elseif ((y <= -220.0) || ~((y <= 1.85))) tmp = y * -0.5; else tmp = 0.918938533204673 - x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.65e+156], N[(y * x), $MachinePrecision], If[Or[LessEqual[y, -220.0], N[Not[LessEqual[y, 1.85]], $MachinePrecision]], N[(y * -0.5), $MachinePrecision], N[(0.918938533204673 - x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.65 \cdot 10^{+156}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq -220 \lor \neg \left(y \leq 1.85\right):\\
\;\;\;\;y \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x\\
\end{array}
\end{array}
if y < -1.6499999999999999e156Initial program 99.8%
+-commutative99.8%
cancel-sign-sub-inv99.8%
+-commutative99.8%
associate-+r+99.8%
cancel-sign-sub-inv99.8%
associate-+l-99.8%
sub-neg99.8%
distribute-rgt-in99.8%
metadata-eval99.8%
neg-mul-199.8%
associate--r+99.8%
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 62.6%
*-commutative62.8%
Simplified62.6%
if -1.6499999999999999e156 < y < -220 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 99.3%
Taylor expanded in x around 0 61.1%
if -220 < 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 96.8%
Final simplification79.5%
(FPCore (x y) :precision binary64 (if (<= y -3.1) (* y -0.5) (if (<= y -1.9e-242) (- x) (if (<= y 1.85) 0.918938533204673 (* y -0.5)))))
double code(double x, double y) {
double tmp;
if (y <= -3.1) {
tmp = y * -0.5;
} else if (y <= -1.9e-242) {
tmp = -x;
} else if (y <= 1.85) {
tmp = 0.918938533204673;
} 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 <= (-3.1d0)) then
tmp = y * (-0.5d0)
else if (y <= (-1.9d-242)) then
tmp = -x
else if (y <= 1.85d0) then
tmp = 0.918938533204673d0
else
tmp = y * (-0.5d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -3.1) {
tmp = y * -0.5;
} else if (y <= -1.9e-242) {
tmp = -x;
} else if (y <= 1.85) {
tmp = 0.918938533204673;
} else {
tmp = y * -0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -3.1: tmp = y * -0.5 elif y <= -1.9e-242: tmp = -x elif y <= 1.85: tmp = 0.918938533204673 else: tmp = y * -0.5 return tmp
function code(x, y) tmp = 0.0 if (y <= -3.1) tmp = Float64(y * -0.5); elseif (y <= -1.9e-242) tmp = Float64(-x); elseif (y <= 1.85) tmp = 0.918938533204673; else tmp = Float64(y * -0.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -3.1) tmp = y * -0.5; elseif (y <= -1.9e-242) tmp = -x; elseif (y <= 1.85) tmp = 0.918938533204673; else tmp = y * -0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -3.1], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, -1.9e-242], (-x), If[LessEqual[y, 1.85], 0.918938533204673, N[(y * -0.5), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.1:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq -1.9 \cdot 10^{-242}:\\
\;\;\;\;-x\\
\mathbf{elif}\;y \leq 1.85:\\
\;\;\;\;0.918938533204673\\
\mathbf{else}:\\
\;\;\;\;y \cdot -0.5\\
\end{array}
\end{array}
if y < -3.10000000000000009 or 1.8500000000000001 < y Initial 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-in99.9%
metadata-eval99.9%
neg-mul-199.9%
associate--r+99.9%
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 99.4%
Taylor expanded in x around 0 55.4%
if -3.10000000000000009 < y < -1.9000000000000001e-242Initial 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%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 95.1%
Taylor expanded in x around inf 57.5%
neg-mul-157.5%
Simplified57.5%
if -1.9000000000000001e-242 < 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 inf 60.1%
Taylor expanded in y around 0 58.9%
(FPCore (x y) :precision binary64 (if (or (<= y -0.6) (not (<= y 1.25e-5))) (+ 0.918938533204673 (* y (- x 0.5))) (- (+ 0.918938533204673 (* y x)) x)))
double code(double x, double y) {
double tmp;
if ((y <= -0.6) || !(y <= 1.25e-5)) {
tmp = 0.918938533204673 + (y * (x - 0.5));
} else {
tmp = (0.918938533204673 + (y * x)) - 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.6d0)) .or. (.not. (y <= 1.25d-5))) then
tmp = 0.918938533204673d0 + (y * (x - 0.5d0))
else
tmp = (0.918938533204673d0 + (y * x)) - x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -0.6) || !(y <= 1.25e-5)) {
tmp = 0.918938533204673 + (y * (x - 0.5));
} else {
tmp = (0.918938533204673 + (y * x)) - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -0.6) or not (y <= 1.25e-5): tmp = 0.918938533204673 + (y * (x - 0.5)) else: tmp = (0.918938533204673 + (y * x)) - x return tmp
function code(x, y) tmp = 0.0 if ((y <= -0.6) || !(y <= 1.25e-5)) tmp = Float64(0.918938533204673 + Float64(y * Float64(x - 0.5))); else tmp = Float64(Float64(0.918938533204673 + Float64(y * x)) - x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -0.6) || ~((y <= 1.25e-5))) tmp = 0.918938533204673 + (y * (x - 0.5)); else tmp = (0.918938533204673 + (y * x)) - x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -0.6], N[Not[LessEqual[y, 1.25e-5]], $MachinePrecision]], N[(0.918938533204673 + N[(y * N[(x - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.918938533204673 + N[(y * x), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.6 \lor \neg \left(y \leq 1.25 \cdot 10^{-5}\right):\\
\;\;\;\;0.918938533204673 + y \cdot \left(x - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.918938533204673 + y \cdot x\right) - x\\
\end{array}
\end{array}
if y < -0.599999999999999978 or 1.25000000000000006e-5 < y Initial 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-in99.9%
metadata-eval99.9%
neg-mul-199.9%
associate--r+99.9%
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%
if -0.599999999999999978 < y < 1.25000000000000006e-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 100.0%
Taylor expanded in x around inf 99.5%
*-commutative99.5%
Simplified99.5%
Final simplification99.7%
(FPCore (x y) :precision binary64 (if (or (<= y -0.65) (not (<= y 5.5e-5))) (+ 0.918938533204673 (* y (- x 0.5))) (- 0.918938533204673 (* x (- 1.0 y)))))
double code(double x, double y) {
double tmp;
if ((y <= -0.65) || !(y <= 5.5e-5)) {
tmp = 0.918938533204673 + (y * (x - 0.5));
} else {
tmp = 0.918938533204673 - (x * (1.0 - y));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-0.65d0)) .or. (.not. (y <= 5.5d-5))) then
tmp = 0.918938533204673d0 + (y * (x - 0.5d0))
else
tmp = 0.918938533204673d0 - (x * (1.0d0 - y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -0.65) || !(y <= 5.5e-5)) {
tmp = 0.918938533204673 + (y * (x - 0.5));
} else {
tmp = 0.918938533204673 - (x * (1.0 - y));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -0.65) or not (y <= 5.5e-5): tmp = 0.918938533204673 + (y * (x - 0.5)) else: tmp = 0.918938533204673 - (x * (1.0 - y)) return tmp
function code(x, y) tmp = 0.0 if ((y <= -0.65) || !(y <= 5.5e-5)) tmp = Float64(0.918938533204673 + Float64(y * Float64(x - 0.5))); else tmp = Float64(0.918938533204673 - Float64(x * Float64(1.0 - y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -0.65) || ~((y <= 5.5e-5))) tmp = 0.918938533204673 + (y * (x - 0.5)); else tmp = 0.918938533204673 - (x * (1.0 - y)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -0.65], N[Not[LessEqual[y, 5.5e-5]], $MachinePrecision]], N[(0.918938533204673 + N[(y * N[(x - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.918938533204673 - N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.65 \lor \neg \left(y \leq 5.5 \cdot 10^{-5}\right):\\
\;\;\;\;0.918938533204673 + y \cdot \left(x - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x \cdot \left(1 - y\right)\\
\end{array}
\end{array}
if y < -0.650000000000000022 or 5.5000000000000002e-5 < y Initial 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-in99.9%
metadata-eval99.9%
neg-mul-199.9%
associate--r+99.9%
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%
if -0.650000000000000022 < y < 5.5000000000000002e-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 x around inf 99.5%
mul-1-neg99.5%
sub-neg99.5%
Simplified99.5%
Final simplification99.7%
(FPCore (x y) :precision binary64 (if (or (<= y -480000.0) (not (<= y 3500000.0))) (* y (- x 0.5)) (- 0.918938533204673 (* x (- 1.0 y)))))
double code(double x, double y) {
double tmp;
if ((y <= -480000.0) || !(y <= 3500000.0)) {
tmp = y * (x - 0.5);
} else {
tmp = 0.918938533204673 - (x * (1.0 - y));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-480000.0d0)) .or. (.not. (y <= 3500000.0d0))) then
tmp = y * (x - 0.5d0)
else
tmp = 0.918938533204673d0 - (x * (1.0d0 - y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -480000.0) || !(y <= 3500000.0)) {
tmp = y * (x - 0.5);
} else {
tmp = 0.918938533204673 - (x * (1.0 - y));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -480000.0) or not (y <= 3500000.0): tmp = y * (x - 0.5) else: tmp = 0.918938533204673 - (x * (1.0 - y)) return tmp
function code(x, y) tmp = 0.0 if ((y <= -480000.0) || !(y <= 3500000.0)) tmp = Float64(y * Float64(x - 0.5)); else tmp = Float64(0.918938533204673 - Float64(x * Float64(1.0 - y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -480000.0) || ~((y <= 3500000.0))) tmp = y * (x - 0.5); else tmp = 0.918938533204673 - (x * (1.0 - y)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -480000.0], N[Not[LessEqual[y, 3500000.0]], $MachinePrecision]], N[(y * N[(x - 0.5), $MachinePrecision]), $MachinePrecision], N[(0.918938533204673 - N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -480000 \lor \neg \left(y \leq 3500000\right):\\
\;\;\;\;y \cdot \left(x - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x \cdot \left(1 - y\right)\\
\end{array}
\end{array}
if y < -4.8e5 or 3.5e6 < y Initial 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-in99.9%
metadata-eval99.9%
neg-mul-199.9%
associate--r+99.9%
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 99.4%
if -4.8e5 < y < 3.5e6Initial 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%
sub-neg98.5%
Simplified98.5%
Final simplification99.0%
(FPCore (x y) :precision binary64 (if (or (<= y -1.35) (not (<= y 1.7))) (* y (- x 0.5)) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((y <= -1.35) || !(y <= 1.7)) {
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.35d0)) .or. (.not. (y <= 1.7d0))) 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.35) || !(y <= 1.7)) {
tmp = y * (x - 0.5);
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.35) or not (y <= 1.7): tmp = y * (x - 0.5) else: tmp = 0.918938533204673 - x return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.35) || !(y <= 1.7)) 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.35) || ~((y <= 1.7))) tmp = y * (x - 0.5); else tmp = 0.918938533204673 - x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.35], N[Not[LessEqual[y, 1.7]], $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.35 \lor \neg \left(y \leq 1.7\right):\\
\;\;\;\;y \cdot \left(x - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x\\
\end{array}
\end{array}
if y < -1.3500000000000001 or 1.69999999999999996 < y Initial 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-in99.9%
metadata-eval99.9%
neg-mul-199.9%
associate--r+99.9%
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 99.4%
if -1.3500000000000001 < y < 1.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 y around 0 96.8%
Final simplification98.1%
(FPCore (x y) :precision binary64 (if (or (<= x -0.92) (not (<= x 8000000.0))) (- x) 0.918938533204673))
double code(double x, double y) {
double tmp;
if ((x <= -0.92) || !(x <= 8000000.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.92d0)) .or. (.not. (x <= 8000000.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.92) || !(x <= 8000000.0)) {
tmp = -x;
} else {
tmp = 0.918938533204673;
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -0.92) or not (x <= 8000000.0): tmp = -x else: tmp = 0.918938533204673 return tmp
function code(x, y) tmp = 0.0 if ((x <= -0.92) || !(x <= 8000000.0)) tmp = Float64(-x); else tmp = 0.918938533204673; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -0.92) || ~((x <= 8000000.0))) tmp = -x; else tmp = 0.918938533204673; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -0.92], N[Not[LessEqual[x, 8000000.0]], $MachinePrecision]], (-x), 0.918938533204673]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.92 \lor \neg \left(x \leq 8000000\right):\\
\;\;\;\;-x\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673\\
\end{array}
\end{array}
if x < -0.92000000000000004 or 8e6 < x Initial 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-in99.9%
metadata-eval99.9%
neg-mul-199.9%
associate--r+99.9%
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.2%
Taylor expanded in x around inf 52.0%
neg-mul-152.0%
Simplified52.0%
if -0.92000000000000004 < x < 8e6Initial 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 99.5%
Taylor expanded in y around 0 48.8%
Final simplification50.3%
(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 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%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around inf 75.9%
Taylor expanded in y around 0 27.3%
herbie shell --seed 2024163
(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))