
(FPCore (x y) :precision binary64 (/ (- x y) (- 1.0 y)))
double code(double x, double y) {
return (x - y) / (1.0 - y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x - y) / (1.0d0 - y)
end function
public static double code(double x, double y) {
return (x - y) / (1.0 - y);
}
def code(x, y): return (x - y) / (1.0 - y)
function code(x, y) return Float64(Float64(x - y) / Float64(1.0 - y)) end
function tmp = code(x, y) tmp = (x - y) / (1.0 - y); end
code[x_, y_] := N[(N[(x - y), $MachinePrecision] / N[(1.0 - y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{1 - y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (/ (- x y) (- 1.0 y)))
double code(double x, double y) {
return (x - y) / (1.0 - y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x - y) / (1.0d0 - y)
end function
public static double code(double x, double y) {
return (x - y) / (1.0 - y);
}
def code(x, y): return (x - y) / (1.0 - y)
function code(x, y) return Float64(Float64(x - y) / Float64(1.0 - y)) end
function tmp = code(x, y) tmp = (x - y) / (1.0 - y); end
code[x_, y_] := N[(N[(x - y), $MachinePrecision] / N[(1.0 - y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{1 - y}
\end{array}
(FPCore (x y) :precision binary64 (/ (- x y) (- 1.0 y)))
double code(double x, double y) {
return (x - y) / (1.0 - y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x - y) / (1.0d0 - y)
end function
public static double code(double x, double y) {
return (x - y) / (1.0 - y);
}
def code(x, y): return (x - y) / (1.0 - y)
function code(x, y) return Float64(Float64(x - y) / Float64(1.0 - y)) end
function tmp = code(x, y) tmp = (x - y) / (1.0 - y); end
code[x_, y_] := N[(N[(x - y), $MachinePrecision] / N[(1.0 - y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{1 - y}
\end{array}
Initial program 100.0%
(FPCore (x y)
:precision binary64
(if (<= y -6000.0)
(+ 1.0 (/ (- 1.0 x) y))
(if (<= y -2.95e-31)
(/ y (+ y -1.0))
(if (<= y 6.6e+15) (/ x (- 1.0 y)) (- 1.0 (/ x y))))))
double code(double x, double y) {
double tmp;
if (y <= -6000.0) {
tmp = 1.0 + ((1.0 - x) / y);
} else if (y <= -2.95e-31) {
tmp = y / (y + -1.0);
} else if (y <= 6.6e+15) {
tmp = x / (1.0 - y);
} else {
tmp = 1.0 - (x / y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-6000.0d0)) then
tmp = 1.0d0 + ((1.0d0 - x) / y)
else if (y <= (-2.95d-31)) then
tmp = y / (y + (-1.0d0))
else if (y <= 6.6d+15) then
tmp = x / (1.0d0 - y)
else
tmp = 1.0d0 - (x / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -6000.0) {
tmp = 1.0 + ((1.0 - x) / y);
} else if (y <= -2.95e-31) {
tmp = y / (y + -1.0);
} else if (y <= 6.6e+15) {
tmp = x / (1.0 - y);
} else {
tmp = 1.0 - (x / y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -6000.0: tmp = 1.0 + ((1.0 - x) / y) elif y <= -2.95e-31: tmp = y / (y + -1.0) elif y <= 6.6e+15: tmp = x / (1.0 - y) else: tmp = 1.0 - (x / y) return tmp
function code(x, y) tmp = 0.0 if (y <= -6000.0) tmp = Float64(1.0 + Float64(Float64(1.0 - x) / y)); elseif (y <= -2.95e-31) tmp = Float64(y / Float64(y + -1.0)); elseif (y <= 6.6e+15) tmp = Float64(x / Float64(1.0 - y)); else tmp = Float64(1.0 - Float64(x / y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -6000.0) tmp = 1.0 + ((1.0 - x) / y); elseif (y <= -2.95e-31) tmp = y / (y + -1.0); elseif (y <= 6.6e+15) tmp = x / (1.0 - y); else tmp = 1.0 - (x / y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -6000.0], N[(1.0 + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -2.95e-31], N[(y / N[(y + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.6e+15], N[(x / N[(1.0 - y), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6000:\\
\;\;\;\;1 + \frac{1 - x}{y}\\
\mathbf{elif}\;y \leq -2.95 \cdot 10^{-31}:\\
\;\;\;\;\frac{y}{y + -1}\\
\mathbf{elif}\;y \leq 6.6 \cdot 10^{+15}:\\
\;\;\;\;\frac{x}{1 - y}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{y}\\
\end{array}
\end{array}
if y < -6e3Initial program 100.0%
Taylor expanded in y around inf 97.1%
+-commutative97.1%
mul-1-neg97.1%
sub-neg97.1%
div-sub97.1%
Simplified97.1%
if -6e3 < y < -2.95000000000000016e-31Initial program 99.8%
Taylor expanded in x around 0 90.3%
neg-mul-190.3%
distribute-neg-frac290.3%
neg-sub090.3%
associate--r-90.3%
metadata-eval90.3%
Simplified90.3%
if -2.95000000000000016e-31 < y < 6.6e15Initial program 100.0%
Taylor expanded in x around inf 72.3%
if 6.6e15 < y Initial program 100.0%
add-cube-cbrt98.1%
pow398.2%
Applied egg-rr98.2%
Taylor expanded in y around inf 100.0%
+-commutative100.0%
mul-1-neg100.0%
sub-neg100.0%
div-sub100.0%
sub-neg100.0%
+-commutative100.0%
neg-mul-1100.0%
metadata-eval100.0%
distribute-lft-in100.0%
metadata-eval100.0%
sub-neg100.0%
associate-*r/100.0%
mul-1-neg100.0%
unsub-neg100.0%
sub-neg100.0%
remove-double-neg100.0%
distribute-neg-in100.0%
+-commutative100.0%
neg-mul-1100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
Final simplification85.6%
(FPCore (x y)
:precision binary64
(let* ((t_0 (- 1.0 (/ x y))))
(if (<= y -14500.0)
t_0
(if (<= y -9e-36)
(/ y (+ y -1.0))
(if (<= y 6.6e+15) (/ x (- 1.0 y)) t_0)))))
double code(double x, double y) {
double t_0 = 1.0 - (x / y);
double tmp;
if (y <= -14500.0) {
tmp = t_0;
} else if (y <= -9e-36) {
tmp = y / (y + -1.0);
} else if (y <= 6.6e+15) {
tmp = x / (1.0 - y);
} else {
tmp = 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 = 1.0d0 - (x / y)
if (y <= (-14500.0d0)) then
tmp = t_0
else if (y <= (-9d-36)) then
tmp = y / (y + (-1.0d0))
else if (y <= 6.6d+15) then
tmp = x / (1.0d0 - y)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 - (x / y);
double tmp;
if (y <= -14500.0) {
tmp = t_0;
} else if (y <= -9e-36) {
tmp = y / (y + -1.0);
} else if (y <= 6.6e+15) {
tmp = x / (1.0 - y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 - (x / y) tmp = 0 if y <= -14500.0: tmp = t_0 elif y <= -9e-36: tmp = y / (y + -1.0) elif y <= 6.6e+15: tmp = x / (1.0 - y) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 - Float64(x / y)) tmp = 0.0 if (y <= -14500.0) tmp = t_0; elseif (y <= -9e-36) tmp = Float64(y / Float64(y + -1.0)); elseif (y <= 6.6e+15) tmp = Float64(x / Float64(1.0 - y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 - (x / y); tmp = 0.0; if (y <= -14500.0) tmp = t_0; elseif (y <= -9e-36) tmp = y / (y + -1.0); elseif (y <= 6.6e+15) tmp = x / (1.0 - y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -14500.0], t$95$0, If[LessEqual[y, -9e-36], N[(y / N[(y + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.6e+15], N[(x / N[(1.0 - y), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \frac{x}{y}\\
\mathbf{if}\;y \leq -14500:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -9 \cdot 10^{-36}:\\
\;\;\;\;\frac{y}{y + -1}\\
\mathbf{elif}\;y \leq 6.6 \cdot 10^{+15}:\\
\;\;\;\;\frac{x}{1 - y}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -14500 or 6.6e15 < y Initial program 100.0%
add-cube-cbrt98.1%
pow398.1%
Applied egg-rr98.1%
Taylor expanded in y around inf 98.8%
+-commutative98.8%
mul-1-neg98.8%
sub-neg98.8%
div-sub98.8%
sub-neg98.8%
+-commutative98.8%
neg-mul-198.8%
metadata-eval98.8%
distribute-lft-in98.8%
metadata-eval98.8%
sub-neg98.8%
associate-*r/98.8%
mul-1-neg98.8%
unsub-neg98.8%
sub-neg98.8%
remove-double-neg98.8%
distribute-neg-in98.8%
+-commutative98.8%
neg-mul-198.8%
Simplified98.8%
Taylor expanded in x around inf 98.8%
if -14500 < y < -9.00000000000000047e-36Initial program 99.8%
Taylor expanded in x around 0 90.3%
neg-mul-190.3%
distribute-neg-frac290.3%
neg-sub090.3%
associate--r-90.3%
metadata-eval90.3%
Simplified90.3%
if -9.00000000000000047e-36 < y < 6.6e15Initial program 100.0%
Taylor expanded in x around inf 72.3%
Final simplification85.6%
(FPCore (x y)
:precision binary64
(let* ((t_0 (- 1.0 (/ x y))))
(if (<= y -0.215)
t_0
(if (<= y -5.5e-30)
(* y (- -1.0 y))
(if (<= y 6.6e+15) (/ x (- 1.0 y)) t_0)))))
double code(double x, double y) {
double t_0 = 1.0 - (x / y);
double tmp;
if (y <= -0.215) {
tmp = t_0;
} else if (y <= -5.5e-30) {
tmp = y * (-1.0 - y);
} else if (y <= 6.6e+15) {
tmp = x / (1.0 - y);
} else {
tmp = 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 = 1.0d0 - (x / y)
if (y <= (-0.215d0)) then
tmp = t_0
else if (y <= (-5.5d-30)) then
tmp = y * ((-1.0d0) - y)
else if (y <= 6.6d+15) then
tmp = x / (1.0d0 - y)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 - (x / y);
double tmp;
if (y <= -0.215) {
tmp = t_0;
} else if (y <= -5.5e-30) {
tmp = y * (-1.0 - y);
} else if (y <= 6.6e+15) {
tmp = x / (1.0 - y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 - (x / y) tmp = 0 if y <= -0.215: tmp = t_0 elif y <= -5.5e-30: tmp = y * (-1.0 - y) elif y <= 6.6e+15: tmp = x / (1.0 - y) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 - Float64(x / y)) tmp = 0.0 if (y <= -0.215) tmp = t_0; elseif (y <= -5.5e-30) tmp = Float64(y * Float64(-1.0 - y)); elseif (y <= 6.6e+15) tmp = Float64(x / Float64(1.0 - y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 - (x / y); tmp = 0.0; if (y <= -0.215) tmp = t_0; elseif (y <= -5.5e-30) tmp = y * (-1.0 - y); elseif (y <= 6.6e+15) tmp = x / (1.0 - y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -0.215], t$95$0, If[LessEqual[y, -5.5e-30], N[(y * N[(-1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.6e+15], N[(x / N[(1.0 - y), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \frac{x}{y}\\
\mathbf{if}\;y \leq -0.215:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -5.5 \cdot 10^{-30}:\\
\;\;\;\;y \cdot \left(-1 - y\right)\\
\mathbf{elif}\;y \leq 6.6 \cdot 10^{+15}:\\
\;\;\;\;\frac{x}{1 - y}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -0.214999999999999997 or 6.6e15 < y Initial program 100.0%
add-cube-cbrt98.1%
pow398.1%
Applied egg-rr98.1%
Taylor expanded in y around inf 98.8%
+-commutative98.8%
mul-1-neg98.8%
sub-neg98.8%
div-sub98.8%
sub-neg98.8%
+-commutative98.8%
neg-mul-198.8%
metadata-eval98.8%
distribute-lft-in98.8%
metadata-eval98.8%
sub-neg98.8%
associate-*r/98.8%
mul-1-neg98.8%
unsub-neg98.8%
sub-neg98.8%
remove-double-neg98.8%
distribute-neg-in98.8%
+-commutative98.8%
neg-mul-198.8%
Simplified98.8%
Taylor expanded in x around inf 98.8%
if -0.214999999999999997 < y < -5.49999999999999976e-30Initial program 99.8%
Taylor expanded in x around 0 90.3%
neg-mul-190.3%
distribute-neg-frac290.3%
neg-sub090.3%
associate--r-90.3%
metadata-eval90.3%
Simplified90.3%
Taylor expanded in y around 0 84.3%
sub-neg84.3%
neg-mul-184.3%
metadata-eval84.3%
+-commutative84.3%
sub-neg84.3%
Simplified84.3%
if -5.49999999999999976e-30 < y < 6.6e15Initial program 100.0%
Taylor expanded in x around inf 72.3%
(FPCore (x y)
:precision binary64
(let* ((t_0 (- 1.0 (/ x y))))
(if (<= y -0.26)
t_0
(if (<= y -4.2e-40) (* y (- -1.0 y)) (if (<= y 1.0) x t_0)))))
double code(double x, double y) {
double t_0 = 1.0 - (x / y);
double tmp;
if (y <= -0.26) {
tmp = t_0;
} else if (y <= -4.2e-40) {
tmp = y * (-1.0 - y);
} else if (y <= 1.0) {
tmp = x;
} else {
tmp = 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 = 1.0d0 - (x / y)
if (y <= (-0.26d0)) then
tmp = t_0
else if (y <= (-4.2d-40)) then
tmp = y * ((-1.0d0) - y)
else if (y <= 1.0d0) then
tmp = x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 - (x / y);
double tmp;
if (y <= -0.26) {
tmp = t_0;
} else if (y <= -4.2e-40) {
tmp = y * (-1.0 - y);
} else if (y <= 1.0) {
tmp = x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 - (x / y) tmp = 0 if y <= -0.26: tmp = t_0 elif y <= -4.2e-40: tmp = y * (-1.0 - y) elif y <= 1.0: tmp = x else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 - Float64(x / y)) tmp = 0.0 if (y <= -0.26) tmp = t_0; elseif (y <= -4.2e-40) tmp = Float64(y * Float64(-1.0 - y)); elseif (y <= 1.0) tmp = x; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 - (x / y); tmp = 0.0; if (y <= -0.26) tmp = t_0; elseif (y <= -4.2e-40) tmp = y * (-1.0 - y); elseif (y <= 1.0) tmp = x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -0.26], t$95$0, If[LessEqual[y, -4.2e-40], N[(y * N[(-1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.0], x, t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \frac{x}{y}\\
\mathbf{if}\;y \leq -0.26:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -4.2 \cdot 10^{-40}:\\
\;\;\;\;y \cdot \left(-1 - y\right)\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -0.26000000000000001 or 1 < y Initial program 100.0%
add-cube-cbrt98.1%
pow398.1%
Applied egg-rr98.1%
Taylor expanded in y around inf 98.3%
+-commutative98.3%
mul-1-neg98.3%
sub-neg98.3%
div-sub98.3%
sub-neg98.3%
+-commutative98.3%
neg-mul-198.3%
metadata-eval98.3%
distribute-lft-in98.3%
metadata-eval98.3%
sub-neg98.3%
associate-*r/98.3%
mul-1-neg98.3%
unsub-neg98.3%
sub-neg98.3%
remove-double-neg98.3%
distribute-neg-in98.3%
+-commutative98.3%
neg-mul-198.3%
Simplified98.3%
Taylor expanded in x around inf 98.3%
if -0.26000000000000001 < y < -4.20000000000000036e-40Initial program 99.8%
Taylor expanded in x around 0 90.3%
neg-mul-190.3%
distribute-neg-frac290.3%
neg-sub090.3%
associate--r-90.3%
metadata-eval90.3%
Simplified90.3%
Taylor expanded in y around 0 84.3%
sub-neg84.3%
neg-mul-184.3%
metadata-eval84.3%
+-commutative84.3%
sub-neg84.3%
Simplified84.3%
if -4.20000000000000036e-40 < y < 1Initial program 100.0%
Taylor expanded in y around 0 71.8%
(FPCore (x y) :precision binary64 (if (<= y -49000.0) 1.0 (if (<= y -4.6e-31) (* y (- -1.0 y)) (if (<= y 1.0) x 1.0))))
double code(double x, double y) {
double tmp;
if (y <= -49000.0) {
tmp = 1.0;
} else if (y <= -4.6e-31) {
tmp = y * (-1.0 - y);
} else if (y <= 1.0) {
tmp = x;
} else {
tmp = 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 <= (-49000.0d0)) then
tmp = 1.0d0
else if (y <= (-4.6d-31)) then
tmp = y * ((-1.0d0) - y)
else if (y <= 1.0d0) then
tmp = x
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -49000.0) {
tmp = 1.0;
} else if (y <= -4.6e-31) {
tmp = y * (-1.0 - y);
} else if (y <= 1.0) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -49000.0: tmp = 1.0 elif y <= -4.6e-31: tmp = y * (-1.0 - y) elif y <= 1.0: tmp = x else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -49000.0) tmp = 1.0; elseif (y <= -4.6e-31) tmp = Float64(y * Float64(-1.0 - y)); elseif (y <= 1.0) tmp = x; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -49000.0) tmp = 1.0; elseif (y <= -4.6e-31) tmp = y * (-1.0 - y); elseif (y <= 1.0) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -49000.0], 1.0, If[LessEqual[y, -4.6e-31], N[(y * N[(-1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.0], x, 1.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -49000:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -4.6 \cdot 10^{-31}:\\
\;\;\;\;y \cdot \left(-1 - y\right)\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -49000 or 1 < y Initial program 100.0%
Taylor expanded in y around inf 73.2%
if -49000 < y < -4.5999999999999997e-31Initial program 99.8%
Taylor expanded in x around 0 81.4%
neg-mul-181.4%
distribute-neg-frac281.4%
neg-sub081.4%
associate--r-81.4%
metadata-eval81.4%
Simplified81.4%
Taylor expanded in y around 0 76.9%
sub-neg76.9%
neg-mul-176.9%
metadata-eval76.9%
+-commutative76.9%
sub-neg76.9%
Simplified76.9%
if -4.5999999999999997e-31 < y < 1Initial program 100.0%
Taylor expanded in y around 0 71.8%
(FPCore (x y) :precision binary64 (if (<= y -28500000.0) 1.0 (if (<= y -2.5e-39) (- y) (if (<= y 1.0) x 1.0))))
double code(double x, double y) {
double tmp;
if (y <= -28500000.0) {
tmp = 1.0;
} else if (y <= -2.5e-39) {
tmp = -y;
} else if (y <= 1.0) {
tmp = x;
} else {
tmp = 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 <= (-28500000.0d0)) then
tmp = 1.0d0
else if (y <= (-2.5d-39)) then
tmp = -y
else if (y <= 1.0d0) then
tmp = x
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -28500000.0) {
tmp = 1.0;
} else if (y <= -2.5e-39) {
tmp = -y;
} else if (y <= 1.0) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -28500000.0: tmp = 1.0 elif y <= -2.5e-39: tmp = -y elif y <= 1.0: tmp = x else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -28500000.0) tmp = 1.0; elseif (y <= -2.5e-39) tmp = Float64(-y); elseif (y <= 1.0) tmp = x; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -28500000.0) tmp = 1.0; elseif (y <= -2.5e-39) tmp = -y; elseif (y <= 1.0) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -28500000.0], 1.0, If[LessEqual[y, -2.5e-39], (-y), If[LessEqual[y, 1.0], x, 1.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -28500000:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -2.5 \cdot 10^{-39}:\\
\;\;\;\;-y\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -2.85e7 or 1 < y Initial program 100.0%
Taylor expanded in y around inf 74.3%
if -2.85e7 < y < -2.4999999999999999e-39Initial program 99.9%
add-cube-cbrt97.3%
pow397.4%
Applied egg-rr97.4%
Taylor expanded in y around -inf 67.8%
neg-mul-167.8%
Simplified67.8%
Taylor expanded in y around 0 59.3%
neg-mul-159.3%
Simplified59.3%
if -2.4999999999999999e-39 < y < 1Initial program 100.0%
Taylor expanded in y around 0 71.8%
(FPCore (x y) :precision binary64 (if (<= y -2.75e-21) 1.0 (if (<= y 1.0) x 1.0)))
double code(double x, double y) {
double tmp;
if (y <= -2.75e-21) {
tmp = 1.0;
} else if (y <= 1.0) {
tmp = x;
} else {
tmp = 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.75d-21)) then
tmp = 1.0d0
else if (y <= 1.0d0) then
tmp = x
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -2.75e-21) {
tmp = 1.0;
} else if (y <= 1.0) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -2.75e-21: tmp = 1.0 elif y <= 1.0: tmp = x else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -2.75e-21) tmp = 1.0; elseif (y <= 1.0) tmp = x; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -2.75e-21) tmp = 1.0; elseif (y <= 1.0) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -2.75e-21], 1.0, If[LessEqual[y, 1.0], x, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.75 \cdot 10^{-21}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -2.74999999999999989e-21 or 1 < y Initial program 100.0%
Taylor expanded in y around inf 70.3%
if -2.74999999999999989e-21 < y < 1Initial program 100.0%
Taylor expanded in y around 0 69.9%
(FPCore (x y) :precision binary64 1.0)
double code(double x, double y) {
return 1.0;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0
end function
public static double code(double x, double y) {
return 1.0;
}
def code(x, y): return 1.0
function code(x, y) return 1.0 end
function tmp = code(x, y) tmp = 1.0; end
code[x_, y_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 100.0%
Taylor expanded in y around inf 37.6%
herbie shell --seed 2024143
(FPCore (x y)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, C"
:precision binary64
(/ (- x y) (- 1.0 y)))