
(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 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (+ (- (* x (- y 1.0)) (* y 0.5)) 0.918938533204673))
double code(double x, double y) {
return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((x * (y - 1.0d0)) - (y * 0.5d0)) + 0.918938533204673d0
end function
public static double code(double x, double y) {
return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673;
}
def code(x, y): return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673
function code(x, y) return Float64(Float64(Float64(x * Float64(y - 1.0)) - Float64(y * 0.5)) + 0.918938533204673) end
function tmp = code(x, y) tmp = ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673; end
code[x_, y_] := N[(N[(N[(x * N[(y - 1.0), $MachinePrecision]), $MachinePrecision] - N[(y * 0.5), $MachinePrecision]), $MachinePrecision] + 0.918938533204673), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673
\end{array}
(FPCore (x y) :precision binary64 (+ (- (* x (+ y -1.0)) (* y 0.5)) 0.918938533204673))
double code(double x, double y) {
return ((x * (y + -1.0)) - (y * 0.5)) + 0.918938533204673;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((x * (y + (-1.0d0))) - (y * 0.5d0)) + 0.918938533204673d0
end function
public static double code(double x, double y) {
return ((x * (y + -1.0)) - (y * 0.5)) + 0.918938533204673;
}
def code(x, y): return ((x * (y + -1.0)) - (y * 0.5)) + 0.918938533204673
function code(x, y) return Float64(Float64(Float64(x * Float64(y + -1.0)) - Float64(y * 0.5)) + 0.918938533204673) end
function tmp = code(x, y) tmp = ((x * (y + -1.0)) - (y * 0.5)) + 0.918938533204673; end
code[x_, y_] := N[(N[(N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision] - N[(y * 0.5), $MachinePrecision]), $MachinePrecision] + 0.918938533204673), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \left(y + -1\right) - y \cdot 0.5\right) + 0.918938533204673
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(if (<= y -7.5e+131)
(* x y)
(if (<= y -550000.0)
(* y -0.5)
(if (<= y 1.7e-9)
(- 0.918938533204673 x)
(if (<= y 8e+58) (* x (+ y -1.0)) (* y -0.5))))))
double code(double x, double y) {
double tmp;
if (y <= -7.5e+131) {
tmp = x * y;
} else if (y <= -550000.0) {
tmp = y * -0.5;
} else if (y <= 1.7e-9) {
tmp = 0.918938533204673 - x;
} else if (y <= 8e+58) {
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 <= (-7.5d+131)) then
tmp = x * y
else if (y <= (-550000.0d0)) then
tmp = y * (-0.5d0)
else if (y <= 1.7d-9) then
tmp = 0.918938533204673d0 - x
else if (y <= 8d+58) 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 <= -7.5e+131) {
tmp = x * y;
} else if (y <= -550000.0) {
tmp = y * -0.5;
} else if (y <= 1.7e-9) {
tmp = 0.918938533204673 - x;
} else if (y <= 8e+58) {
tmp = x * (y + -1.0);
} else {
tmp = y * -0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -7.5e+131: tmp = x * y elif y <= -550000.0: tmp = y * -0.5 elif y <= 1.7e-9: tmp = 0.918938533204673 - x elif y <= 8e+58: tmp = x * (y + -1.0) else: tmp = y * -0.5 return tmp
function code(x, y) tmp = 0.0 if (y <= -7.5e+131) tmp = Float64(x * y); elseif (y <= -550000.0) tmp = Float64(y * -0.5); elseif (y <= 1.7e-9) tmp = Float64(0.918938533204673 - x); elseif (y <= 8e+58) 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 <= -7.5e+131) tmp = x * y; elseif (y <= -550000.0) tmp = y * -0.5; elseif (y <= 1.7e-9) tmp = 0.918938533204673 - x; elseif (y <= 8e+58) tmp = x * (y + -1.0); else tmp = y * -0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -7.5e+131], N[(x * y), $MachinePrecision], If[LessEqual[y, -550000.0], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 1.7e-9], N[(0.918938533204673 - x), $MachinePrecision], If[LessEqual[y, 8e+58], N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision], N[(y * -0.5), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.5 \cdot 10^{+131}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;y \leq -550000:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 1.7 \cdot 10^{-9}:\\
\;\;\;\;0.918938533204673 - x\\
\mathbf{elif}\;y \leq 8 \cdot 10^{+58}:\\
\;\;\;\;x \cdot \left(y + -1\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot -0.5\\
\end{array}
\end{array}
if y < -7.4999999999999995e131Initial 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 100.0%
Taylor expanded in x around inf 68.5%
*-commutative68.5%
Simplified68.5%
if -7.4999999999999995e131 < y < -5.5e5 or 7.99999999999999955e58 < 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.7%
Taylor expanded in x around 0 60.8%
if -5.5e5 < y < 1.6999999999999999e-9Initial 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 96.9%
if 1.6999999999999999e-9 < y < 7.99999999999999955e58Initial 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-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 x around inf 74.0%
mul-1-neg74.0%
neg-sub074.0%
mul-1-neg74.0%
distribute-rgt-in74.2%
fma-define74.2%
distribute-lft-neg-in74.2%
fmm-def74.2%
*-lft-identity74.2%
associate-+l-74.2%
neg-sub074.2%
neg-mul-174.2%
distribute-rgt-in74.0%
+-commutative74.0%
Simplified74.0%
Final simplification80.6%
(FPCore (x y)
:precision binary64
(if (<= y -2.55e+124)
(* x y)
(if (<= y -550000.0)
(* y -0.5)
(if (<= y 1.1)
(- 0.918938533204673 x)
(if (<= y 1.3e+59) (* x y) (* y -0.5))))))
double code(double x, double y) {
double tmp;
if (y <= -2.55e+124) {
tmp = x * y;
} else if (y <= -550000.0) {
tmp = y * -0.5;
} else if (y <= 1.1) {
tmp = 0.918938533204673 - x;
} else if (y <= 1.3e+59) {
tmp = x * y;
} 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.55d+124)) then
tmp = x * y
else if (y <= (-550000.0d0)) then
tmp = y * (-0.5d0)
else if (y <= 1.1d0) then
tmp = 0.918938533204673d0 - x
else if (y <= 1.3d+59) then
tmp = x * y
else
tmp = y * (-0.5d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -2.55e+124) {
tmp = x * y;
} else if (y <= -550000.0) {
tmp = y * -0.5;
} else if (y <= 1.1) {
tmp = 0.918938533204673 - x;
} else if (y <= 1.3e+59) {
tmp = x * y;
} else {
tmp = y * -0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -2.55e+124: tmp = x * y elif y <= -550000.0: tmp = y * -0.5 elif y <= 1.1: tmp = 0.918938533204673 - x elif y <= 1.3e+59: tmp = x * y else: tmp = y * -0.5 return tmp
function code(x, y) tmp = 0.0 if (y <= -2.55e+124) tmp = Float64(x * y); elseif (y <= -550000.0) tmp = Float64(y * -0.5); elseif (y <= 1.1) tmp = Float64(0.918938533204673 - x); elseif (y <= 1.3e+59) tmp = Float64(x * y); else tmp = Float64(y * -0.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -2.55e+124) tmp = x * y; elseif (y <= -550000.0) tmp = y * -0.5; elseif (y <= 1.1) tmp = 0.918938533204673 - x; elseif (y <= 1.3e+59) tmp = x * y; else tmp = y * -0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -2.55e+124], N[(x * y), $MachinePrecision], If[LessEqual[y, -550000.0], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 1.1], N[(0.918938533204673 - x), $MachinePrecision], If[LessEqual[y, 1.3e+59], N[(x * y), $MachinePrecision], N[(y * -0.5), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.55 \cdot 10^{+124}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;y \leq -550000:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 1.1:\\
\;\;\;\;0.918938533204673 - x\\
\mathbf{elif}\;y \leq 1.3 \cdot 10^{+59}:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;y \cdot -0.5\\
\end{array}
\end{array}
if y < -2.5499999999999999e124 or 1.1000000000000001 < y < 1.3e59Initial 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 99.6%
Taylor expanded in x around inf 68.8%
*-commutative68.8%
Simplified68.8%
if -2.5499999999999999e124 < y < -5.5e5 or 1.3e59 < 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.7%
Taylor expanded in x around 0 60.8%
if -5.5e5 < y < 1.1000000000000001Initial 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 96.5%
Final simplification80.3%
(FPCore (x y)
:precision binary64
(if (<= y -4.3e+126)
(* x y)
(if (<= y -0.09)
(* y -0.5)
(if (<= y 1.0) (- x) (if (<= y 1.9e+58) (* x y) (* y -0.5))))))
double code(double x, double y) {
double tmp;
if (y <= -4.3e+126) {
tmp = x * y;
} else if (y <= -0.09) {
tmp = y * -0.5;
} else if (y <= 1.0) {
tmp = -x;
} else if (y <= 1.9e+58) {
tmp = x * y;
} else {
tmp = y * -0.5;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-4.3d+126)) then
tmp = x * y
else if (y <= (-0.09d0)) then
tmp = y * (-0.5d0)
else if (y <= 1.0d0) then
tmp = -x
else if (y <= 1.9d+58) then
tmp = x * y
else
tmp = y * (-0.5d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -4.3e+126) {
tmp = x * y;
} else if (y <= -0.09) {
tmp = y * -0.5;
} else if (y <= 1.0) {
tmp = -x;
} else if (y <= 1.9e+58) {
tmp = x * y;
} else {
tmp = y * -0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -4.3e+126: tmp = x * y elif y <= -0.09: tmp = y * -0.5 elif y <= 1.0: tmp = -x elif y <= 1.9e+58: tmp = x * y else: tmp = y * -0.5 return tmp
function code(x, y) tmp = 0.0 if (y <= -4.3e+126) tmp = Float64(x * y); elseif (y <= -0.09) tmp = Float64(y * -0.5); elseif (y <= 1.0) tmp = Float64(-x); elseif (y <= 1.9e+58) tmp = Float64(x * y); else tmp = Float64(y * -0.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -4.3e+126) tmp = x * y; elseif (y <= -0.09) tmp = y * -0.5; elseif (y <= 1.0) tmp = -x; elseif (y <= 1.9e+58) tmp = x * y; else tmp = y * -0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -4.3e+126], N[(x * y), $MachinePrecision], If[LessEqual[y, -0.09], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 1.0], (-x), If[LessEqual[y, 1.9e+58], N[(x * y), $MachinePrecision], N[(y * -0.5), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.3 \cdot 10^{+126}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;y \leq -0.09:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;-x\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{+58}:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;y \cdot -0.5\\
\end{array}
\end{array}
if y < -4.3000000000000002e126 or 1 < y < 1.8999999999999999e58Initial 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 99.6%
Taylor expanded in x around inf 68.8%
*-commutative68.8%
Simplified68.8%
if -4.3000000000000002e126 < y < -0.089999999999999997 or 1.8999999999999999e58 < 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 97.1%
Taylor expanded in x around 0 59.6%
if -0.089999999999999997 < 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 97.7%
Taylor expanded in x around inf 45.3%
neg-mul-145.3%
Simplified45.3%
Final simplification53.9%
(FPCore (x y) :precision binary64 (if (or (<= x -2800.0) (not (<= x 4200000.0))) (* x (+ y -1.0)) (- (* x y) (- (* y 0.5) 0.918938533204673))))
double code(double x, double y) {
double tmp;
if ((x <= -2800.0) || !(x <= 4200000.0)) {
tmp = x * (y + -1.0);
} else {
tmp = (x * y) - ((y * 0.5) - 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 <= (-2800.0d0)) .or. (.not. (x <= 4200000.0d0))) then
tmp = x * (y + (-1.0d0))
else
tmp = (x * y) - ((y * 0.5d0) - 0.918938533204673d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -2800.0) || !(x <= 4200000.0)) {
tmp = x * (y + -1.0);
} else {
tmp = (x * y) - ((y * 0.5) - 0.918938533204673);
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -2800.0) or not (x <= 4200000.0): tmp = x * (y + -1.0) else: tmp = (x * y) - ((y * 0.5) - 0.918938533204673) return tmp
function code(x, y) tmp = 0.0 if ((x <= -2800.0) || !(x <= 4200000.0)) tmp = Float64(x * Float64(y + -1.0)); else tmp = Float64(Float64(x * y) - Float64(Float64(y * 0.5) - 0.918938533204673)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -2800.0) || ~((x <= 4200000.0))) tmp = x * (y + -1.0); else tmp = (x * y) - ((y * 0.5) - 0.918938533204673); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -2800.0], N[Not[LessEqual[x, 4200000.0]], $MachinePrecision]], N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] - N[(N[(y * 0.5), $MachinePrecision] - 0.918938533204673), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2800 \lor \neg \left(x \leq 4200000\right):\\
\;\;\;\;x \cdot \left(y + -1\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot y - \left(y \cdot 0.5 - 0.918938533204673\right)\\
\end{array}
\end{array}
if x < -2800 or 4.2e6 < x 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 x around inf 98.1%
mul-1-neg98.1%
neg-sub098.1%
mul-1-neg98.1%
distribute-rgt-in98.1%
fma-define98.1%
distribute-lft-neg-in98.1%
fmm-def98.1%
*-lft-identity98.1%
associate-+l-98.1%
neg-sub098.1%
neg-mul-198.1%
distribute-rgt-in98.1%
+-commutative98.1%
Simplified98.1%
if -2800 < x < 4.2e6Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 99.7%
Final simplification98.9%
(FPCore (x y) :precision binary64 (if (or (<= x -0.66) (not (<= x 0.75))) (* x (+ y -1.0)) (- 0.918938533204673 (* y 0.5))))
double code(double x, double y) {
double tmp;
if ((x <= -0.66) || !(x <= 0.75)) {
tmp = x * (y + -1.0);
} else {
tmp = 0.918938533204673 - (y * 0.5);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((x <= (-0.66d0)) .or. (.not. (x <= 0.75d0))) then
tmp = x * (y + (-1.0d0))
else
tmp = 0.918938533204673d0 - (y * 0.5d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -0.66) || !(x <= 0.75)) {
tmp = x * (y + -1.0);
} else {
tmp = 0.918938533204673 - (y * 0.5);
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -0.66) or not (x <= 0.75): tmp = x * (y + -1.0) else: tmp = 0.918938533204673 - (y * 0.5) return tmp
function code(x, y) tmp = 0.0 if ((x <= -0.66) || !(x <= 0.75)) tmp = Float64(x * Float64(y + -1.0)); else tmp = Float64(0.918938533204673 - Float64(y * 0.5)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -0.66) || ~((x <= 0.75))) tmp = x * (y + -1.0); else tmp = 0.918938533204673 - (y * 0.5); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -0.66], N[Not[LessEqual[x, 0.75]], $MachinePrecision]], N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision], N[(0.918938533204673 - N[(y * 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.66 \lor \neg \left(x \leq 0.75\right):\\
\;\;\;\;x \cdot \left(y + -1\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - y \cdot 0.5\\
\end{array}
\end{array}
if x < -0.660000000000000031 or 0.75 < x 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 x around inf 98.1%
mul-1-neg98.1%
neg-sub098.1%
mul-1-neg98.1%
distribute-rgt-in98.1%
fma-define98.1%
distribute-lft-neg-in98.1%
fmm-def98.1%
*-lft-identity98.1%
associate-+l-98.1%
neg-sub098.1%
neg-mul-198.1%
distribute-rgt-in98.1%
+-commutative98.1%
Simplified98.1%
if -0.660000000000000031 < x < 0.75Initial 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 x around 0 98.4%
*-commutative98.4%
Simplified98.4%
Final simplification98.3%
(FPCore (x y) :precision binary64 (if (or (<= y -1.45) (not (<= y 1.0))) (* y (- x 0.5)) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((y <= -1.45) || !(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.45d0)) .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.45) || !(y <= 1.0)) {
tmp = y * (x - 0.5);
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.45) 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.45) || !(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.45) || ~((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.45], 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.45 \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.44999999999999996 or 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%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around inf 98.5%
if -1.44999999999999996 < 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 97.1%
Final simplification97.8%
(FPCore (x y) :precision binary64 (if (or (<= x -0.08) (not (<= x 0.53))) (- x) (* y -0.5)))
double code(double x, double y) {
double tmp;
if ((x <= -0.08) || !(x <= 0.53)) {
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 <= (-0.08d0)) .or. (.not. (x <= 0.53d0))) 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 <= -0.08) || !(x <= 0.53)) {
tmp = -x;
} else {
tmp = y * -0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -0.08) or not (x <= 0.53): tmp = -x else: tmp = y * -0.5 return tmp
function code(x, y) tmp = 0.0 if ((x <= -0.08) || !(x <= 0.53)) tmp = Float64(-x); else tmp = Float64(y * -0.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -0.08) || ~((x <= 0.53))) tmp = -x; else tmp = y * -0.5; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -0.08], N[Not[LessEqual[x, 0.53]], $MachinePrecision]], (-x), N[(y * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.08 \lor \neg \left(x \leq 0.53\right):\\
\;\;\;\;-x\\
\mathbf{else}:\\
\;\;\;\;y \cdot -0.5\\
\end{array}
\end{array}
if x < -0.0800000000000000017 or 0.53000000000000003 < x 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 50.0%
Taylor expanded in x around inf 48.1%
neg-mul-148.1%
Simplified48.1%
if -0.0800000000000000017 < x < 0.53000000000000003Initial 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 49.6%
Taylor expanded in x around 0 48.3%
Final simplification48.2%
(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 51.1%
Taylor expanded in x around inf 24.5%
neg-mul-124.5%
Simplified24.5%
(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 51.1%
Taylor expanded in x around inf 24.5%
neg-mul-124.5%
Simplified24.5%
neg-sub024.5%
sub-neg24.5%
add-sqr-sqrt12.5%
sqrt-unprod10.2%
sqr-neg10.2%
sqrt-unprod1.3%
add-sqr-sqrt2.5%
Applied egg-rr2.5%
+-lft-identity2.5%
Simplified2.5%
herbie shell --seed 2024181
(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))