
(FPCore (x l t) :precision binary64 (/ (* (sqrt 2.0) t) (sqrt (- (* (/ (+ x 1.0) (- x 1.0)) (+ (* l l) (* 2.0 (* t t)))) (* l l)))))
double code(double x, double l, double t) {
return (sqrt(2.0) * t) / sqrt(((((x + 1.0) / (x - 1.0)) * ((l * l) + (2.0 * (t * t)))) - (l * l)));
}
real(8) function code(x, l, t)
real(8), intent (in) :: x
real(8), intent (in) :: l
real(8), intent (in) :: t
code = (sqrt(2.0d0) * t) / sqrt(((((x + 1.0d0) / (x - 1.0d0)) * ((l * l) + (2.0d0 * (t * t)))) - (l * l)))
end function
public static double code(double x, double l, double t) {
return (Math.sqrt(2.0) * t) / Math.sqrt(((((x + 1.0) / (x - 1.0)) * ((l * l) + (2.0 * (t * t)))) - (l * l)));
}
def code(x, l, t): return (math.sqrt(2.0) * t) / math.sqrt(((((x + 1.0) / (x - 1.0)) * ((l * l) + (2.0 * (t * t)))) - (l * l)))
function code(x, l, t) return Float64(Float64(sqrt(2.0) * t) / sqrt(Float64(Float64(Float64(Float64(x + 1.0) / Float64(x - 1.0)) * Float64(Float64(l * l) + Float64(2.0 * Float64(t * t)))) - Float64(l * l)))) end
function tmp = code(x, l, t) tmp = (sqrt(2.0) * t) / sqrt(((((x + 1.0) / (x - 1.0)) * ((l * l) + (2.0 * (t * t)))) - (l * l))); end
code[x_, l_, t_] := N[(N[(N[Sqrt[2.0], $MachinePrecision] * t), $MachinePrecision] / N[Sqrt[N[(N[(N[(N[(x + 1.0), $MachinePrecision] / N[(x - 1.0), $MachinePrecision]), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] + N[(2.0 * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(l * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x l t) :precision binary64 (/ (* (sqrt 2.0) t) (sqrt (- (* (/ (+ x 1.0) (- x 1.0)) (+ (* l l) (* 2.0 (* t t)))) (* l l)))))
double code(double x, double l, double t) {
return (sqrt(2.0) * t) / sqrt(((((x + 1.0) / (x - 1.0)) * ((l * l) + (2.0 * (t * t)))) - (l * l)));
}
real(8) function code(x, l, t)
real(8), intent (in) :: x
real(8), intent (in) :: l
real(8), intent (in) :: t
code = (sqrt(2.0d0) * t) / sqrt(((((x + 1.0d0) / (x - 1.0d0)) * ((l * l) + (2.0d0 * (t * t)))) - (l * l)))
end function
public static double code(double x, double l, double t) {
return (Math.sqrt(2.0) * t) / Math.sqrt(((((x + 1.0) / (x - 1.0)) * ((l * l) + (2.0 * (t * t)))) - (l * l)));
}
def code(x, l, t): return (math.sqrt(2.0) * t) / math.sqrt(((((x + 1.0) / (x - 1.0)) * ((l * l) + (2.0 * (t * t)))) - (l * l)))
function code(x, l, t) return Float64(Float64(sqrt(2.0) * t) / sqrt(Float64(Float64(Float64(Float64(x + 1.0) / Float64(x - 1.0)) * Float64(Float64(l * l) + Float64(2.0 * Float64(t * t)))) - Float64(l * l)))) end
function tmp = code(x, l, t) tmp = (sqrt(2.0) * t) / sqrt(((((x + 1.0) / (x - 1.0)) * ((l * l) + (2.0 * (t * t)))) - (l * l))); end
code[x_, l_, t_] := N[(N[(N[Sqrt[2.0], $MachinePrecision] * t), $MachinePrecision] / N[Sqrt[N[(N[(N[(N[(x + 1.0), $MachinePrecision] / N[(x - 1.0), $MachinePrecision]), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] + N[(2.0 * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(l * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}}
\end{array}
NOTE: l should be positive before calling this function
(FPCore (x l t)
:precision binary64
(if (<= t -9e-127)
(+ -1.0 (/ 1.0 x))
(if (<= t 6.2e-155)
(* t (* (sqrt (/ 1.0 (+ (/ 2.0 x) (/ 2.0 (* x x))))) (/ (sqrt 2.0) l)))
(if (<= t 1.8e+20)
(*
t
(/
(sqrt 2.0)
(sqrt
(+
(/ (* l l) x)
(+
(* 2.0 (+ (* t t) (/ (* t t) x)))
(/ (fma (* t 2.0) t (* l l)) x))))))
(sqrt (/ (+ -1.0 x) (+ 1.0 x)))))))l = abs(l);
double code(double x, double l, double t) {
double tmp;
if (t <= -9e-127) {
tmp = -1.0 + (1.0 / x);
} else if (t <= 6.2e-155) {
tmp = t * (sqrt((1.0 / ((2.0 / x) + (2.0 / (x * x))))) * (sqrt(2.0) / l));
} else if (t <= 1.8e+20) {
tmp = t * (sqrt(2.0) / sqrt((((l * l) / x) + ((2.0 * ((t * t) + ((t * t) / x))) + (fma((t * 2.0), t, (l * l)) / x)))));
} else {
tmp = sqrt(((-1.0 + x) / (1.0 + x)));
}
return tmp;
}
l = abs(l) function code(x, l, t) tmp = 0.0 if (t <= -9e-127) tmp = Float64(-1.0 + Float64(1.0 / x)); elseif (t <= 6.2e-155) tmp = Float64(t * Float64(sqrt(Float64(1.0 / Float64(Float64(2.0 / x) + Float64(2.0 / Float64(x * x))))) * Float64(sqrt(2.0) / l))); elseif (t <= 1.8e+20) tmp = Float64(t * Float64(sqrt(2.0) / sqrt(Float64(Float64(Float64(l * l) / x) + Float64(Float64(2.0 * Float64(Float64(t * t) + Float64(Float64(t * t) / x))) + Float64(fma(Float64(t * 2.0), t, Float64(l * l)) / x)))))); else tmp = sqrt(Float64(Float64(-1.0 + x) / Float64(1.0 + x))); end return tmp end
NOTE: l should be positive before calling this function code[x_, l_, t_] := If[LessEqual[t, -9e-127], N[(-1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 6.2e-155], N[(t * N[(N[Sqrt[N[(1.0 / N[(N[(2.0 / x), $MachinePrecision] + N[(2.0 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.8e+20], N[(t * N[(N[Sqrt[2.0], $MachinePrecision] / N[Sqrt[N[(N[(N[(l * l), $MachinePrecision] / x), $MachinePrecision] + N[(N[(2.0 * N[(N[(t * t), $MachinePrecision] + N[(N[(t * t), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(t * 2.0), $MachinePrecision] * t + N[(l * l), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[(-1.0 + x), $MachinePrecision] / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
l = |l|\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9 \cdot 10^{-127}:\\
\;\;\;\;-1 + \frac{1}{x}\\
\mathbf{elif}\;t \leq 6.2 \cdot 10^{-155}:\\
\;\;\;\;t \cdot \left(\sqrt{\frac{1}{\frac{2}{x} + \frac{2}{x \cdot x}}} \cdot \frac{\sqrt{2}}{\ell}\right)\\
\mathbf{elif}\;t \leq 1.8 \cdot 10^{+20}:\\
\;\;\;\;t \cdot \frac{\sqrt{2}}{\sqrt{\frac{\ell \cdot \ell}{x} + \left(2 \cdot \left(t \cdot t + \frac{t \cdot t}{x}\right) + \frac{\mathsf{fma}\left(t \cdot 2, t, \ell \cdot \ell\right)}{x}\right)}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{-1 + x}{1 + x}}\\
\end{array}
\end{array}
if t < -8.9999999999999998e-127Initial program 41.4%
associate-*l/41.5%
Simplified41.5%
sqrt-undiv41.6%
fma-neg41.6%
distribute-rgt-neg-out41.6%
fma-udef41.6%
associate-*r*41.6%
fma-def41.6%
add-sqr-sqrt18.6%
sqrt-unprod43.0%
distribute-rgt-neg-out43.0%
distribute-rgt-neg-out43.0%
sqr-neg43.0%
sqrt-unprod43.3%
add-sqr-sqrt43.3%
Applied egg-rr43.3%
Taylor expanded in t around inf 32.9%
sub-neg32.9%
metadata-eval32.9%
unpow232.9%
Simplified32.9%
Taylor expanded in x around -inf 0.0%
unpow20.0%
rem-square-sqrt87.9%
Simplified87.9%
if -8.9999999999999998e-127 < t < 6.2e-155Initial program 5.2%
associate-*l/5.2%
Simplified5.2%
Taylor expanded in x around -inf 39.5%
associate--l+39.5%
unpow239.5%
sub-neg39.5%
Simplified39.5%
Taylor expanded in l around inf 41.2%
*-commutative41.2%
associate-*r/41.2%
metadata-eval41.2%
unpow241.2%
associate-*r/41.2%
metadata-eval41.2%
Simplified41.2%
Taylor expanded in l around 0 41.2%
*-commutative41.2%
+-commutative41.2%
associate-*r/41.2%
metadata-eval41.2%
associate-*r/41.2%
metadata-eval41.2%
unpow241.2%
Simplified41.2%
if 6.2e-155 < t < 1.8e20Initial program 32.3%
associate-*l/32.4%
Simplified32.4%
Taylor expanded in x around inf 90.5%
associate--l+90.5%
unpow290.5%
distribute-lft-out90.5%
unpow290.5%
unpow290.5%
associate-*r/90.5%
mul-1-neg90.5%
+-commutative90.5%
unpow290.5%
associate-*l*90.5%
unpow290.5%
fma-udef90.5%
Simplified90.5%
if 1.8e20 < t Initial program 41.4%
associate-*r/41.2%
fma-neg41.2%
sub-neg41.2%
metadata-eval41.2%
+-commutative41.2%
fma-def41.2%
distribute-rgt-neg-in41.2%
Simplified41.2%
Applied egg-rr85.6%
Taylor expanded in t around inf 96.5%
Final simplification80.9%
NOTE: l should be positive before calling this function
(FPCore (x l t)
:precision binary64
(if (<= t -9e-127)
(+ -1.0 (/ 1.0 x))
(if (<= t 6.5e-123)
(* t (* (sqrt (/ 1.0 (+ (/ 2.0 x) (/ 2.0 (* x x))))) (/ (sqrt 2.0) l)))
(sqrt (/ (+ -1.0 x) (+ 1.0 x))))))l = abs(l);
double code(double x, double l, double t) {
double tmp;
if (t <= -9e-127) {
tmp = -1.0 + (1.0 / x);
} else if (t <= 6.5e-123) {
tmp = t * (sqrt((1.0 / ((2.0 / x) + (2.0 / (x * x))))) * (sqrt(2.0) / l));
} else {
tmp = sqrt(((-1.0 + x) / (1.0 + x)));
}
return tmp;
}
NOTE: l should be positive before calling this function
real(8) function code(x, l, t)
real(8), intent (in) :: x
real(8), intent (in) :: l
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-9d-127)) then
tmp = (-1.0d0) + (1.0d0 / x)
else if (t <= 6.5d-123) then
tmp = t * (sqrt((1.0d0 / ((2.0d0 / x) + (2.0d0 / (x * x))))) * (sqrt(2.0d0) / l))
else
tmp = sqrt((((-1.0d0) + x) / (1.0d0 + x)))
end if
code = tmp
end function
l = Math.abs(l);
public static double code(double x, double l, double t) {
double tmp;
if (t <= -9e-127) {
tmp = -1.0 + (1.0 / x);
} else if (t <= 6.5e-123) {
tmp = t * (Math.sqrt((1.0 / ((2.0 / x) + (2.0 / (x * x))))) * (Math.sqrt(2.0) / l));
} else {
tmp = Math.sqrt(((-1.0 + x) / (1.0 + x)));
}
return tmp;
}
l = abs(l) def code(x, l, t): tmp = 0 if t <= -9e-127: tmp = -1.0 + (1.0 / x) elif t <= 6.5e-123: tmp = t * (math.sqrt((1.0 / ((2.0 / x) + (2.0 / (x * x))))) * (math.sqrt(2.0) / l)) else: tmp = math.sqrt(((-1.0 + x) / (1.0 + x))) return tmp
l = abs(l) function code(x, l, t) tmp = 0.0 if (t <= -9e-127) tmp = Float64(-1.0 + Float64(1.0 / x)); elseif (t <= 6.5e-123) tmp = Float64(t * Float64(sqrt(Float64(1.0 / Float64(Float64(2.0 / x) + Float64(2.0 / Float64(x * x))))) * Float64(sqrt(2.0) / l))); else tmp = sqrt(Float64(Float64(-1.0 + x) / Float64(1.0 + x))); end return tmp end
l = abs(l) function tmp_2 = code(x, l, t) tmp = 0.0; if (t <= -9e-127) tmp = -1.0 + (1.0 / x); elseif (t <= 6.5e-123) tmp = t * (sqrt((1.0 / ((2.0 / x) + (2.0 / (x * x))))) * (sqrt(2.0) / l)); else tmp = sqrt(((-1.0 + x) / (1.0 + x))); end tmp_2 = tmp; end
NOTE: l should be positive before calling this function code[x_, l_, t_] := If[LessEqual[t, -9e-127], N[(-1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 6.5e-123], N[(t * N[(N[Sqrt[N[(1.0 / N[(N[(2.0 / x), $MachinePrecision] + N[(2.0 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[(-1.0 + x), $MachinePrecision] / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
l = |l|\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9 \cdot 10^{-127}:\\
\;\;\;\;-1 + \frac{1}{x}\\
\mathbf{elif}\;t \leq 6.5 \cdot 10^{-123}:\\
\;\;\;\;t \cdot \left(\sqrt{\frac{1}{\frac{2}{x} + \frac{2}{x \cdot x}}} \cdot \frac{\sqrt{2}}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{-1 + x}{1 + x}}\\
\end{array}
\end{array}
if t < -8.9999999999999998e-127Initial program 41.4%
associate-*l/41.5%
Simplified41.5%
sqrt-undiv41.6%
fma-neg41.6%
distribute-rgt-neg-out41.6%
fma-udef41.6%
associate-*r*41.6%
fma-def41.6%
add-sqr-sqrt18.6%
sqrt-unprod43.0%
distribute-rgt-neg-out43.0%
distribute-rgt-neg-out43.0%
sqr-neg43.0%
sqrt-unprod43.3%
add-sqr-sqrt43.3%
Applied egg-rr43.3%
Taylor expanded in t around inf 32.9%
sub-neg32.9%
metadata-eval32.9%
unpow232.9%
Simplified32.9%
Taylor expanded in x around -inf 0.0%
unpow20.0%
rem-square-sqrt87.9%
Simplified87.9%
if -8.9999999999999998e-127 < t < 6.49999999999999938e-123Initial program 4.9%
associate-*l/4.9%
Simplified4.9%
Taylor expanded in x around -inf 43.8%
associate--l+43.8%
unpow243.8%
sub-neg43.8%
Simplified43.8%
Taylor expanded in l around inf 41.3%
*-commutative41.3%
associate-*r/41.3%
metadata-eval41.3%
unpow241.3%
associate-*r/41.3%
metadata-eval41.3%
Simplified41.3%
Taylor expanded in l around 0 41.3%
*-commutative41.3%
+-commutative41.3%
associate-*r/41.3%
metadata-eval41.3%
associate-*r/41.3%
metadata-eval41.3%
unpow241.3%
Simplified41.3%
if 6.49999999999999938e-123 < t Initial program 41.2%
associate-*r/41.2%
fma-neg41.2%
sub-neg41.2%
metadata-eval41.2%
+-commutative41.2%
fma-def41.2%
distribute-rgt-neg-in41.2%
Simplified41.2%
Applied egg-rr75.6%
Taylor expanded in t around inf 89.6%
Final simplification77.6%
NOTE: l should be positive before calling this function
(FPCore (x l t)
:precision binary64
(if (<= t -9e-127)
(+ -1.0 (/ 1.0 x))
(if (<= t 2.4e-130)
(* t (/ (sqrt 2.0) (* l (sqrt (+ (/ 2.0 x) (/ 2.0 (* x x)))))))
(sqrt (/ (+ -1.0 x) (+ 1.0 x))))))l = abs(l);
double code(double x, double l, double t) {
double tmp;
if (t <= -9e-127) {
tmp = -1.0 + (1.0 / x);
} else if (t <= 2.4e-130) {
tmp = t * (sqrt(2.0) / (l * sqrt(((2.0 / x) + (2.0 / (x * x))))));
} else {
tmp = sqrt(((-1.0 + x) / (1.0 + x)));
}
return tmp;
}
NOTE: l should be positive before calling this function
real(8) function code(x, l, t)
real(8), intent (in) :: x
real(8), intent (in) :: l
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-9d-127)) then
tmp = (-1.0d0) + (1.0d0 / x)
else if (t <= 2.4d-130) then
tmp = t * (sqrt(2.0d0) / (l * sqrt(((2.0d0 / x) + (2.0d0 / (x * x))))))
else
tmp = sqrt((((-1.0d0) + x) / (1.0d0 + x)))
end if
code = tmp
end function
l = Math.abs(l);
public static double code(double x, double l, double t) {
double tmp;
if (t <= -9e-127) {
tmp = -1.0 + (1.0 / x);
} else if (t <= 2.4e-130) {
tmp = t * (Math.sqrt(2.0) / (l * Math.sqrt(((2.0 / x) + (2.0 / (x * x))))));
} else {
tmp = Math.sqrt(((-1.0 + x) / (1.0 + x)));
}
return tmp;
}
l = abs(l) def code(x, l, t): tmp = 0 if t <= -9e-127: tmp = -1.0 + (1.0 / x) elif t <= 2.4e-130: tmp = t * (math.sqrt(2.0) / (l * math.sqrt(((2.0 / x) + (2.0 / (x * x)))))) else: tmp = math.sqrt(((-1.0 + x) / (1.0 + x))) return tmp
l = abs(l) function code(x, l, t) tmp = 0.0 if (t <= -9e-127) tmp = Float64(-1.0 + Float64(1.0 / x)); elseif (t <= 2.4e-130) tmp = Float64(t * Float64(sqrt(2.0) / Float64(l * sqrt(Float64(Float64(2.0 / x) + Float64(2.0 / Float64(x * x))))))); else tmp = sqrt(Float64(Float64(-1.0 + x) / Float64(1.0 + x))); end return tmp end
l = abs(l) function tmp_2 = code(x, l, t) tmp = 0.0; if (t <= -9e-127) tmp = -1.0 + (1.0 / x); elseif (t <= 2.4e-130) tmp = t * (sqrt(2.0) / (l * sqrt(((2.0 / x) + (2.0 / (x * x)))))); else tmp = sqrt(((-1.0 + x) / (1.0 + x))); end tmp_2 = tmp; end
NOTE: l should be positive before calling this function code[x_, l_, t_] := If[LessEqual[t, -9e-127], N[(-1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.4e-130], N[(t * N[(N[Sqrt[2.0], $MachinePrecision] / N[(l * N[Sqrt[N[(N[(2.0 / x), $MachinePrecision] + N[(2.0 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[(-1.0 + x), $MachinePrecision] / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
l = |l|\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9 \cdot 10^{-127}:\\
\;\;\;\;-1 + \frac{1}{x}\\
\mathbf{elif}\;t \leq 2.4 \cdot 10^{-130}:\\
\;\;\;\;t \cdot \frac{\sqrt{2}}{\ell \cdot \sqrt{\frac{2}{x} + \frac{2}{x \cdot x}}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{-1 + x}{1 + x}}\\
\end{array}
\end{array}
if t < -8.9999999999999998e-127Initial program 41.4%
associate-*l/41.5%
Simplified41.5%
sqrt-undiv41.6%
fma-neg41.6%
distribute-rgt-neg-out41.6%
fma-udef41.6%
associate-*r*41.6%
fma-def41.6%
add-sqr-sqrt18.6%
sqrt-unprod43.0%
distribute-rgt-neg-out43.0%
distribute-rgt-neg-out43.0%
sqr-neg43.0%
sqrt-unprod43.3%
add-sqr-sqrt43.3%
Applied egg-rr43.3%
Taylor expanded in t around inf 32.9%
sub-neg32.9%
metadata-eval32.9%
unpow232.9%
Simplified32.9%
Taylor expanded in x around -inf 0.0%
unpow20.0%
rem-square-sqrt87.9%
Simplified87.9%
if -8.9999999999999998e-127 < t < 2.39999999999999997e-130Initial program 4.9%
associate-*l/4.9%
Simplified4.9%
Taylor expanded in x around -inf 43.8%
associate--l+43.8%
unpow243.8%
sub-neg43.8%
Simplified43.8%
Taylor expanded in l around inf 41.3%
*-commutative41.3%
associate-*r/41.3%
metadata-eval41.3%
unpow241.3%
associate-*r/41.3%
metadata-eval41.3%
Simplified41.3%
if 2.39999999999999997e-130 < t Initial program 41.2%
associate-*r/41.2%
fma-neg41.2%
sub-neg41.2%
metadata-eval41.2%
+-commutative41.2%
fma-def41.2%
distribute-rgt-neg-in41.2%
Simplified41.2%
Applied egg-rr75.6%
Taylor expanded in t around inf 89.6%
Final simplification77.6%
NOTE: l should be positive before calling this function (FPCore (x l t) :precision binary64 (if (<= t -5e-310) (+ -1.0 (/ 1.0 x)) (sqrt (/ (+ -1.0 x) (+ 1.0 x)))))
l = abs(l);
double code(double x, double l, double t) {
double tmp;
if (t <= -5e-310) {
tmp = -1.0 + (1.0 / x);
} else {
tmp = sqrt(((-1.0 + x) / (1.0 + x)));
}
return tmp;
}
NOTE: l should be positive before calling this function
real(8) function code(x, l, t)
real(8), intent (in) :: x
real(8), intent (in) :: l
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-5d-310)) then
tmp = (-1.0d0) + (1.0d0 / x)
else
tmp = sqrt((((-1.0d0) + x) / (1.0d0 + x)))
end if
code = tmp
end function
l = Math.abs(l);
public static double code(double x, double l, double t) {
double tmp;
if (t <= -5e-310) {
tmp = -1.0 + (1.0 / x);
} else {
tmp = Math.sqrt(((-1.0 + x) / (1.0 + x)));
}
return tmp;
}
l = abs(l) def code(x, l, t): tmp = 0 if t <= -5e-310: tmp = -1.0 + (1.0 / x) else: tmp = math.sqrt(((-1.0 + x) / (1.0 + x))) return tmp
l = abs(l) function code(x, l, t) tmp = 0.0 if (t <= -5e-310) tmp = Float64(-1.0 + Float64(1.0 / x)); else tmp = sqrt(Float64(Float64(-1.0 + x) / Float64(1.0 + x))); end return tmp end
l = abs(l) function tmp_2 = code(x, l, t) tmp = 0.0; if (t <= -5e-310) tmp = -1.0 + (1.0 / x); else tmp = sqrt(((-1.0 + x) / (1.0 + x))); end tmp_2 = tmp; end
NOTE: l should be positive before calling this function code[x_, l_, t_] := If[LessEqual[t, -5e-310], N[(-1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[(-1.0 + x), $MachinePrecision] / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
l = |l|\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5 \cdot 10^{-310}:\\
\;\;\;\;-1 + \frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{-1 + x}{1 + x}}\\
\end{array}
\end{array}
if t < -4.999999999999985e-310Initial program 31.2%
associate-*l/31.3%
Simplified31.3%
sqrt-undiv30.9%
fma-neg30.9%
distribute-rgt-neg-out30.9%
fma-udef30.9%
associate-*r*30.9%
fma-def30.9%
add-sqr-sqrt14.2%
sqrt-unprod37.8%
distribute-rgt-neg-out37.8%
distribute-rgt-neg-out37.8%
sqr-neg37.8%
sqrt-unprod38.0%
add-sqr-sqrt38.0%
Applied egg-rr38.0%
Taylor expanded in t around inf 24.9%
sub-neg24.9%
metadata-eval24.9%
unpow224.9%
Simplified24.9%
Taylor expanded in x around -inf 0.0%
unpow20.0%
rem-square-sqrt73.7%
Simplified73.7%
if -4.999999999999985e-310 < t Initial program 34.6%
associate-*r/34.5%
fma-neg34.6%
sub-neg34.6%
metadata-eval34.6%
+-commutative34.6%
fma-def34.6%
distribute-rgt-neg-in34.6%
Simplified34.6%
Applied egg-rr66.3%
Taylor expanded in t around inf 81.0%
Final simplification77.1%
NOTE: l should be positive before calling this function (FPCore (x l t) :precision binary64 (if (<= t -5e-310) (+ -1.0 (/ 1.0 x)) (+ 1.0 (+ (/ 0.5 (* x x)) (/ -1.0 x)))))
l = abs(l);
double code(double x, double l, double t) {
double tmp;
if (t <= -5e-310) {
tmp = -1.0 + (1.0 / x);
} else {
tmp = 1.0 + ((0.5 / (x * x)) + (-1.0 / x));
}
return tmp;
}
NOTE: l should be positive before calling this function
real(8) function code(x, l, t)
real(8), intent (in) :: x
real(8), intent (in) :: l
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-5d-310)) then
tmp = (-1.0d0) + (1.0d0 / x)
else
tmp = 1.0d0 + ((0.5d0 / (x * x)) + ((-1.0d0) / x))
end if
code = tmp
end function
l = Math.abs(l);
public static double code(double x, double l, double t) {
double tmp;
if (t <= -5e-310) {
tmp = -1.0 + (1.0 / x);
} else {
tmp = 1.0 + ((0.5 / (x * x)) + (-1.0 / x));
}
return tmp;
}
l = abs(l) def code(x, l, t): tmp = 0 if t <= -5e-310: tmp = -1.0 + (1.0 / x) else: tmp = 1.0 + ((0.5 / (x * x)) + (-1.0 / x)) return tmp
l = abs(l) function code(x, l, t) tmp = 0.0 if (t <= -5e-310) tmp = Float64(-1.0 + Float64(1.0 / x)); else tmp = Float64(1.0 + Float64(Float64(0.5 / Float64(x * x)) + Float64(-1.0 / x))); end return tmp end
l = abs(l) function tmp_2 = code(x, l, t) tmp = 0.0; if (t <= -5e-310) tmp = -1.0 + (1.0 / x); else tmp = 1.0 + ((0.5 / (x * x)) + (-1.0 / x)); end tmp_2 = tmp; end
NOTE: l should be positive before calling this function code[x_, l_, t_] := If[LessEqual[t, -5e-310], N[(-1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
l = |l|\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5 \cdot 10^{-310}:\\
\;\;\;\;-1 + \frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\frac{0.5}{x \cdot x} + \frac{-1}{x}\right)\\
\end{array}
\end{array}
if t < -4.999999999999985e-310Initial program 31.2%
associate-*l/31.3%
Simplified31.3%
sqrt-undiv30.9%
fma-neg30.9%
distribute-rgt-neg-out30.9%
fma-udef30.9%
associate-*r*30.9%
fma-def30.9%
add-sqr-sqrt14.2%
sqrt-unprod37.8%
distribute-rgt-neg-out37.8%
distribute-rgt-neg-out37.8%
sqr-neg37.8%
sqrt-unprod38.0%
add-sqr-sqrt38.0%
Applied egg-rr38.0%
Taylor expanded in t around inf 24.9%
sub-neg24.9%
metadata-eval24.9%
unpow224.9%
Simplified24.9%
Taylor expanded in x around -inf 0.0%
unpow20.0%
rem-square-sqrt73.7%
Simplified73.7%
if -4.999999999999985e-310 < t Initial program 34.6%
associate-*l/34.7%
Simplified34.7%
sqrt-undiv34.7%
fma-neg34.7%
distribute-rgt-neg-out34.7%
fma-udef34.7%
associate-*r*34.7%
fma-def34.7%
add-sqr-sqrt16.5%
sqrt-unprod36.1%
distribute-rgt-neg-out36.1%
distribute-rgt-neg-out36.1%
sqr-neg36.1%
sqrt-unprod36.5%
add-sqr-sqrt36.5%
Applied egg-rr36.5%
Taylor expanded in t around inf 26.3%
sub-neg26.3%
metadata-eval26.3%
unpow226.3%
Simplified26.3%
Taylor expanded in x around inf 80.8%
associate--l+80.8%
associate-*r/80.8%
metadata-eval80.8%
unpow280.8%
Simplified80.8%
Final simplification77.0%
NOTE: l should be positive before calling this function (FPCore (x l t) :precision binary64 (if (<= t -5e-310) (+ -1.0 (/ 1.0 x)) 1.0))
l = abs(l);
double code(double x, double l, double t) {
double tmp;
if (t <= -5e-310) {
tmp = -1.0 + (1.0 / x);
} else {
tmp = 1.0;
}
return tmp;
}
NOTE: l should be positive before calling this function
real(8) function code(x, l, t)
real(8), intent (in) :: x
real(8), intent (in) :: l
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-5d-310)) then
tmp = (-1.0d0) + (1.0d0 / x)
else
tmp = 1.0d0
end if
code = tmp
end function
l = Math.abs(l);
public static double code(double x, double l, double t) {
double tmp;
if (t <= -5e-310) {
tmp = -1.0 + (1.0 / x);
} else {
tmp = 1.0;
}
return tmp;
}
l = abs(l) def code(x, l, t): tmp = 0 if t <= -5e-310: tmp = -1.0 + (1.0 / x) else: tmp = 1.0 return tmp
l = abs(l) function code(x, l, t) tmp = 0.0 if (t <= -5e-310) tmp = Float64(-1.0 + Float64(1.0 / x)); else tmp = 1.0; end return tmp end
l = abs(l) function tmp_2 = code(x, l, t) tmp = 0.0; if (t <= -5e-310) tmp = -1.0 + (1.0 / x); else tmp = 1.0; end tmp_2 = tmp; end
NOTE: l should be positive before calling this function code[x_, l_, t_] := If[LessEqual[t, -5e-310], N[(-1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision], 1.0]
\begin{array}{l}
l = |l|\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5 \cdot 10^{-310}:\\
\;\;\;\;-1 + \frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if t < -4.999999999999985e-310Initial program 31.2%
associate-*l/31.3%
Simplified31.3%
sqrt-undiv30.9%
fma-neg30.9%
distribute-rgt-neg-out30.9%
fma-udef30.9%
associate-*r*30.9%
fma-def30.9%
add-sqr-sqrt14.2%
sqrt-unprod37.8%
distribute-rgt-neg-out37.8%
distribute-rgt-neg-out37.8%
sqr-neg37.8%
sqrt-unprod38.0%
add-sqr-sqrt38.0%
Applied egg-rr38.0%
Taylor expanded in t around inf 24.9%
sub-neg24.9%
metadata-eval24.9%
unpow224.9%
Simplified24.9%
Taylor expanded in x around -inf 0.0%
unpow20.0%
rem-square-sqrt73.7%
Simplified73.7%
if -4.999999999999985e-310 < t Initial program 34.6%
associate-*l/34.7%
Simplified34.7%
Taylor expanded in x around inf 77.8%
sqrt-unprod79.0%
metadata-eval79.0%
metadata-eval79.0%
Applied egg-rr79.0%
Final simplification76.2%
NOTE: l should be positive before calling this function (FPCore (x l t) :precision binary64 (if (<= t -5e-310) (+ -1.0 (/ 1.0 x)) (+ 1.0 (/ -1.0 x))))
l = abs(l);
double code(double x, double l, double t) {
double tmp;
if (t <= -5e-310) {
tmp = -1.0 + (1.0 / x);
} else {
tmp = 1.0 + (-1.0 / x);
}
return tmp;
}
NOTE: l should be positive before calling this function
real(8) function code(x, l, t)
real(8), intent (in) :: x
real(8), intent (in) :: l
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-5d-310)) then
tmp = (-1.0d0) + (1.0d0 / x)
else
tmp = 1.0d0 + ((-1.0d0) / x)
end if
code = tmp
end function
l = Math.abs(l);
public static double code(double x, double l, double t) {
double tmp;
if (t <= -5e-310) {
tmp = -1.0 + (1.0 / x);
} else {
tmp = 1.0 + (-1.0 / x);
}
return tmp;
}
l = abs(l) def code(x, l, t): tmp = 0 if t <= -5e-310: tmp = -1.0 + (1.0 / x) else: tmp = 1.0 + (-1.0 / x) return tmp
l = abs(l) function code(x, l, t) tmp = 0.0 if (t <= -5e-310) tmp = Float64(-1.0 + Float64(1.0 / x)); else tmp = Float64(1.0 + Float64(-1.0 / x)); end return tmp end
l = abs(l) function tmp_2 = code(x, l, t) tmp = 0.0; if (t <= -5e-310) tmp = -1.0 + (1.0 / x); else tmp = 1.0 + (-1.0 / x); end tmp_2 = tmp; end
NOTE: l should be positive before calling this function code[x_, l_, t_] := If[LessEqual[t, -5e-310], N[(-1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
l = |l|\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5 \cdot 10^{-310}:\\
\;\;\;\;-1 + \frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{-1}{x}\\
\end{array}
\end{array}
if t < -4.999999999999985e-310Initial program 31.2%
associate-*l/31.3%
Simplified31.3%
sqrt-undiv30.9%
fma-neg30.9%
distribute-rgt-neg-out30.9%
fma-udef30.9%
associate-*r*30.9%
fma-def30.9%
add-sqr-sqrt14.2%
sqrt-unprod37.8%
distribute-rgt-neg-out37.8%
distribute-rgt-neg-out37.8%
sqr-neg37.8%
sqrt-unprod38.0%
add-sqr-sqrt38.0%
Applied egg-rr38.0%
Taylor expanded in t around inf 24.9%
sub-neg24.9%
metadata-eval24.9%
unpow224.9%
Simplified24.9%
Taylor expanded in x around -inf 0.0%
unpow20.0%
rem-square-sqrt73.7%
Simplified73.7%
if -4.999999999999985e-310 < t Initial program 34.6%
associate-*l/34.7%
Simplified34.7%
sqrt-undiv34.7%
fma-neg34.7%
distribute-rgt-neg-out34.7%
fma-udef34.7%
associate-*r*34.7%
fma-def34.7%
add-sqr-sqrt16.5%
sqrt-unprod36.1%
distribute-rgt-neg-out36.1%
distribute-rgt-neg-out36.1%
sqr-neg36.1%
sqrt-unprod36.5%
add-sqr-sqrt36.5%
Applied egg-rr36.5%
Taylor expanded in t around inf 26.3%
sub-neg26.3%
metadata-eval26.3%
unpow226.3%
Simplified26.3%
Taylor expanded in x around inf 80.4%
Final simplification76.8%
NOTE: l should be positive before calling this function (FPCore (x l t) :precision binary64 (if (<= t -5e-310) -1.0 1.0))
l = abs(l);
double code(double x, double l, double t) {
double tmp;
if (t <= -5e-310) {
tmp = -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
NOTE: l should be positive before calling this function
real(8) function code(x, l, t)
real(8), intent (in) :: x
real(8), intent (in) :: l
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-5d-310)) then
tmp = -1.0d0
else
tmp = 1.0d0
end if
code = tmp
end function
l = Math.abs(l);
public static double code(double x, double l, double t) {
double tmp;
if (t <= -5e-310) {
tmp = -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
l = abs(l) def code(x, l, t): tmp = 0 if t <= -5e-310: tmp = -1.0 else: tmp = 1.0 return tmp
l = abs(l) function code(x, l, t) tmp = 0.0 if (t <= -5e-310) tmp = -1.0; else tmp = 1.0; end return tmp end
l = abs(l) function tmp_2 = code(x, l, t) tmp = 0.0; if (t <= -5e-310) tmp = -1.0; else tmp = 1.0; end tmp_2 = tmp; end
NOTE: l should be positive before calling this function code[x_, l_, t_] := If[LessEqual[t, -5e-310], -1.0, 1.0]
\begin{array}{l}
l = |l|\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5 \cdot 10^{-310}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if t < -4.999999999999985e-310Initial program 31.2%
associate-*l/31.3%
Simplified31.3%
sqrt-undiv30.9%
fma-neg30.9%
distribute-rgt-neg-out30.9%
fma-udef30.9%
associate-*r*30.9%
fma-def30.9%
add-sqr-sqrt14.2%
sqrt-unprod37.8%
distribute-rgt-neg-out37.8%
distribute-rgt-neg-out37.8%
sqr-neg37.8%
sqrt-unprod38.0%
add-sqr-sqrt38.0%
Applied egg-rr38.0%
Taylor expanded in t around inf 24.9%
associate-*r/24.9%
unpow224.9%
sub-neg24.9%
metadata-eval24.9%
Simplified24.9%
Taylor expanded in x around -inf 0.0%
unpow20.0%
rem-square-sqrt73.4%
Simplified73.4%
Taylor expanded in t around 0 73.6%
if -4.999999999999985e-310 < t Initial program 34.6%
associate-*l/34.7%
Simplified34.7%
Taylor expanded in x around inf 77.8%
sqrt-unprod79.0%
metadata-eval79.0%
metadata-eval79.0%
Applied egg-rr79.0%
Final simplification76.1%
NOTE: l should be positive before calling this function (FPCore (x l t) :precision binary64 -1.0)
l = abs(l);
double code(double x, double l, double t) {
return -1.0;
}
NOTE: l should be positive before calling this function
real(8) function code(x, l, t)
real(8), intent (in) :: x
real(8), intent (in) :: l
real(8), intent (in) :: t
code = -1.0d0
end function
l = Math.abs(l);
public static double code(double x, double l, double t) {
return -1.0;
}
l = abs(l) def code(x, l, t): return -1.0
l = abs(l) function code(x, l, t) return -1.0 end
l = abs(l) function tmp = code(x, l, t) tmp = -1.0; end
NOTE: l should be positive before calling this function code[x_, l_, t_] := -1.0
\begin{array}{l}
l = |l|\\
\\
-1
\end{array}
Initial program 32.8%
associate-*l/32.8%
Simplified32.8%
sqrt-undiv32.6%
fma-neg32.6%
distribute-rgt-neg-out32.6%
fma-udef32.6%
associate-*r*32.6%
fma-def32.6%
add-sqr-sqrt15.3%
sqrt-unprod37.0%
distribute-rgt-neg-out37.0%
distribute-rgt-neg-out37.0%
sqr-neg37.0%
sqrt-unprod37.3%
add-sqr-sqrt37.3%
Applied egg-rr37.3%
Taylor expanded in t around inf 25.5%
associate-*r/25.5%
unpow225.5%
sub-neg25.5%
metadata-eval25.5%
Simplified25.5%
Taylor expanded in x around -inf 0.0%
unpow20.0%
rem-square-sqrt40.4%
Simplified40.4%
Taylor expanded in t around 0 40.5%
Final simplification40.5%
herbie shell --seed 2023257
(FPCore (x l t)
:name "Toniolo and Linder, Equation (7)"
:precision binary64
(/ (* (sqrt 2.0) t) (sqrt (- (* (/ (+ x 1.0) (- x 1.0)) (+ (* l l) (* 2.0 (* t t)))) (* l l)))))