Average Error: 34.5 → 27.0
Time: 13.3s
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}\;\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)} \leq 2.0492823108714415 \cdot 10^{-161}:\\ \;\;\;\;\sqrt{2 \cdot n} \cdot \sqrt{U \cdot \left(t + \frac{\ell}{Om} \cdot \left(\ell \cdot -2 + n \cdot \left(\frac{\ell}{Om} \cdot \left(U* - U\right)\right)\right)\right)}\\ \mathbf{elif}\;\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)} \leq 2.414158705259629 \cdot 10^{+150}:\\ \;\;\;\;\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}\;\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)} \leq \infty:\\ \;\;\;\;\sqrt{\left(2 \cdot n\right) \cdot U} \cdot \sqrt{t + \frac{\ell}{Om} \cdot \left(\ell \cdot -2 + n \cdot \left(\frac{\ell}{Om} \cdot \left(U* - U\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\sqrt{\left(2 \cdot n\right) \cdot \left(U \cdot \left(t + \frac{\ell}{Om} \cdot \left(\ell \cdot -2 + n \cdot \left(\frac{\ell}{Om} \cdot \left(U* - U\right)\right)\right)\right)\right)}} \cdot \sqrt{\sqrt{\left(2 \cdot n\right) \cdot \left(U \cdot \left(t + \frac{\ell}{Om} \cdot \left(\ell \cdot -2 + n \cdot \left(\frac{\ell}{Om} \cdot \left(U* - U\right)\right)\right)\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}\;\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)} \leq 2.0492823108714415 \cdot 10^{-161}:\\
\;\;\;\;\sqrt{2 \cdot n} \cdot \sqrt{U \cdot \left(t + \frac{\ell}{Om} \cdot \left(\ell \cdot -2 + n \cdot \left(\frac{\ell}{Om} \cdot \left(U* - U\right)\right)\right)\right)}\\

\mathbf{elif}\;\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)} \leq 2.414158705259629 \cdot 10^{+150}:\\
\;\;\;\;\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}\;\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)} \leq \infty:\\
\;\;\;\;\sqrt{\left(2 \cdot n\right) \cdot U} \cdot \sqrt{t + \frac{\ell}{Om} \cdot \left(\ell \cdot -2 + n \cdot \left(\frac{\ell}{Om} \cdot \left(U* - U\right)\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{\sqrt{\left(2 \cdot n\right) \cdot \left(U \cdot \left(t + \frac{\ell}{Om} \cdot \left(\ell \cdot -2 + n \cdot \left(\frac{\ell}{Om} \cdot \left(U* - U\right)\right)\right)\right)\right)}} \cdot \sqrt{\sqrt{\left(2 \cdot n\right) \cdot \left(U \cdot \left(t + \frac{\ell}{Om} \cdot \left(\ell \cdot -2 + n \cdot \left(\frac{\ell}{Om} \cdot \left(U* - U\right)\right)\right)\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 (<=
      (sqrt
       (*
        (* (* 2.0 n) U)
        (-
         (- t (* 2.0 (/ (* l l) Om)))
         (* (* n (pow (/ l Om) 2.0)) (- U U*)))))
      2.0492823108714415e-161)
   (*
    (sqrt (* 2.0 n))
    (sqrt (* U (+ t (* (/ l Om) (+ (* l -2.0) (* n (* (/ l Om) (- U* U)))))))))
   (if (<=
        (sqrt
         (*
          (* (* 2.0 n) U)
          (-
           (- t (* 2.0 (/ (* l l) Om)))
           (* (* n (pow (/ l Om) 2.0)) (- U U*)))))
        2.414158705259629e+150)
     (sqrt
      (*
       (* (* 2.0 n) U)
       (- (- t (* 2.0 (/ (* l l) Om))) (* (* n (pow (/ l Om) 2.0)) (- U U*)))))
     (if (<=
          (sqrt
           (*
            (* (* 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) (* n (* (/ l Om) (- U* U))))))))
       (*
        (sqrt
         (sqrt
          (*
           (* 2.0 n)
           (*
            U
            (+ t (* (/ l Om) (+ (* l -2.0) (* n (* (/ l Om) (- U* U))))))))))
        (sqrt
         (sqrt
          (*
           (* 2.0 n)
           (*
            U
            (+
             t
             (* (/ l Om) (+ (* l -2.0) (* n (* (/ l Om) (- U* U)))))))))))))))
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 (sqrt(((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * pow((l / Om), 2.0)) * (U - U_42_)))) <= 2.0492823108714415e-161) {
		tmp = sqrt(2.0 * n) * sqrt(U * (t + ((l / Om) * ((l * -2.0) + (n * ((l / Om) * (U_42_ - U)))))));
	} else if (sqrt(((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * pow((l / Om), 2.0)) * (U - U_42_)))) <= 2.414158705259629e+150) {
		tmp = sqrt(((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * pow((l / Om), 2.0)) * (U - U_42_))));
	} else if (sqrt(((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) + (n * ((l / Om) * (U_42_ - U))))));
	} else {
		tmp = sqrt(sqrt((2.0 * n) * (U * (t + ((l / Om) * ((l * -2.0) + (n * ((l / Om) * (U_42_ - U))))))))) * sqrt(sqrt((2.0 * n) * (U * (t + ((l / Om) * ((l * -2.0) + (n * ((l / Om) * (U_42_ - U)))))))));
	}
	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 (sqrt.f64 (*.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.0492823108714415e-161

    1. Initial program 56.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. Simplified56.0

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

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

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

    if 2.0492823108714415e-161 < (sqrt.f64 (*.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.4141587052596291e150

    1. Initial program 1.8

      \[\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 2.4141587052596291e150 < (sqrt.f64 (*.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 63.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. Simplified53.0

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

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

    if +inf.0 < (sqrt.f64 (*.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. Simplified56.0

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

      \[\leadsto \sqrt{\color{blue}{\left(2 \cdot n\right) \cdot \left(U \cdot \left(t + \frac{\ell}{Om} \cdot \left(\ell \cdot -2 + n \cdot \left(\frac{\ell}{Om} \cdot \left(U* - U\right)\right)\right)\right)\right)}}\]
    5. Using strategy rm
    6. Applied add-sqr-sqrt_binary6451.2

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\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)} \leq 2.0492823108714415 \cdot 10^{-161}:\\ \;\;\;\;\sqrt{2 \cdot n} \cdot \sqrt{U \cdot \left(t + \frac{\ell}{Om} \cdot \left(\ell \cdot -2 + n \cdot \left(\frac{\ell}{Om} \cdot \left(U* - U\right)\right)\right)\right)}\\ \mathbf{elif}\;\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)} \leq 2.414158705259629 \cdot 10^{+150}:\\ \;\;\;\;\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}\;\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)} \leq \infty:\\ \;\;\;\;\sqrt{\left(2 \cdot n\right) \cdot U} \cdot \sqrt{t + \frac{\ell}{Om} \cdot \left(\ell \cdot -2 + n \cdot \left(\frac{\ell}{Om} \cdot \left(U* - U\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\sqrt{\left(2 \cdot n\right) \cdot \left(U \cdot \left(t + \frac{\ell}{Om} \cdot \left(\ell \cdot -2 + n \cdot \left(\frac{\ell}{Om} \cdot \left(U* - U\right)\right)\right)\right)\right)}} \cdot \sqrt{\sqrt{\left(2 \cdot n\right) \cdot \left(U \cdot \left(t + \frac{\ell}{Om} \cdot \left(\ell \cdot -2 + n \cdot \left(\frac{\ell}{Om} \cdot \left(U* - U\right)\right)\right)\right)\right)}}\\ \end{array}\]

Reproduce

herbie shell --seed 2020224 
(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*))))))