
(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 8 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%
sub-neg100.0%
+-commutative100.0%
sub-neg100.0%
distribute-rgt-in100.0%
associate-+r+100.0%
associate-+l+100.0%
distribute-rgt-neg-in100.0%
distribute-lft-out100.0%
fma-def100.0%
+-commutative100.0%
metadata-eval100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
*-lft-identity100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(if (<= x -8.6e+42)
(* y x)
(if (<= x -2.3e-9)
(- x)
(if (<= x 0.5)
(* y -0.5)
(if (<= x 7.5e+66) (* y x) (if (<= x 2.5e+150) (- x) (* y x)))))))
double code(double x, double y) {
double tmp;
if (x <= -8.6e+42) {
tmp = y * x;
} else if (x <= -2.3e-9) {
tmp = -x;
} else if (x <= 0.5) {
tmp = y * -0.5;
} else if (x <= 7.5e+66) {
tmp = y * x;
} else if (x <= 2.5e+150) {
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 <= (-8.6d+42)) then
tmp = y * x
else if (x <= (-2.3d-9)) then
tmp = -x
else if (x <= 0.5d0) then
tmp = y * (-0.5d0)
else if (x <= 7.5d+66) then
tmp = y * x
else if (x <= 2.5d+150) 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 <= -8.6e+42) {
tmp = y * x;
} else if (x <= -2.3e-9) {
tmp = -x;
} else if (x <= 0.5) {
tmp = y * -0.5;
} else if (x <= 7.5e+66) {
tmp = y * x;
} else if (x <= 2.5e+150) {
tmp = -x;
} else {
tmp = y * x;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -8.6e+42: tmp = y * x elif x <= -2.3e-9: tmp = -x elif x <= 0.5: tmp = y * -0.5 elif x <= 7.5e+66: tmp = y * x elif x <= 2.5e+150: tmp = -x else: tmp = y * x return tmp
function code(x, y) tmp = 0.0 if (x <= -8.6e+42) tmp = Float64(y * x); elseif (x <= -2.3e-9) tmp = Float64(-x); elseif (x <= 0.5) tmp = Float64(y * -0.5); elseif (x <= 7.5e+66) tmp = Float64(y * x); elseif (x <= 2.5e+150) tmp = Float64(-x); else tmp = Float64(y * x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -8.6e+42) tmp = y * x; elseif (x <= -2.3e-9) tmp = -x; elseif (x <= 0.5) tmp = y * -0.5; elseif (x <= 7.5e+66) tmp = y * x; elseif (x <= 2.5e+150) tmp = -x; else tmp = y * x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -8.6e+42], N[(y * x), $MachinePrecision], If[LessEqual[x, -2.3e-9], (-x), If[LessEqual[x, 0.5], N[(y * -0.5), $MachinePrecision], If[LessEqual[x, 7.5e+66], N[(y * x), $MachinePrecision], If[LessEqual[x, 2.5e+150], (-x), N[(y * x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.6 \cdot 10^{+42}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;x \leq -2.3 \cdot 10^{-9}:\\
\;\;\;\;-x\\
\mathbf{elif}\;x \leq 0.5:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{+66}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{+150}:\\
\;\;\;\;-x\\
\mathbf{else}:\\
\;\;\;\;y \cdot x\\
\end{array}
\end{array}
if x < -8.5999999999999996e42 or 0.5 < x < 7.50000000000000024e66 or 2.50000000000000004e150 < x Initial program 100.0%
associate-+l-100.0%
fma-neg100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
fma-neg100.0%
sub-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 63.8%
Taylor expanded in x around inf 63.5%
if -8.5999999999999996e42 < x < -2.2999999999999999e-9 or 7.50000000000000024e66 < x < 2.50000000000000004e150Initial program 100.0%
associate-+l-100.0%
fma-neg100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
fma-neg100.0%
sub-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 88.4%
Taylor expanded in y around 0 68.3%
neg-mul-168.3%
Simplified68.3%
if -2.2999999999999999e-9 < x < 0.5Initial program 100.0%
associate-+l-100.0%
fma-neg100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
fma-neg100.0%
sub-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 47.8%
Taylor expanded in x around 0 47.1%
*-commutative47.1%
Simplified47.1%
Final simplification56.1%
(FPCore (x y)
:precision binary64
(if (<= y -3.3e+142)
(* y -0.5)
(if (<= y -1.45e+116)
(* y x)
(if (<= y -14000000000.0)
(* y -0.5)
(if (<= y 1.3) (- 0.918938533204673 x) (* y x))))))
double code(double x, double y) {
double tmp;
if (y <= -3.3e+142) {
tmp = y * -0.5;
} else if (y <= -1.45e+116) {
tmp = y * x;
} else if (y <= -14000000000.0) {
tmp = y * -0.5;
} else if (y <= 1.3) {
tmp = 0.918938533204673 - 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 <= (-3.3d+142)) then
tmp = y * (-0.5d0)
else if (y <= (-1.45d+116)) then
tmp = y * x
else if (y <= (-14000000000.0d0)) then
tmp = y * (-0.5d0)
else if (y <= 1.3d0) then
tmp = 0.918938533204673d0 - x
else
tmp = y * x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -3.3e+142) {
tmp = y * -0.5;
} else if (y <= -1.45e+116) {
tmp = y * x;
} else if (y <= -14000000000.0) {
tmp = y * -0.5;
} else if (y <= 1.3) {
tmp = 0.918938533204673 - x;
} else {
tmp = y * x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -3.3e+142: tmp = y * -0.5 elif y <= -1.45e+116: tmp = y * x elif y <= -14000000000.0: tmp = y * -0.5 elif y <= 1.3: tmp = 0.918938533204673 - x else: tmp = y * x return tmp
function code(x, y) tmp = 0.0 if (y <= -3.3e+142) tmp = Float64(y * -0.5); elseif (y <= -1.45e+116) tmp = Float64(y * x); elseif (y <= -14000000000.0) tmp = Float64(y * -0.5); elseif (y <= 1.3) tmp = Float64(0.918938533204673 - x); else tmp = Float64(y * x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -3.3e+142) tmp = y * -0.5; elseif (y <= -1.45e+116) tmp = y * x; elseif (y <= -14000000000.0) tmp = y * -0.5; elseif (y <= 1.3) tmp = 0.918938533204673 - x; else tmp = y * x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -3.3e+142], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, -1.45e+116], N[(y * x), $MachinePrecision], If[LessEqual[y, -14000000000.0], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 1.3], N[(0.918938533204673 - x), $MachinePrecision], N[(y * x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.3 \cdot 10^{+142}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq -1.45 \cdot 10^{+116}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq -14000000000:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 1.3:\\
\;\;\;\;0.918938533204673 - x\\
\mathbf{else}:\\
\;\;\;\;y \cdot x\\
\end{array}
\end{array}
if y < -3.3000000000000002e142 or -1.4500000000000001e116 < y < -1.4e10Initial program 100.0%
associate-+l-100.0%
fma-neg100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
fma-neg100.0%
sub-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 99.7%
Taylor expanded in x around 0 58.2%
*-commutative58.2%
Simplified58.2%
if -3.3000000000000002e142 < y < -1.4500000000000001e116 or 1.30000000000000004 < y Initial program 100.0%
associate-+l-100.0%
fma-neg100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
fma-neg100.0%
sub-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 97.6%
Taylor expanded in x around inf 66.6%
if -1.4e10 < y < 1.30000000000000004Initial program 100.0%
associate-+l-100.0%
fma-neg100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
fma-neg100.0%
sub-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 95.8%
neg-mul-195.8%
sub-neg95.8%
Simplified95.8%
Final simplification79.2%
(FPCore (x y) :precision binary64 (if (or (<= x -3.3e+31) (not (<= x 350000.0))) (* x (+ y -1.0)) (- (+ 0.918938533204673 (* y -0.5)) x)))
double code(double x, double y) {
double tmp;
if ((x <= -3.3e+31) || !(x <= 350000.0)) {
tmp = x * (y + -1.0);
} else {
tmp = (0.918938533204673 + (y * -0.5)) - x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((x <= (-3.3d+31)) .or. (.not. (x <= 350000.0d0))) then
tmp = x * (y + (-1.0d0))
else
tmp = (0.918938533204673d0 + (y * (-0.5d0))) - x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -3.3e+31) || !(x <= 350000.0)) {
tmp = x * (y + -1.0);
} else {
tmp = (0.918938533204673 + (y * -0.5)) - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -3.3e+31) or not (x <= 350000.0): tmp = x * (y + -1.0) else: tmp = (0.918938533204673 + (y * -0.5)) - x return tmp
function code(x, y) tmp = 0.0 if ((x <= -3.3e+31) || !(x <= 350000.0)) tmp = Float64(x * Float64(y + -1.0)); else tmp = Float64(Float64(0.918938533204673 + Float64(y * -0.5)) - x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -3.3e+31) || ~((x <= 350000.0))) tmp = x * (y + -1.0); else tmp = (0.918938533204673 + (y * -0.5)) - x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -3.3e+31], N[Not[LessEqual[x, 350000.0]], $MachinePrecision]], N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(0.918938533204673 + N[(y * -0.5), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.3 \cdot 10^{+31} \lor \neg \left(x \leq 350000\right):\\
\;\;\;\;x \cdot \left(y + -1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.918938533204673 + y \cdot -0.5\right) - x\\
\end{array}
\end{array}
if x < -3.29999999999999992e31 or 3.5e5 < x Initial program 100.0%
associate-+l-100.0%
fma-neg100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
fma-neg100.0%
sub-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 99.7%
if -3.29999999999999992e31 < x < 3.5e5Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
sub-neg100.0%
distribute-rgt-in100.0%
associate-+r+100.0%
associate-+l+100.0%
distribute-rgt-neg-in100.0%
distribute-lft-out100.0%
fma-def100.0%
+-commutative100.0%
metadata-eval100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
*-lft-identity100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in x around 0 99.3%
*-commutative43.9%
Simplified99.3%
Final simplification99.5%
(FPCore (x y) :precision binary64 (if (or (<= y -1.25) (not (<= y 1.7))) (* y (- x 0.5)) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((y <= -1.25) || !(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.25d0)) .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.25) || !(y <= 1.7)) {
tmp = y * (x - 0.5);
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.25) 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.25) || !(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.25) || ~((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.25], 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.25 \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.25 or 1.69999999999999996 < y Initial program 100.0%
associate-+l-100.0%
fma-neg100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
fma-neg100.0%
sub-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 97.7%
if -1.25 < y < 1.69999999999999996Initial program 100.0%
associate-+l-100.0%
fma-neg100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
fma-neg100.0%
sub-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 97.8%
neg-mul-197.8%
sub-neg97.8%
Simplified97.8%
Final simplification97.8%
(FPCore (x y) :precision binary64 (if (or (<= x -0.7) (not (<= x 0.52))) (* x (+ y -1.0)) (- 0.918938533204673 (* y 0.5))))
double code(double x, double y) {
double tmp;
if ((x <= -0.7) || !(x <= 0.52)) {
tmp = x * (y + -1.0);
} else {
tmp = 0.918938533204673 - (y * 0.5);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((x <= (-0.7d0)) .or. (.not. (x <= 0.52d0))) then
tmp = x * (y + (-1.0d0))
else
tmp = 0.918938533204673d0 - (y * 0.5d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -0.7) || !(x <= 0.52)) {
tmp = x * (y + -1.0);
} else {
tmp = 0.918938533204673 - (y * 0.5);
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -0.7) or not (x <= 0.52): tmp = x * (y + -1.0) else: tmp = 0.918938533204673 - (y * 0.5) return tmp
function code(x, y) tmp = 0.0 if ((x <= -0.7) || !(x <= 0.52)) tmp = Float64(x * Float64(y + -1.0)); else tmp = Float64(0.918938533204673 - Float64(y * 0.5)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -0.7) || ~((x <= 0.52))) tmp = x * (y + -1.0); else tmp = 0.918938533204673 - (y * 0.5); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -0.7], N[Not[LessEqual[x, 0.52]], $MachinePrecision]], N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision], N[(0.918938533204673 - N[(y * 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.7 \lor \neg \left(x \leq 0.52\right):\\
\;\;\;\;x \cdot \left(y + -1\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - y \cdot 0.5\\
\end{array}
\end{array}
if x < -0.69999999999999996 or 0.52000000000000002 < x Initial program 100.0%
associate-+l-100.0%
fma-neg100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
fma-neg100.0%
sub-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 97.9%
if -0.69999999999999996 < x < 0.52000000000000002Initial program 100.0%
associate-+l-100.0%
fma-neg100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
fma-neg100.0%
sub-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 98.1%
Final simplification98.0%
(FPCore (x y) :precision binary64 (if (<= y -2.4e-13) (* y -0.5) (if (<= y 1.6) (- x) (* y -0.5))))
double code(double x, double y) {
double tmp;
if (y <= -2.4e-13) {
tmp = y * -0.5;
} else if (y <= 1.6) {
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 (y <= (-2.4d-13)) then
tmp = y * (-0.5d0)
else if (y <= 1.6d0) 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 (y <= -2.4e-13) {
tmp = y * -0.5;
} else if (y <= 1.6) {
tmp = -x;
} else {
tmp = y * -0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -2.4e-13: tmp = y * -0.5 elif y <= 1.6: tmp = -x else: tmp = y * -0.5 return tmp
function code(x, y) tmp = 0.0 if (y <= -2.4e-13) tmp = Float64(y * -0.5); elseif (y <= 1.6) tmp = Float64(-x); else tmp = Float64(y * -0.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -2.4e-13) tmp = y * -0.5; elseif (y <= 1.6) tmp = -x; else tmp = y * -0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -2.4e-13], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 1.6], (-x), N[(y * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.4 \cdot 10^{-13}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 1.6:\\
\;\;\;\;-x\\
\mathbf{else}:\\
\;\;\;\;y \cdot -0.5\\
\end{array}
\end{array}
if y < -2.3999999999999999e-13 or 1.6000000000000001 < y Initial program 100.0%
associate-+l-100.0%
fma-neg100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
fma-neg100.0%
sub-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 93.9%
Taylor expanded in x around 0 43.1%
*-commutative43.1%
Simplified43.1%
if -2.3999999999999999e-13 < y < 1.6000000000000001Initial program 100.0%
associate-+l-100.0%
fma-neg100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
fma-neg100.0%
sub-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 48.4%
Taylor expanded in y around 0 48.3%
neg-mul-148.3%
Simplified48.3%
Final simplification45.6%
(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%
associate-+l-100.0%
fma-neg100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
fma-neg100.0%
sub-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 52.0%
Taylor expanded in y around 0 24.2%
neg-mul-124.2%
Simplified24.2%
Final simplification24.2%
herbie shell --seed 2023192
(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))