
(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 (- 0.918938533204673 (fma y (- 0.5 x) x)))
double code(double x, double y) {
return 0.918938533204673 - fma(y, (0.5 - x), x);
}
function code(x, y) return Float64(0.918938533204673 - fma(y, Float64(0.5 - x), x)) end
code[x_, y_] := N[(0.918938533204673 - N[(y * N[(0.5 - x), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.918938533204673 - \mathsf{fma}\left(y, 0.5 - x, x\right)
\end{array}
Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
(FPCore (x y)
:precision binary64
(if (<= y -5.2e+39)
(* y x)
(if (<= y -26.0)
(* y -0.5)
(if (<= y 7.2e-7)
(- 0.918938533204673 x)
(if (<= y 7.5e+173) (* x (+ y -1.0)) (* y -0.5))))))
double code(double x, double y) {
double tmp;
if (y <= -5.2e+39) {
tmp = y * x;
} else if (y <= -26.0) {
tmp = y * -0.5;
} else if (y <= 7.2e-7) {
tmp = 0.918938533204673 - x;
} else if (y <= 7.5e+173) {
tmp = x * (y + -1.0);
} 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 <= (-5.2d+39)) then
tmp = y * x
else if (y <= (-26.0d0)) then
tmp = y * (-0.5d0)
else if (y <= 7.2d-7) then
tmp = 0.918938533204673d0 - x
else if (y <= 7.5d+173) then
tmp = x * (y + (-1.0d0))
else
tmp = y * (-0.5d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -5.2e+39) {
tmp = y * x;
} else if (y <= -26.0) {
tmp = y * -0.5;
} else if (y <= 7.2e-7) {
tmp = 0.918938533204673 - x;
} else if (y <= 7.5e+173) {
tmp = x * (y + -1.0);
} else {
tmp = y * -0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -5.2e+39: tmp = y * x elif y <= -26.0: tmp = y * -0.5 elif y <= 7.2e-7: tmp = 0.918938533204673 - x elif y <= 7.5e+173: tmp = x * (y + -1.0) else: tmp = y * -0.5 return tmp
function code(x, y) tmp = 0.0 if (y <= -5.2e+39) tmp = Float64(y * x); elseif (y <= -26.0) tmp = Float64(y * -0.5); elseif (y <= 7.2e-7) tmp = Float64(0.918938533204673 - x); elseif (y <= 7.5e+173) tmp = Float64(x * Float64(y + -1.0)); else tmp = Float64(y * -0.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -5.2e+39) tmp = y * x; elseif (y <= -26.0) tmp = y * -0.5; elseif (y <= 7.2e-7) tmp = 0.918938533204673 - x; elseif (y <= 7.5e+173) tmp = x * (y + -1.0); else tmp = y * -0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -5.2e+39], N[(y * x), $MachinePrecision], If[LessEqual[y, -26.0], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 7.2e-7], N[(0.918938533204673 - x), $MachinePrecision], If[LessEqual[y, 7.5e+173], N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision], N[(y * -0.5), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.2 \cdot 10^{+39}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq -26:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 7.2 \cdot 10^{-7}:\\
\;\;\;\;0.918938533204673 - x\\
\mathbf{elif}\;y \leq 7.5 \cdot 10^{+173}:\\
\;\;\;\;x \cdot \left(y + -1\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot -0.5\\
\end{array}
\end{array}
if y < -5.2e39Initial program 99.9%
+-commutative99.9%
cancel-sign-sub-inv99.9%
+-commutative99.9%
associate-+r+99.9%
cancel-sign-sub-inv99.9%
associate-+l-99.9%
sub-neg99.9%
distribute-rgt-in99.9%
metadata-eval99.9%
neg-mul-199.9%
associate--r+99.9%
distribute-lft-out--100.0%
unsub-neg100.0%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
Taylor expanded in x around inf 58.1%
*-commutative58.1%
Simplified58.1%
if -5.2e39 < y < -26 or 7.5e173 < y Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--99.9%
unsub-neg99.9%
fmm-def99.9%
unsub-neg99.9%
remove-double-neg99.9%
Simplified99.9%
Taylor expanded in y around inf 99.0%
Taylor expanded in x around 0 74.4%
if -26 < y < 7.19999999999999989e-7Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 99.7%
if 7.19999999999999989e-7 < y < 7.5e173Initial program 99.9%
+-commutative99.9%
cancel-sign-sub-inv99.9%
+-commutative99.9%
associate-+r+99.9%
cancel-sign-sub-inv99.9%
associate-+l-99.9%
sub-neg99.9%
distribute-rgt-in99.9%
metadata-eval99.9%
neg-mul-199.9%
associate--r+99.9%
distribute-lft-out--99.9%
unsub-neg99.9%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around inf 68.7%
mul-1-neg68.7%
neg-sub068.7%
mul-1-neg68.7%
distribute-rgt-in68.7%
fma-define68.7%
distribute-lft-neg-in68.7%
fmm-def68.7%
*-lft-identity68.7%
associate-+l-68.7%
neg-sub068.7%
neg-mul-168.7%
distribute-rgt-in68.7%
+-commutative68.7%
Simplified68.7%
(FPCore (x y)
:precision binary64
(if (<= y -2.4e+42)
(* y x)
(if (<= y -210.0)
(* y -0.5)
(if (<= y 1.2)
(- 0.918938533204673 x)
(if (<= y 1.26e+175) (* y x) (* y -0.5))))))
double code(double x, double y) {
double tmp;
if (y <= -2.4e+42) {
tmp = y * x;
} else if (y <= -210.0) {
tmp = y * -0.5;
} else if (y <= 1.2) {
tmp = 0.918938533204673 - x;
} else if (y <= 1.26e+175) {
tmp = y * x;
} else {
tmp = y * -0.5;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-2.4d+42)) then
tmp = y * x
else if (y <= (-210.0d0)) then
tmp = y * (-0.5d0)
else if (y <= 1.2d0) then
tmp = 0.918938533204673d0 - x
else if (y <= 1.26d+175) then
tmp = y * x
else
tmp = y * (-0.5d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -2.4e+42) {
tmp = y * x;
} else if (y <= -210.0) {
tmp = y * -0.5;
} else if (y <= 1.2) {
tmp = 0.918938533204673 - x;
} else if (y <= 1.26e+175) {
tmp = y * x;
} else {
tmp = y * -0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -2.4e+42: tmp = y * x elif y <= -210.0: tmp = y * -0.5 elif y <= 1.2: tmp = 0.918938533204673 - x elif y <= 1.26e+175: tmp = y * x else: tmp = y * -0.5 return tmp
function code(x, y) tmp = 0.0 if (y <= -2.4e+42) tmp = Float64(y * x); elseif (y <= -210.0) tmp = Float64(y * -0.5); elseif (y <= 1.2) tmp = Float64(0.918938533204673 - x); elseif (y <= 1.26e+175) tmp = Float64(y * x); else tmp = Float64(y * -0.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -2.4e+42) tmp = y * x; elseif (y <= -210.0) tmp = y * -0.5; elseif (y <= 1.2) tmp = 0.918938533204673 - x; elseif (y <= 1.26e+175) tmp = y * x; else tmp = y * -0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -2.4e+42], N[(y * x), $MachinePrecision], If[LessEqual[y, -210.0], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 1.2], N[(0.918938533204673 - x), $MachinePrecision], If[LessEqual[y, 1.26e+175], N[(y * x), $MachinePrecision], N[(y * -0.5), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.4 \cdot 10^{+42}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq -210:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 1.2:\\
\;\;\;\;0.918938533204673 - x\\
\mathbf{elif}\;y \leq 1.26 \cdot 10^{+175}:\\
\;\;\;\;y \cdot x\\
\mathbf{else}:\\
\;\;\;\;y \cdot -0.5\\
\end{array}
\end{array}
if y < -2.3999999999999999e42 or 1.19999999999999996 < y < 1.26e175Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in99.9%
metadata-eval99.9%
neg-mul-199.9%
associate--r+99.9%
distribute-lft-out--100.0%
unsub-neg100.0%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around inf 98.3%
Taylor expanded in x around inf 60.3%
*-commutative60.3%
Simplified60.3%
if -2.3999999999999999e42 < y < -210 or 1.26e175 < y Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--99.9%
unsub-neg99.9%
fmm-def99.9%
unsub-neg99.9%
remove-double-neg99.9%
Simplified99.9%
Taylor expanded in y around inf 99.0%
Taylor expanded in x around 0 74.4%
if -210 < y < 1.19999999999999996Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 99.3%
(FPCore (x y)
:precision binary64
(if (<= y -1.8e+42)
(* y x)
(if (<= y -1.25)
(* y -0.5)
(if (<= y 1.0) (- x) (if (<= y 1.8e+170) (* y x) (* y -0.5))))))
double code(double x, double y) {
double tmp;
if (y <= -1.8e+42) {
tmp = y * x;
} else if (y <= -1.25) {
tmp = y * -0.5;
} else if (y <= 1.0) {
tmp = -x;
} else if (y <= 1.8e+170) {
tmp = y * 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 <= (-1.8d+42)) then
tmp = y * x
else if (y <= (-1.25d0)) then
tmp = y * (-0.5d0)
else if (y <= 1.0d0) then
tmp = -x
else if (y <= 1.8d+170) then
tmp = y * x
else
tmp = y * (-0.5d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.8e+42) {
tmp = y * x;
} else if (y <= -1.25) {
tmp = y * -0.5;
} else if (y <= 1.0) {
tmp = -x;
} else if (y <= 1.8e+170) {
tmp = y * x;
} else {
tmp = y * -0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.8e+42: tmp = y * x elif y <= -1.25: tmp = y * -0.5 elif y <= 1.0: tmp = -x elif y <= 1.8e+170: tmp = y * x else: tmp = y * -0.5 return tmp
function code(x, y) tmp = 0.0 if (y <= -1.8e+42) tmp = Float64(y * x); elseif (y <= -1.25) tmp = Float64(y * -0.5); elseif (y <= 1.0) tmp = Float64(-x); elseif (y <= 1.8e+170) tmp = Float64(y * x); else tmp = Float64(y * -0.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.8e+42) tmp = y * x; elseif (y <= -1.25) tmp = y * -0.5; elseif (y <= 1.0) tmp = -x; elseif (y <= 1.8e+170) tmp = y * x; else tmp = y * -0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.8e+42], N[(y * x), $MachinePrecision], If[LessEqual[y, -1.25], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 1.0], (-x), If[LessEqual[y, 1.8e+170], N[(y * x), $MachinePrecision], N[(y * -0.5), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.8 \cdot 10^{+42}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq -1.25:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;-x\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{+170}:\\
\;\;\;\;y \cdot x\\
\mathbf{else}:\\
\;\;\;\;y \cdot -0.5\\
\end{array}
\end{array}
if y < -1.8e42 or 1 < y < 1.8e170Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in99.9%
metadata-eval99.9%
neg-mul-199.9%
associate--r+99.9%
distribute-lft-out--100.0%
unsub-neg100.0%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around inf 98.3%
Taylor expanded in x around inf 60.3%
*-commutative60.3%
Simplified60.3%
if -1.8e42 < y < -1.25 or 1.8e170 < y Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--99.9%
unsub-neg99.9%
fmm-def99.9%
unsub-neg99.9%
remove-double-neg99.9%
Simplified99.9%
Taylor expanded in y around inf 99.0%
Taylor expanded in x around 0 74.4%
if -1.25 < y < 1Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 99.3%
Taylor expanded in x around inf 52.8%
neg-mul-152.8%
Simplified52.8%
(FPCore (x y) :precision binary64 (if (or (<= y -5.2e-9) (not (<= y 0.000155))) (+ (* y x) (- 0.918938533204673 (* y 0.5))) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((y <= -5.2e-9) || !(y <= 0.000155)) {
tmp = (y * x) + (0.918938533204673 - (y * 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 <= (-5.2d-9)) .or. (.not. (y <= 0.000155d0))) then
tmp = (y * x) + (0.918938533204673d0 - (y * 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 <= -5.2e-9) || !(y <= 0.000155)) {
tmp = (y * x) + (0.918938533204673 - (y * 0.5));
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -5.2e-9) or not (y <= 0.000155): tmp = (y * x) + (0.918938533204673 - (y * 0.5)) else: tmp = 0.918938533204673 - x return tmp
function code(x, y) tmp = 0.0 if ((y <= -5.2e-9) || !(y <= 0.000155)) tmp = Float64(Float64(y * x) + Float64(0.918938533204673 - Float64(y * 0.5))); else tmp = Float64(0.918938533204673 - x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -5.2e-9) || ~((y <= 0.000155))) tmp = (y * x) + (0.918938533204673 - (y * 0.5)); else tmp = 0.918938533204673 - x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -5.2e-9], N[Not[LessEqual[y, 0.000155]], $MachinePrecision]], N[(N[(y * x), $MachinePrecision] + N[(0.918938533204673 - N[(y * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.918938533204673 - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.2 \cdot 10^{-9} \lor \neg \left(y \leq 0.000155\right):\\
\;\;\;\;y \cdot x + \left(0.918938533204673 - y \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x\\
\end{array}
\end{array}
if y < -5.2000000000000002e-9 or 1.55e-4 < y Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 98.9%
if -5.2000000000000002e-9 < y < 1.55e-4Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 99.3%
Final simplification99.1%
(FPCore (x y) :precision binary64 (if (or (<= y -1.25) (not (<= y 1.55))) (* y (- x 0.5)) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((y <= -1.25) || !(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.25d0)) .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.25) || !(y <= 1.55)) {
tmp = y * (x - 0.5);
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.25) or not (y <= 1.55): tmp = y * (x - 0.5) else: tmp = 0.918938533204673 - x return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.25) || !(y <= 1.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.25) || ~((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.25], 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.25 \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.25 or 1.55000000000000004 < y Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around inf 98.5%
if -1.25 < y < 1.55000000000000004Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 99.3%
Final simplification99.0%
(FPCore (x y) :precision binary64 (if (or (<= y -45.0) (not (<= y 1.3))) (* y -0.5) (- x)))
double code(double x, double y) {
double tmp;
if ((y <= -45.0) || !(y <= 1.3)) {
tmp = y * -0.5;
} 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 ((y <= (-45.0d0)) .or. (.not. (y <= 1.3d0))) then
tmp = y * (-0.5d0)
else
tmp = -x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -45.0) || !(y <= 1.3)) {
tmp = y * -0.5;
} else {
tmp = -x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -45.0) or not (y <= 1.3): tmp = y * -0.5 else: tmp = -x return tmp
function code(x, y) tmp = 0.0 if ((y <= -45.0) || !(y <= 1.3)) tmp = Float64(y * -0.5); else tmp = Float64(-x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -45.0) || ~((y <= 1.3))) tmp = y * -0.5; else tmp = -x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -45.0], N[Not[LessEqual[y, 1.3]], $MachinePrecision]], N[(y * -0.5), $MachinePrecision], (-x)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -45 \lor \neg \left(y \leq 1.3\right):\\
\;\;\;\;y \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;-x\\
\end{array}
\end{array}
if y < -45 or 1.30000000000000004 < y Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around inf 98.5%
Taylor expanded in x around 0 52.7%
if -45 < y < 1.30000000000000004Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 99.3%
Taylor expanded in x around inf 52.8%
neg-mul-152.8%
Simplified52.8%
Final simplification52.8%
(FPCore (x y) :precision binary64 (- (+ 0.918938533204673 (* y (- x 0.5))) x))
double code(double x, double y) {
return (0.918938533204673 + (y * (x - 0.5))) - x;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (0.918938533204673d0 + (y * (x - 0.5d0))) - x
end function
public static double code(double x, double y) {
return (0.918938533204673 + (y * (x - 0.5))) - x;
}
def code(x, y): return (0.918938533204673 + (y * (x - 0.5))) - x
function code(x, y) return Float64(Float64(0.918938533204673 + Float64(y * Float64(x - 0.5))) - x) end
function tmp = code(x, y) tmp = (0.918938533204673 + (y * (x - 0.5))) - x; end
code[x_, y_] := N[(N[(0.918938533204673 + N[(y * N[(x - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]
\begin{array}{l}
\\
\left(0.918938533204673 + y \cdot \left(x - 0.5\right)\right) - x
\end{array}
Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
(FPCore (x y) :precision binary64 (- x))
double code(double x, double y) {
return -x;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = -x
end function
public static double code(double x, double y) {
return -x;
}
def code(x, y): return -x
function code(x, y) return Float64(-x) end
function tmp = code(x, y) tmp = -x; end
code[x_, y_] := (-x)
\begin{array}{l}
\\
-x
\end{array}
Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 55.5%
Taylor expanded in x around inf 30.1%
neg-mul-130.1%
Simplified30.1%
(FPCore (x y) :precision binary64 x)
double code(double x, double y) {
return x;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x
end function
public static double code(double x, double y) {
return x;
}
def code(x, y): return x
function code(x, y) return x end
function tmp = code(x, y) tmp = x; end
code[x_, y_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 55.5%
Taylor expanded in x around inf 30.1%
neg-mul-130.1%
Simplified30.1%
neg-sub030.1%
sub-neg30.1%
add-sqr-sqrt15.6%
sqrt-unprod16.2%
sqr-neg16.2%
sqrt-unprod1.5%
add-sqr-sqrt2.5%
Applied egg-rr2.5%
+-lft-identity2.5%
Simplified2.5%
herbie shell --seed 2024185
(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))