
(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}
(FPCore (x l t)
:precision binary64
(let* ((t_1 (sqrt (/ (+ x -1.0) (+ x 1.0)))))
(if (<= t -1.02e+95)
(- t_1)
(if (<= t 4.5e+134)
(*
t
(/
(sqrt 2.0)
(sqrt (+ (* 2.0 (* t (+ t (/ t x)))) (* 2.0 (/ l (/ x l)))))))
t_1))))
double code(double x, double l, double t) {
double t_1 = sqrt(((x + -1.0) / (x + 1.0)));
double tmp;
if (t <= -1.02e+95) {
tmp = -t_1;
} else if (t <= 4.5e+134) {
tmp = t * (sqrt(2.0) / sqrt(((2.0 * (t * (t + (t / x)))) + (2.0 * (l / (x / l))))));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, l, t)
real(8), intent (in) :: x
real(8), intent (in) :: l
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt(((x + (-1.0d0)) / (x + 1.0d0)))
if (t <= (-1.02d+95)) then
tmp = -t_1
else if (t <= 4.5d+134) then
tmp = t * (sqrt(2.0d0) / sqrt(((2.0d0 * (t * (t + (t / x)))) + (2.0d0 * (l / (x / l))))))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double l, double t) {
double t_1 = Math.sqrt(((x + -1.0) / (x + 1.0)));
double tmp;
if (t <= -1.02e+95) {
tmp = -t_1;
} else if (t <= 4.5e+134) {
tmp = t * (Math.sqrt(2.0) / Math.sqrt(((2.0 * (t * (t + (t / x)))) + (2.0 * (l / (x / l))))));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, l, t): t_1 = math.sqrt(((x + -1.0) / (x + 1.0))) tmp = 0 if t <= -1.02e+95: tmp = -t_1 elif t <= 4.5e+134: tmp = t * (math.sqrt(2.0) / math.sqrt(((2.0 * (t * (t + (t / x)))) + (2.0 * (l / (x / l)))))) else: tmp = t_1 return tmp
function code(x, l, t) t_1 = sqrt(Float64(Float64(x + -1.0) / Float64(x + 1.0))) tmp = 0.0 if (t <= -1.02e+95) tmp = Float64(-t_1); elseif (t <= 4.5e+134) tmp = Float64(t * Float64(sqrt(2.0) / sqrt(Float64(Float64(2.0 * Float64(t * Float64(t + Float64(t / x)))) + Float64(2.0 * Float64(l / Float64(x / l))))))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, l, t) t_1 = sqrt(((x + -1.0) / (x + 1.0))); tmp = 0.0; if (t <= -1.02e+95) tmp = -t_1; elseif (t <= 4.5e+134) tmp = t * (sqrt(2.0) / sqrt(((2.0 * (t * (t + (t / x)))) + (2.0 * (l / (x / l)))))); else tmp = t_1; end tmp_2 = tmp; end
code[x_, l_, t_] := Block[{t$95$1 = N[Sqrt[N[(N[(x + -1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, -1.02e+95], (-t$95$1), If[LessEqual[t, 4.5e+134], N[(t * N[(N[Sqrt[2.0], $MachinePrecision] / N[Sqrt[N[(N[(2.0 * N[(t * N[(t + N[(t / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(l / N[(x / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{\frac{x + -1}{x + 1}}\\
\mathbf{if}\;t \leq -1.02 \cdot 10^{+95}:\\
\;\;\;\;-t_1\\
\mathbf{elif}\;t \leq 4.5 \cdot 10^{+134}:\\
\;\;\;\;t \cdot \frac{\sqrt{2}}{\sqrt{2 \cdot \left(t \cdot \left(t + \frac{t}{x}\right)\right) + 2 \cdot \frac{\ell}{\frac{x}{\ell}}}}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if t < -1.0200000000000001e95Initial program 21.6%
associate-*r/21.6%
fma-neg21.6%
sub-neg21.6%
metadata-eval21.6%
+-commutative21.6%
fma-def21.6%
distribute-rgt-neg-in21.6%
Simplified21.6%
Applied egg-rr87.4%
Taylor expanded in t around -inf 99.9%
mul-1-neg99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
if -1.0200000000000001e95 < t < 4.4999999999999997e134Initial program 44.3%
associate-*l/44.3%
Simplified44.3%
Taylor expanded in x around inf 76.4%
associate--l+76.4%
unpow276.4%
distribute-lft-out76.4%
unpow276.4%
unpow276.4%
associate-*r/76.4%
mul-1-neg76.4%
+-commutative76.4%
unpow276.4%
associate-*l*76.4%
unpow276.4%
fma-udef76.4%
Simplified76.4%
Taylor expanded in t around 0 76.4%
associate-*r/76.4%
mul-1-neg76.4%
unpow276.4%
distribute-rgt-neg-in76.4%
Simplified76.4%
*-un-lft-identity76.4%
associate-*l/76.4%
*-commutative76.4%
+-commutative76.4%
associate-/l*76.4%
Applied egg-rr76.4%
*-lft-identity76.4%
associate-+r-76.4%
sub-neg76.4%
+-commutative76.4%
distribute-rgt-neg-out76.4%
unpow276.4%
distribute-frac-neg76.4%
unpow276.4%
associate-*r/82.4%
remove-double-neg82.4%
associate-+l+82.4%
Simplified82.3%
if 4.4999999999999997e134 < t Initial program 7.6%
associate-*r/7.6%
fma-neg7.6%
sub-neg7.6%
metadata-eval7.6%
+-commutative7.6%
fma-def7.6%
distribute-rgt-neg-in7.6%
Simplified7.6%
Applied egg-rr83.4%
Taylor expanded in t around inf 100.0%
Final simplification90.0%
(FPCore (x l t)
:precision binary64
(if (<= t -5.8e-261)
(+ (/ 1.0 x) (- -1.0 (/ 0.5 (* x x))))
(if (or (<= t 3e-262) (and (not (<= t 1.75e-202)) (<= t 4.6e-119)))
(* t (/ (sqrt x) l))
(sqrt (/ (+ x -1.0) (+ x 1.0))))))
double code(double x, double l, double t) {
double tmp;
if (t <= -5.8e-261) {
tmp = (1.0 / x) + (-1.0 - (0.5 / (x * x)));
} else if ((t <= 3e-262) || (!(t <= 1.75e-202) && (t <= 4.6e-119))) {
tmp = t * (sqrt(x) / l);
} else {
tmp = sqrt(((x + -1.0) / (x + 1.0)));
}
return tmp;
}
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 <= (-5.8d-261)) then
tmp = (1.0d0 / x) + ((-1.0d0) - (0.5d0 / (x * x)))
else if ((t <= 3d-262) .or. (.not. (t <= 1.75d-202)) .and. (t <= 4.6d-119)) then
tmp = t * (sqrt(x) / l)
else
tmp = sqrt(((x + (-1.0d0)) / (x + 1.0d0)))
end if
code = tmp
end function
public static double code(double x, double l, double t) {
double tmp;
if (t <= -5.8e-261) {
tmp = (1.0 / x) + (-1.0 - (0.5 / (x * x)));
} else if ((t <= 3e-262) || (!(t <= 1.75e-202) && (t <= 4.6e-119))) {
tmp = t * (Math.sqrt(x) / l);
} else {
tmp = Math.sqrt(((x + -1.0) / (x + 1.0)));
}
return tmp;
}
def code(x, l, t): tmp = 0 if t <= -5.8e-261: tmp = (1.0 / x) + (-1.0 - (0.5 / (x * x))) elif (t <= 3e-262) or (not (t <= 1.75e-202) and (t <= 4.6e-119)): tmp = t * (math.sqrt(x) / l) else: tmp = math.sqrt(((x + -1.0) / (x + 1.0))) return tmp
function code(x, l, t) tmp = 0.0 if (t <= -5.8e-261) tmp = Float64(Float64(1.0 / x) + Float64(-1.0 - Float64(0.5 / Float64(x * x)))); elseif ((t <= 3e-262) || (!(t <= 1.75e-202) && (t <= 4.6e-119))) tmp = Float64(t * Float64(sqrt(x) / l)); else tmp = sqrt(Float64(Float64(x + -1.0) / Float64(x + 1.0))); end return tmp end
function tmp_2 = code(x, l, t) tmp = 0.0; if (t <= -5.8e-261) tmp = (1.0 / x) + (-1.0 - (0.5 / (x * x))); elseif ((t <= 3e-262) || (~((t <= 1.75e-202)) && (t <= 4.6e-119))) tmp = t * (sqrt(x) / l); else tmp = sqrt(((x + -1.0) / (x + 1.0))); end tmp_2 = tmp; end
code[x_, l_, t_] := If[LessEqual[t, -5.8e-261], N[(N[(1.0 / x), $MachinePrecision] + N[(-1.0 - N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t, 3e-262], And[N[Not[LessEqual[t, 1.75e-202]], $MachinePrecision], LessEqual[t, 4.6e-119]]], N[(t * N[(N[Sqrt[x], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[(x + -1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.8 \cdot 10^{-261}:\\
\;\;\;\;\frac{1}{x} + \left(-1 - \frac{0.5}{x \cdot x}\right)\\
\mathbf{elif}\;t \leq 3 \cdot 10^{-262} \lor \neg \left(t \leq 1.75 \cdot 10^{-202}\right) \land t \leq 4.6 \cdot 10^{-119}:\\
\;\;\;\;t \cdot \frac{\sqrt{x}}{\ell}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{x + -1}{x + 1}}\\
\end{array}
\end{array}
if t < -5.7999999999999997e-261Initial program 33.0%
associate-/l*33.0%
fma-neg33.0%
remove-double-neg33.0%
fma-neg33.0%
sub-neg33.0%
metadata-eval33.0%
remove-double-neg33.0%
fma-def33.0%
Simplified33.0%
Taylor expanded in t around -inf 86.5%
associate-*r*86.5%
neg-mul-186.5%
+-commutative86.5%
sub-neg86.5%
metadata-eval86.5%
+-commutative86.5%
Simplified86.5%
Taylor expanded in x around inf 86.0%
associate-*r/86.0%
metadata-eval86.0%
unpow286.0%
Simplified86.0%
if -5.7999999999999997e-261 < t < 3.00000000000000018e-262 or 1.75e-202 < t < 4.59999999999999987e-119Initial program 9.9%
associate-*l/9.9%
Simplified9.9%
Taylor expanded in x around inf 59.9%
associate--l+59.9%
unpow259.9%
distribute-lft-out59.9%
unpow259.9%
unpow259.9%
associate-*r/59.9%
mul-1-neg59.9%
+-commutative59.9%
unpow259.9%
associate-*l*59.9%
unpow259.9%
fma-udef59.9%
Simplified59.9%
Taylor expanded in t around 0 54.2%
sub-neg54.2%
unpow254.2%
associate-/l*54.2%
mul-1-neg54.2%
unpow254.2%
remove-double-neg54.2%
associate-/l*64.6%
Simplified64.6%
Taylor expanded in l around 0 64.1%
associate-*l/64.1%
*-lft-identity64.1%
Simplified64.1%
if 3.00000000000000018e-262 < t < 1.75e-202 or 4.59999999999999987e-119 < t Initial program 33.2%
associate-*r/33.2%
fma-neg33.2%
sub-neg33.2%
metadata-eval33.2%
+-commutative33.2%
fma-def33.2%
distribute-rgt-neg-in33.2%
Simplified33.2%
Applied egg-rr72.2%
Taylor expanded in t around inf 90.4%
Final simplification86.5%
(FPCore (x l t)
:precision binary64
(let* ((t_1 (sqrt (/ (+ x -1.0) (+ x 1.0)))))
(if (<= t -2.55e-261)
(- t_1)
(if (or (<= t 3e-262) (and (not (<= t 5e-203)) (<= t 4.5e-119)))
(* t (/ (sqrt x) l))
t_1))))
double code(double x, double l, double t) {
double t_1 = sqrt(((x + -1.0) / (x + 1.0)));
double tmp;
if (t <= -2.55e-261) {
tmp = -t_1;
} else if ((t <= 3e-262) || (!(t <= 5e-203) && (t <= 4.5e-119))) {
tmp = t * (sqrt(x) / l);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, l, t)
real(8), intent (in) :: x
real(8), intent (in) :: l
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt(((x + (-1.0d0)) / (x + 1.0d0)))
if (t <= (-2.55d-261)) then
tmp = -t_1
else if ((t <= 3d-262) .or. (.not. (t <= 5d-203)) .and. (t <= 4.5d-119)) then
tmp = t * (sqrt(x) / l)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double l, double t) {
double t_1 = Math.sqrt(((x + -1.0) / (x + 1.0)));
double tmp;
if (t <= -2.55e-261) {
tmp = -t_1;
} else if ((t <= 3e-262) || (!(t <= 5e-203) && (t <= 4.5e-119))) {
tmp = t * (Math.sqrt(x) / l);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, l, t): t_1 = math.sqrt(((x + -1.0) / (x + 1.0))) tmp = 0 if t <= -2.55e-261: tmp = -t_1 elif (t <= 3e-262) or (not (t <= 5e-203) and (t <= 4.5e-119)): tmp = t * (math.sqrt(x) / l) else: tmp = t_1 return tmp
function code(x, l, t) t_1 = sqrt(Float64(Float64(x + -1.0) / Float64(x + 1.0))) tmp = 0.0 if (t <= -2.55e-261) tmp = Float64(-t_1); elseif ((t <= 3e-262) || (!(t <= 5e-203) && (t <= 4.5e-119))) tmp = Float64(t * Float64(sqrt(x) / l)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, l, t) t_1 = sqrt(((x + -1.0) / (x + 1.0))); tmp = 0.0; if (t <= -2.55e-261) tmp = -t_1; elseif ((t <= 3e-262) || (~((t <= 5e-203)) && (t <= 4.5e-119))) tmp = t * (sqrt(x) / l); else tmp = t_1; end tmp_2 = tmp; end
code[x_, l_, t_] := Block[{t$95$1 = N[Sqrt[N[(N[(x + -1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, -2.55e-261], (-t$95$1), If[Or[LessEqual[t, 3e-262], And[N[Not[LessEqual[t, 5e-203]], $MachinePrecision], LessEqual[t, 4.5e-119]]], N[(t * N[(N[Sqrt[x], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{\frac{x + -1}{x + 1}}\\
\mathbf{if}\;t \leq -2.55 \cdot 10^{-261}:\\
\;\;\;\;-t_1\\
\mathbf{elif}\;t \leq 3 \cdot 10^{-262} \lor \neg \left(t \leq 5 \cdot 10^{-203}\right) \land t \leq 4.5 \cdot 10^{-119}:\\
\;\;\;\;t \cdot \frac{\sqrt{x}}{\ell}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if t < -2.54999999999999978e-261Initial program 33.0%
associate-*r/32.9%
fma-neg32.9%
sub-neg32.9%
metadata-eval32.9%
+-commutative32.9%
fma-def32.9%
distribute-rgt-neg-in32.9%
Simplified32.9%
Applied egg-rr70.2%
Taylor expanded in t around -inf 86.5%
mul-1-neg86.5%
sub-neg86.5%
metadata-eval86.5%
Simplified86.5%
if -2.54999999999999978e-261 < t < 3.00000000000000018e-262 or 5.0000000000000002e-203 < t < 4.5000000000000003e-119Initial program 9.9%
associate-*l/9.9%
Simplified9.9%
Taylor expanded in x around inf 59.9%
associate--l+59.9%
unpow259.9%
distribute-lft-out59.9%
unpow259.9%
unpow259.9%
associate-*r/59.9%
mul-1-neg59.9%
+-commutative59.9%
unpow259.9%
associate-*l*59.9%
unpow259.9%
fma-udef59.9%
Simplified59.9%
Taylor expanded in t around 0 54.2%
sub-neg54.2%
unpow254.2%
associate-/l*54.2%
mul-1-neg54.2%
unpow254.2%
remove-double-neg54.2%
associate-/l*64.6%
Simplified64.6%
Taylor expanded in l around 0 64.1%
associate-*l/64.1%
*-lft-identity64.1%
Simplified64.1%
if 3.00000000000000018e-262 < t < 5.0000000000000002e-203 or 4.5000000000000003e-119 < t Initial program 33.2%
associate-*r/33.2%
fma-neg33.2%
sub-neg33.2%
metadata-eval33.2%
+-commutative33.2%
fma-def33.2%
distribute-rgt-neg-in33.2%
Simplified33.2%
Applied egg-rr72.2%
Taylor expanded in t around inf 90.4%
Final simplification86.7%
(FPCore (x l t) :precision binary64 (if (<= t -5.8e-261) (+ (/ 1.0 x) (- -1.0 (/ 0.5 (* x x)))) (* (sqrt x) (/ t l))))
double code(double x, double l, double t) {
double tmp;
if (t <= -5.8e-261) {
tmp = (1.0 / x) + (-1.0 - (0.5 / (x * x)));
} else {
tmp = sqrt(x) * (t / l);
}
return tmp;
}
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 <= (-5.8d-261)) then
tmp = (1.0d0 / x) + ((-1.0d0) - (0.5d0 / (x * x)))
else
tmp = sqrt(x) * (t / l)
end if
code = tmp
end function
public static double code(double x, double l, double t) {
double tmp;
if (t <= -5.8e-261) {
tmp = (1.0 / x) + (-1.0 - (0.5 / (x * x)));
} else {
tmp = Math.sqrt(x) * (t / l);
}
return tmp;
}
def code(x, l, t): tmp = 0 if t <= -5.8e-261: tmp = (1.0 / x) + (-1.0 - (0.5 / (x * x))) else: tmp = math.sqrt(x) * (t / l) return tmp
function code(x, l, t) tmp = 0.0 if (t <= -5.8e-261) tmp = Float64(Float64(1.0 / x) + Float64(-1.0 - Float64(0.5 / Float64(x * x)))); else tmp = Float64(sqrt(x) * Float64(t / l)); end return tmp end
function tmp_2 = code(x, l, t) tmp = 0.0; if (t <= -5.8e-261) tmp = (1.0 / x) + (-1.0 - (0.5 / (x * x))); else tmp = sqrt(x) * (t / l); end tmp_2 = tmp; end
code[x_, l_, t_] := If[LessEqual[t, -5.8e-261], N[(N[(1.0 / x), $MachinePrecision] + N[(-1.0 - N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[x], $MachinePrecision] * N[(t / l), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.8 \cdot 10^{-261}:\\
\;\;\;\;\frac{1}{x} + \left(-1 - \frac{0.5}{x \cdot x}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x} \cdot \frac{t}{\ell}\\
\end{array}
\end{array}
if t < -5.7999999999999997e-261Initial program 33.0%
associate-/l*33.0%
fma-neg33.0%
remove-double-neg33.0%
fma-neg33.0%
sub-neg33.0%
metadata-eval33.0%
remove-double-neg33.0%
fma-def33.0%
Simplified33.0%
Taylor expanded in t around -inf 86.5%
associate-*r*86.5%
neg-mul-186.5%
+-commutative86.5%
sub-neg86.5%
metadata-eval86.5%
+-commutative86.5%
Simplified86.5%
Taylor expanded in x around inf 86.0%
associate-*r/86.0%
metadata-eval86.0%
unpow286.0%
Simplified86.0%
if -5.7999999999999997e-261 < t Initial program 30.2%
associate-*l/30.2%
Simplified30.2%
Taylor expanded in x around inf 47.4%
associate--l+47.4%
unpow247.4%
distribute-lft-out47.4%
unpow247.4%
unpow247.4%
associate-*r/47.4%
mul-1-neg47.4%
+-commutative47.4%
unpow247.4%
associate-*l*47.4%
unpow247.4%
fma-udef47.4%
Simplified47.4%
Taylor expanded in t around 0 14.2%
sub-neg14.2%
unpow214.2%
associate-/l*14.2%
mul-1-neg14.2%
unpow214.2%
remove-double-neg14.2%
associate-/l*16.8%
Simplified16.8%
Taylor expanded in l around 0 10.6%
Final simplification47.4%
(FPCore (x l t) :precision binary64 (if (<= t -5.8e-261) (+ (/ 1.0 x) (- -1.0 (/ 0.5 (* x x)))) (* t (/ (sqrt x) l))))
double code(double x, double l, double t) {
double tmp;
if (t <= -5.8e-261) {
tmp = (1.0 / x) + (-1.0 - (0.5 / (x * x)));
} else {
tmp = t * (sqrt(x) / l);
}
return tmp;
}
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 <= (-5.8d-261)) then
tmp = (1.0d0 / x) + ((-1.0d0) - (0.5d0 / (x * x)))
else
tmp = t * (sqrt(x) / l)
end if
code = tmp
end function
public static double code(double x, double l, double t) {
double tmp;
if (t <= -5.8e-261) {
tmp = (1.0 / x) + (-1.0 - (0.5 / (x * x)));
} else {
tmp = t * (Math.sqrt(x) / l);
}
return tmp;
}
def code(x, l, t): tmp = 0 if t <= -5.8e-261: tmp = (1.0 / x) + (-1.0 - (0.5 / (x * x))) else: tmp = t * (math.sqrt(x) / l) return tmp
function code(x, l, t) tmp = 0.0 if (t <= -5.8e-261) tmp = Float64(Float64(1.0 / x) + Float64(-1.0 - Float64(0.5 / Float64(x * x)))); else tmp = Float64(t * Float64(sqrt(x) / l)); end return tmp end
function tmp_2 = code(x, l, t) tmp = 0.0; if (t <= -5.8e-261) tmp = (1.0 / x) + (-1.0 - (0.5 / (x * x))); else tmp = t * (sqrt(x) / l); end tmp_2 = tmp; end
code[x_, l_, t_] := If[LessEqual[t, -5.8e-261], N[(N[(1.0 / x), $MachinePrecision] + N[(-1.0 - N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(N[Sqrt[x], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.8 \cdot 10^{-261}:\\
\;\;\;\;\frac{1}{x} + \left(-1 - \frac{0.5}{x \cdot x}\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{\sqrt{x}}{\ell}\\
\end{array}
\end{array}
if t < -5.7999999999999997e-261Initial program 33.0%
associate-/l*33.0%
fma-neg33.0%
remove-double-neg33.0%
fma-neg33.0%
sub-neg33.0%
metadata-eval33.0%
remove-double-neg33.0%
fma-def33.0%
Simplified33.0%
Taylor expanded in t around -inf 86.5%
associate-*r*86.5%
neg-mul-186.5%
+-commutative86.5%
sub-neg86.5%
metadata-eval86.5%
+-commutative86.5%
Simplified86.5%
Taylor expanded in x around inf 86.0%
associate-*r/86.0%
metadata-eval86.0%
unpow286.0%
Simplified86.0%
if -5.7999999999999997e-261 < t Initial program 30.2%
associate-*l/30.2%
Simplified30.2%
Taylor expanded in x around inf 47.4%
associate--l+47.4%
unpow247.4%
distribute-lft-out47.4%
unpow247.4%
unpow247.4%
associate-*r/47.4%
mul-1-neg47.4%
+-commutative47.4%
unpow247.4%
associate-*l*47.4%
unpow247.4%
fma-udef47.4%
Simplified47.4%
Taylor expanded in t around 0 14.2%
sub-neg14.2%
unpow214.2%
associate-/l*14.2%
mul-1-neg14.2%
unpow214.2%
remove-double-neg14.2%
associate-/l*16.8%
Simplified16.8%
Taylor expanded in l around 0 13.4%
associate-*l/13.4%
*-lft-identity13.4%
Simplified13.4%
Final simplification48.8%
(FPCore (x l t) :precision binary64 (if (<= t -1.15e-261) (+ (/ 1.0 x) (- -1.0 (/ 0.5 (* x x)))) (/ -0.5 (* x x))))
double code(double x, double l, double t) {
double tmp;
if (t <= -1.15e-261) {
tmp = (1.0 / x) + (-1.0 - (0.5 / (x * x)));
} else {
tmp = -0.5 / (x * x);
}
return tmp;
}
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 <= (-1.15d-261)) then
tmp = (1.0d0 / x) + ((-1.0d0) - (0.5d0 / (x * x)))
else
tmp = (-0.5d0) / (x * x)
end if
code = tmp
end function
public static double code(double x, double l, double t) {
double tmp;
if (t <= -1.15e-261) {
tmp = (1.0 / x) + (-1.0 - (0.5 / (x * x)));
} else {
tmp = -0.5 / (x * x);
}
return tmp;
}
def code(x, l, t): tmp = 0 if t <= -1.15e-261: tmp = (1.0 / x) + (-1.0 - (0.5 / (x * x))) else: tmp = -0.5 / (x * x) return tmp
function code(x, l, t) tmp = 0.0 if (t <= -1.15e-261) tmp = Float64(Float64(1.0 / x) + Float64(-1.0 - Float64(0.5 / Float64(x * x)))); else tmp = Float64(-0.5 / Float64(x * x)); end return tmp end
function tmp_2 = code(x, l, t) tmp = 0.0; if (t <= -1.15e-261) tmp = (1.0 / x) + (-1.0 - (0.5 / (x * x))); else tmp = -0.5 / (x * x); end tmp_2 = tmp; end
code[x_, l_, t_] := If[LessEqual[t, -1.15e-261], N[(N[(1.0 / x), $MachinePrecision] + N[(-1.0 - N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.15 \cdot 10^{-261}:\\
\;\;\;\;\frac{1}{x} + \left(-1 - \frac{0.5}{x \cdot x}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5}{x \cdot x}\\
\end{array}
\end{array}
if t < -1.15e-261Initial program 33.0%
associate-/l*33.0%
fma-neg33.0%
remove-double-neg33.0%
fma-neg33.0%
sub-neg33.0%
metadata-eval33.0%
remove-double-neg33.0%
fma-def33.0%
Simplified33.0%
Taylor expanded in t around -inf 86.5%
associate-*r*86.5%
neg-mul-186.5%
+-commutative86.5%
sub-neg86.5%
metadata-eval86.5%
+-commutative86.5%
Simplified86.5%
Taylor expanded in x around inf 86.0%
associate-*r/86.0%
metadata-eval86.0%
unpow286.0%
Simplified86.0%
if -1.15e-261 < t Initial program 30.2%
associate-/l*30.1%
fma-neg30.2%
remove-double-neg30.2%
fma-neg30.1%
sub-neg30.1%
metadata-eval30.1%
remove-double-neg30.1%
fma-def30.2%
Simplified30.2%
Taylor expanded in t around -inf 1.8%
associate-*r*1.8%
neg-mul-11.8%
+-commutative1.8%
sub-neg1.8%
metadata-eval1.8%
+-commutative1.8%
Simplified1.8%
Taylor expanded in x around inf 1.8%
associate-*r/1.8%
metadata-eval1.8%
unpow21.8%
Simplified1.8%
Taylor expanded in x around 0 5.3%
unpow25.3%
Simplified5.3%
Final simplification44.7%
(FPCore (x l t) :precision binary64 (if (<= t -1.15e-261) (+ (/ 1.0 x) -1.0) (/ -0.5 (* x x))))
double code(double x, double l, double t) {
double tmp;
if (t <= -1.15e-261) {
tmp = (1.0 / x) + -1.0;
} else {
tmp = -0.5 / (x * x);
}
return tmp;
}
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 <= (-1.15d-261)) then
tmp = (1.0d0 / x) + (-1.0d0)
else
tmp = (-0.5d0) / (x * x)
end if
code = tmp
end function
public static double code(double x, double l, double t) {
double tmp;
if (t <= -1.15e-261) {
tmp = (1.0 / x) + -1.0;
} else {
tmp = -0.5 / (x * x);
}
return tmp;
}
def code(x, l, t): tmp = 0 if t <= -1.15e-261: tmp = (1.0 / x) + -1.0 else: tmp = -0.5 / (x * x) return tmp
function code(x, l, t) tmp = 0.0 if (t <= -1.15e-261) tmp = Float64(Float64(1.0 / x) + -1.0); else tmp = Float64(-0.5 / Float64(x * x)); end return tmp end
function tmp_2 = code(x, l, t) tmp = 0.0; if (t <= -1.15e-261) tmp = (1.0 / x) + -1.0; else tmp = -0.5 / (x * x); end tmp_2 = tmp; end
code[x_, l_, t_] := If[LessEqual[t, -1.15e-261], N[(N[(1.0 / x), $MachinePrecision] + -1.0), $MachinePrecision], N[(-0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.15 \cdot 10^{-261}:\\
\;\;\;\;\frac{1}{x} + -1\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5}{x \cdot x}\\
\end{array}
\end{array}
if t < -1.15e-261Initial program 33.0%
associate-/l*33.0%
fma-neg33.0%
remove-double-neg33.0%
fma-neg33.0%
sub-neg33.0%
metadata-eval33.0%
remove-double-neg33.0%
fma-def33.0%
Simplified33.0%
Taylor expanded in t around -inf 86.5%
associate-*r*86.5%
neg-mul-186.5%
+-commutative86.5%
sub-neg86.5%
metadata-eval86.5%
+-commutative86.5%
Simplified86.5%
Taylor expanded in x around inf 85.8%
if -1.15e-261 < t Initial program 30.2%
associate-/l*30.1%
fma-neg30.2%
remove-double-neg30.2%
fma-neg30.1%
sub-neg30.1%
metadata-eval30.1%
remove-double-neg30.1%
fma-def30.2%
Simplified30.2%
Taylor expanded in t around -inf 1.8%
associate-*r*1.8%
neg-mul-11.8%
+-commutative1.8%
sub-neg1.8%
metadata-eval1.8%
+-commutative1.8%
Simplified1.8%
Taylor expanded in x around inf 1.8%
associate-*r/1.8%
metadata-eval1.8%
unpow21.8%
Simplified1.8%
Taylor expanded in x around 0 5.3%
unpow25.3%
Simplified5.3%
Final simplification44.6%
(FPCore (x l t) :precision binary64 (+ (/ 1.0 x) -1.0))
double code(double x, double l, double t) {
return (1.0 / x) + -1.0;
}
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 / x) + (-1.0d0)
end function
public static double code(double x, double l, double t) {
return (1.0 / x) + -1.0;
}
def code(x, l, t): return (1.0 / x) + -1.0
function code(x, l, t) return Float64(Float64(1.0 / x) + -1.0) end
function tmp = code(x, l, t) tmp = (1.0 / x) + -1.0; end
code[x_, l_, t_] := N[(N[(1.0 / x), $MachinePrecision] + -1.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{x} + -1
\end{array}
Initial program 31.5%
associate-/l*31.5%
fma-neg31.5%
remove-double-neg31.5%
fma-neg31.5%
sub-neg31.5%
metadata-eval31.5%
remove-double-neg31.5%
fma-def31.5%
Simplified31.5%
Taylor expanded in t around -inf 43.1%
associate-*r*43.1%
neg-mul-143.1%
+-commutative43.1%
sub-neg43.1%
metadata-eval43.1%
+-commutative43.1%
Simplified43.1%
Taylor expanded in x around inf 42.8%
Final simplification42.8%
(FPCore (x l t) :precision binary64 -1.0)
double code(double x, double l, double t) {
return -1.0;
}
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
public static double code(double x, double l, double t) {
return -1.0;
}
def code(x, l, t): return -1.0
function code(x, l, t) return -1.0 end
function tmp = code(x, l, t) tmp = -1.0; end
code[x_, l_, t_] := -1.0
\begin{array}{l}
\\
-1
\end{array}
Initial program 31.5%
associate-/l*31.5%
fma-neg31.5%
remove-double-neg31.5%
fma-neg31.5%
sub-neg31.5%
metadata-eval31.5%
remove-double-neg31.5%
fma-def31.5%
Simplified31.5%
Taylor expanded in t around -inf 43.1%
associate-*r*43.1%
neg-mul-143.1%
+-commutative43.1%
sub-neg43.1%
metadata-eval43.1%
+-commutative43.1%
Simplified43.1%
Taylor expanded in x around inf 42.5%
Final simplification42.5%
herbie shell --seed 2023213
(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)))))