Average Error: 34.4 → 27.4
Time: 36.2s
Precision: binary64
\[\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)}\]
\[\begin{array}{l} \mathbf{if}\;\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right) \leq 2.1904953972238747 \cdot 10^{-49}:\\ \;\;\;\;\sqrt{\left(2 \cdot n\right) \cdot \left(U \cdot \left(t + \frac{\ell}{Om} \cdot \left(n \cdot \left(\frac{\ell}{Om} \cdot \left(U* - U\right)\right) + \ell \cdot -2\right)\right)\right)}\\ \mathbf{elif}\;\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right) \leq 5.485031934778326 \cdot 10^{+295}:\\ \;\;\;\;\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)}\\ \mathbf{elif}\;\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right) \leq \infty:\\ \;\;\;\;\sqrt{\left(2 \cdot n\right) \cdot U} \cdot \sqrt{t + \frac{\ell}{Om} \cdot \left(\ell \cdot -2 + \ell \cdot \left(\left(U* - U\right) \cdot \frac{n}{Om}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{n \cdot \left(U \cdot \left(\frac{n \cdot U*}{{Om}^{2}} - \left(\frac{n \cdot U}{{Om}^{2}} + 2 \cdot \frac{1}{Om}\right)\right)\right)} \cdot \left(\ell \cdot \sqrt{2}\right) + 0.5 \cdot \left(\frac{t \cdot \sqrt{2}}{\ell} \cdot \sqrt{\frac{n \cdot U}{\frac{n \cdot U*}{{Om}^{2}} - \left(\frac{n \cdot U}{{Om}^{2}} + 2 \cdot \frac{1}{Om}\right)}}\right)\\ \end{array}\]
\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)}
\begin{array}{l}
\mathbf{if}\;\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right) \leq 2.1904953972238747 \cdot 10^{-49}:\\
\;\;\;\;\sqrt{\left(2 \cdot n\right) \cdot \left(U \cdot \left(t + \frac{\ell}{Om} \cdot \left(n \cdot \left(\frac{\ell}{Om} \cdot \left(U* - U\right)\right) + \ell \cdot -2\right)\right)\right)}\\

\mathbf{elif}\;\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right) \leq 5.485031934778326 \cdot 10^{+295}:\\
\;\;\;\;\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)}\\

