
(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 9 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(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%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(if (<= y -130.0)
(* y -0.5)
(if (<= y -9.2e-77)
(- x)
(if (<= y -1.22e-206)
0.918938533204673
(if (<= y -7.5e-289)
(- x)
(if (<= y 2.5e-258)
0.918938533204673
(if (<= y 1.25) (- x) (* y -0.5))))))))
double code(double x, double y) {
double tmp;
if (y <= -130.0) {
tmp = y * -0.5;
} else if (y <= -9.2e-77) {
tmp = -x;
} else if (y <= -1.22e-206) {
tmp = 0.918938533204673;
} else if (y <= -7.5e-289) {
tmp = -x;
} else if (y <= 2.5e-258) {
tmp = 0.918938533204673;
} else if (y <= 1.25) {
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 <= (-130.0d0)) then
tmp = y * (-0.5d0)
else if (y <= (-9.2d-77)) then
tmp = -x
else if (y <= (-1.22d-206)) then
tmp = 0.918938533204673d0
else if (y <= (-7.5d-289)) then
tmp = -x
else if (y <= 2.5d-258) then
tmp = 0.918938533204673d0
else if (y <= 1.25d0) 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 <= -130.0) {
tmp = y * -0.5;
} else if (y <= -9.2e-77) {
tmp = -x;
} else if (y <= -1.22e-206) {
tmp = 0.918938533204673;
} else if (y <= -7.5e-289) {
tmp = -x;
} else if (y <= 2.5e-258) {
tmp = 0.918938533204673;
} else if (y <= 1.25) {
tmp = -x;
} else {
tmp = y * -0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -130.0: tmp = y * -0.5 elif y <= -9.2e-77: tmp = -x elif y <= -1.22e-206: tmp = 0.918938533204673 elif y <= -7.5e-289: tmp = -x elif y <= 2.5e-258: tmp = 0.918938533204673 elif y <= 1.25: tmp = -x else: tmp = y * -0.5 return tmp
function code(x, y) tmp = 0.0 if (y <= -130.0) tmp = Float64(y * -0.5); elseif (y <= -9.2e-77) tmp = Float64(-x); elseif (y <= -1.22e-206) tmp = 0.918938533204673; elseif (y <= -7.5e-289) tmp = Float64(-x); elseif (y <= 2.5e-258) tmp = 0.918938533204673; elseif (y <= 1.25) tmp = Float64(-x); else tmp = Float64(y * -0.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -130.0) tmp = y * -0.5; elseif (y <= -9.2e-77) tmp = -x; elseif (y <= -1.22e-206) tmp = 0.918938533204673; elseif (y <= -7.5e-289) tmp = -x; elseif (y <= 2.5e-258) tmp = 0.918938533204673; elseif (y <= 1.25) tmp = -x; else tmp = y * -0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -130.0], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, -9.2e-77], (-x), If[LessEqual[y, -1.22e-206], 0.918938533204673, If[LessEqual[y, -7.5e-289], (-x), If[LessEqual[y, 2.5e-258], 0.918938533204673, If[LessEqual[y, 1.25], (-x), N[(y * -0.5), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -130:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq -9.2 \cdot 10^{-77}:\\
\;\;\;\;-x\\
\mathbf{elif}\;y \leq -1.22 \cdot 10^{-206}:\\
\;\;\;\;0.918938533204673\\
\mathbf{elif}\;y \leq -7.5 \cdot 10^{-289}:\\
\;\;\;\;-x\\
\mathbf{elif}\;y \leq 2.5 \cdot 10^{-258}:\\
\;\;\;\;0.918938533204673\\
\mathbf{elif}\;y \leq 1.25:\\
\;\;\;\;-x\\
\mathbf{else}:\\
\;\;\;\;y \cdot -0.5\\
\end{array}
\end{array}
if y < -130 or 1.25 < y Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 97.0%
Taylor expanded in x around 0 45.6%
if -130 < y < -9.19999999999999994e-77 or -1.22000000000000002e-206 < y < -7.49999999999999998e-289 or 2.4999999999999999e-258 < y < 1.25Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 95.1%
neg-mul-195.1%
unsub-neg95.1%
Simplified95.1%
Taylor expanded in x around inf 61.6%
neg-mul-161.6%
Simplified61.6%
if -9.19999999999999994e-77 < y < -1.22000000000000002e-206 or -7.49999999999999998e-289 < y < 2.4999999999999999e-258Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 67.6%
Final simplification55.0%
(FPCore (x y)
:precision binary64
(if (<= y -1.0)
(* x y)
(if (<= y -7.8e-76)
(- x)
(if (<= y -2.85e-205)
0.918938533204673
(if (<= y -2.5e-289)
(- x)
(if (<= y 2.5e-258)
0.918938533204673
(if (<= y 1.0) (- x) (* x y))))))))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x * y;
} else if (y <= -7.8e-76) {
tmp = -x;
} else if (y <= -2.85e-205) {
tmp = 0.918938533204673;
} else if (y <= -2.5e-289) {
tmp = -x;
} else if (y <= 2.5e-258) {
tmp = 0.918938533204673;
} else if (y <= 1.0) {
tmp = -x;
} else {
tmp = x * y;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-1.0d0)) then
tmp = x * y
else if (y <= (-7.8d-76)) then
tmp = -x
else if (y <= (-2.85d-205)) then
tmp = 0.918938533204673d0
else if (y <= (-2.5d-289)) then
tmp = -x
else if (y <= 2.5d-258) then
tmp = 0.918938533204673d0
else if (y <= 1.0d0) then
tmp = -x
else
tmp = x * y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x * y;
} else if (y <= -7.8e-76) {
tmp = -x;
} else if (y <= -2.85e-205) {
tmp = 0.918938533204673;
} else if (y <= -2.5e-289) {
tmp = -x;
} else if (y <= 2.5e-258) {
tmp = 0.918938533204673;
} else if (y <= 1.0) {
tmp = -x;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = x * y elif y <= -7.8e-76: tmp = -x elif y <= -2.85e-205: tmp = 0.918938533204673 elif y <= -2.5e-289: tmp = -x elif y <= 2.5e-258: tmp = 0.918938533204673 elif y <= 1.0: tmp = -x else: tmp = x * y return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = Float64(x * y); elseif (y <= -7.8e-76) tmp = Float64(-x); elseif (y <= -2.85e-205) tmp = 0.918938533204673; elseif (y <= -2.5e-289) tmp = Float64(-x); elseif (y <= 2.5e-258) tmp = 0.918938533204673; elseif (y <= 1.0) tmp = Float64(-x); else tmp = Float64(x * y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.0) tmp = x * y; elseif (y <= -7.8e-76) tmp = -x; elseif (y <= -2.85e-205) tmp = 0.918938533204673; elseif (y <= -2.5e-289) tmp = -x; elseif (y <= 2.5e-258) tmp = 0.918938533204673; elseif (y <= 1.0) tmp = -x; else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], N[(x * y), $MachinePrecision], If[LessEqual[y, -7.8e-76], (-x), If[LessEqual[y, -2.85e-205], 0.918938533204673, If[LessEqual[y, -2.5e-289], (-x), If[LessEqual[y, 2.5e-258], 0.918938533204673, If[LessEqual[y, 1.0], (-x), N[(x * y), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;y \leq -7.8 \cdot 10^{-76}:\\
\;\;\;\;-x\\
\mathbf{elif}\;y \leq -2.85 \cdot 10^{-205}:\\
\;\;\;\;0.918938533204673\\
\mathbf{elif}\;y \leq -2.5 \cdot 10^{-289}:\\
\;\;\;\;-x\\
\mathbf{elif}\;y \leq 2.5 \cdot 10^{-258}:\\
\;\;\;\;0.918938533204673\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;-x\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if y < -1 or 1 < y Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 96.4%
Taylor expanded in x around inf 53.4%
*-commutative53.4%
Simplified53.4%
if -1 < y < -7.8000000000000005e-76 or -2.85e-205 < y < -2.50000000000000014e-289 or 2.4999999999999999e-258 < y < 1Initial 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%
Taylor expanded in x around inf 62.2%
neg-mul-162.2%
Simplified62.2%
if -7.8000000000000005e-76 < y < -2.85e-205 or -2.50000000000000014e-289 < y < 2.4999999999999999e-258Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 67.6%
Final simplification58.9%
(FPCore (x y) :precision binary64 (if (or (<= y -34000000.0) (not (<= y 13000000.0))) (* y (- x 0.5)) (- (- 0.918938533204673 (* y 0.5)) x)))
double code(double x, double y) {
double tmp;
if ((y <= -34000000.0) || !(y <= 13000000.0)) {
tmp = y * (x - 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 <= (-34000000.0d0)) .or. (.not. (y <= 13000000.0d0))) then
tmp = y * (x - 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 <= -34000000.0) || !(y <= 13000000.0)) {
tmp = y * (x - 0.5);
} else {
tmp = (0.918938533204673 - (y * 0.5)) - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -34000000.0) or not (y <= 13000000.0): tmp = y * (x - 0.5) else: tmp = (0.918938533204673 - (y * 0.5)) - x return tmp
function code(x, y) tmp = 0.0 if ((y <= -34000000.0) || !(y <= 13000000.0)) tmp = Float64(y * Float64(x - 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 <= -34000000.0) || ~((y <= 13000000.0))) tmp = y * (x - 0.5); else tmp = (0.918938533204673 - (y * 0.5)) - x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -34000000.0], N[Not[LessEqual[y, 13000000.0]], $MachinePrecision]], N[(y * N[(x - 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 -34000000 \lor \neg \left(y \leq 13000000\right):\\
\;\;\;\;y \cdot \left(x - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.918938533204673 - y \cdot 0.5\right) - x\\
\end{array}
\end{array}
if y < -3.4e7 or 1.3e7 < y Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 99.2%
if -3.4e7 < y < 1.3e7Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 97.4%
neg-mul-197.4%
Simplified97.4%
Final simplification98.2%
(FPCore (x y) :precision binary64 (if (or (<= x -0.5) (not (<= x 0.5))) (+ 0.918938533204673 (- (* x y) x)) (- (- 0.918938533204673 (* y 0.5)) x)))
double code(double x, double y) {
double tmp;
if ((x <= -0.5) || !(x <= 0.5)) {
tmp = 0.918938533204673 + ((x * y) - x);
} 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 <= (-0.5d0)) .or. (.not. (x <= 0.5d0))) then
tmp = 0.918938533204673d0 + ((x * y) - x)
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 <= -0.5) || !(x <= 0.5)) {
tmp = 0.918938533204673 + ((x * y) - x);
} else {
tmp = (0.918938533204673 - (y * 0.5)) - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -0.5) or not (x <= 0.5): tmp = 0.918938533204673 + ((x * y) - x) else: tmp = (0.918938533204673 - (y * 0.5)) - x return tmp
function code(x, y) tmp = 0.0 if ((x <= -0.5) || !(x <= 0.5)) tmp = Float64(0.918938533204673 + Float64(Float64(x * y) - x)); 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 <= -0.5) || ~((x <= 0.5))) tmp = 0.918938533204673 + ((x * y) - x); else tmp = (0.918938533204673 - (y * 0.5)) - x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -0.5], N[Not[LessEqual[x, 0.5]], $MachinePrecision]], N[(0.918938533204673 + N[(N[(x * y), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision], N[(N[(0.918938533204673 - N[(y * 0.5), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.5 \lor \neg \left(x \leq 0.5\right):\\
\;\;\;\;0.918938533204673 + \left(x \cdot y - x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.918938533204673 - y \cdot 0.5\right) - x\\
\end{array}
\end{array}
if x < -0.5 or 0.5 < 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 99.0%
*-commutative48.8%
Simplified99.0%
if -0.5 < x < 0.5Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 99.8%
neg-mul-199.8%
Simplified99.8%
Final simplification99.4%
(FPCore (x y) :precision binary64 (if (or (<= y -1.22) (not (<= y 1.55))) (* y (- x 0.5)) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((y <= -1.22) || !(y <= 1.55)) {
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.22d0)) .or. (.not. (y <= 1.55d0))) 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.22) || !(y <= 1.55)) {
tmp = y * (x - 0.5);
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.22) or not (y <= 1.55): tmp = y * (x - 0.5) else: tmp = 0.918938533204673 - x return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.22) || !(y <= 1.55)) 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.22) || ~((y <= 1.55))) tmp = y * (x - 0.5); else tmp = 0.918938533204673 - x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.22], N[Not[LessEqual[y, 1.55]], $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.22 \lor \neg \left(y \leq 1.55\right):\\
\;\;\;\;y \cdot \left(x - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x\\
\end{array}
\end{array}
if y < -1.21999999999999997 or 1.55000000000000004 < y Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 96.4%
if -1.21999999999999997 < y < 1.55000000000000004Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 97.4%
neg-mul-197.4%
unsub-neg97.4%
Simplified97.4%
Final simplification97.0%
(FPCore (x y) :precision binary64 (if (<= y -2800000.0) (* x y) (if (<= y 1.6) (- 0.918938533204673 x) (* x y))))
double code(double x, double y) {
double tmp;
if (y <= -2800000.0) {
tmp = x * y;
} else if (y <= 1.6) {
tmp = 0.918938533204673 - x;
} else {
tmp = x * y;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-2800000.0d0)) then
tmp = x * y
else if (y <= 1.6d0) then
tmp = 0.918938533204673d0 - x
else
tmp = x * y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -2800000.0) {
tmp = x * y;
} else if (y <= 1.6) {
tmp = 0.918938533204673 - x;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -2800000.0: tmp = x * y elif y <= 1.6: tmp = 0.918938533204673 - x else: tmp = x * y return tmp
function code(x, y) tmp = 0.0 if (y <= -2800000.0) tmp = Float64(x * y); elseif (y <= 1.6) tmp = Float64(0.918938533204673 - x); else tmp = Float64(x * y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -2800000.0) tmp = x * y; elseif (y <= 1.6) tmp = 0.918938533204673 - x; else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -2800000.0], N[(x * y), $MachinePrecision], If[LessEqual[y, 1.6], N[(0.918938533204673 - x), $MachinePrecision], N[(x * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2800000:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;y \leq 1.6:\\
\;\;\;\;0.918938533204673 - x\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if y < -2.8e6 or 1.6000000000000001 < y Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 97.9%
Taylor expanded in x around inf 54.5%
*-commutative54.5%
Simplified54.5%
if -2.8e6 < y < 1.6000000000000001Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 95.6%
neg-mul-195.6%
unsub-neg95.6%
Simplified95.6%
Final simplification76.1%
(FPCore (x y) :precision binary64 (if (<= x -0.92) (- x) (if (<= x 6000.0) 0.918938533204673 (- x))))
double code(double x, double y) {
double tmp;
if (x <= -0.92) {
tmp = -x;
} else if (x <= 6000.0) {
tmp = 0.918938533204673;
} else {
tmp = -x;
}
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)) then
tmp = -x
else if (x <= 6000.0d0) then
tmp = 0.918938533204673d0
else
tmp = -x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -0.92) {
tmp = -x;
} else if (x <= 6000.0) {
tmp = 0.918938533204673;
} else {
tmp = -x;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -0.92: tmp = -x elif x <= 6000.0: tmp = 0.918938533204673 else: tmp = -x return tmp
function code(x, y) tmp = 0.0 if (x <= -0.92) tmp = Float64(-x); elseif (x <= 6000.0) tmp = 0.918938533204673; else tmp = Float64(-x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -0.92) tmp = -x; elseif (x <= 6000.0) tmp = 0.918938533204673; else tmp = -x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -0.92], (-x), If[LessEqual[x, 6000.0], 0.918938533204673, (-x)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.92:\\
\;\;\;\;-x\\
\mathbf{elif}\;x \leq 6000:\\
\;\;\;\;0.918938533204673\\
\mathbf{else}:\\
\;\;\;\;-x\\
\end{array}
\end{array}
if x < -0.92000000000000004 or 6e3 < x Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 51.4%
neg-mul-151.4%
unsub-neg51.4%
Simplified51.4%
Taylor expanded in x around inf 50.9%
neg-mul-150.9%
Simplified50.9%
if -0.92000000000000004 < x < 6e3Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 52.9%
neg-mul-152.9%
unsub-neg52.9%
Simplified52.9%
Taylor expanded in x around 0 52.4%
Final simplification51.6%
(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 0 52.1%
neg-mul-152.1%
unsub-neg52.1%
Simplified52.1%
Taylor expanded in x around 0 26.0%
Final simplification26.0%
herbie shell --seed 2023279
(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))