
(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 (<= x -9.4e+181)
(- x)
(if (<= x -0.98)
(* y x)
(if (<= x -7e-109)
0.918938533204673
(if (<= x -1.75e-299)
(* y -0.5)
(if (<= x 1.6e-119)
0.918938533204673
(if (<= x 3.4e-34)
(* y -0.5)
(if (<= x 0.92) 0.918938533204673 (- x)))))))))
double code(double x, double y) {
double tmp;
if (x <= -9.4e+181) {
tmp = -x;
} else if (x <= -0.98) {
tmp = y * x;
} else if (x <= -7e-109) {
tmp = 0.918938533204673;
} else if (x <= -1.75e-299) {
tmp = y * -0.5;
} else if (x <= 1.6e-119) {
tmp = 0.918938533204673;
} else if (x <= 3.4e-34) {
tmp = y * -0.5;
} else if (x <= 0.92) {
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 <= (-9.4d+181)) then
tmp = -x
else if (x <= (-0.98d0)) then
tmp = y * x
else if (x <= (-7d-109)) then
tmp = 0.918938533204673d0
else if (x <= (-1.75d-299)) then
tmp = y * (-0.5d0)
else if (x <= 1.6d-119) then
tmp = 0.918938533204673d0
else if (x <= 3.4d-34) then
tmp = y * (-0.5d0)
else if (x <= 0.92d0) 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 <= -9.4e+181) {
tmp = -x;
} else if (x <= -0.98) {
tmp = y * x;
} else if (x <= -7e-109) {
tmp = 0.918938533204673;
} else if (x <= -1.75e-299) {
tmp = y * -0.5;
} else if (x <= 1.6e-119) {
tmp = 0.918938533204673;
} else if (x <= 3.4e-34) {
tmp = y * -0.5;
} else if (x <= 0.92) {
tmp = 0.918938533204673;
} else {
tmp = -x;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -9.4e+181: tmp = -x elif x <= -0.98: tmp = y * x elif x <= -7e-109: tmp = 0.918938533204673 elif x <= -1.75e-299: tmp = y * -0.5 elif x <= 1.6e-119: tmp = 0.918938533204673 elif x <= 3.4e-34: tmp = y * -0.5 elif x <= 0.92: tmp = 0.918938533204673 else: tmp = -x return tmp
function code(x, y) tmp = 0.0 if (x <= -9.4e+181) tmp = Float64(-x); elseif (x <= -0.98) tmp = Float64(y * x); elseif (x <= -7e-109) tmp = 0.918938533204673; elseif (x <= -1.75e-299) tmp = Float64(y * -0.5); elseif (x <= 1.6e-119) tmp = 0.918938533204673; elseif (x <= 3.4e-34) tmp = Float64(y * -0.5); elseif (x <= 0.92) tmp = 0.918938533204673; else tmp = Float64(-x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -9.4e+181) tmp = -x; elseif (x <= -0.98) tmp = y * x; elseif (x <= -7e-109) tmp = 0.918938533204673; elseif (x <= -1.75e-299) tmp = y * -0.5; elseif (x <= 1.6e-119) tmp = 0.918938533204673; elseif (x <= 3.4e-34) tmp = y * -0.5; elseif (x <= 0.92) tmp = 0.918938533204673; else tmp = -x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -9.4e+181], (-x), If[LessEqual[x, -0.98], N[(y * x), $MachinePrecision], If[LessEqual[x, -7e-109], 0.918938533204673, If[LessEqual[x, -1.75e-299], N[(y * -0.5), $MachinePrecision], If[LessEqual[x, 1.6e-119], 0.918938533204673, If[LessEqual[x, 3.4e-34], N[(y * -0.5), $MachinePrecision], If[LessEqual[x, 0.92], 0.918938533204673, (-x)]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.4 \cdot 10^{+181}:\\
\;\;\;\;-x\\
\mathbf{elif}\;x \leq -0.98:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;x \leq -7 \cdot 10^{-109}:\\
\;\;\;\;0.918938533204673\\
\mathbf{elif}\;x \leq -1.75 \cdot 10^{-299}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;x \leq 1.6 \cdot 10^{-119}:\\
\;\;\;\;0.918938533204673\\
\mathbf{elif}\;x \leq 3.4 \cdot 10^{-34}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;x \leq 0.92:\\
\;\;\;\;0.918938533204673\\
\mathbf{else}:\\
\;\;\;\;-x\\
\end{array}
\end{array}
if x < -9.40000000000000055e181 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 97.9%
Taylor expanded in y around 0 56.5%
neg-mul-156.5%
Simplified56.5%
if -9.40000000000000055e181 < x < -0.97999999999999998Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 97.5%
Taylor expanded in y around inf 60.2%
*-commutative60.2%
Simplified60.2%
if -0.97999999999999998 < x < -7e-109 or -1.74999999999999995e-299 < x < 1.59999999999999997e-119 or 3.4000000000000001e-34 < x < 0.92000000000000004Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 95.3%
Taylor expanded in y around 0 70.5%
if -7e-109 < x < -1.74999999999999995e-299 or 1.59999999999999997e-119 < x < 3.4000000000000001e-34Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 60.7%
Taylor expanded in x around 0 60.7%
*-commutative60.7%
Simplified60.7%
(FPCore (x y)
:precision binary64
(if (<= x -1600.0)
(- x)
(if (<= x -5e-102)
0.918938533204673
(if (<= x -3.4e-300)
(* y -0.5)
(if (<= x 2.5e-118)
0.918938533204673
(if (<= x 5e-35)
(* y -0.5)
(if (<= x 0.92) 0.918938533204673 (- x))))))))
double code(double x, double y) {
double tmp;
if (x <= -1600.0) {
tmp = -x;
} else if (x <= -5e-102) {
tmp = 0.918938533204673;
} else if (x <= -3.4e-300) {
tmp = y * -0.5;
} else if (x <= 2.5e-118) {
tmp = 0.918938533204673;
} else if (x <= 5e-35) {
tmp = y * -0.5;
} else if (x <= 0.92) {
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 <= (-1600.0d0)) then
tmp = -x
else if (x <= (-5d-102)) then
tmp = 0.918938533204673d0
else if (x <= (-3.4d-300)) then
tmp = y * (-0.5d0)
else if (x <= 2.5d-118) then
tmp = 0.918938533204673d0
else if (x <= 5d-35) then
tmp = y * (-0.5d0)
else if (x <= 0.92d0) 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 <= -1600.0) {
tmp = -x;
} else if (x <= -5e-102) {
tmp = 0.918938533204673;
} else if (x <= -3.4e-300) {
tmp = y * -0.5;
} else if (x <= 2.5e-118) {
tmp = 0.918938533204673;
} else if (x <= 5e-35) {
tmp = y * -0.5;
} else if (x <= 0.92) {
tmp = 0.918938533204673;
} else {
tmp = -x;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1600.0: tmp = -x elif x <= -5e-102: tmp = 0.918938533204673 elif x <= -3.4e-300: tmp = y * -0.5 elif x <= 2.5e-118: tmp = 0.918938533204673 elif x <= 5e-35: tmp = y * -0.5 elif x <= 0.92: tmp = 0.918938533204673 else: tmp = -x return tmp
function code(x, y) tmp = 0.0 if (x <= -1600.0) tmp = Float64(-x); elseif (x <= -5e-102) tmp = 0.918938533204673; elseif (x <= -3.4e-300) tmp = Float64(y * -0.5); elseif (x <= 2.5e-118) tmp = 0.918938533204673; elseif (x <= 5e-35) tmp = Float64(y * -0.5); elseif (x <= 0.92) tmp = 0.918938533204673; else tmp = Float64(-x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1600.0) tmp = -x; elseif (x <= -5e-102) tmp = 0.918938533204673; elseif (x <= -3.4e-300) tmp = y * -0.5; elseif (x <= 2.5e-118) tmp = 0.918938533204673; elseif (x <= 5e-35) tmp = y * -0.5; elseif (x <= 0.92) tmp = 0.918938533204673; else tmp = -x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1600.0], (-x), If[LessEqual[x, -5e-102], 0.918938533204673, If[LessEqual[x, -3.4e-300], N[(y * -0.5), $MachinePrecision], If[LessEqual[x, 2.5e-118], 0.918938533204673, If[LessEqual[x, 5e-35], N[(y * -0.5), $MachinePrecision], If[LessEqual[x, 0.92], 0.918938533204673, (-x)]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1600:\\
\;\;\;\;-x\\
\mathbf{elif}\;x \leq -5 \cdot 10^{-102}:\\
\;\;\;\;0.918938533204673\\
\mathbf{elif}\;x \leq -3.4 \cdot 10^{-300}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{-118}:\\
\;\;\;\;0.918938533204673\\
\mathbf{elif}\;x \leq 5 \cdot 10^{-35}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;x \leq 0.92:\\
\;\;\;\;0.918938533204673\\
\mathbf{else}:\\
\;\;\;\;-x\\
\end{array}
\end{array}
if x < -1600 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.2%
Taylor expanded in y around 0 52.0%
neg-mul-152.0%
Simplified52.0%
if -1600 < x < -5.00000000000000026e-102 or -3.40000000000000018e-300 < x < 2.50000000000000007e-118 or 4.99999999999999964e-35 < x < 0.92000000000000004Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 94.1%
Taylor expanded in y around 0 69.4%
if -5.00000000000000026e-102 < x < -3.40000000000000018e-300 or 2.50000000000000007e-118 < x < 4.99999999999999964e-35Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 60.7%
Taylor expanded in x around 0 60.7%
*-commutative60.7%
Simplified60.7%
(FPCore (x y)
:precision binary64
(if (<= y -2.85e+289)
(* y -0.5)
(if (<= y -4.4e+194)
(* y x)
(if (<= y -8000.0)
(* y -0.5)
(if (<= y 4e-18) (- 0.918938533204673 x) (* x (+ y -1.0)))))))
double code(double x, double y) {
double tmp;
if (y <= -2.85e+289) {
tmp = y * -0.5;
} else if (y <= -4.4e+194) {
tmp = y * x;
} else if (y <= -8000.0) {
tmp = y * -0.5;
} else if (y <= 4e-18) {
tmp = 0.918938533204673 - x;
} else {
tmp = x * (y + -1.0);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-2.85d+289)) then
tmp = y * (-0.5d0)
else if (y <= (-4.4d+194)) then
tmp = y * x
else if (y <= (-8000.0d0)) then
tmp = y * (-0.5d0)
else if (y <= 4d-18) then
tmp = 0.918938533204673d0 - x
else
tmp = x * (y + (-1.0d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -2.85e+289) {
tmp = y * -0.5;
} else if (y <= -4.4e+194) {
tmp = y * x;
} else if (y <= -8000.0) {
tmp = y * -0.5;
} else if (y <= 4e-18) {
tmp = 0.918938533204673 - x;
} else {
tmp = x * (y + -1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -2.85e+289: tmp = y * -0.5 elif y <= -4.4e+194: tmp = y * x elif y <= -8000.0: tmp = y * -0.5 elif y <= 4e-18: tmp = 0.918938533204673 - x else: tmp = x * (y + -1.0) return tmp
function code(x, y) tmp = 0.0 if (y <= -2.85e+289) tmp = Float64(y * -0.5); elseif (y <= -4.4e+194) tmp = Float64(y * x); elseif (y <= -8000.0) tmp = Float64(y * -0.5); elseif (y <= 4e-18) tmp = Float64(0.918938533204673 - x); else tmp = Float64(x * Float64(y + -1.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -2.85e+289) tmp = y * -0.5; elseif (y <= -4.4e+194) tmp = y * x; elseif (y <= -8000.0) tmp = y * -0.5; elseif (y <= 4e-18) tmp = 0.918938533204673 - x; else tmp = x * (y + -1.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -2.85e+289], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, -4.4e+194], N[(y * x), $MachinePrecision], If[LessEqual[y, -8000.0], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 4e-18], N[(0.918938533204673 - x), $MachinePrecision], N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.85 \cdot 10^{+289}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq -4.4 \cdot 10^{+194}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq -8000:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 4 \cdot 10^{-18}:\\
\;\;\;\;0.918938533204673 - x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(y + -1\right)\\
\end{array}
\end{array}
if y < -2.8499999999999999e289 or -4.4000000000000002e194 < y < -8e3Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 98.0%
Taylor expanded in x around 0 64.2%
*-commutative64.2%
Simplified64.2%
if -2.8499999999999999e289 < y < -4.4000000000000002e194Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 79.9%
Taylor expanded in y around inf 79.9%
*-commutative79.9%
Simplified79.9%
if -8e3 < y < 4.0000000000000003e-18Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 98.9%
neg-mul-198.9%
sub-neg98.9%
Simplified98.9%
if 4.0000000000000003e-18 < y Initial program 99.9%
associate-+l-99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around inf 56.5%
Final simplification81.5%
(FPCore (x y)
:precision binary64
(if (<= y -1.02e+290)
(* y -0.5)
(if (<= y -1.22e+195)
(* y x)
(if (<= y -8000.0)
(* y -0.5)
(if (<= y 1.0) (- 0.918938533204673 x) (* y x))))))
double code(double x, double y) {
double tmp;
if (y <= -1.02e+290) {
tmp = y * -0.5;
} else if (y <= -1.22e+195) {
tmp = y * x;
} else if (y <= -8000.0) {
tmp = y * -0.5;
} else if (y <= 1.0) {
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 <= (-1.02d+290)) then
tmp = y * (-0.5d0)
else if (y <= (-1.22d+195)) then
tmp = y * x
else if (y <= (-8000.0d0)) then
tmp = y * (-0.5d0)
else if (y <= 1.0d0) 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 <= -1.02e+290) {
tmp = y * -0.5;
} else if (y <= -1.22e+195) {
tmp = y * x;
} else if (y <= -8000.0) {
tmp = y * -0.5;
} else if (y <= 1.0) {
tmp = 0.918938533204673 - x;
} else {
tmp = y * x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.02e+290: tmp = y * -0.5 elif y <= -1.22e+195: tmp = y * x elif y <= -8000.0: tmp = y * -0.5 elif y <= 1.0: tmp = 0.918938533204673 - x else: tmp = y * x return tmp
function code(x, y) tmp = 0.0 if (y <= -1.02e+290) tmp = Float64(y * -0.5); elseif (y <= -1.22e+195) tmp = Float64(y * x); elseif (y <= -8000.0) tmp = Float64(y * -0.5); elseif (y <= 1.0) 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 <= -1.02e+290) tmp = y * -0.5; elseif (y <= -1.22e+195) tmp = y * x; elseif (y <= -8000.0) tmp = y * -0.5; elseif (y <= 1.0) tmp = 0.918938533204673 - x; else tmp = y * x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.02e+290], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, -1.22e+195], N[(y * x), $MachinePrecision], If[LessEqual[y, -8000.0], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 1.0], N[(0.918938533204673 - x), $MachinePrecision], N[(y * x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.02 \cdot 10^{+290}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq -1.22 \cdot 10^{+195}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq -8000:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;0.918938533204673 - x\\
\mathbf{else}:\\
\;\;\;\;y \cdot x\\
\end{array}
\end{array}
if y < -1.02e290 or -1.2200000000000001e195 < y < -8e3Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 98.0%
Taylor expanded in x around 0 64.2%
*-commutative64.2%
Simplified64.2%
if -1.02e290 < y < -1.2200000000000001e195 or 1 < y Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 59.6%
Taylor expanded in y around inf 59.6%
*-commutative59.6%
Simplified59.6%
if -8e3 < y < 1Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 98.4%
neg-mul-198.4%
sub-neg98.4%
Simplified98.4%
(FPCore (x y) :precision binary64 (if (or (<= y -1.35) (not (<= y 1.0))) (* y (- x 0.5)) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((y <= -1.35) || !(y <= 1.0)) {
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.0d0))) 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.0)) {
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.0): 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.0)) 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.0))) 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.0]], $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\right):\\
\;\;\;\;y \cdot \left(x - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x\\
\end{array}
\end{array}
if y < -1.3500000000000001 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 97.0%
if -1.3500000000000001 < y < 1Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 99.0%
neg-mul-199.0%
sub-neg99.0%
Simplified99.0%
Final simplification98.1%
(FPCore (x y) :precision binary64 (if (or (<= x -1600.0) (not (<= x 0.92))) (- x) 0.918938533204673))
double code(double x, double y) {
double tmp;
if ((x <= -1600.0) || !(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 <= (-1600.0d0)) .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 <= -1600.0) || !(x <= 0.92)) {
tmp = -x;
} else {
tmp = 0.918938533204673;
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -1600.0) or not (x <= 0.92): tmp = -x else: tmp = 0.918938533204673 return tmp
function code(x, y) tmp = 0.0 if ((x <= -1600.0) || !(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 <= -1600.0) || ~((x <= 0.92))) tmp = -x; else tmp = 0.918938533204673; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -1600.0], N[Not[LessEqual[x, 0.92]], $MachinePrecision]], (-x), 0.918938533204673]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1600 \lor \neg \left(x \leq 0.92\right):\\
\;\;\;\;-x\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673\\
\end{array}
\end{array}
if x < -1600 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.2%
Taylor expanded in y around 0 52.0%
neg-mul-152.0%
Simplified52.0%
if -1600 < 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.1%
Taylor expanded in y around 0 54.1%
Final simplification53.1%
(FPCore (x y) :precision binary64 (+ 0.918938533204673 (- (* x (+ y -1.0)) (* y 0.5))))
double code(double x, double y) {
return 0.918938533204673 + ((x * (y + -1.0)) - (y * 0.5));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 0.918938533204673d0 + ((x * (y + (-1.0d0))) - (y * 0.5d0))
end function
public static double code(double x, double y) {
return 0.918938533204673 + ((x * (y + -1.0)) - (y * 0.5));
}
def code(x, y): return 0.918938533204673 + ((x * (y + -1.0)) - (y * 0.5))
function code(x, y) return Float64(0.918938533204673 + Float64(Float64(x * Float64(y + -1.0)) - Float64(y * 0.5))) end
function tmp = code(x, y) tmp = 0.918938533204673 + ((x * (y + -1.0)) - (y * 0.5)); end
code[x_, y_] := N[(0.918938533204673 + N[(N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision] - N[(y * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.918938533204673 + \left(x \cdot \left(y + -1\right) - y \cdot 0.5\right)
\end{array}
Initial program 100.0%
Final simplification100.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 x around 0 51.4%
Taylor expanded in y around 0 29.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 x around inf 90.4%
associate-*r/90.4%
metadata-eval90.4%
associate-*r/90.4%
Simplified90.4%
Taylor expanded in y around 0 54.2%
sub-neg54.2%
associate-*r/54.2%
metadata-eval54.2%
metadata-eval54.2%
Simplified54.2%
distribute-lft-in54.2%
fma-define54.2%
*-commutative54.2%
neg-mul-154.2%
fma-neg54.2%
frac-2neg54.2%
associate-*r/54.2%
metadata-eval54.2%
add-sqr-sqrt23.7%
sqrt-unprod33.5%
sqr-neg33.5%
sqrt-unprod15.3%
add-sqr-sqrt26.4%
Applied egg-rr26.4%
*-commutative26.4%
associate-/l*26.4%
*-inverses26.4%
metadata-eval26.4%
Simplified26.4%
Taylor expanded in x around 0 2.7%
herbie shell --seed 2024110
(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))