
(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 (+ (- (* 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}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(if (<= y -4.5e+238)
(* y -0.5)
(if (<= y -2.5e+125)
(* x y)
(if (<= y -6.8e+81)
(* y -0.5)
(if (<= y -3700000000000.0)
(* x y)
(if (<= y 1.85) 0.918938533204673 (* y -0.5)))))))
double code(double x, double y) {
double tmp;
if (y <= -4.5e+238) {
tmp = y * -0.5;
} else if (y <= -2.5e+125) {
tmp = x * y;
} else if (y <= -6.8e+81) {
tmp = y * -0.5;
} else if (y <= -3700000000000.0) {
tmp = x * y;
} 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 <= (-4.5d+238)) then
tmp = y * (-0.5d0)
else if (y <= (-2.5d+125)) then
tmp = x * y
else if (y <= (-6.8d+81)) then
tmp = y * (-0.5d0)
else if (y <= (-3700000000000.0d0)) then
tmp = x * y
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 <= -4.5e+238) {
tmp = y * -0.5;
} else if (y <= -2.5e+125) {
tmp = x * y;
} else if (y <= -6.8e+81) {
tmp = y * -0.5;
} else if (y <= -3700000000000.0) {
tmp = x * y;
} else if (y <= 1.85) {
tmp = 0.918938533204673;
} else {
tmp = y * -0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -4.5e+238: tmp = y * -0.5 elif y <= -2.5e+125: tmp = x * y elif y <= -6.8e+81: tmp = y * -0.5 elif y <= -3700000000000.0: tmp = x * y elif y <= 1.85: tmp = 0.918938533204673 else: tmp = y * -0.5 return tmp
function code(x, y) tmp = 0.0 if (y <= -4.5e+238) tmp = Float64(y * -0.5); elseif (y <= -2.5e+125) tmp = Float64(x * y); elseif (y <= -6.8e+81) tmp = Float64(y * -0.5); elseif (y <= -3700000000000.0) tmp = Float64(x * y); 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 <= -4.5e+238) tmp = y * -0.5; elseif (y <= -2.5e+125) tmp = x * y; elseif (y <= -6.8e+81) tmp = y * -0.5; elseif (y <= -3700000000000.0) tmp = x * y; elseif (y <= 1.85) tmp = 0.918938533204673; else tmp = y * -0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -4.5e+238], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, -2.5e+125], N[(x * y), $MachinePrecision], If[LessEqual[y, -6.8e+81], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, -3700000000000.0], N[(x * y), $MachinePrecision], If[LessEqual[y, 1.85], 0.918938533204673, N[(y * -0.5), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.5 \cdot 10^{+238}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq -2.5 \cdot 10^{+125}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;y \leq -6.8 \cdot 10^{+81}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq -3700000000000:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;y \leq 1.85:\\
\;\;\;\;0.918938533204673\\
\mathbf{else}:\\
\;\;\;\;y \cdot -0.5\\
\end{array}
\end{array}
if y < -4.5e238 or -2.49999999999999981e125 < y < -6.80000000000000005e81 or 1.8500000000000001 < 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 y around inf 99.1%
Taylor expanded in x around 0 69.9%
if -4.5e238 < y < -2.49999999999999981e125 or -6.80000000000000005e81 < y < -3.7e12Initial 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 72.4%
*-commutative72.4%
Simplified72.4%
if -3.7e12 < y < 1.8500000000000001Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 49.8%
Taylor expanded in y around 0 46.6%
Final simplification58.2%
(FPCore (x y)
:precision binary64
(let* ((t_0 (- 0.918938533204673 (* y 0.5))))
(if (<= y -4200000000000.0)
(+ (* x y) (* y -0.5))
(if (<= y 1.0) (- t_0 x) (+ (* x y) t_0)))))
double code(double x, double y) {
double t_0 = 0.918938533204673 - (y * 0.5);
double tmp;
if (y <= -4200000000000.0) {
tmp = (x * y) + (y * -0.5);
} else if (y <= 1.0) {
tmp = t_0 - x;
} else {
tmp = (x * y) + t_0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = 0.918938533204673d0 - (y * 0.5d0)
if (y <= (-4200000000000.0d0)) then
tmp = (x * y) + (y * (-0.5d0))
else if (y <= 1.0d0) then
tmp = t_0 - x
else
tmp = (x * y) + t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 0.918938533204673 - (y * 0.5);
double tmp;
if (y <= -4200000000000.0) {
tmp = (x * y) + (y * -0.5);
} else if (y <= 1.0) {
tmp = t_0 - x;
} else {
tmp = (x * y) + t_0;
}
return tmp;
}
def code(x, y): t_0 = 0.918938533204673 - (y * 0.5) tmp = 0 if y <= -4200000000000.0: tmp = (x * y) + (y * -0.5) elif y <= 1.0: tmp = t_0 - x else: tmp = (x * y) + t_0 return tmp
function code(x, y) t_0 = Float64(0.918938533204673 - Float64(y * 0.5)) tmp = 0.0 if (y <= -4200000000000.0) tmp = Float64(Float64(x * y) + Float64(y * -0.5)); elseif (y <= 1.0) tmp = Float64(t_0 - x); else tmp = Float64(Float64(x * y) + t_0); end return tmp end
function tmp_2 = code(x, y) t_0 = 0.918938533204673 - (y * 0.5); tmp = 0.0; if (y <= -4200000000000.0) tmp = (x * y) + (y * -0.5); elseif (y <= 1.0) tmp = t_0 - x; else tmp = (x * y) + t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(0.918938533204673 - N[(y * 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4200000000000.0], N[(N[(x * y), $MachinePrecision] + N[(y * -0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.0], N[(t$95$0 - x), $MachinePrecision], N[(N[(x * y), $MachinePrecision] + t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.918938533204673 - y \cdot 0.5\\
\mathbf{if}\;y \leq -4200000000000:\\
\;\;\;\;x \cdot y + y \cdot -0.5\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;t_0 - x\\
\mathbf{else}:\\
\;\;\;\;x \cdot y + t_0\\
\end{array}
\end{array}
if y < -4.2e12Initial 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 y around inf 100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-lft-in100.0%
Applied egg-rr100.0%
if -4.2e12 < y < 1Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 99.2%
mul-1-neg99.2%
Simplified99.2%
if 1 < 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%
Final simplification99.6%
(FPCore (x y) :precision binary64 (if (or (<= y -3700000000000.0) (not (<= y 430000000.0))) (+ (* x y) (* y -0.5)) (- 0.918938533204673 (* y 0.5))))
double code(double x, double y) {
double tmp;
if ((y <= -3700000000000.0) || !(y <= 430000000.0)) {
tmp = (x * y) + (y * -0.5);
} 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 ((y <= (-3700000000000.0d0)) .or. (.not. (y <= 430000000.0d0))) then
tmp = (x * y) + (y * (-0.5d0))
else
tmp = 0.918938533204673d0 - (y * 0.5d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -3700000000000.0) || !(y <= 430000000.0)) {
tmp = (x * y) + (y * -0.5);
} else {
tmp = 0.918938533204673 - (y * 0.5);
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -3700000000000.0) or not (y <= 430000000.0): tmp = (x * y) + (y * -0.5) else: tmp = 0.918938533204673 - (y * 0.5) return tmp
function code(x, y) tmp = 0.0 if ((y <= -3700000000000.0) || !(y <= 430000000.0)) tmp = Float64(Float64(x * y) + Float64(y * -0.5)); else tmp = Float64(0.918938533204673 - Float64(y * 0.5)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -3700000000000.0) || ~((y <= 430000000.0))) tmp = (x * y) + (y * -0.5); else tmp = 0.918938533204673 - (y * 0.5); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -3700000000000.0], N[Not[LessEqual[y, 430000000.0]], $MachinePrecision]], N[(N[(x * y), $MachinePrecision] + N[(y * -0.5), $MachinePrecision]), $MachinePrecision], N[(0.918938533204673 - N[(y * 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3700000000000 \lor \neg \left(y \leq 430000000\right):\\
\;\;\;\;x \cdot y + y \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - y \cdot 0.5\\
\end{array}
\end{array}
if y < -3.7e12 or 4.3e8 < 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 y around inf 100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-lft-in100.0%
Applied egg-rr100.0%
if -3.7e12 < y < 4.3e8Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 50.2%
Taylor expanded in x around 0 50.1%
Final simplification74.1%
(FPCore (x y) :precision binary64 (if (or (<= y -3700000000000.0) (not (<= y 30000000.0))) (+ (* x y) (* y -0.5)) (- (- 0.918938533204673 (* y 0.5)) x)))
double code(double x, double y) {
double tmp;
if ((y <= -3700000000000.0) || !(y <= 30000000.0)) {
tmp = (x * y) + (y * -0.5);
} 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 ((y <= (-3700000000000.0d0)) .or. (.not. (y <= 30000000.0d0))) then
tmp = (x * y) + (y * (-0.5d0))
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 ((y <= -3700000000000.0) || !(y <= 30000000.0)) {
tmp = (x * y) + (y * -0.5);
} else {
tmp = (0.918938533204673 - (y * 0.5)) - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -3700000000000.0) or not (y <= 30000000.0): tmp = (x * y) + (y * -0.5) else: tmp = (0.918938533204673 - (y * 0.5)) - x return tmp
function code(x, y) tmp = 0.0 if ((y <= -3700000000000.0) || !(y <= 30000000.0)) tmp = Float64(Float64(x * y) + Float64(y * -0.5)); 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 ((y <= -3700000000000.0) || ~((y <= 30000000.0))) tmp = (x * y) + (y * -0.5); else tmp = (0.918938533204673 - (y * 0.5)) - x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -3700000000000.0], N[Not[LessEqual[y, 30000000.0]], $MachinePrecision]], N[(N[(x * y), $MachinePrecision] + N[(y * -0.5), $MachinePrecision]), $MachinePrecision], N[(N[(0.918938533204673 - N[(y * 0.5), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3700000000000 \lor \neg \left(y \leq 30000000\right):\\
\;\;\;\;x \cdot y + y \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;\left(0.918938533204673 - y \cdot 0.5\right) - x\\
\end{array}
\end{array}
if y < -3.7e12 or 3e7 < 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 y around inf 100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-lft-in100.0%
Applied egg-rr100.0%
if -3.7e12 < y < 3e7Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 99.2%
mul-1-neg99.2%
Simplified99.2%
Final simplification99.6%
(FPCore (x y) :precision binary64 (if (or (<= y -3e-21) (not (<= y 1.8))) (* y (- x 0.5)) 0.918938533204673))
double code(double x, double y) {
double tmp;
if ((y <= -3e-21) || !(y <= 1.8)) {
tmp = y * (x - 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 <= (-3d-21)) .or. (.not. (y <= 1.8d0))) then
tmp = y * (x - 0.5d0)
else
tmp = 0.918938533204673d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -3e-21) || !(y <= 1.8)) {
tmp = y * (x - 0.5);
} else {
tmp = 0.918938533204673;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -3e-21) or not (y <= 1.8): tmp = y * (x - 0.5) else: tmp = 0.918938533204673 return tmp
function code(x, y) tmp = 0.0 if ((y <= -3e-21) || !(y <= 1.8)) tmp = Float64(y * Float64(x - 0.5)); else tmp = 0.918938533204673; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -3e-21) || ~((y <= 1.8))) tmp = y * (x - 0.5); else tmp = 0.918938533204673; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -3e-21], N[Not[LessEqual[y, 1.8]], $MachinePrecision]], N[(y * N[(x - 0.5), $MachinePrecision]), $MachinePrecision], 0.918938533204673]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3 \cdot 10^{-21} \lor \neg \left(y \leq 1.8\right):\\
\;\;\;\;y \cdot \left(x - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673\\
\end{array}
\end{array}
if y < -2.99999999999999991e-21 or 1.80000000000000004 < y Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 98.6%
Taylor expanded in y around inf 96.8%
if -2.99999999999999991e-21 < y < 1.80000000000000004Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 48.8%
Taylor expanded in y around 0 48.3%
Final simplification72.9%
(FPCore (x y) :precision binary64 (if (or (<= y -3700000000000.0) (not (<= y 3800000.0))) (* y (- x 0.5)) (- 0.918938533204673 (* y 0.5))))
double code(double x, double y) {
double tmp;
if ((y <= -3700000000000.0) || !(y <= 3800000.0)) {
tmp = y * (x - 0.5);
} 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 ((y <= (-3700000000000.0d0)) .or. (.not. (y <= 3800000.0d0))) then
tmp = y * (x - 0.5d0)
else
tmp = 0.918938533204673d0 - (y * 0.5d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -3700000000000.0) || !(y <= 3800000.0)) {
tmp = y * (x - 0.5);
} else {
tmp = 0.918938533204673 - (y * 0.5);
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -3700000000000.0) or not (y <= 3800000.0): tmp = y * (x - 0.5) else: tmp = 0.918938533204673 - (y * 0.5) return tmp
function code(x, y) tmp = 0.0 if ((y <= -3700000000000.0) || !(y <= 3800000.0)) tmp = Float64(y * Float64(x - 0.5)); else tmp = Float64(0.918938533204673 - Float64(y * 0.5)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -3700000000000.0) || ~((y <= 3800000.0))) tmp = y * (x - 0.5); else tmp = 0.918938533204673 - (y * 0.5); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -3700000000000.0], N[Not[LessEqual[y, 3800000.0]], $MachinePrecision]], N[(y * N[(x - 0.5), $MachinePrecision]), $MachinePrecision], N[(0.918938533204673 - N[(y * 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3700000000000 \lor \neg \left(y \leq 3800000\right):\\
\;\;\;\;y \cdot \left(x - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - y \cdot 0.5\\
\end{array}
\end{array}
if y < -3.7e12 or 3.8e6 < 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 y around inf 100.0%
if -3.7e12 < y < 3.8e6Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 50.2%
Taylor expanded in x around 0 50.1%
Final simplification74.1%
(FPCore (x y) :precision binary64 (if (<= y -1.82) (* y -0.5) (if (<= y 1.85) 0.918938533204673 (* y -0.5))))
double code(double x, double y) {
double tmp;
if (y <= -1.82) {
tmp = y * -0.5;
} 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.82d0)) then
tmp = y * (-0.5d0)
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.82) {
tmp = y * -0.5;
} else if (y <= 1.85) {
tmp = 0.918938533204673;
} else {
tmp = y * -0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.82: tmp = y * -0.5 elif y <= 1.85: tmp = 0.918938533204673 else: tmp = y * -0.5 return tmp
function code(x, y) tmp = 0.0 if (y <= -1.82) tmp = Float64(y * -0.5); 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.82) tmp = y * -0.5; elseif (y <= 1.85) tmp = 0.918938533204673; else tmp = y * -0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.82], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 1.85], 0.918938533204673, N[(y * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.82:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 1.85:\\
\;\;\;\;0.918938533204673\\
\mathbf{else}:\\
\;\;\;\;y \cdot -0.5\\
\end{array}
\end{array}
if y < -1.82000000000000006 or 1.8500000000000001 < 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 y around inf 98.1%
Taylor expanded in x around 0 57.2%
if -1.82000000000000006 < y < 1.8500000000000001Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 48.2%
Taylor expanded in y around 0 47.6%
Final simplification52.4%
(FPCore (x y) :precision binary64 (+ 0.918938533204673 (* y (+ x -0.5))))
double code(double x, double y) {
return 0.918938533204673 + (y * (x + -0.5));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 0.918938533204673d0 + (y * (x + (-0.5d0)))
end function
public static double code(double x, double y) {
return 0.918938533204673 + (y * (x + -0.5));
}
def code(x, y): return 0.918938533204673 + (y * (x + -0.5))
function code(x, y) return Float64(0.918938533204673 + Float64(y * Float64(x + -0.5))) end
function tmp = code(x, y) tmp = 0.918938533204673 + (y * (x + -0.5)); end
code[x_, y_] := N[(0.918938533204673 + N[(y * N[(x + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.918938533204673 + y \cdot \left(x + -0.5\right)
\end{array}
Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 74.1%
associate--r-74.1%
*-commutative74.1%
distribute-lft-out--74.1%
sub-neg74.1%
metadata-eval74.1%
Applied egg-rr74.1%
Final simplification74.1%
(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 74.1%
Taylor expanded in y around 0 25.2%
Final simplification25.2%
herbie shell --seed 2023297
(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))