
(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%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
cancel-sign-sub-inv100.0%
metadata-eval100.0%
sub-neg100.0%
metadata-eval100.0%
associate-+r+100.0%
distribute-lft-in100.0%
*-commutative100.0%
neg-mul-1100.0%
+-commutative100.0%
associate-+l+100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
sub-neg100.0%
+-commutative100.0%
unsub-neg100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(if (<= y -110000000.0)
(* y x)
(if (<= y 2.35e-247)
(- x)
(if (<= y 2.3e-180) 0.918938533204673 (if (<= y 0.0096) (- x) (* y x))))))
double code(double x, double y) {
double tmp;
if (y <= -110000000.0) {
tmp = y * x;
} else if (y <= 2.35e-247) {
tmp = -x;
} else if (y <= 2.3e-180) {
tmp = 0.918938533204673;
} else if (y <= 0.0096) {
tmp = -x;
} else {
tmp = y * x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-110000000.0d0)) then
tmp = y * x
else if (y <= 2.35d-247) then
tmp = -x
else if (y <= 2.3d-180) then
tmp = 0.918938533204673d0
else if (y <= 0.0096d0) then
tmp = -x
else
tmp = y * x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -110000000.0) {
tmp = y * x;
} else if (y <= 2.35e-247) {
tmp = -x;
} else if (y <= 2.3e-180) {
tmp = 0.918938533204673;
} else if (y <= 0.0096) {
tmp = -x;
} else {
tmp = y * x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -110000000.0: tmp = y * x elif y <= 2.35e-247: tmp = -x elif y <= 2.3e-180: tmp = 0.918938533204673 elif y <= 0.0096: tmp = -x else: tmp = y * x return tmp
function code(x, y) tmp = 0.0 if (y <= -110000000.0) tmp = Float64(y * x); elseif (y <= 2.35e-247) tmp = Float64(-x); elseif (y <= 2.3e-180) tmp = 0.918938533204673; elseif (y <= 0.0096) tmp = Float64(-x); else tmp = Float64(y * x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -110000000.0) tmp = y * x; elseif (y <= 2.35e-247) tmp = -x; elseif (y <= 2.3e-180) tmp = 0.918938533204673; elseif (y <= 0.0096) tmp = -x; else tmp = y * x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -110000000.0], N[(y * x), $MachinePrecision], If[LessEqual[y, 2.35e-247], (-x), If[LessEqual[y, 2.3e-180], 0.918938533204673, If[LessEqual[y, 0.0096], (-x), N[(y * x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -110000000:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq 2.35 \cdot 10^{-247}:\\
\;\;\;\;-x\\
\mathbf{elif}\;y \leq 2.3 \cdot 10^{-180}:\\
\;\;\;\;0.918938533204673\\
\mathbf{elif}\;y \leq 0.0096:\\
\;\;\;\;-x\\
\mathbf{else}:\\
\;\;\;\;y \cdot x\\
\end{array}
\end{array}
if y < -1.1e8 or 0.00959999999999999916 < y Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
cancel-sign-sub-inv100.0%
metadata-eval100.0%
sub-neg100.0%
metadata-eval100.0%
associate-+r+100.0%
distribute-lft-in100.0%
*-commutative100.0%
neg-mul-1100.0%
+-commutative100.0%
associate-+l+100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
sub-neg100.0%
+-commutative100.0%
unsub-neg100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 55.2%
*-commutative55.2%
Simplified55.2%
Taylor expanded in y around inf 54.4%
if -1.1e8 < y < 2.3499999999999999e-247 or 2.29999999999999996e-180 < y < 0.00959999999999999916Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 61.1%
Taylor expanded in y around 0 58.9%
neg-mul-158.9%
Simplified58.9%
if 2.3499999999999999e-247 < y < 2.29999999999999996e-180Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
cancel-sign-sub-inv100.0%
metadata-eval100.0%
sub-neg100.0%
metadata-eval100.0%
associate-+r+100.0%
distribute-lft-in100.0%
*-commutative100.0%
neg-mul-1100.0%
+-commutative100.0%
associate-+l+100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
sub-neg100.0%
+-commutative100.0%
unsub-neg100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 77.3%
Final simplification57.2%
(FPCore (x y) :precision binary64 (if (or (<= x -1e-14) (not (<= x 0.37))) (+ 0.918938533204673 (- (* y x) x)) (- 0.918938533204673 (* y 0.5))))
double code(double x, double y) {
double tmp;
if ((x <= -1e-14) || !(x <= 0.37)) {
tmp = 0.918938533204673 + ((y * x) - x);
} 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 <= (-1d-14)) .or. (.not. (x <= 0.37d0))) then
tmp = 0.918938533204673d0 + ((y * x) - x)
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 <= -1e-14) || !(x <= 0.37)) {
tmp = 0.918938533204673 + ((y * x) - x);
} else {
tmp = 0.918938533204673 - (y * 0.5);
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -1e-14) or not (x <= 0.37): tmp = 0.918938533204673 + ((y * x) - x) else: tmp = 0.918938533204673 - (y * 0.5) return tmp
function code(x, y) tmp = 0.0 if ((x <= -1e-14) || !(x <= 0.37)) tmp = Float64(0.918938533204673 + Float64(Float64(y * x) - x)); else tmp = Float64(0.918938533204673 - Float64(y * 0.5)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -1e-14) || ~((x <= 0.37))) tmp = 0.918938533204673 + ((y * x) - x); else tmp = 0.918938533204673 - (y * 0.5); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -1e-14], N[Not[LessEqual[x, 0.37]], $MachinePrecision]], N[(0.918938533204673 + N[(N[(y * x), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision], N[(0.918938533204673 - N[(y * 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{-14} \lor \neg \left(x \leq 0.37\right):\\
\;\;\;\;0.918938533204673 + \left(y \cdot x - x\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - y \cdot 0.5\\
\end{array}
\end{array}
if x < -9.99999999999999999e-15 or 0.37 < x Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
cancel-sign-sub-inv100.0%
metadata-eval100.0%
sub-neg100.0%
metadata-eval100.0%
associate-+r+100.0%
distribute-lft-in100.0%
*-commutative100.0%
neg-mul-1100.0%
+-commutative100.0%
associate-+l+100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
sub-neg100.0%
+-commutative100.0%
unsub-neg100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 99.2%
*-commutative99.2%
Simplified99.2%
if -9.99999999999999999e-15 < x < 0.37Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 98.7%
Final simplification99.0%
(FPCore (x y) :precision binary64 (if (or (<= x -7000000.0) (not (<= x 7600.0))) (* x (+ y -1.0)) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((x <= -7000000.0) || !(x <= 7600.0)) {
tmp = x * (y + -1.0);
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((x <= (-7000000.0d0)) .or. (.not. (x <= 7600.0d0))) then
tmp = x * (y + (-1.0d0))
else
tmp = 0.918938533204673d0 - x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -7000000.0) || !(x <= 7600.0)) {
tmp = x * (y + -1.0);
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -7000000.0) or not (x <= 7600.0): tmp = x * (y + -1.0) else: tmp = 0.918938533204673 - x return tmp
function code(x, y) tmp = 0.0 if ((x <= -7000000.0) || !(x <= 7600.0)) tmp = Float64(x * Float64(y + -1.0)); else tmp = Float64(0.918938533204673 - x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -7000000.0) || ~((x <= 7600.0))) tmp = x * (y + -1.0); else tmp = 0.918938533204673 - x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -7000000.0], N[Not[LessEqual[x, 7600.0]], $MachinePrecision]], N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision], N[(0.918938533204673 - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7000000 \lor \neg \left(x \leq 7600\right):\\
\;\;\;\;x \cdot \left(y + -1\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x\\
\end{array}
\end{array}
if x < -7e6 or 7600 < x Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 99.7%
if -7e6 < x < 7600Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 46.6%
neg-mul-146.6%
unsub-neg46.6%
Simplified46.6%
Final simplification75.9%
(FPCore (x y) :precision binary64 (if (or (<= y -1.32) (not (<= y 1.2))) (* y (- x 0.5)) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((y <= -1.32) || !(y <= 1.2)) {
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.32d0)) .or. (.not. (y <= 1.2d0))) 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.32) || !(y <= 1.2)) {
tmp = y * (x - 0.5);
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.32) or not (y <= 1.2): tmp = y * (x - 0.5) else: tmp = 0.918938533204673 - x return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.32) || !(y <= 1.2)) 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.32) || ~((y <= 1.2))) tmp = y * (x - 0.5); else tmp = 0.918938533204673 - x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.32], N[Not[LessEqual[y, 1.2]], $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.32 \lor \neg \left(y \leq 1.2\right):\\
\;\;\;\;y \cdot \left(x - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x\\
\end{array}
\end{array}
if y < -1.32000000000000006 or 1.19999999999999996 < y Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 98.5%
if -1.32000000000000006 < y < 1.19999999999999996Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 96.0%
neg-mul-196.0%
unsub-neg96.0%
Simplified96.0%
Final simplification97.3%
(FPCore (x y) :precision binary64 (if (or (<= x -0.66) (not (<= x 0.92))) (* x (+ y -1.0)) (- 0.918938533204673 (* y 0.5))))
double code(double x, double y) {
double tmp;
if ((x <= -0.66) || !(x <= 0.92)) {
tmp = x * (y + -1.0);
} else {
tmp = 0.918938533204673 - (y * 0.5);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((x <= (-0.66d0)) .or. (.not. (x <= 0.92d0))) then
tmp = x * (y + (-1.0d0))
else
tmp = 0.918938533204673d0 - (y * 0.5d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -0.66) || !(x <= 0.92)) {
tmp = x * (y + -1.0);
} else {
tmp = 0.918938533204673 - (y * 0.5);
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -0.66) or not (x <= 0.92): tmp = x * (y + -1.0) else: tmp = 0.918938533204673 - (y * 0.5) return tmp
function code(x, y) tmp = 0.0 if ((x <= -0.66) || !(x <= 0.92)) tmp = Float64(x * Float64(y + -1.0)); else tmp = Float64(0.918938533204673 - Float64(y * 0.5)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -0.66) || ~((x <= 0.92))) tmp = x * (y + -1.0); else tmp = 0.918938533204673 - (y * 0.5); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -0.66], N[Not[LessEqual[x, 0.92]], $MachinePrecision]], N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision], N[(0.918938533204673 - N[(y * 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.66 \lor \neg \left(x \leq 0.92\right):\\
\;\;\;\;x \cdot \left(y + -1\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - y \cdot 0.5\\
\end{array}
\end{array}
if x < -0.660000000000000031 or 0.92000000000000004 < x Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 98.7%
if -0.660000000000000031 < x < 0.92000000000000004Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 97.8%
Final simplification98.3%
(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(0.918938533204673 + Float64(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[(0.918938533204673 + N[(N[(y * N[(x + -0.5), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.918938533204673 + \left(y \cdot \left(x + -0.5\right) - x\right)
\end{array}
Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
cancel-sign-sub-inv100.0%
metadata-eval100.0%
sub-neg100.0%
metadata-eval100.0%
associate-+r+100.0%
distribute-lft-in100.0%
*-commutative100.0%
neg-mul-1100.0%
+-commutative100.0%
associate-+l+100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
sub-neg100.0%
+-commutative100.0%
unsub-neg100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y) :precision binary64 (if (or (<= y -3.6e+19) (not (<= y 1.0))) (* y x) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((y <= -3.6e+19) || !(y <= 1.0)) {
tmp = y * x;
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-3.6d+19)) .or. (.not. (y <= 1.0d0))) then
tmp = y * x
else
tmp = 0.918938533204673d0 - x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -3.6e+19) || !(y <= 1.0)) {
tmp = y * x;
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -3.6e+19) or not (y <= 1.0): tmp = y * x else: tmp = 0.918938533204673 - x return tmp
function code(x, y) tmp = 0.0 if ((y <= -3.6e+19) || !(y <= 1.0)) tmp = Float64(y * x); else tmp = Float64(0.918938533204673 - x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -3.6e+19) || ~((y <= 1.0))) tmp = y * x; else tmp = 0.918938533204673 - x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -3.6e+19], N[Not[LessEqual[y, 1.0]], $MachinePrecision]], N[(y * x), $MachinePrecision], N[(0.918938533204673 - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.6 \cdot 10^{+19} \lor \neg \left(y \leq 1\right):\\
\;\;\;\;y \cdot x\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x\\
\end{array}
\end{array}
if y < -3.6e19 or 1 < y Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
cancel-sign-sub-inv100.0%
metadata-eval100.0%
sub-neg100.0%
metadata-eval100.0%
associate-+r+100.0%
distribute-lft-in100.0%
*-commutative100.0%
neg-mul-1100.0%
+-commutative100.0%
associate-+l+100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
sub-neg100.0%
+-commutative100.0%
unsub-neg100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 56.1%
*-commutative56.1%
Simplified56.1%
Taylor expanded in y around inf 55.6%
if -3.6e19 < y < 1Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 94.0%
neg-mul-194.0%
unsub-neg94.0%
Simplified94.0%
Final simplification74.6%
(FPCore (x y) :precision binary64 (if (or (<= x -0.92) (not (<= x 0.92))) (- x) 0.918938533204673))
double code(double x, double y) {
double tmp;
if ((x <= -0.92) || !(x <= 0.92)) {
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 <= 0.92d0))) 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 <= 0.92)) {
tmp = -x;
} else {
tmp = 0.918938533204673;
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -0.92) or not (x <= 0.92): tmp = -x else: tmp = 0.918938533204673 return tmp
function code(x, y) tmp = 0.0 if ((x <= -0.92) || !(x <= 0.92)) 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 <= 0.92))) tmp = -x; else tmp = 0.918938533204673; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -0.92], N[Not[LessEqual[x, 0.92]], $MachinePrecision]], (-x), 0.918938533204673]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.92 \lor \neg \left(x \leq 0.92\right):\\
\;\;\;\;-x\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673\\
\end{array}
\end{array}
if x < -0.92000000000000004 or 0.92000000000000004 < x Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 98.7%
Taylor expanded in y around 0 48.9%
neg-mul-148.9%
Simplified48.9%
if -0.92000000000000004 < x < 0.92000000000000004Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
cancel-sign-sub-inv100.0%
metadata-eval100.0%
sub-neg100.0%
metadata-eval100.0%
associate-+r+100.0%
distribute-lft-in100.0%
*-commutative100.0%
neg-mul-1100.0%
+-commutative100.0%
associate-+l+100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
sub-neg100.0%
+-commutative100.0%
unsub-neg100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 45.8%
*-commutative45.8%
Simplified45.8%
Taylor expanded in x around 0 45.4%
Final simplification47.4%
(FPCore (x y) :precision binary64 0.918938533204673)
double code(double x, double y) {
return 0.918938533204673;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 0.918938533204673d0
end function
public static double code(double x, double y) {
return 0.918938533204673;
}
def code(x, y): return 0.918938533204673
function code(x, y) return 0.918938533204673 end
function tmp = code(x, y) tmp = 0.918938533204673; end
code[x_, y_] := 0.918938533204673
\begin{array}{l}
\\
0.918938533204673
\end{array}
Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
cancel-sign-sub-inv100.0%
metadata-eval100.0%
sub-neg100.0%
metadata-eval100.0%
associate-+r+100.0%
distribute-lft-in100.0%
*-commutative100.0%
neg-mul-1100.0%
+-commutative100.0%
associate-+l+100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
sub-neg100.0%
+-commutative100.0%
unsub-neg100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 76.0%
*-commutative76.0%
Simplified76.0%
Taylor expanded in x around 0 21.5%
Final simplification21.5%
herbie shell --seed 2024010
(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))