\mathbf{elif}\;\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right) \leq \infty:\\
\;\;\;\;\sqrt{\left(2 \cdot n\right) \cdot U} \cdot \sqrt{t + \frac{\ell}{Om} \cdot \left(\ell \cdot -2 + \ell \cdot \left(\left(U* - U\right) \cdot \frac{n}{Om}\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{n \cdot \left(U \cdot \left(\frac{n \cdot U*}{{Om}^{2}} - \left(\frac{n \cdot U}{{Om}^{2}} + 2 \cdot \frac{1}{Om}\right)\right)\right)} \cdot \left(\ell \cdot \sqrt{2}\right) + 0.5 \cdot \left(\frac{t \cdot \sqrt{2}}{\ell} \cdot \sqrt{\frac{n \cdot U}{\frac{n \cdot U*}{{Om}^{2}} - \left(\frac{n \cdot U}{{Om}^{2}} + 2 \cdot \frac{1}{Om}\right)}}\right)\\

\end{array}
(FPCore (n U t l Om U*)
 :precision binary64
 (sqrt
  (*
   (* (* 2.0 n) U)
   (- (- t (* 2.0 (/ (* l l) Om))) (* (* n (pow (/ l Om) 2.0)) (- U U*))))))
(FPCore (n U t l Om U*)
 :precision binary64
 (if (<=
      (*
       (* (* 2.0 n) U)
       (- (- t (* 2.0 (/ (* l l) Om))) (* (* n (pow (/ l Om) 2.0)) (- U U*))))
      2.1904953972238747e-49)
   (sqrt
    (*
     (* 2.0 n)
     (* U (+ t (* (/ l Om) (+ (* n (* (/ l Om) (- U* U))) (* l -2.0)))))))
   (if (<=
        (*
         (* (* 2.0 n) U)
         (-
          (- t (* 2.0 (/ (* l l) Om)))
          (* (* n (pow (/ l Om) 2.0)) (- U U*))))
        5.485031934778326e+295)
     (sqrt
      (*
       (* (* 2.0 n) U)
       (- (- t (* 2.0 (/ (* l l) Om))) (* (* n (pow (/ l Om) 2.0)) (- U U*)))))
     (if (<=
          (*
           (* (* 2.0 n) U)
           (-
            (- t (* 2.0 (/ (* l l) Om)))
            (* (* n (pow (/ l Om) 2.0)) (- U U*))))
          INFINITY)
       (*
        (sqrt (* (* 2.0 n) U))
        (sqrt (+ t (* (/ l Om) (+ (* l -2.0) (* l (* (- U* U) (/ n Om))))))))
       (+
        (*
         (sqrt
          (*
           n
           (*
            U
            (-
             (/ (* n U*) (pow Om 2.0))
             (+ (/ (* n U) (pow Om 2.0)) (* 2.0 (/ 1.0 Om)))))))
         (* l (sqrt 2.0)))
        (*
         0.5
         (*
          (/ (* t (sqrt 2.0)) l)
          (sqrt
           (/
            (* n U)
            (-
             (/ (* n U*) (pow Om 2.0))
             (+ (/ (* n U) (pow Om 2.0)) (* 2.0 (/ 1.0 Om)))))))))))))
double code(double n, double U, double t, double l, double Om, double U_42_) {
	return sqrt(((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * pow((l / Om), 2.0)) * (U - U_42_))));
}
double code(double n, double U, double t, double l, double Om, double U_42_) {
	double tmp;
	if ((((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * pow((l / Om), 2.0)) * (U - U_42_)))) <= 2.1904953972238747e-49) {
		tmp = sqrt((2.0 * n) * (U * (t + ((l / Om) * ((n * ((l / Om) * (U_42_ - U))) + (l * -2.0))))));
	} else if ((((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * pow((l / Om), 2.0)) * (U - U_42_)))) <= 5.485031934778326e+295) {
		tmp = sqrt(((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * pow((l / Om), 2.0)) * (U - U_42_))));
	} else if ((((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * pow((l / Om), 2.0)) * (U - U_42_)))) <= ((double) INFINITY)) {
		tmp = sqrt((2.0 * n) * U) * sqrt(t + ((l / Om) * ((l * -2.0) + (l * ((U_42_ - U) * (n / Om))))));
	} else {
		tmp = (sqrt(n * (U * (((n * U_42_) / pow(Om, 2.0)) - (((n * U) / pow(Om, 2.0)) + (2.0 * (1.0 / Om)))))) * (l * sqrt(2.0))) + (0.5 * (((t * sqrt(2.0)) / l) * sqrt((n * U) / (((n * U_42_) / pow(Om, 2.0)) - (((n * U) / pow(Om, 2.0)) + (2.0 * (1.0 / Om)))))));
	}
	return tmp;
}

Error

Bits error versus n

Bits error versus U

Bits error versus t

Bits error versus l

Bits error versus Om

