
(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 -3600000.0)
1.0
(if (<= y 8e-110)
x
(if (<= y 1.0) (/ y -1.0) (if (<= y 2.9e+83) (/ (- x) y) 1.0)))))
double code(double x, double y) {
double tmp;
if (y <= -3600000.0) {
tmp = 1.0;
} else if (y <= 8e-110) {
tmp = x;
} else if (y <= 1.0) {
tmp = y / -1.0;
} else if (y <= 2.9e+83) {
tmp = -x / y;
} 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 <= (-3600000.0d0)) then
tmp = 1.0d0
else if (y <= 8d-110) then
tmp = x
else if (y <= 1.0d0) then
tmp = y / (-1.0d0)
else if (y <= 2.9d+83) then
tmp = -x / y
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -3600000.0) {
tmp = 1.0;
} else if (y <= 8e-110) {
tmp = x;
} else if (y <= 1.0) {
tmp = y / -1.0;
} else if (y <= 2.9e+83) {
tmp = -x / y;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -3600000.0: tmp = 1.0 elif y <= 8e-110: tmp = x elif y <= 1.0: tmp = y / -1.0 elif y <= 2.9e+83: tmp = -x / y else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -3600000.0) tmp = 1.0; elseif (y <= 8e-110) tmp = x; elseif (y <= 1.0) tmp = Float64(y / -1.0); elseif (y <= 2.9e+83) tmp = Float64(Float64(-x) / y); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -3600000.0) tmp = 1.0; elseif (y <= 8e-110) tmp = x; elseif (y <= 1.0) tmp = y / -1.0; elseif (y <= 2.9e+83) tmp = -x / y; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -3600000.0], 1.0, If[LessEqual[y, 8e-110], x, If[LessEqual[y, 1.0], N[(y / -1.0), $MachinePrecision], If[LessEqual[y, 2.9e+83], N[((-x) / y), $MachinePrecision], 1.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3600000:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 8 \cdot 10^{-110}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;\frac{y}{-1}\\
\mathbf{elif}\;y \leq 2.9 \cdot 10^{+83}:\\
\;\;\;\;\frac{-x}{y}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -3.6e6 or 2.89999999999999999e83 < y Initial program 99.9%
Taylor expanded in y around inf 78.0%
if -3.6e6 < y < 8.0000000000000004e-110Initial program 100.0%
Taylor expanded in y around 0 81.7%
if 8.0000000000000004e-110 < y < 1Initial program 99.9%
Taylor expanded in x around 0 67.2%
neg-mul-167.2%
distribute-neg-frac267.2%
neg-sub067.2%
associate--r-67.2%
metadata-eval67.2%
Simplified67.2%
Taylor expanded in y around 0 62.0%
if 1 < y < 2.89999999999999999e83Initial program 100.0%
Taylor expanded in x around inf 60.5%
Taylor expanded in y around inf 60.5%
associate-*r/60.5%
neg-mul-160.5%
Simplified60.5%
(FPCore (x y)
:precision binary64
(if (<= y -4200000.0)
(+ 1.0 (/ (- 1.0 x) y))
(if (<= y 1.15e-107)
(/ x (- 1.0 y))
(if (<= y 145000000.0) (/ y (+ y -1.0)) (- 1.0 (/ x y))))))
double code(double x, double y) {
double tmp;
if (y <= -4200000.0) {
tmp = 1.0 + ((1.0 - x) / y);
} else if (y <= 1.15e-107) {
tmp = x / (1.0 - y);
} else if (y <= 145000000.0) {
tmp = y / (y + -1.0);
} 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 <= (-4200000.0d0)) then
tmp = 1.0d0 + ((1.0d0 - x) / y)
else if (y <= 1.15d-107) then
tmp = x / (1.0d0 - y)
else if (y <= 145000000.0d0) then
tmp = y / (y + (-1.0d0))
else
tmp = 1.0d0 - (x / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -4200000.0) {
tmp = 1.0 + ((1.0 - x) / y);
} else if (y <= 1.15e-107) {
tmp = x / (1.0 - y);
} else if (y <= 145000000.0) {
tmp = y / (y + -1.0);
} else {
tmp = 1.0 - (x / y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -4200000.0: tmp = 1.0 + ((1.0 - x) / y) elif y <= 1.15e-107: tmp = x / (1.0 - y) elif y <= 145000000.0: tmp = y / (y + -1.0) else: tmp = 1.0 - (x / y) return tmp
function code(x, y) tmp = 0.0 if (y <= -4200000.0) tmp = Float64(1.0 + Float64(Float64(1.0 - x) / y)); elseif (y <= 1.15e-107) tmp = Float64(x / Float64(1.0 - y)); elseif (y <= 145000000.0) tmp = Float64(y / Float64(y + -1.0)); else tmp = Float64(1.0 - Float64(x / y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -4200000.0) tmp = 1.0 + ((1.0 - x) / y); elseif (y <= 1.15e-107) tmp = x / (1.0 - y); elseif (y <= 145000000.0) tmp = y / (y + -1.0); else tmp = 1.0 - (x / y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -4200000.0], N[(1.0 + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.15e-107], N[(x / N[(1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 145000000.0], N[(y / N[(y + -1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4200000:\\
\;\;\;\;1 + \frac{1 - x}{y}\\
\mathbf{elif}\;y \leq 1.15 \cdot 10^{-107}:\\
\;\;\;\;\frac{x}{1 - y}\\
\mathbf{elif}\;y \leq 145000000:\\
\;\;\;\;\frac{y}{y + -1}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{y}\\
\end{array}
\end{array}
if y < -4.2e6Initial program 99.9%
Taylor expanded in y around inf 99.8%
+-commutative99.8%
mul-1-neg99.8%
sub-neg99.8%
div-sub99.8%
Simplified99.8%
if -4.2e6 < y < 1.15000000000000002e-107Initial program 100.0%
Taylor expanded in x around inf 83.2%
if 1.15000000000000002e-107 < y < 1.45e8Initial program 99.9%
Taylor expanded in x around 0 68.7%
neg-mul-168.7%
distribute-neg-frac268.7%
neg-sub068.7%
associate--r-68.7%
metadata-eval68.7%
Simplified68.7%
if 1.45e8 < y Initial program 100.0%
expm1-log1p-u0.0%
Applied egg-rr0.0%
expm1-undefine0.0%
sub-neg0.0%
log1p-undefine0.0%
rem-exp-log100.0%
associate-+r-100.0%
metadata-eval100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
neg-mul-1100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
Final simplification90.4%
(FPCore (x y)
:precision binary64
(let* ((t_0 (- 1.0 (/ x y))))
(if (<= y -45000000.0)
t_0
(if (<= y 1e-107)
(/ x (- 1.0 y))
(if (<= y 510000.0) (/ y (+ y -1.0)) t_0)))))
double code(double x, double y) {
double t_0 = 1.0 - (x / y);
double tmp;
if (y <= -45000000.0) {
tmp = t_0;
} else if (y <= 1e-107) {
tmp = x / (1.0 - y);
} else if (y <= 510000.0) {
tmp = y / (y + -1.0);
} 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 <= (-45000000.0d0)) then
tmp = t_0
else if (y <= 1d-107) then
tmp = x / (1.0d0 - y)
else if (y <= 510000.0d0) then
tmp = y / (y + (-1.0d0))
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 <= -45000000.0) {
tmp = t_0;
} else if (y <= 1e-107) {
tmp = x / (1.0 - y);
} else if (y <= 510000.0) {
tmp = y / (y + -1.0);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 - (x / y) tmp = 0 if y <= -45000000.0: tmp = t_0 elif y <= 1e-107: tmp = x / (1.0 - y) elif y <= 510000.0: tmp = y / (y + -1.0) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 - Float64(x / y)) tmp = 0.0 if (y <= -45000000.0) tmp = t_0; elseif (y <= 1e-107) tmp = Float64(x / Float64(1.0 - y)); elseif (y <= 510000.0) tmp = Float64(y / Float64(y + -1.0)); 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 <= -45000000.0) tmp = t_0; elseif (y <= 1e-107) tmp = x / (1.0 - y); elseif (y <= 510000.0) tmp = y / (y + -1.0); 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, -45000000.0], t$95$0, If[LessEqual[y, 1e-107], N[(x / N[(1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 510000.0], N[(y / N[(y + -1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \frac{x}{y}\\
\mathbf{if}\;y \leq -45000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 10^{-107}:\\
\;\;\;\;\frac{x}{1 - y}\\
\mathbf{elif}\;y \leq 510000:\\
\;\;\;\;\frac{y}{y + -1}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -4.5e7 or 5.1e5 < y Initial program 100.0%
expm1-log1p-u51.7%
Applied egg-rr51.7%
expm1-undefine51.7%
sub-neg51.7%
log1p-undefine51.7%
rem-exp-log100.0%
associate-+r-100.0%
metadata-eval100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 99.6%
neg-mul-199.6%
Simplified99.6%
Taylor expanded in x around 0 99.7%
neg-mul-199.7%
unsub-neg99.7%
Simplified99.7%
if -4.5e7 < y < 1e-107Initial program 100.0%
Taylor expanded in x around inf 83.2%
if 1e-107 < y < 5.1e5Initial program 99.9%
Taylor expanded in x around 0 68.7%
neg-mul-168.7%
distribute-neg-frac268.7%
neg-sub068.7%
associate--r-68.7%
metadata-eval68.7%
Simplified68.7%
Final simplification90.3%
(FPCore (x y)
:precision binary64
(let* ((t_0 (- 1.0 (/ x y))))
(if (<= y -45000000.0)
t_0
(if (<= y 1.15e-107) (/ x (- 1.0 y)) (if (<= y 1.0) (/ y -1.0) t_0)))))
double code(double x, double y) {
double t_0 = 1.0 - (x / y);
double tmp;
if (y <= -45000000.0) {
tmp = t_0;
} else if (y <= 1.15e-107) {
tmp = x / (1.0 - y);
} else if (y <= 1.0) {
tmp = y / -1.0;
} 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 <= (-45000000.0d0)) then
tmp = t_0
else if (y <= 1.15d-107) then
tmp = x / (1.0d0 - y)
else if (y <= 1.0d0) then
tmp = y / (-1.0d0)
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 <= -45000000.0) {
tmp = t_0;
} else if (y <= 1.15e-107) {
tmp = x / (1.0 - y);
} else if (y <= 1.0) {
tmp = y / -1.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 - (x / y) tmp = 0 if y <= -45000000.0: tmp = t_0 elif y <= 1.15e-107: tmp = x / (1.0 - y) elif y <= 1.0: tmp = y / -1.0 else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 - Float64(x / y)) tmp = 0.0 if (y <= -45000000.0) tmp = t_0; elseif (y <= 1.15e-107) tmp = Float64(x / Float64(1.0 - y)); elseif (y <= 1.0) tmp = Float64(y / -1.0); 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 <= -45000000.0) tmp = t_0; elseif (y <= 1.15e-107) tmp = x / (1.0 - y); elseif (y <= 1.0) tmp = y / -1.0; 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, -45000000.0], t$95$0, If[LessEqual[y, 1.15e-107], N[(x / N[(1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.0], N[(y / -1.0), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \frac{x}{y}\\
\mathbf{if}\;y \leq -45000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.15 \cdot 10^{-107}:\\
\;\;\;\;\frac{x}{1 - y}\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;\frac{y}{-1}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -4.5e7 or 1 < y Initial program 100.0%
expm1-log1p-u51.3%
Applied egg-rr51.3%
expm1-undefine51.3%
sub-neg51.3%
log1p-undefine51.3%
rem-exp-log100.0%
associate-+r-100.0%
metadata-eval100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 99.1%
neg-mul-199.1%
Simplified99.1%
Taylor expanded in x around 0 99.2%
neg-mul-199.2%
unsub-neg99.2%
Simplified99.2%
if -4.5e7 < y < 1.15000000000000002e-107Initial program 100.0%
Taylor expanded in x around inf 83.2%
if 1.15000000000000002e-107 < y < 1Initial program 99.9%
Taylor expanded in x around 0 67.2%
neg-mul-167.2%
distribute-neg-frac267.2%
neg-sub067.2%
associate--r-67.2%
metadata-eval67.2%
Simplified67.2%
Taylor expanded in y around 0 62.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (- 1.0 (/ x y))))
(if (<= y -0.2)
t_0
(if (<= y 1.15e-107) x (if (<= y 1.0) (/ y -1.0) t_0)))))
double code(double x, double y) {
double t_0 = 1.0 - (x / y);
double tmp;
if (y <= -0.2) {
tmp = t_0;
} else if (y <= 1.15e-107) {
tmp = x;
} else if (y <= 1.0) {
tmp = y / -1.0;
} 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.2d0)) then
tmp = t_0
else if (y <= 1.15d-107) then
tmp = x
else if (y <= 1.0d0) then
tmp = y / (-1.0d0)
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.2) {
tmp = t_0;
} else if (y <= 1.15e-107) {
tmp = x;
} else if (y <= 1.0) {
tmp = y / -1.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 - (x / y) tmp = 0 if y <= -0.2: tmp = t_0 elif y <= 1.15e-107: tmp = x elif y <= 1.0: tmp = y / -1.0 else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 - Float64(x / y)) tmp = 0.0 if (y <= -0.2) tmp = t_0; elseif (y <= 1.15e-107) tmp = x; elseif (y <= 1.0) tmp = Float64(y / -1.0); 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.2) tmp = t_0; elseif (y <= 1.15e-107) tmp = x; elseif (y <= 1.0) tmp = y / -1.0; 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.2], t$95$0, If[LessEqual[y, 1.15e-107], x, If[LessEqual[y, 1.0], N[(y / -1.0), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \frac{x}{y}\\
\mathbf{if}\;y \leq -0.2:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.15 \cdot 10^{-107}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;\frac{y}{-1}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -0.20000000000000001 or 1 < y Initial program 100.0%
expm1-log1p-u51.7%
Applied egg-rr51.7%
expm1-undefine51.7%
sub-neg51.7%
log1p-undefine51.7%
rem-exp-log100.0%
associate-+r-100.0%
metadata-eval100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 98.8%
neg-mul-198.8%
Simplified98.8%
Taylor expanded in x around 0 98.8%
neg-mul-198.8%
unsub-neg98.8%
Simplified98.8%
if -0.20000000000000001 < y < 1.15000000000000002e-107Initial program 100.0%
Taylor expanded in y around 0 82.4%
if 1.15000000000000002e-107 < y < 1Initial program 99.9%
Taylor expanded in x around 0 67.2%
neg-mul-167.2%
distribute-neg-frac267.2%
neg-sub067.2%
associate--r-67.2%
metadata-eval67.2%
Simplified67.2%
Taylor expanded in y around 0 62.0%
(FPCore (x y) :precision binary64 (if (<= y -3600000.0) 1.0 (if (<= y 3.3e-108) x (if (<= y 0.0033) (/ y -1.0) 1.0))))
double code(double x, double y) {
double tmp;
if (y <= -3600000.0) {
tmp = 1.0;
} else if (y <= 3.3e-108) {
tmp = x;
} else if (y <= 0.0033) {
tmp = y / -1.0;
} 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 <= (-3600000.0d0)) then
tmp = 1.0d0
else if (y <= 3.3d-108) then
tmp = x
else if (y <= 0.0033d0) then
tmp = y / (-1.0d0)
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -3600000.0) {
tmp = 1.0;
} else if (y <= 3.3e-108) {
tmp = x;
} else if (y <= 0.0033) {
tmp = y / -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -3600000.0: tmp = 1.0 elif y <= 3.3e-108: tmp = x elif y <= 0.0033: tmp = y / -1.0 else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -3600000.0) tmp = 1.0; elseif (y <= 3.3e-108) tmp = x; elseif (y <= 0.0033) tmp = Float64(y / -1.0); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -3600000.0) tmp = 1.0; elseif (y <= 3.3e-108) tmp = x; elseif (y <= 0.0033) tmp = y / -1.0; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -3600000.0], 1.0, If[LessEqual[y, 3.3e-108], x, If[LessEqual[y, 0.0033], N[(y / -1.0), $MachinePrecision], 1.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3600000:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 3.3 \cdot 10^{-108}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 0.0033:\\
\;\;\;\;\frac{y}{-1}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -3.6e6 or 0.0033 < y Initial program 100.0%
Taylor expanded in y around inf 72.0%
if -3.6e6 < y < 3.3000000000000002e-108Initial program 100.0%
Taylor expanded in y around 0 81.7%
if 3.3000000000000002e-108 < y < 0.0033Initial program 99.9%
Taylor expanded in x around 0 70.5%
neg-mul-170.5%
distribute-neg-frac270.5%
neg-sub070.5%
associate--r-70.5%
metadata-eval70.5%
Simplified70.5%
Taylor expanded in y around 0 65.1%
(FPCore (x y) :precision binary64 (if (<= y -3600000.0) 1.0 (if (<= y 1.0) x 1.0)))
double code(double x, double y) {
double tmp;
if (y <= -3600000.0) {
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 <= (-3600000.0d0)) 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 <= -3600000.0) {
tmp = 1.0;
} else if (y <= 1.0) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -3600000.0: tmp = 1.0 elif y <= 1.0: tmp = x else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -3600000.0) 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 <= -3600000.0) tmp = 1.0; elseif (y <= 1.0) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -3600000.0], 1.0, If[LessEqual[y, 1.0], x, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3600000:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -3.6e6 or 1 < y Initial program 100.0%
Taylor expanded in y around inf 72.5%
if -3.6e6 < y < 1Initial program 100.0%
Taylor expanded in y around 0 72.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 38.9%
herbie shell --seed 2024180
(FPCore (x y)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, C"
:precision binary64
(/ (- x y) (- 1.0 y)))