| Alternative 1 | |
|---|---|
| Accuracy | 65.5% |
| Cost | 27400 |
(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)))))
(FPCore (x l t) :precision binary64 (let* ((t_1 (sqrt (/ (+ -1.0 x) (+ x 1.0))))) (if (<= t 7.8e-308) (- t_1) t_1)))
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)));
}
double code(double x, double l, double t) {
double t_1 = sqrt(((-1.0 + x) / (x + 1.0)));
double tmp;
if (t <= 7.8e-308) {
tmp = -t_1;
} 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
code = (sqrt(2.0d0) * t) / sqrt(((((x + 1.0d0) / (x - 1.0d0)) * ((l * l) + (2.0d0 * (t * t)))) - (l * l)))
end 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) :: t_1
real(8) :: tmp
t_1 = sqrt((((-1.0d0) + x) / (x + 1.0d0)))
if (t <= 7.8d-308) then
tmp = -t_1
else
tmp = t_1
end if
code = tmp
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)));
}
public static double code(double x, double l, double t) {
double t_1 = Math.sqrt(((-1.0 + x) / (x + 1.0)));
double tmp;
if (t <= 7.8e-308) {
tmp = -t_1;
} else {
tmp = t_1;
}
return tmp;
}
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)))
def code(x, l, t): t_1 = math.sqrt(((-1.0 + x) / (x + 1.0))) tmp = 0 if t <= 7.8e-308: tmp = -t_1 else: tmp = t_1 return tmp
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 code(x, l, t) t_1 = sqrt(Float64(Float64(-1.0 + x) / Float64(x + 1.0))) tmp = 0.0 if (t <= 7.8e-308) tmp = Float64(-t_1); else tmp = t_1; end return tmp 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
function tmp_2 = code(x, l, t) t_1 = sqrt(((-1.0 + x) / (x + 1.0))); tmp = 0.0; if (t <= 7.8e-308) tmp = -t_1; else tmp = t_1; end tmp_2 = tmp; 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]
code[x_, l_, t_] := Block[{t$95$1 = N[Sqrt[N[(N[(-1.0 + x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 7.8e-308], (-t$95$1), t$95$1]]
\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}}
\begin{array}{l}
t_1 := \sqrt{\frac{-1 + x}{x + 1}}\\
\mathbf{if}\;t \leq 7.8 \cdot 10^{-308}:\\
\;\;\;\;-t_1\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
Results
if t < 7.7999999999999999e-308Initial program 29.5%
Simplified29.4%
[Start]29.5 | \[ \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}}
\] |
|---|---|
associate-*l/ [<=]29.4 | \[ \color{blue}{\frac{\sqrt{2}}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}} \cdot t}
\] |
Taylor expanded in t around -inf 79.0%
Simplified79.0%
[Start]79.0 | \[ \frac{\sqrt{2}}{-1 \cdot \left(\left(\sqrt{2} \cdot t\right) \cdot \sqrt{\frac{1 + x}{x - 1}}\right)} \cdot t
\] |
|---|---|
mul-1-neg [=>]79.0 | \[ \frac{\sqrt{2}}{\color{blue}{-\left(\sqrt{2} \cdot t\right) \cdot \sqrt{\frac{1 + x}{x - 1}}}} \cdot t
\] |
distribute-lft-neg-in [=>]79.0 | \[ \frac{\sqrt{2}}{\color{blue}{\left(-\sqrt{2} \cdot t\right) \cdot \sqrt{\frac{1 + x}{x - 1}}}} \cdot t
\] |
distribute-rgt-neg-out [<=]79.0 | \[ \frac{\sqrt{2}}{\color{blue}{\left(\sqrt{2} \cdot \left(-t\right)\right)} \cdot \sqrt{\frac{1 + x}{x - 1}}} \cdot t
\] |
+-commutative [=>]79.0 | \[ \frac{\sqrt{2}}{\left(\sqrt{2} \cdot \left(-t\right)\right) \cdot \sqrt{\frac{\color{blue}{x + 1}}{x - 1}}} \cdot t
\] |
sub-neg [=>]79.0 | \[ \frac{\sqrt{2}}{\left(\sqrt{2} \cdot \left(-t\right)\right) \cdot \sqrt{\frac{x + 1}{\color{blue}{x + \left(-1\right)}}}} \cdot t
\] |
metadata-eval [=>]79.0 | \[ \frac{\sqrt{2}}{\left(\sqrt{2} \cdot \left(-t\right)\right) \cdot \sqrt{\frac{x + 1}{x + \color{blue}{-1}}}} \cdot t
\] |
+-commutative [=>]79.0 | \[ \frac{\sqrt{2}}{\left(\sqrt{2} \cdot \left(-t\right)\right) \cdot \sqrt{\frac{x + 1}{\color{blue}{-1 + x}}}} \cdot t
\] |
Taylor expanded in t around 0 79.3%
Simplified79.3%
[Start]79.3 | \[ -1 \cdot \sqrt{\frac{x - 1}{1 + x}}
\] |
|---|---|
mul-1-neg [=>]79.3 | \[ \color{blue}{-\sqrt{\frac{x - 1}{1 + x}}}
\] |
sub-neg [=>]79.3 | \[ -\sqrt{\frac{\color{blue}{x + \left(-1\right)}}{1 + x}}
\] |
metadata-eval [=>]79.3 | \[ -\sqrt{\frac{x + \color{blue}{-1}}{1 + x}}
\] |
+-commutative [=>]79.3 | \[ -\sqrt{\frac{\color{blue}{-1 + x}}{1 + x}}
\] |
+-commutative [=>]79.3 | \[ -\sqrt{\frac{-1 + x}{\color{blue}{x + 1}}}
\] |
if 7.7999999999999999e-308 < t Initial program 33.5%
Simplified33.5%
[Start]33.5 | \[ \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}}
\] |
|---|---|
associate-*l/ [<=]33.5 | \[ \color{blue}{\frac{\sqrt{2}}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}} \cdot t}
\] |
Taylor expanded in t around -inf 1.8%
Simplified1.8%
[Start]1.8 | \[ \frac{\sqrt{2}}{-1 \cdot \left(\left(\sqrt{2} \cdot t\right) \cdot \sqrt{\frac{1 + x}{x - 1}}\right)} \cdot t
\] |
|---|---|
mul-1-neg [=>]1.8 | \[ \frac{\sqrt{2}}{\color{blue}{-\left(\sqrt{2} \cdot t\right) \cdot \sqrt{\frac{1 + x}{x - 1}}}} \cdot t
\] |
distribute-lft-neg-in [=>]1.8 | \[ \frac{\sqrt{2}}{\color{blue}{\left(-\sqrt{2} \cdot t\right) \cdot \sqrt{\frac{1 + x}{x - 1}}}} \cdot t
\] |
distribute-rgt-neg-out [<=]1.8 | \[ \frac{\sqrt{2}}{\color{blue}{\left(\sqrt{2} \cdot \left(-t\right)\right)} \cdot \sqrt{\frac{1 + x}{x - 1}}} \cdot t
\] |
+-commutative [=>]1.8 | \[ \frac{\sqrt{2}}{\left(\sqrt{2} \cdot \left(-t\right)\right) \cdot \sqrt{\frac{\color{blue}{x + 1}}{x - 1}}} \cdot t
\] |
sub-neg [=>]1.8 | \[ \frac{\sqrt{2}}{\left(\sqrt{2} \cdot \left(-t\right)\right) \cdot \sqrt{\frac{x + 1}{\color{blue}{x + \left(-1\right)}}}} \cdot t
\] |
metadata-eval [=>]1.8 | \[ \frac{\sqrt{2}}{\left(\sqrt{2} \cdot \left(-t\right)\right) \cdot \sqrt{\frac{x + 1}{x + \color{blue}{-1}}}} \cdot t
\] |
+-commutative [=>]1.8 | \[ \frac{\sqrt{2}}{\left(\sqrt{2} \cdot \left(-t\right)\right) \cdot \sqrt{\frac{x + 1}{\color{blue}{-1 + x}}}} \cdot t
\] |
Applied egg-rr33.5%
[Start]1.8 | \[ \frac{\sqrt{2}}{\left(\sqrt{2} \cdot \left(-t\right)\right) \cdot \sqrt{\frac{x + 1}{-1 + x}}} \cdot t
\] |
|---|---|
associate-/r* [=>]1.8 | \[ \color{blue}{\frac{\frac{\sqrt{2}}{\sqrt{2} \cdot \left(-t\right)}}{\sqrt{\frac{x + 1}{-1 + x}}}} \cdot t
\] |
sqrt-div [=>]1.2 | \[ \frac{\frac{\sqrt{2}}{\sqrt{2} \cdot \left(-t\right)}}{\color{blue}{\frac{\sqrt{x + 1}}{\sqrt{-1 + x}}}} \cdot t
\] |
associate-/r/ [=>]1.3 | \[ \color{blue}{\left(\frac{\frac{\sqrt{2}}{\sqrt{2} \cdot \left(-t\right)}}{\sqrt{x + 1}} \cdot \sqrt{-1 + x}\right)} \cdot t
\] |
add-sqr-sqrt [=>]0.0 | \[ \left(\frac{\frac{\sqrt{2}}{\sqrt{2} \cdot \color{blue}{\left(\sqrt{-t} \cdot \sqrt{-t}\right)}}}{\sqrt{x + 1}} \cdot \sqrt{-1 + x}\right) \cdot t
\] |
sqrt-unprod [=>]25.0 | \[ \left(\frac{\frac{\sqrt{2}}{\sqrt{2} \cdot \color{blue}{\sqrt{\left(-t\right) \cdot \left(-t\right)}}}}{\sqrt{x + 1}} \cdot \sqrt{-1 + x}\right) \cdot t
\] |
sqr-neg [=>]25.0 | \[ \left(\frac{\frac{\sqrt{2}}{\sqrt{2} \cdot \sqrt{\color{blue}{t \cdot t}}}}{\sqrt{x + 1}} \cdot \sqrt{-1 + x}\right) \cdot t
\] |
sqrt-unprod [<=]33.5 | \[ \left(\frac{\frac{\sqrt{2}}{\sqrt{2} \cdot \color{blue}{\left(\sqrt{t} \cdot \sqrt{t}\right)}}}{\sqrt{x + 1}} \cdot \sqrt{-1 + x}\right) \cdot t
\] |
add-sqr-sqrt [<=]33.5 | \[ \left(\frac{\frac{\sqrt{2}}{\sqrt{2} \cdot \color{blue}{t}}}{\sqrt{x + 1}} \cdot \sqrt{-1 + x}\right) \cdot t
\] |
+-commutative [=>]33.5 | \[ \left(\frac{\frac{\sqrt{2}}{\sqrt{2} \cdot t}}{\sqrt{\color{blue}{1 + x}}} \cdot \sqrt{-1 + x}\right) \cdot t
\] |
add-sqr-sqrt [=>]33.5 | \[ \left(\frac{\frac{\sqrt{2}}{\sqrt{2} \cdot t}}{\sqrt{1 + \color{blue}{\sqrt{x} \cdot \sqrt{x}}}} \cdot \sqrt{-1 + x}\right) \cdot t
\] |
hypot-1-def [=>]33.5 | \[ \left(\frac{\frac{\sqrt{2}}{\sqrt{2} \cdot t}}{\color{blue}{\mathsf{hypot}\left(1, \sqrt{x}\right)}} \cdot \sqrt{-1 + x}\right) \cdot t
\] |
+-commutative [=>]33.5 | \[ \left(\frac{\frac{\sqrt{2}}{\sqrt{2} \cdot t}}{\mathsf{hypot}\left(1, \sqrt{x}\right)} \cdot \sqrt{\color{blue}{x + -1}}\right) \cdot t
\] |
Simplified39.0%
[Start]33.5 | \[ \left(\frac{\frac{\sqrt{2}}{\sqrt{2} \cdot t}}{\mathsf{hypot}\left(1, \sqrt{x}\right)} \cdot \sqrt{x + -1}\right) \cdot t
\] |
|---|---|
associate-*l/ [=>]39.0 | \[ \color{blue}{\frac{\frac{\sqrt{2}}{\sqrt{2} \cdot t} \cdot \sqrt{x + -1}}{\mathsf{hypot}\left(1, \sqrt{x}\right)}} \cdot t
\] |
associate-/r* [=>]39.1 | \[ \frac{\color{blue}{\frac{\frac{\sqrt{2}}{\sqrt{2}}}{t}} \cdot \sqrt{x + -1}}{\mathsf{hypot}\left(1, \sqrt{x}\right)} \cdot t
\] |
*-inverses [=>]39.1 | \[ \frac{\frac{\color{blue}{1}}{t} \cdot \sqrt{x + -1}}{\mathsf{hypot}\left(1, \sqrt{x}\right)} \cdot t
\] |
associate-*l/ [=>]39.0 | \[ \frac{\color{blue}{\frac{1 \cdot \sqrt{x + -1}}{t}}}{\mathsf{hypot}\left(1, \sqrt{x}\right)} \cdot t
\] |
*-lft-identity [=>]39.0 | \[ \frac{\frac{\color{blue}{\sqrt{x + -1}}}{t}}{\mathsf{hypot}\left(1, \sqrt{x}\right)} \cdot t
\] |
+-commutative [=>]39.0 | \[ \frac{\frac{\sqrt{\color{blue}{-1 + x}}}{t}}{\mathsf{hypot}\left(1, \sqrt{x}\right)} \cdot t
\] |
Taylor expanded in t around 0 78.1%
Simplified78.1%
[Start]78.1 | \[ \sqrt{\frac{x - 1}{1 + x}}
\] |
|---|---|
+-commutative [=>]78.1 | \[ \sqrt{\frac{x - 1}{\color{blue}{x + 1}}}
\] |
Final simplification78.7%
| Alternative 1 | |
|---|---|
| Accuracy | 65.5% |
| Cost | 27400 |
| Alternative 2 | |
|---|---|
| Accuracy | 65.6% |
| Cost | 14856 |
| Alternative 3 | |
|---|---|
| Accuracy | 65.5% |
| Cost | 14344 |
| Alternative 4 | |
|---|---|
| Accuracy | 73.5% |
| Cost | 13768 |
| Alternative 5 | |
|---|---|
| Accuracy | 73.4% |
| Cost | 13640 |
| Alternative 6 | |
|---|---|
| Accuracy | 76.7% |
| Cost | 6980 |
| Alternative 7 | |
|---|---|
| Accuracy | 76.3% |
| Cost | 836 |
| Alternative 8 | |
|---|---|
| Accuracy | 76.4% |
| Cost | 836 |
| Alternative 9 | |
|---|---|
| Accuracy | 76.4% |
| Cost | 836 |
| Alternative 10 | |
|---|---|
| Accuracy | 75.8% |
| Cost | 452 |
| Alternative 11 | |
|---|---|
| Accuracy | 76.2% |
| Cost | 452 |
| Alternative 12 | |
|---|---|
| Accuracy | 75.5% |
| Cost | 196 |
| Alternative 13 | |
|---|---|
| Accuracy | 39.3% |
| Cost | 64 |
herbie shell --seed 2023159
(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)))))