
(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 (- (* 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%
+-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%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
fma-udef100.0%
Applied egg-rr100.0%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(if (<= y -36000.0)
(* y (- x 0.5))
(if (<= y 1.0)
(- 0.918938533204673 (+ x (* y 0.5)))
(+ 0.918938533204673 (- (* y x) (* y 0.5))))))
double code(double x, double y) {
double tmp;
if (y <= -36000.0) {
tmp = y * (x - 0.5);
} else if (y <= 1.0) {
tmp = 0.918938533204673 - (x + (y * 0.5));
} else {
tmp = 0.918938533204673 + ((y * x) - (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 <= (-36000.0d0)) then
tmp = y * (x - 0.5d0)
else if (y <= 1.0d0) then
tmp = 0.918938533204673d0 - (x + (y * 0.5d0))
else
tmp = 0.918938533204673d0 + ((y * x) - (y * 0.5d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -36000.0) {
tmp = y * (x - 0.5);
} else if (y <= 1.0) {
tmp = 0.918938533204673 - (x + (y * 0.5));
} else {
tmp = 0.918938533204673 + ((y * x) - (y * 0.5));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -36000.0: tmp = y * (x - 0.5) elif y <= 1.0: tmp = 0.918938533204673 - (x + (y * 0.5)) else: tmp = 0.918938533204673 + ((y * x) - (y * 0.5)) return tmp
function code(x, y) tmp = 0.0 if (y <= -36000.0) tmp = Float64(y * Float64(x - 0.5)); elseif (y <= 1.0) tmp = Float64(0.918938533204673 - Float64(x + Float64(y * 0.5))); else tmp = Float64(0.918938533204673 + Float64(Float64(y * x) - Float64(y * 0.5))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -36000.0) tmp = y * (x - 0.5); elseif (y <= 1.0) tmp = 0.918938533204673 - (x + (y * 0.5)); else tmp = 0.918938533204673 + ((y * x) - (y * 0.5)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -36000.0], N[(y * N[(x - 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.0], N[(0.918938533204673 - N[(x + N[(y * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.918938533204673 + N[(N[(y * x), $MachinePrecision] - N[(y * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -36000:\\
\;\;\;\;y \cdot \left(x - 0.5\right)\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;0.918938533204673 - \left(x + y \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 + \left(y \cdot x - y \cdot 0.5\right)\\
\end{array}
\end{array}
if y < -36000Initial program 100.0%
Taylor expanded in y around inf 99.0%
if -36000 < 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%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
fma-udef100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 99.6%
if 1 < y Initial program 100.0%
Taylor expanded in y around inf 98.7%
Final simplification99.2%
(FPCore (x y)
:precision binary64
(if (<= y -1.0)
(* y x)
(if (<= y 4e-7)
(- x)
(if (or (<= y 6.3e+175) (not (<= y 2.1e+293))) (* y -0.5) (* y x)))))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = y * x;
} else if (y <= 4e-7) {
tmp = -x;
} else if ((y <= 6.3e+175) || !(y <= 2.1e+293)) {
tmp = y * -0.5;
} else {
tmp = y * x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-1.0d0)) then
tmp = y * x
else if (y <= 4d-7) then
tmp = -x
else if ((y <= 6.3d+175) .or. (.not. (y <= 2.1d+293))) then
tmp = y * (-0.5d0)
else
tmp = y * x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = y * x;
} else if (y <= 4e-7) {
tmp = -x;
} else if ((y <= 6.3e+175) || !(y <= 2.1e+293)) {
tmp = y * -0.5;
} else {
tmp = y * x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = y * x elif y <= 4e-7: tmp = -x elif (y <= 6.3e+175) or not (y <= 2.1e+293): tmp = y * -0.5 else: tmp = y * x return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = Float64(y * x); elseif (y <= 4e-7) tmp = Float64(-x); elseif ((y <= 6.3e+175) || !(y <= 2.1e+293)) tmp = Float64(y * -0.5); else tmp = Float64(y * x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.0) tmp = y * x; elseif (y <= 4e-7) tmp = -x; elseif ((y <= 6.3e+175) || ~((y <= 2.1e+293))) tmp = y * -0.5; else tmp = y * x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], N[(y * x), $MachinePrecision], If[LessEqual[y, 4e-7], (-x), If[Or[LessEqual[y, 6.3e+175], N[Not[LessEqual[y, 2.1e+293]], $MachinePrecision]], N[(y * -0.5), $MachinePrecision], N[(y * x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq 4 \cdot 10^{-7}:\\
\;\;\;\;-x\\
\mathbf{elif}\;y \leq 6.3 \cdot 10^{+175} \lor \neg \left(y \leq 2.1 \cdot 10^{+293}\right):\\
\;\;\;\;y \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;y \cdot x\\
\end{array}
\end{array}
if y < -1 or 6.2999999999999997e175 < y < 2.1e293Initial program 100.0%
Taylor expanded in y around inf 98.5%
Taylor expanded in x around inf 62.7%
*-commutative62.7%
Simplified62.7%
if -1 < y < 3.9999999999999998e-7Initial program 100.0%
Taylor expanded in x around inf 50.0%
Taylor expanded in y around 0 49.8%
neg-mul-149.8%
Simplified49.8%
if 3.9999999999999998e-7 < y < 6.2999999999999997e175 or 2.1e293 < y Initial program 100.0%
Taylor expanded in y around inf 93.3%
Taylor expanded in x around 0 57.6%
*-commutative57.6%
Simplified57.6%
Final simplification55.3%
(FPCore (x y)
:precision binary64
(if (<= y -15200.0)
(* y x)
(if (<= y 1.85)
(- 0.918938533204673 x)
(if (or (<= y 9e+176) (not (<= y 1.3e+295))) (* y -0.5) (* y x)))))
double code(double x, double y) {
double tmp;
if (y <= -15200.0) {
tmp = y * x;
} else if (y <= 1.85) {
tmp = 0.918938533204673 - x;
} else if ((y <= 9e+176) || !(y <= 1.3e+295)) {
tmp = y * -0.5;
} else {
tmp = y * x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-15200.0d0)) then
tmp = y * x
else if (y <= 1.85d0) then
tmp = 0.918938533204673d0 - x
else if ((y <= 9d+176) .or. (.not. (y <= 1.3d+295))) then
tmp = y * (-0.5d0)
else
tmp = y * x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -15200.0) {
tmp = y * x;
} else if (y <= 1.85) {
tmp = 0.918938533204673 - x;
} else if ((y <= 9e+176) || !(y <= 1.3e+295)) {
tmp = y * -0.5;
} else {
tmp = y * x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -15200.0: tmp = y * x elif y <= 1.85: tmp = 0.918938533204673 - x elif (y <= 9e+176) or not (y <= 1.3e+295): tmp = y * -0.5 else: tmp = y * x return tmp
function code(x, y) tmp = 0.0 if (y <= -15200.0) tmp = Float64(y * x); elseif (y <= 1.85) tmp = Float64(0.918938533204673 - x); elseif ((y <= 9e+176) || !(y <= 1.3e+295)) tmp = Float64(y * -0.5); else tmp = Float64(y * x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -15200.0) tmp = y * x; elseif (y <= 1.85) tmp = 0.918938533204673 - x; elseif ((y <= 9e+176) || ~((y <= 1.3e+295))) tmp = y * -0.5; else tmp = y * x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -15200.0], N[(y * x), $MachinePrecision], If[LessEqual[y, 1.85], N[(0.918938533204673 - x), $MachinePrecision], If[Or[LessEqual[y, 9e+176], N[Not[LessEqual[y, 1.3e+295]], $MachinePrecision]], N[(y * -0.5), $MachinePrecision], N[(y * x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -15200:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq 1.85:\\
\;\;\;\;0.918938533204673 - x\\
\mathbf{elif}\;y \leq 9 \cdot 10^{+176} \lor \neg \left(y \leq 1.3 \cdot 10^{+295}\right):\\
\;\;\;\;y \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;y \cdot x\\
\end{array}
\end{array}
if y < -15200 or 9.00000000000000007e176 < y < 1.29999999999999993e295Initial program 100.0%
Taylor expanded in y around inf 99.3%
Taylor expanded in x around inf 63.4%
*-commutative63.4%
Simplified63.4%
if -15200 < y < 1.8500000000000001Initial program 100.0%
Taylor expanded in y around 0 98.6%
neg-mul-198.6%
sub-neg98.6%
Simplified98.6%
if 1.8500000000000001 < y < 9.00000000000000007e176 or 1.29999999999999993e295 < y Initial program 100.0%
Taylor expanded in y around inf 95.2%
Taylor expanded in x around 0 58.7%
*-commutative58.7%
Simplified58.7%
Final simplification80.2%
(FPCore (x y)
:precision binary64
(if (<= y -6.4e-12)
(* x (+ y -1.0))
(if (<= y 1.85)
(- 0.918938533204673 x)
(if (or (<= y 4.2e+176) (not (<= y 5.5e+294))) (* y -0.5) (* y x)))))
double code(double x, double y) {
double tmp;
if (y <= -6.4e-12) {
tmp = x * (y + -1.0);
} else if (y <= 1.85) {
tmp = 0.918938533204673 - x;
} else if ((y <= 4.2e+176) || !(y <= 5.5e+294)) {
tmp = y * -0.5;
} else {
tmp = y * x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-6.4d-12)) then
tmp = x * (y + (-1.0d0))
else if (y <= 1.85d0) then
tmp = 0.918938533204673d0 - x
else if ((y <= 4.2d+176) .or. (.not. (y <= 5.5d+294))) then
tmp = y * (-0.5d0)
else
tmp = y * x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -6.4e-12) {
tmp = x * (y + -1.0);
} else if (y <= 1.85) {
tmp = 0.918938533204673 - x;
} else if ((y <= 4.2e+176) || !(y <= 5.5e+294)) {
tmp = y * -0.5;
} else {
tmp = y * x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -6.4e-12: tmp = x * (y + -1.0) elif y <= 1.85: tmp = 0.918938533204673 - x elif (y <= 4.2e+176) or not (y <= 5.5e+294): tmp = y * -0.5 else: tmp = y * x return tmp
function code(x, y) tmp = 0.0 if (y <= -6.4e-12) tmp = Float64(x * Float64(y + -1.0)); elseif (y <= 1.85) tmp = Float64(0.918938533204673 - x); elseif ((y <= 4.2e+176) || !(y <= 5.5e+294)) tmp = Float64(y * -0.5); else tmp = Float64(y * x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -6.4e-12) tmp = x * (y + -1.0); elseif (y <= 1.85) tmp = 0.918938533204673 - x; elseif ((y <= 4.2e+176) || ~((y <= 5.5e+294))) tmp = y * -0.5; else tmp = y * x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -6.4e-12], N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.85], N[(0.918938533204673 - x), $MachinePrecision], If[Or[LessEqual[y, 4.2e+176], N[Not[LessEqual[y, 5.5e+294]], $MachinePrecision]], N[(y * -0.5), $MachinePrecision], N[(y * x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.4 \cdot 10^{-12}:\\
\;\;\;\;x \cdot \left(y + -1\right)\\
\mathbf{elif}\;y \leq 1.85:\\
\;\;\;\;0.918938533204673 - x\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{+176} \lor \neg \left(y \leq 5.5 \cdot 10^{+294}\right):\\
\;\;\;\;y \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;y \cdot x\\
\end{array}
\end{array}
if y < -6.4000000000000002e-12Initial program 99.9%
Taylor expanded in x around inf 62.8%
if -6.4000000000000002e-12 < y < 1.8500000000000001Initial program 100.0%
Taylor expanded in y around 0 99.4%
neg-mul-199.4%
sub-neg99.4%
Simplified99.4%
if 1.8500000000000001 < y < 4.1999999999999998e176 or 5.4999999999999994e294 < y Initial program 100.0%
Taylor expanded in y around inf 95.2%
Taylor expanded in x around 0 58.7%
*-commutative58.7%
Simplified58.7%
if 4.1999999999999998e176 < y < 5.4999999999999994e294Initial program 100.0%
Taylor expanded in y around inf 100.0%
Taylor expanded in x around inf 66.2%
*-commutative66.2%
Simplified66.2%
Final simplification80.5%
(FPCore (x y) :precision binary64 (if (or (<= y -0.00032) (not (<= y 2.2e-15))) (+ 0.918938533204673 (* y (- x 0.5))) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((y <= -0.00032) || !(y <= 2.2e-15)) {
tmp = 0.918938533204673 + (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 <= (-0.00032d0)) .or. (.not. (y <= 2.2d-15))) then
tmp = 0.918938533204673d0 + (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 <= -0.00032) || !(y <= 2.2e-15)) {
tmp = 0.918938533204673 + (y * (x - 0.5));
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -0.00032) or not (y <= 2.2e-15): tmp = 0.918938533204673 + (y * (x - 0.5)) else: tmp = 0.918938533204673 - x return tmp
function code(x, y) tmp = 0.0 if ((y <= -0.00032) || !(y <= 2.2e-15)) tmp = Float64(0.918938533204673 + 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 <= -0.00032) || ~((y <= 2.2e-15))) tmp = 0.918938533204673 + (y * (x - 0.5)); else tmp = 0.918938533204673 - x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -0.00032], N[Not[LessEqual[y, 2.2e-15]], $MachinePrecision]], N[(0.918938533204673 + N[(y * N[(x - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.918938533204673 - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.00032 \lor \neg \left(y \leq 2.2 \cdot 10^{-15}\right):\\
\;\;\;\;0.918938533204673 + y \cdot \left(x - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x\\
\end{array}
\end{array}
if y < -3.20000000000000026e-4 or 2.19999999999999986e-15 < 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%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around inf 98.4%
if -3.20000000000000026e-4 < y < 2.19999999999999986e-15Initial program 100.0%
Taylor expanded in y around 0 99.7%
neg-mul-199.7%
sub-neg99.7%
Simplified99.7%
Final simplification99.1%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* y (- x 0.5))))
(if (<= y -510000.0)
t_0
(if (<= y 1.0)
(- 0.918938533204673 (+ x (* y 0.5)))
(+ 0.918938533204673 t_0)))))
double code(double x, double y) {
double t_0 = y * (x - 0.5);
double tmp;
if (y <= -510000.0) {
tmp = t_0;
} else if (y <= 1.0) {
tmp = 0.918938533204673 - (x + (y * 0.5));
} else {
tmp = 0.918938533204673 + 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 = y * (x - 0.5d0)
if (y <= (-510000.0d0)) then
tmp = t_0
else if (y <= 1.0d0) then
tmp = 0.918938533204673d0 - (x + (y * 0.5d0))
else
tmp = 0.918938533204673d0 + t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = y * (x - 0.5);
double tmp;
if (y <= -510000.0) {
tmp = t_0;
} else if (y <= 1.0) {
tmp = 0.918938533204673 - (x + (y * 0.5));
} else {
tmp = 0.918938533204673 + t_0;
}
return tmp;
}
def code(x, y): t_0 = y * (x - 0.5) tmp = 0 if y <= -510000.0: tmp = t_0 elif y <= 1.0: tmp = 0.918938533204673 - (x + (y * 0.5)) else: tmp = 0.918938533204673 + t_0 return tmp
function code(x, y) t_0 = Float64(y * Float64(x - 0.5)) tmp = 0.0 if (y <= -510000.0) tmp = t_0; elseif (y <= 1.0) tmp = Float64(0.918938533204673 - Float64(x + Float64(y * 0.5))); else tmp = Float64(0.918938533204673 + t_0); end return tmp end
function tmp_2 = code(x, y) t_0 = y * (x - 0.5); tmp = 0.0; if (y <= -510000.0) tmp = t_0; elseif (y <= 1.0) tmp = 0.918938533204673 - (x + (y * 0.5)); else tmp = 0.918938533204673 + t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(y * N[(x - 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -510000.0], t$95$0, If[LessEqual[y, 1.0], N[(0.918938533204673 - N[(x + N[(y * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.918938533204673 + t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \left(x - 0.5\right)\\
\mathbf{if}\;y \leq -510000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;0.918938533204673 - \left(x + y \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 + t_0\\
\end{array}
\end{array}
if y < -5.1e5Initial program 100.0%
Taylor expanded in y around inf 99.0%
if -5.1e5 < 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%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
fma-udef100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 99.6%
if 1 < 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%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around inf 98.7%
Final simplification99.2%
(FPCore (x y) :precision binary64 (if (or (<= y -1.25) (not (<= y 1.85))) (* y (- x 0.5)) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((y <= -1.25) || !(y <= 1.85)) {
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.85d0))) 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.85)) {
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.85): 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.85)) 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.85))) 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.85]], $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.85\right):\\
\;\;\;\;y \cdot \left(x - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x\\
\end{array}
\end{array}
if y < -1.25 or 1.8500000000000001 < y Initial program 100.0%
Taylor expanded in y around inf 97.2%
if -1.25 < y < 1.8500000000000001Initial program 100.0%
Taylor expanded in y around 0 99.2%
neg-mul-199.2%
sub-neg99.2%
Simplified99.2%
Final simplification98.2%
(FPCore (x y) :precision binary64 (if (or (<= x -3.1e-9) (not (<= x 0.9))) (- x) (* y -0.5)))
double code(double x, double y) {
double tmp;
if ((x <= -3.1e-9) || !(x <= 0.9)) {
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 ((x <= (-3.1d-9)) .or. (.not. (x <= 0.9d0))) 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 ((x <= -3.1e-9) || !(x <= 0.9)) {
tmp = -x;
} else {
tmp = y * -0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -3.1e-9) or not (x <= 0.9): tmp = -x else: tmp = y * -0.5 return tmp
function code(x, y) tmp = 0.0 if ((x <= -3.1e-9) || !(x <= 0.9)) tmp = Float64(-x); else tmp = Float64(y * -0.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -3.1e-9) || ~((x <= 0.9))) tmp = -x; else tmp = y * -0.5; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -3.1e-9], N[Not[LessEqual[x, 0.9]], $MachinePrecision]], (-x), N[(y * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.1 \cdot 10^{-9} \lor \neg \left(x \leq 0.9\right):\\
\;\;\;\;-x\\
\mathbf{else}:\\
\;\;\;\;y \cdot -0.5\\
\end{array}
\end{array}
if x < -3.10000000000000005e-9 or 0.900000000000000022 < x Initial program 100.0%
Taylor expanded in x around inf 95.9%
Taylor expanded in y around 0 47.4%
neg-mul-147.4%
Simplified47.4%
if -3.10000000000000005e-9 < x < 0.900000000000000022Initial program 100.0%
Taylor expanded in y around inf 49.1%
Taylor expanded in x around 0 48.1%
*-commutative48.1%
Simplified48.1%
Final simplification47.7%
(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%
Taylor expanded in x around inf 51.9%
Taylor expanded in y around 0 26.3%
neg-mul-126.3%
Simplified26.3%
Final simplification26.3%
herbie shell --seed 2023336
(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))