
(FPCore (f n) :precision binary64 (/ (- (+ f n)) (- f n)))
double code(double f, double n) {
return -(f + n) / (f - n);
}
real(8) function code(f, n)
real(8), intent (in) :: f
real(8), intent (in) :: n
code = -(f + n) / (f - n)
end function
public static double code(double f, double n) {
return -(f + n) / (f - n);
}
def code(f, n): return -(f + n) / (f - n)
function code(f, n) return Float64(Float64(-Float64(f + n)) / Float64(f - n)) end
function tmp = code(f, n) tmp = -(f + n) / (f - n); end
code[f_, n_] := N[((-N[(f + n), $MachinePrecision]) / N[(f - n), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{-\left(f + n\right)}{f - n}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (f n) :precision binary64 (/ (- (+ f n)) (- f n)))
double code(double f, double n) {
return -(f + n) / (f - n);
}
real(8) function code(f, n)
real(8), intent (in) :: f
real(8), intent (in) :: n
code = -(f + n) / (f - n)
end function
public static double code(double f, double n) {
return -(f + n) / (f - n);
}
def code(f, n): return -(f + n) / (f - n)
function code(f, n) return Float64(Float64(-Float64(f + n)) / Float64(f - n)) end
function tmp = code(f, n) tmp = -(f + n) / (f - n); end
code[f_, n_] := N[((-N[(f + n), $MachinePrecision]) / N[(f - n), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{-\left(f + n\right)}{f - n}
\end{array}
(FPCore (f n) :precision binary64 (/ (+ f n) (- n f)))
double code(double f, double n) {
return (f + n) / (n - f);
}
real(8) function code(f, n)
real(8), intent (in) :: f
real(8), intent (in) :: n
code = (f + n) / (n - f)
end function
public static double code(double f, double n) {
return (f + n) / (n - f);
}
def code(f, n): return (f + n) / (n - f)
function code(f, n) return Float64(Float64(f + n) / Float64(n - f)) end
function tmp = code(f, n) tmp = (f + n) / (n - f); end
code[f_, n_] := N[(N[(f + n), $MachinePrecision] / N[(n - f), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{f + n}{n - f}
\end{array}
Initial program 100.0%
distribute-frac-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
--lowering--.f64100.0%
Simplified100.0%
(FPCore (f n) :precision binary64 (if (<= f -4.9e+73) (- -1.0 (/ n f)) (if (<= f 1.36e-42) (+ 1.0 (* 2.0 (/ f n))) (+ -1.0 (/ (* n -2.0) f)))))
double code(double f, double n) {
double tmp;
if (f <= -4.9e+73) {
tmp = -1.0 - (n / f);
} else if (f <= 1.36e-42) {
tmp = 1.0 + (2.0 * (f / n));
} else {
tmp = -1.0 + ((n * -2.0) / f);
}
return tmp;
}
real(8) function code(f, n)
real(8), intent (in) :: f
real(8), intent (in) :: n
real(8) :: tmp
if (f <= (-4.9d+73)) then
tmp = (-1.0d0) - (n / f)
else if (f <= 1.36d-42) then
tmp = 1.0d0 + (2.0d0 * (f / n))
else
tmp = (-1.0d0) + ((n * (-2.0d0)) / f)
end if
code = tmp
end function
public static double code(double f, double n) {
double tmp;
if (f <= -4.9e+73) {
tmp = -1.0 - (n / f);
} else if (f <= 1.36e-42) {
tmp = 1.0 + (2.0 * (f / n));
} else {
tmp = -1.0 + ((n * -2.0) / f);
}
return tmp;
}
def code(f, n): tmp = 0 if f <= -4.9e+73: tmp = -1.0 - (n / f) elif f <= 1.36e-42: tmp = 1.0 + (2.0 * (f / n)) else: tmp = -1.0 + ((n * -2.0) / f) return tmp
function code(f, n) tmp = 0.0 if (f <= -4.9e+73) tmp = Float64(-1.0 - Float64(n / f)); elseif (f <= 1.36e-42) tmp = Float64(1.0 + Float64(2.0 * Float64(f / n))); else tmp = Float64(-1.0 + Float64(Float64(n * -2.0) / f)); end return tmp end
function tmp_2 = code(f, n) tmp = 0.0; if (f <= -4.9e+73) tmp = -1.0 - (n / f); elseif (f <= 1.36e-42) tmp = 1.0 + (2.0 * (f / n)); else tmp = -1.0 + ((n * -2.0) / f); end tmp_2 = tmp; end
code[f_, n_] := If[LessEqual[f, -4.9e+73], N[(-1.0 - N[(n / f), $MachinePrecision]), $MachinePrecision], If[LessEqual[f, 1.36e-42], N[(1.0 + N[(2.0 * N[(f / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.0 + N[(N[(n * -2.0), $MachinePrecision] / f), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;f \leq -4.9 \cdot 10^{+73}:\\
\;\;\;\;-1 - \frac{n}{f}\\
\mathbf{elif}\;f \leq 1.36 \cdot 10^{-42}:\\
\;\;\;\;1 + 2 \cdot \frac{f}{n}\\
\mathbf{else}:\\
\;\;\;\;-1 + \frac{n \cdot -2}{f}\\
\end{array}
\end{array}
if f < -4.8999999999999999e73Initial program 100.0%
distribute-frac-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
--lowering--.f64100.0%
Simplified100.0%
Taylor expanded in f around inf
Simplified78.3%
Taylor expanded in f around inf
sub-negN/A
metadata-evalN/A
+-commutativeN/A
mul-1-negN/A
sub-negN/A
--lowering--.f64N/A
/-lowering-/.f6478.7%
Simplified78.7%
if -4.8999999999999999e73 < f < 1.36e-42Initial program 100.0%
distribute-frac-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
--lowering--.f64100.0%
Simplified100.0%
Taylor expanded in f around 0
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
+-lowering-+.f64N/A
associate-*l*N/A
associate-*l/N/A
*-lft-identityN/A
*-lowering-*.f64N/A
/-lowering-/.f6482.3%
Simplified82.3%
if 1.36e-42 < f Initial program 99.9%
distribute-frac-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
--lowering--.f6499.9%
Simplified99.9%
Taylor expanded in f around inf
+-commutativeN/A
associate--r+N/A
associate-*r/N/A
div-subN/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
*-lft-identityN/A
distribute-rgt-out--N/A
metadata-evalN/A
*-lowering-*.f6471.7%
Simplified71.7%
(FPCore (f n) :precision binary64 (if (<= f -4.2e+71) (- -1.0 (/ n f)) (if (<= f 1.9e-98) (/ n (- n f)) (+ -1.0 (/ (* n -2.0) f)))))
double code(double f, double n) {
double tmp;
if (f <= -4.2e+71) {
tmp = -1.0 - (n / f);
} else if (f <= 1.9e-98) {
tmp = n / (n - f);
} else {
tmp = -1.0 + ((n * -2.0) / f);
}
return tmp;
}
real(8) function code(f, n)
real(8), intent (in) :: f
real(8), intent (in) :: n
real(8) :: tmp
if (f <= (-4.2d+71)) then
tmp = (-1.0d0) - (n / f)
else if (f <= 1.9d-98) then
tmp = n / (n - f)
else
tmp = (-1.0d0) + ((n * (-2.0d0)) / f)
end if
code = tmp
end function
public static double code(double f, double n) {
double tmp;
if (f <= -4.2e+71) {
tmp = -1.0 - (n / f);
} else if (f <= 1.9e-98) {
tmp = n / (n - f);
} else {
tmp = -1.0 + ((n * -2.0) / f);
}
return tmp;
}
def code(f, n): tmp = 0 if f <= -4.2e+71: tmp = -1.0 - (n / f) elif f <= 1.9e-98: tmp = n / (n - f) else: tmp = -1.0 + ((n * -2.0) / f) return tmp
function code(f, n) tmp = 0.0 if (f <= -4.2e+71) tmp = Float64(-1.0 - Float64(n / f)); elseif (f <= 1.9e-98) tmp = Float64(n / Float64(n - f)); else tmp = Float64(-1.0 + Float64(Float64(n * -2.0) / f)); end return tmp end
function tmp_2 = code(f, n) tmp = 0.0; if (f <= -4.2e+71) tmp = -1.0 - (n / f); elseif (f <= 1.9e-98) tmp = n / (n - f); else tmp = -1.0 + ((n * -2.0) / f); end tmp_2 = tmp; end
code[f_, n_] := If[LessEqual[f, -4.2e+71], N[(-1.0 - N[(n / f), $MachinePrecision]), $MachinePrecision], If[LessEqual[f, 1.9e-98], N[(n / N[(n - f), $MachinePrecision]), $MachinePrecision], N[(-1.0 + N[(N[(n * -2.0), $MachinePrecision] / f), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;f \leq -4.2 \cdot 10^{+71}:\\
\;\;\;\;-1 - \frac{n}{f}\\
\mathbf{elif}\;f \leq 1.9 \cdot 10^{-98}:\\
\;\;\;\;\frac{n}{n - f}\\
\mathbf{else}:\\
\;\;\;\;-1 + \frac{n \cdot -2}{f}\\
\end{array}
\end{array}
if f < -4.19999999999999978e71Initial program 100.0%
distribute-frac-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
--lowering--.f64100.0%
Simplified100.0%
Taylor expanded in f around inf
Simplified78.3%
Taylor expanded in f around inf
sub-negN/A
metadata-evalN/A
+-commutativeN/A
mul-1-negN/A
sub-negN/A
--lowering--.f64N/A
/-lowering-/.f6478.7%
Simplified78.7%
if -4.19999999999999978e71 < f < 1.9000000000000002e-98Initial program 100.0%
distribute-frac-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
--lowering--.f64100.0%
Simplified100.0%
Taylor expanded in f around 0
Simplified84.4%
if 1.9000000000000002e-98 < f Initial program 99.9%
distribute-frac-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
--lowering--.f6499.9%
Simplified99.9%
Taylor expanded in f around inf
+-commutativeN/A
associate--r+N/A
associate-*r/N/A
div-subN/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
*-lft-identityN/A
distribute-rgt-out--N/A
metadata-evalN/A
*-lowering-*.f6469.3%
Simplified69.3%
(FPCore (f n) :precision binary64 (if (<= f -1.3e+73) (- -1.0 (/ n f)) (if (<= f 1.25e-59) (/ n (- n f)) (/ f (- n f)))))
double code(double f, double n) {
double tmp;
if (f <= -1.3e+73) {
tmp = -1.0 - (n / f);
} else if (f <= 1.25e-59) {
tmp = n / (n - f);
} else {
tmp = f / (n - f);
}
return tmp;
}
real(8) function code(f, n)
real(8), intent (in) :: f
real(8), intent (in) :: n
real(8) :: tmp
if (f <= (-1.3d+73)) then
tmp = (-1.0d0) - (n / f)
else if (f <= 1.25d-59) then
tmp = n / (n - f)
else
tmp = f / (n - f)
end if
code = tmp
end function
public static double code(double f, double n) {
double tmp;
if (f <= -1.3e+73) {
tmp = -1.0 - (n / f);
} else if (f <= 1.25e-59) {
tmp = n / (n - f);
} else {
tmp = f / (n - f);
}
return tmp;
}
def code(f, n): tmp = 0 if f <= -1.3e+73: tmp = -1.0 - (n / f) elif f <= 1.25e-59: tmp = n / (n - f) else: tmp = f / (n - f) return tmp
function code(f, n) tmp = 0.0 if (f <= -1.3e+73) tmp = Float64(-1.0 - Float64(n / f)); elseif (f <= 1.25e-59) tmp = Float64(n / Float64(n - f)); else tmp = Float64(f / Float64(n - f)); end return tmp end
function tmp_2 = code(f, n) tmp = 0.0; if (f <= -1.3e+73) tmp = -1.0 - (n / f); elseif (f <= 1.25e-59) tmp = n / (n - f); else tmp = f / (n - f); end tmp_2 = tmp; end
code[f_, n_] := If[LessEqual[f, -1.3e+73], N[(-1.0 - N[(n / f), $MachinePrecision]), $MachinePrecision], If[LessEqual[f, 1.25e-59], N[(n / N[(n - f), $MachinePrecision]), $MachinePrecision], N[(f / N[(n - f), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;f \leq -1.3 \cdot 10^{+73}:\\
\;\;\;\;-1 - \frac{n}{f}\\
\mathbf{elif}\;f \leq 1.25 \cdot 10^{-59}:\\
\;\;\;\;\frac{n}{n - f}\\
\mathbf{else}:\\
\;\;\;\;\frac{f}{n - f}\\
\end{array}
\end{array}
if f < -1.3e73Initial program 100.0%
distribute-frac-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
--lowering--.f64100.0%
Simplified100.0%
Taylor expanded in f around inf
Simplified78.3%
Taylor expanded in f around inf
sub-negN/A
metadata-evalN/A
+-commutativeN/A
mul-1-negN/A
sub-negN/A
--lowering--.f64N/A
/-lowering-/.f6478.7%
Simplified78.7%
if -1.3e73 < f < 1.25e-59Initial program 100.0%
distribute-frac-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
--lowering--.f64100.0%
Simplified100.0%
Taylor expanded in f around 0
Simplified82.4%
if 1.25e-59 < f Initial program 99.9%
distribute-frac-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
--lowering--.f6499.9%
Simplified99.9%
Taylor expanded in f around inf
Simplified70.8%
(FPCore (f n) :precision binary64 (if (<= f -6.6e+72) (- -1.0 (/ n f)) (if (<= f 2.15e-48) (+ 1.0 (/ f n)) (/ f (- n f)))))
double code(double f, double n) {
double tmp;
if (f <= -6.6e+72) {
tmp = -1.0 - (n / f);
} else if (f <= 2.15e-48) {
tmp = 1.0 + (f / n);
} else {
tmp = f / (n - f);
}
return tmp;
}
real(8) function code(f, n)
real(8), intent (in) :: f
real(8), intent (in) :: n
real(8) :: tmp
if (f <= (-6.6d+72)) then
tmp = (-1.0d0) - (n / f)
else if (f <= 2.15d-48) then
tmp = 1.0d0 + (f / n)
else
tmp = f / (n - f)
end if
code = tmp
end function
public static double code(double f, double n) {
double tmp;
if (f <= -6.6e+72) {
tmp = -1.0 - (n / f);
} else if (f <= 2.15e-48) {
tmp = 1.0 + (f / n);
} else {
tmp = f / (n - f);
}
return tmp;
}
def code(f, n): tmp = 0 if f <= -6.6e+72: tmp = -1.0 - (n / f) elif f <= 2.15e-48: tmp = 1.0 + (f / n) else: tmp = f / (n - f) return tmp
function code(f, n) tmp = 0.0 if (f <= -6.6e+72) tmp = Float64(-1.0 - Float64(n / f)); elseif (f <= 2.15e-48) tmp = Float64(1.0 + Float64(f / n)); else tmp = Float64(f / Float64(n - f)); end return tmp end
function tmp_2 = code(f, n) tmp = 0.0; if (f <= -6.6e+72) tmp = -1.0 - (n / f); elseif (f <= 2.15e-48) tmp = 1.0 + (f / n); else tmp = f / (n - f); end tmp_2 = tmp; end
code[f_, n_] := If[LessEqual[f, -6.6e+72], N[(-1.0 - N[(n / f), $MachinePrecision]), $MachinePrecision], If[LessEqual[f, 2.15e-48], N[(1.0 + N[(f / n), $MachinePrecision]), $MachinePrecision], N[(f / N[(n - f), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;f \leq -6.6 \cdot 10^{+72}:\\
\;\;\;\;-1 - \frac{n}{f}\\
\mathbf{elif}\;f \leq 2.15 \cdot 10^{-48}:\\
\;\;\;\;1 + \frac{f}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{f}{n - f}\\
\end{array}
\end{array}
if f < -6.6e72Initial program 100.0%
distribute-frac-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
--lowering--.f64100.0%
Simplified100.0%
Taylor expanded in f around inf
Simplified78.3%
Taylor expanded in f around inf
sub-negN/A
metadata-evalN/A
+-commutativeN/A
mul-1-negN/A
sub-negN/A
--lowering--.f64N/A
/-lowering-/.f6478.7%
Simplified78.7%
if -6.6e72 < f < 2.15e-48Initial program 100.0%
distribute-frac-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
--lowering--.f64100.0%
Simplified100.0%
Taylor expanded in f around 0
Simplified81.9%
Taylor expanded in n around inf
+-lowering-+.f64N/A
/-lowering-/.f6481.9%
Simplified81.9%
if 2.15e-48 < f Initial program 99.9%
distribute-frac-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
--lowering--.f6499.9%
Simplified99.9%
Taylor expanded in f around inf
Simplified71.3%
(FPCore (f n) :precision binary64 (let* ((t_0 (- -1.0 (/ n f)))) (if (<= f -1.3e+74) t_0 (if (<= f 2.4e-45) (+ 1.0 (/ f n)) t_0))))
double code(double f, double n) {
double t_0 = -1.0 - (n / f);
double tmp;
if (f <= -1.3e+74) {
tmp = t_0;
} else if (f <= 2.4e-45) {
tmp = 1.0 + (f / n);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(f, n)
real(8), intent (in) :: f
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = (-1.0d0) - (n / f)
if (f <= (-1.3d+74)) then
tmp = t_0
else if (f <= 2.4d-45) then
tmp = 1.0d0 + (f / n)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double f, double n) {
double t_0 = -1.0 - (n / f);
double tmp;
if (f <= -1.3e+74) {
tmp = t_0;
} else if (f <= 2.4e-45) {
tmp = 1.0 + (f / n);
} else {
tmp = t_0;
}
return tmp;
}
def code(f, n): t_0 = -1.0 - (n / f) tmp = 0 if f <= -1.3e+74: tmp = t_0 elif f <= 2.4e-45: tmp = 1.0 + (f / n) else: tmp = t_0 return tmp
function code(f, n) t_0 = Float64(-1.0 - Float64(n / f)) tmp = 0.0 if (f <= -1.3e+74) tmp = t_0; elseif (f <= 2.4e-45) tmp = Float64(1.0 + Float64(f / n)); else tmp = t_0; end return tmp end
function tmp_2 = code(f, n) t_0 = -1.0 - (n / f); tmp = 0.0; if (f <= -1.3e+74) tmp = t_0; elseif (f <= 2.4e-45) tmp = 1.0 + (f / n); else tmp = t_0; end tmp_2 = tmp; end
code[f_, n_] := Block[{t$95$0 = N[(-1.0 - N[(n / f), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[f, -1.3e+74], t$95$0, If[LessEqual[f, 2.4e-45], N[(1.0 + N[(f / n), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -1 - \frac{n}{f}\\
\mathbf{if}\;f \leq -1.3 \cdot 10^{+74}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;f \leq 2.4 \cdot 10^{-45}:\\
\;\;\;\;1 + \frac{f}{n}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if f < -1.3e74 or 2.3999999999999999e-45 < f Initial program 99.9%
distribute-frac-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
--lowering--.f6499.9%
Simplified99.9%
Taylor expanded in f around inf
Simplified73.7%
Taylor expanded in f around inf
sub-negN/A
metadata-evalN/A
+-commutativeN/A
mul-1-negN/A
sub-negN/A
--lowering--.f64N/A
/-lowering-/.f6473.7%
Simplified73.7%
if -1.3e74 < f < 2.3999999999999999e-45Initial program 100.0%
distribute-frac-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
--lowering--.f64100.0%
Simplified100.0%
Taylor expanded in f around 0
Simplified81.9%
Taylor expanded in n around inf
+-lowering-+.f64N/A
/-lowering-/.f6481.9%
Simplified81.9%
(FPCore (f n) :precision binary64 (if (<= f -1.25e+74) -1.0 (if (<= f 1.06e-40) (+ 1.0 (/ f n)) -1.0)))
double code(double f, double n) {
double tmp;
if (f <= -1.25e+74) {
tmp = -1.0;
} else if (f <= 1.06e-40) {
tmp = 1.0 + (f / n);
} else {
tmp = -1.0;
}
return tmp;
}
real(8) function code(f, n)
real(8), intent (in) :: f
real(8), intent (in) :: n
real(8) :: tmp
if (f <= (-1.25d+74)) then
tmp = -1.0d0
else if (f <= 1.06d-40) then
tmp = 1.0d0 + (f / n)
else
tmp = -1.0d0
end if
code = tmp
end function
public static double code(double f, double n) {
double tmp;
if (f <= -1.25e+74) {
tmp = -1.0;
} else if (f <= 1.06e-40) {
tmp = 1.0 + (f / n);
} else {
tmp = -1.0;
}
return tmp;
}
def code(f, n): tmp = 0 if f <= -1.25e+74: tmp = -1.0 elif f <= 1.06e-40: tmp = 1.0 + (f / n) else: tmp = -1.0 return tmp
function code(f, n) tmp = 0.0 if (f <= -1.25e+74) tmp = -1.0; elseif (f <= 1.06e-40) tmp = Float64(1.0 + Float64(f / n)); else tmp = -1.0; end return tmp end
function tmp_2 = code(f, n) tmp = 0.0; if (f <= -1.25e+74) tmp = -1.0; elseif (f <= 1.06e-40) tmp = 1.0 + (f / n); else tmp = -1.0; end tmp_2 = tmp; end
code[f_, n_] := If[LessEqual[f, -1.25e+74], -1.0, If[LessEqual[f, 1.06e-40], N[(1.0 + N[(f / n), $MachinePrecision]), $MachinePrecision], -1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;f \leq -1.25 \cdot 10^{+74}:\\
\;\;\;\;-1\\
\mathbf{elif}\;f \leq 1.06 \cdot 10^{-40}:\\
\;\;\;\;1 + \frac{f}{n}\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\end{array}
if f < -1.24999999999999991e74 or 1.06e-40 < f Initial program 99.9%
distribute-frac-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
--lowering--.f6499.9%
Simplified99.9%
Taylor expanded in f around inf
Simplified72.9%
if -1.24999999999999991e74 < f < 1.06e-40Initial program 100.0%
distribute-frac-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
--lowering--.f64100.0%
Simplified100.0%
Taylor expanded in f around 0
Simplified81.9%
Taylor expanded in n around inf
+-lowering-+.f64N/A
/-lowering-/.f6481.9%
Simplified81.9%
(FPCore (f n) :precision binary64 (if (<= f -3.8e+71) -1.0 (if (<= f 1.35e-59) 1.0 -1.0)))
double code(double f, double n) {
double tmp;
if (f <= -3.8e+71) {
tmp = -1.0;
} else if (f <= 1.35e-59) {
tmp = 1.0;
} else {
tmp = -1.0;
}
return tmp;
}
real(8) function code(f, n)
real(8), intent (in) :: f
real(8), intent (in) :: n
real(8) :: tmp
if (f <= (-3.8d+71)) then
tmp = -1.0d0
else if (f <= 1.35d-59) then
tmp = 1.0d0
else
tmp = -1.0d0
end if
code = tmp
end function
public static double code(double f, double n) {
double tmp;
if (f <= -3.8e+71) {
tmp = -1.0;
} else if (f <= 1.35e-59) {
tmp = 1.0;
} else {
tmp = -1.0;
}
return tmp;
}
def code(f, n): tmp = 0 if f <= -3.8e+71: tmp = -1.0 elif f <= 1.35e-59: tmp = 1.0 else: tmp = -1.0 return tmp
function code(f, n) tmp = 0.0 if (f <= -3.8e+71) tmp = -1.0; elseif (f <= 1.35e-59) tmp = 1.0; else tmp = -1.0; end return tmp end
function tmp_2 = code(f, n) tmp = 0.0; if (f <= -3.8e+71) tmp = -1.0; elseif (f <= 1.35e-59) tmp = 1.0; else tmp = -1.0; end tmp_2 = tmp; end
code[f_, n_] := If[LessEqual[f, -3.8e+71], -1.0, If[LessEqual[f, 1.35e-59], 1.0, -1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;f \leq -3.8 \cdot 10^{+71}:\\
\;\;\;\;-1\\
\mathbf{elif}\;f \leq 1.35 \cdot 10^{-59}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\end{array}
if f < -3.8000000000000001e71 or 1.3499999999999999e-59 < f Initial program 99.9%
distribute-frac-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
--lowering--.f6499.9%
Simplified99.9%
Taylor expanded in f around inf
Simplified72.6%
if -3.8000000000000001e71 < f < 1.3499999999999999e-59Initial program 100.0%
distribute-frac-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
--lowering--.f64100.0%
Simplified100.0%
Taylor expanded in f around 0
Simplified81.9%
(FPCore (f n) :precision binary64 -1.0)
double code(double f, double n) {
return -1.0;
}
real(8) function code(f, n)
real(8), intent (in) :: f
real(8), intent (in) :: n
code = -1.0d0
end function
public static double code(double f, double n) {
return -1.0;
}
def code(f, n): return -1.0
function code(f, n) return -1.0 end
function tmp = code(f, n) tmp = -1.0; end
code[f_, n_] := -1.0
\begin{array}{l}
\\
-1
\end{array}
Initial program 100.0%
distribute-frac-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
--lowering--.f64100.0%
Simplified100.0%
Taylor expanded in f around inf
Simplified43.0%
herbie shell --seed 2024147
(FPCore (f n)
:name "subtraction fraction"
:precision binary64
(/ (- (+ f n)) (- f n)))