
(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 (fma y (+ x -0.5) (- 0.918938533204673 x)))
double code(double x, double y) {
return fma(y, (x + -0.5), (0.918938533204673 - x));
}
function code(x, y) return fma(y, Float64(x + -0.5), Float64(0.918938533204673 - x)) end
code[x_, y_] := N[(y * N[(x + -0.5), $MachinePrecision] + N[(0.918938533204673 - x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, x + -0.5, 0.918938533204673 - x\right)
\end{array}
Initial program 100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate-+r+100.0%
unsub-neg100.0%
associate-+l-100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
distribute-lft-out100.0%
fma-neg100.0%
+-commutative100.0%
metadata-eval100.0%
neg-sub0100.0%
associate-+l-100.0%
neg-sub0100.0%
+-commutative100.0%
unsub-neg100.0%
Simplified100.0%
(FPCore (x y)
:precision binary64
(if (<= y -140.0)
(* y -0.5)
(if (<= y 1.85)
(- 0.918938533204673 x)
(if (or (<= y 2.3e+75) (and (not (<= y 1.65e+146)) (<= y 7.2e+229)))
(* y -0.5)
(* y x)))))
double code(double x, double y) {
double tmp;
if (y <= -140.0) {
tmp = y * -0.5;
} else if (y <= 1.85) {
tmp = 0.918938533204673 - x;
} else if ((y <= 2.3e+75) || (!(y <= 1.65e+146) && (y <= 7.2e+229))) {
tmp = y * -0.5;
} else {
tmp = y * x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-140.0d0)) then
tmp = y * (-0.5d0)
else if (y <= 1.85d0) then
tmp = 0.918938533204673d0 - x
else if ((y <= 2.3d+75) .or. (.not. (y <= 1.65d+146)) .and. (y <= 7.2d+229)) then
tmp = y * (-0.5d0)
else
tmp = y * x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -140.0) {
tmp = y * -0.5;
} else if (y <= 1.85) {
tmp = 0.918938533204673 - x;
} else if ((y <= 2.3e+75) || (!(y <= 1.65e+146) && (y <= 7.2e+229))) {
tmp = y * -0.5;
} else {
tmp = y * x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -140.0: tmp = y * -0.5 elif y <= 1.85: tmp = 0.918938533204673 - x elif (y <= 2.3e+75) or (not (y <= 1.65e+146) and (y <= 7.2e+229)): tmp = y * -0.5 else: tmp = y * x return tmp
function code(x, y) tmp = 0.0 if (y <= -140.0) tmp = Float64(y * -0.5); elseif (y <= 1.85) tmp = Float64(0.918938533204673 - x); elseif ((y <= 2.3e+75) || (!(y <= 1.65e+146) && (y <= 7.2e+229))) tmp = Float64(y * -0.5); else tmp = Float64(y * x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -140.0) tmp = y * -0.5; elseif (y <= 1.85) tmp = 0.918938533204673 - x; elseif ((y <= 2.3e+75) || (~((y <= 1.65e+146)) && (y <= 7.2e+229))) tmp = y * -0.5; else tmp = y * x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -140.0], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 1.85], N[(0.918938533204673 - x), $MachinePrecision], If[Or[LessEqual[y, 2.3e+75], And[N[Not[LessEqual[y, 1.65e+146]], $MachinePrecision], LessEqual[y, 7.2e+229]]], N[(y * -0.5), $MachinePrecision], N[(y * x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -140:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 1.85:\\
\;\;\;\;0.918938533204673 - x\\
\mathbf{elif}\;y \leq 2.3 \cdot 10^{+75} \lor \neg \left(y \leq 1.65 \cdot 10^{+146}\right) \land y \leq 7.2 \cdot 10^{+229}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;y \cdot x\\
\end{array}
\end{array}
if y < -140 or 1.8500000000000001 < y < 2.2999999999999999e75 or 1.65000000000000008e146 < y < 7.19999999999999973e229Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 96.6%
Taylor expanded in x around 0 60.4%
if -140 < y < 1.8500000000000001Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 97.9%
neg-mul-197.9%
unsub-neg97.9%
Simplified97.9%
if 2.2999999999999999e75 < y < 1.65000000000000008e146 or 7.19999999999999973e229 < y Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
Taylor expanded in x around inf 69.5%
*-commutative69.5%
Simplified69.5%
Final simplification81.7%
(FPCore (x y)
:precision binary64
(if (<= y -7.8e-8)
(* y -0.5)
(if (<= y 3.7e-7)
0.918938533204673
(if (or (<= y 1.38e+75) (and (not (<= y 2.2e+144)) (<= y 4e+229)))
(* y -0.5)
(* y x)))))
double code(double x, double y) {
double tmp;
if (y <= -7.8e-8) {
tmp = y * -0.5;
} else if (y <= 3.7e-7) {
tmp = 0.918938533204673;
} else if ((y <= 1.38e+75) || (!(y <= 2.2e+144) && (y <= 4e+229))) {
tmp = y * -0.5;
} else {
tmp = y * x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-7.8d-8)) then
tmp = y * (-0.5d0)
else if (y <= 3.7d-7) then
tmp = 0.918938533204673d0
else if ((y <= 1.38d+75) .or. (.not. (y <= 2.2d+144)) .and. (y <= 4d+229)) then
tmp = y * (-0.5d0)
else
tmp = y * x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -7.8e-8) {
tmp = y * -0.5;
} else if (y <= 3.7e-7) {
tmp = 0.918938533204673;
} else if ((y <= 1.38e+75) || (!(y <= 2.2e+144) && (y <= 4e+229))) {
tmp = y * -0.5;
} else {
tmp = y * x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -7.8e-8: tmp = y * -0.5 elif y <= 3.7e-7: tmp = 0.918938533204673 elif (y <= 1.38e+75) or (not (y <= 2.2e+144) and (y <= 4e+229)): tmp = y * -0.5 else: tmp = y * x return tmp
function code(x, y) tmp = 0.0 if (y <= -7.8e-8) tmp = Float64(y * -0.5); elseif (y <= 3.7e-7) tmp = 0.918938533204673; elseif ((y <= 1.38e+75) || (!(y <= 2.2e+144) && (y <= 4e+229))) tmp = Float64(y * -0.5); else tmp = Float64(y * x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -7.8e-8) tmp = y * -0.5; elseif (y <= 3.7e-7) tmp = 0.918938533204673; elseif ((y <= 1.38e+75) || (~((y <= 2.2e+144)) && (y <= 4e+229))) tmp = y * -0.5; else tmp = y * x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -7.8e-8], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 3.7e-7], 0.918938533204673, If[Or[LessEqual[y, 1.38e+75], And[N[Not[LessEqual[y, 2.2e+144]], $MachinePrecision], LessEqual[y, 4e+229]]], N[(y * -0.5), $MachinePrecision], N[(y * x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.8 \cdot 10^{-8}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 3.7 \cdot 10^{-7}:\\
\;\;\;\;0.918938533204673\\
\mathbf{elif}\;y \leq 1.38 \cdot 10^{+75} \lor \neg \left(y \leq 2.2 \cdot 10^{+144}\right) \land y \leq 4 \cdot 10^{+229}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;y \cdot x\\
\end{array}
\end{array}
if y < -7.7999999999999997e-8 or 3.70000000000000004e-7 < y < 1.3799999999999999e75 or 2.19999999999999988e144 < y < 4e229Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 93.7%
Taylor expanded in x around 0 58.5%
if -7.7999999999999997e-8 < y < 3.70000000000000004e-7Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 50.1%
Taylor expanded in y around 0 49.4%
if 1.3799999999999999e75 < y < 2.19999999999999988e144 or 4e229 < y Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
Taylor expanded in x around inf 69.5%
*-commutative69.5%
Simplified69.5%
Final simplification55.1%
(FPCore (x y) :precision binary64 (if (or (<= x -1.55e-9) (not (<= x 1.55e-7))) (+ 0.918938533204673 (* x (+ y -1.0))) (- 0.918938533204673 (* y 0.5))))
double code(double x, double y) {
double tmp;
if ((x <= -1.55e-9) || !(x <= 1.55e-7)) {
tmp = 0.918938533204673 + (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 <= (-1.55d-9)) .or. (.not. (x <= 1.55d-7))) then
tmp = 0.918938533204673d0 + (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 <= -1.55e-9) || !(x <= 1.55e-7)) {
tmp = 0.918938533204673 + (x * (y + -1.0));
} else {
tmp = 0.918938533204673 - (y * 0.5);
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -1.55e-9) or not (x <= 1.55e-7): tmp = 0.918938533204673 + (x * (y + -1.0)) else: tmp = 0.918938533204673 - (y * 0.5) return tmp
function code(x, y) tmp = 0.0 if ((x <= -1.55e-9) || !(x <= 1.55e-7)) tmp = Float64(0.918938533204673 + 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 <= -1.55e-9) || ~((x <= 1.55e-7))) tmp = 0.918938533204673 + (x * (y + -1.0)); else tmp = 0.918938533204673 - (y * 0.5); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -1.55e-9], N[Not[LessEqual[x, 1.55e-7]], $MachinePrecision]], N[(0.918938533204673 + N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.918938533204673 - N[(y * 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.55 \cdot 10^{-9} \lor \neg \left(x \leq 1.55 \cdot 10^{-7}\right):\\
\;\;\;\;0.918938533204673 + x \cdot \left(y + -1\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - y \cdot 0.5\\
\end{array}
\end{array}
if x < -1.55000000000000002e-9 or 1.55e-7 < x Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in x around inf 98.8%
if -1.55000000000000002e-9 < x < 1.55e-7Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 99.5%
Final simplification99.1%
(FPCore (x y)
:precision binary64
(if (<= x -5.0)
(+ 0.918938533204673 (* x (+ y -1.0)))
(if (<= x 5.5e-8)
(+ 0.918938533204673 (* y (+ x -0.5)))
(+ 0.918938533204673 (- (* y x) x)))))
double code(double x, double y) {
double tmp;
if (x <= -5.0) {
tmp = 0.918938533204673 + (x * (y + -1.0));
} else if (x <= 5.5e-8) {
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 (x <= (-5.0d0)) then
tmp = 0.918938533204673d0 + (x * (y + (-1.0d0)))
else if (x <= 5.5d-8) 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 (x <= -5.0) {
tmp = 0.918938533204673 + (x * (y + -1.0));
} else if (x <= 5.5e-8) {
tmp = 0.918938533204673 + (y * (x + -0.5));
} else {
tmp = 0.918938533204673 + ((y * x) - x);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -5.0: tmp = 0.918938533204673 + (x * (y + -1.0)) elif x <= 5.5e-8: tmp = 0.918938533204673 + (y * (x + -0.5)) else: tmp = 0.918938533204673 + ((y * x) - x) return tmp
function code(x, y) tmp = 0.0 if (x <= -5.0) tmp = Float64(0.918938533204673 + Float64(x * Float64(y + -1.0))); elseif (x <= 5.5e-8) tmp = Float64(0.918938533204673 + Float64(y * Float64(x + -0.5))); else tmp = Float64(0.918938533204673 + Float64(Float64(y * x) - x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -5.0) tmp = 0.918938533204673 + (x * (y + -1.0)); elseif (x <= 5.5e-8) tmp = 0.918938533204673 + (y * (x + -0.5)); else tmp = 0.918938533204673 + ((y * x) - x); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -5.0], N[(0.918938533204673 + N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.5e-8], N[(0.918938533204673 + N[(y * N[(x + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.918938533204673 + N[(N[(y * x), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5:\\
\;\;\;\;0.918938533204673 + x \cdot \left(y + -1\right)\\
\mathbf{elif}\;x \leq 5.5 \cdot 10^{-8}:\\
\;\;\;\;0.918938533204673 + y \cdot \left(x + -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 + \left(y \cdot x - x\right)\\
\end{array}
\end{array}
if x < -5Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in x around inf 99.6%
if -5 < x < 5.5000000000000003e-8Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 99.6%
associate-+l-99.6%
*-commutative99.6%
distribute-lft-out--99.6%
*-un-lft-identity99.6%
sub-neg99.6%
*-un-lft-identity99.6%
metadata-eval99.6%
Applied egg-rr99.6%
if 5.5000000000000003e-8 < x Initial program 99.9%
associate-+l-99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 100.0%
+-commutative100.0%
mul-1-neg100.0%
unsub-neg100.0%
*-un-lft-identity100.0%
sub-neg100.0%
*-un-lft-identity100.0%
metadata-eval100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 99.1%
*-commutative99.1%
Simplified99.1%
Final simplification99.5%
(FPCore (x y)
:precision binary64
(if (<= x -1.95e-10)
(+ 0.918938533204673 (* x (+ y -1.0)))
(if (<= x 6.6e-9)
(- 0.918938533204673 (* y 0.5))
(+ 0.918938533204673 (- (* y x) x)))))
double code(double x, double y) {
double tmp;
if (x <= -1.95e-10) {
tmp = 0.918938533204673 + (x * (y + -1.0));
} else if (x <= 6.6e-9) {
tmp = 0.918938533204673 - (y * 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 (x <= (-1.95d-10)) then
tmp = 0.918938533204673d0 + (x * (y + (-1.0d0)))
else if (x <= 6.6d-9) then
tmp = 0.918938533204673d0 - (y * 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 (x <= -1.95e-10) {
tmp = 0.918938533204673 + (x * (y + -1.0));
} else if (x <= 6.6e-9) {
tmp = 0.918938533204673 - (y * 0.5);
} else {
tmp = 0.918938533204673 + ((y * x) - x);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1.95e-10: tmp = 0.918938533204673 + (x * (y + -1.0)) elif x <= 6.6e-9: tmp = 0.918938533204673 - (y * 0.5) else: tmp = 0.918938533204673 + ((y * x) - x) return tmp
function code(x, y) tmp = 0.0 if (x <= -1.95e-10) tmp = Float64(0.918938533204673 + Float64(x * Float64(y + -1.0))); elseif (x <= 6.6e-9) tmp = Float64(0.918938533204673 - Float64(y * 0.5)); else tmp = Float64(0.918938533204673 + Float64(Float64(y * x) - x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1.95e-10) tmp = 0.918938533204673 + (x * (y + -1.0)); elseif (x <= 6.6e-9) tmp = 0.918938533204673 - (y * 0.5); else tmp = 0.918938533204673 + ((y * x) - x); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1.95e-10], N[(0.918938533204673 + N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 6.6e-9], N[(0.918938533204673 - N[(y * 0.5), $MachinePrecision]), $MachinePrecision], N[(0.918938533204673 + N[(N[(y * x), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.95 \cdot 10^{-10}:\\
\;\;\;\;0.918938533204673 + x \cdot \left(y + -1\right)\\
\mathbf{elif}\;x \leq 6.6 \cdot 10^{-9}:\\
\;\;\;\;0.918938533204673 - y \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 + \left(y \cdot x - x\right)\\
\end{array}
\end{array}
if x < -1.95e-10Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in x around inf 98.6%
if -1.95e-10 < x < 6.60000000000000037e-9Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 99.5%
if 6.60000000000000037e-9 < x Initial program 99.9%
associate-+l-99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 100.0%
+-commutative100.0%
mul-1-neg100.0%
unsub-neg100.0%
*-un-lft-identity100.0%
sub-neg100.0%
*-un-lft-identity100.0%
metadata-eval100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 99.1%
*-commutative99.1%
Simplified99.1%
Final simplification99.2%
(FPCore (x y) :precision binary64 (if (or (<= y -1.35) (not (<= y 1.2))) (* y (- x 0.5)) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((y <= -1.35) || !(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.35d0)) .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.35) || !(y <= 1.2)) {
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.2): 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.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.35) || ~((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.35], 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.35 \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.3500000000000001 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 97.5%
if -1.3500000000000001 < y < 1.19999999999999996Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 97.9%
neg-mul-197.9%
unsub-neg97.9%
Simplified97.9%
Final simplification97.7%
(FPCore (x y) :precision binary64 (if (or (<= y -7.8e-8) (not (<= y 3.7e-7))) (* y -0.5) 0.918938533204673))
double code(double x, double y) {
double tmp;
if ((y <= -7.8e-8) || !(y <= 3.7e-7)) {
tmp = y * -0.5;
} 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 ((y <= (-7.8d-8)) .or. (.not. (y <= 3.7d-7))) then
tmp = y * (-0.5d0)
else
tmp = 0.918938533204673d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -7.8e-8) || !(y <= 3.7e-7)) {
tmp = y * -0.5;
} else {
tmp = 0.918938533204673;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -7.8e-8) or not (y <= 3.7e-7): tmp = y * -0.5 else: tmp = 0.918938533204673 return tmp
function code(x, y) tmp = 0.0 if ((y <= -7.8e-8) || !(y <= 3.7e-7)) tmp = Float64(y * -0.5); else tmp = 0.918938533204673; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -7.8e-8) || ~((y <= 3.7e-7))) tmp = y * -0.5; else tmp = 0.918938533204673; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -7.8e-8], N[Not[LessEqual[y, 3.7e-7]], $MachinePrecision]], N[(y * -0.5), $MachinePrecision], 0.918938533204673]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.8 \cdot 10^{-8} \lor \neg \left(y \leq 3.7 \cdot 10^{-7}\right):\\
\;\;\;\;y \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673\\
\end{array}
\end{array}
if y < -7.7999999999999997e-8 or 3.70000000000000004e-7 < y Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 95.4%
Taylor expanded in x around 0 51.6%
if -7.7999999999999997e-8 < y < 3.70000000000000004e-7Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 50.1%
Taylor expanded in y around 0 49.4%
Final simplification50.4%
(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 y around 0 100.0%
+-commutative100.0%
mul-1-neg100.0%
unsub-neg100.0%
*-un-lft-identity100.0%
sub-neg100.0%
*-un-lft-identity100.0%
metadata-eval100.0%
Applied egg-rr100.0%
(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 y around inf 72.2%
Taylor expanded in y around 0 27.1%
herbie shell --seed 2024108
(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))