Bits error versus U*

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 4 regimes
  2. if (*.f64 (*.f64 (*.f64 2 n) U) (-.f64 (-.f64 t (*.f64 2 (/.f64 (*.f64 l l) Om))) (*.f64 (*.f64 n (pow.f64 (/.f64 l Om) 2)) (-.f64 U U*)))) < 2.1904953972238747e-49

    1. Initial program 29.1

      \[\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)}\]
    2. Simplified27.3

      \[\leadsto \color{blue}{\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(t + \frac{\ell}{Om} \cdot \left(\ell \cdot -2 + \frac{\ell}{Om} \cdot \left(n \cdot \left(U* - U\right)\right)\right)\right)}}\]
    3. Using strategy rm
    4. Applied add-cube-cbrt_binary64_45427.4

      \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(t + \frac{\ell}{Om} \cdot \color{blue}{\left(\left(\sqrt[3]{\ell \cdot -2 + \frac{\ell}{Om} \cdot \left(n \cdot \left(U* - U\right)\right)} \cdot \sqrt[3]{\ell \cdot -2 + \frac{\ell}{Om} \cdot \left(n \cdot \left(U* - U\right)\right)}\right) \cdot \sqrt[3]{\ell \cdot -2 + \frac{\ell}{Om} \cdot \left(n \cdot \left(U* - U\right)\right)}\right)}\right)}\]
    5. Applied associate-*r*_binary64_35927.4

      \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(t + \color{blue}{\left(\frac{\ell}{Om} \cdot \left(\sqrt[3]{\ell \cdot -2 + \frac{\ell}{Om} \cdot \left(n \cdot \left(U* - U\right)\right)} \cdot \sqrt[3]{\ell \cdot -2 + \frac{\ell}{Om} \cdot \left(n \cdot \left(U* - U\right)\right)}\right)\right) \cdot \sqrt[3]{\ell \cdot -2 + \frac{\ell}{Om} \cdot \left(n \cdot \left(U* - U\right)\right)}}\right)}\]
    6. Simplified28.8

      \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(t + \color{blue}{\left(\frac{\ell}{Om} \cdot \left(\sqrt[3]{n \cdot \frac{\ell \cdot \left(U* - U\right)}{Om} + \ell \cdot -2} \cdot \sqrt[3]{n \cdot \frac{\ell \cdot \left(U* - U\right)}{Om} + \ell \cdot -2}\right)\right)} \cdot \sqrt[3]{\ell \cdot -2 + \frac{\ell}{Om} \cdot \left(n \cdot \left(U* - U\right)\right)}\right)}\]
    7. Using strategy rm
    8. Applied associate-*l*_binary64_36023.9

      \[\leadsto \sqrt{\color{blue}{\left(2 \cdot n\right) \cdot \left(U \cdot \left(t + \left(\frac{\ell}{Om} \cdot \left(\sqrt[3]{n \cdot \frac{\ell \cdot \left(U* - U\right)}{Om} + \ell \cdot -2} \cdot \sqrt[3]{n \cdot \frac{\ell \cdot \left(U* - U\right)}{Om} + \ell \cdot -2}\right)\right) \cdot \sqrt[3]{\ell \cdot -2 + \frac{\ell}{Om} \cdot \left(n \cdot \left(U* - U\right)\right)}\right)\right)}}\]
    9. Simplified21.5

      \[\leadsto \sqrt{\left(2 \cdot n\right) \cdot \color{blue}{\left(U \cdot \left(t + \frac{\ell}{Om} \cdot \left(n \cdot \left(\frac{\ell}{Om} \cdot \left(U* - U\right)\right) + \ell \cdot -2\right)\right)\right)}}\]

    if 2.1904953972238747e-49 < (*.f64 (*.f64 (*.f64 2 n) U) (-.f64 (-.f64 t (*.f64 2 (/.f64 (*.f64 l l) Om))) (*.f64 (*.f64 n (pow.f64 (/.f64 l Om) 2)) (-.f64 U U*)))) < 5.48503193477832607e295

    1. Initial program 0.9

      \[\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)}\]

    if 5.48503193477832607e295 < (*.f64 (*.f64 (*.f64 2 n) U) (-.f64 (-.f64 t (*.f64 2 (/.f64 (*.f64 l l) Om))) (*.f64 (*.f64 n (pow.f64 (/.f64 l Om) 2)) (-.f64 U U*)))) < +inf.0

    1. Initial program 62.3

      \[\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)}\]
    2. Simplified52.3

      \[\leadsto \color{blue}{\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(t + \frac{\ell}{Om} \cdot \left(\ell \cdot -2 + \frac{\ell}{Om} \cdot \left(n \cdot \left(U* - U\right)\right)\right)\right)}}\]
    3. Using strategy rm
    4. Applied div-inv_binary64_41652.3

      \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(t + \frac{\ell}{Om} \cdot \left(\ell \cdot -2 + \color{blue}{\left(\ell \cdot \frac{1}{Om}\right)} \cdot \left(n \cdot \left(U* - U\right)\right)\right)\right)}\]
    5. Applied associate-*l*_binary64_36052.5

      \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(t + \frac{\ell}{Om} \cdot \left(\ell \cdot -2 + \color{blue}{\ell \cdot \left(\frac{1}{Om} \cdot \left(n \cdot \left(U* - U\right)\right)\right)}\right)\right)}\]
    6. Simplified52.5

      \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(t + \frac{\ell}{Om} \cdot \left(\ell \cdot -2 + \ell \cdot \color{blue}{\left(\left(U* - U\right) \cdot \frac{n}{Om}\right)}\right)\right)}\]
    7. Using strategy rm
    8. Applied sqrt-prod_binary64_43551.1

      \[\leadsto \color{blue}{\sqrt{\left(2 \cdot n\right) \cdot U} \cdot \sqrt{t + \frac{\ell}{Om} \cdot \left(\ell \cdot -2 + \ell \cdot \left(\left(U* - U\right) \cdot \frac{n}{Om}\right)\right)}}\]

    if +inf.0 < (*.f64 (*.f64 (*.f64 2 n) U) (-.f64 (-.f64 t (*.f64 2 (/.f64 (*.f64 l l) Om))) (*.f64 (*.f64 n (pow.f64 (/.f64 l Om) 2)) (-.f64 U U*))))

    1. Initial program 64.0

      \[\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)}\]
    2. Simplified63.4

      \[\leadsto \color{blue}{\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(t + \frac{\ell}{Om} \cdot \left(\ell \cdot -2 + \frac{\ell}{Om} \cdot \left(n \cdot \left(U* - U\right)\right)\right)\right)}}\]
    3. Taylor expanded around inf 51.5

      \[\leadsto \color{blue}{\sqrt{n \cdot \left(U \cdot \left(\frac{n \cdot U*}{{Om}^{2}} - \left(\frac{U \cdot n}{{Om}^{2}} + 2 \cdot \frac{1}{Om}\right)\right)\right)} \cdot \left(\ell \cdot \sqrt{2}\right) + 0.5 \cdot \left(\frac{t \cdot \sqrt{2}}{\ell} \cdot \sqrt{\frac{U \cdot n}{\frac{n \cdot U*}{{Om}^{2}} - \left(\frac{U \cdot n}{{Om}^{2}} + 2 \cdot \frac{1}{Om}\right)}}\right)}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification27.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right) \leq 2.1904953972238747 \cdot 10^{-49}:\\ \;\;\;\;\sqrt{\left(2 \cdot n\right) \cdot \left(U \cdot \left(t + \frac{\ell}{Om} \cdot \left(n \cdot \left(\frac{\ell}{Om} \cdot \left(U* - U\right)\right) + \ell \cdot -2\right)\right)\right)}\\ \mathbf{elif}\;\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right) \leq 5.485031934778326 \cdot 10^{+295}:\\ \;\;\;\;\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)}\\ \mathbf{elif}\;\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right) \leq \infty:\\ \;\;\;\;\sqrt{\left(2 \cdot n\right) \cdot U} \cdot \sqrt{t + \frac{\ell}{Om} \cdot \left(\ell \cdot -2 + \ell \cdot \left(\left(U* - U\right) \cdot \frac{n}{Om}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{n \cdot \left(U \cdot \left(\frac{n \cdot U*}{{Om}^{2}} - \left(\frac{n \cdot U}{{Om}^{2}} + 2 \cdot \frac{1}{Om}\right)\right)\right)} \cdot \left(\ell \cdot \sqrt{2}\right) + 0.5 \cdot \left(\frac{t \cdot \sqrt{2}}{\ell} \cdot \sqrt{\frac{n \cdot U}{\frac{n \cdot U*}{{Om}^{2}} - \left(\frac{n \cdot U}{{Om}^{2}} + 2 \cdot \frac{1}{Om}\right)}}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2021059 
(FPCore (n U t l Om U*)
  :name "Toniolo and Linder, Equation (13)"
  :precision binary64
  (sqrt (* (* (* 2.0 n) U) (- (- t (* 2.0 (/ (* l l) Om))) (* (* n (pow (/ l Om) 2.0)) (- U U*))))))