Average Error: 34.6 → 27.4
Time: 33.2s
Precision: binary64
Cost: 37442
\[\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 3.486260874876501 \cdot 10^{-161}:\\ \;\;\;\;\sqrt{2 \cdot n} \cdot \sqrt{U \cdot \left(t + \frac{\ell}{Om} \cdot \left(\frac{\ell}{Om} \cdot \left(n \cdot \left(U* - U\right)\right) + \ell \cdot -2\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(\left(2 \cdot n\right) \cdot U\right) \cdot \left(t + \frac{\ell}{Om} \cdot \left(\ell \cdot -2 + \left(U* - U\right) \cdot \left(n \cdot \frac{\ell}{Om}\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\left(2 \cdot n\right) \cdot \left(U \cdot \left(t + \frac{\ell}{Om} \cdot \left(\ell \cdot -2 + \ell \cdot \frac{n \cdot \left(U* - U\right)}{Om}\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 3.486260874876501 \cdot 10^{-161}:\\
\;\;\;\;\sqrt{2 \cdot n} \cdot \sqrt{U \cdot \left(t + \frac{\ell}{Om} \cdot \left(\frac{\ell}{Om} \cdot \left(n \cdot \left(U* - U\right)\right) + \ell \cdot -2\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(\left(2 \cdot n\right) \cdot U\right) \cdot \left(t + \frac{\ell}{Om} \cdot \left(\ell \cdot -2 + \left(U* - U\right) \cdot \left(n \cdot \frac{\ell}{Om}\right)\right)\right)}\\

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

Alternatives

Alternative 1
Error29.3
Cost8642
\[\begin{array}{l} \mathbf{if}\;U \leq -5.821043595233304 \cdot 10^{-63}:\\ \;\;\;\;\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(t + \frac{\ell}{Om} \cdot \left(\ell \cdot -2 + U* \cdot \left(n \cdot \frac{\ell}{Om}\right)\right)\right)}\\ \mathbf{elif}\;U \leq 2.756168924462203 \cdot 10^{-22}:\\ \;\;\;\;\sqrt{\left(2 \cdot n\right) \cdot \left(U \cdot \left(t + \frac{\ell}{Om} \cdot \left(\frac{\ell}{Om} \cdot \left(n \cdot \left(U* - U\right)\right) + \ell \cdot -2\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(t + \frac{\ell}{Om} \cdot \left(\ell \cdot -2 + \left(U* - U\right) \cdot \left(n \cdot \frac{\ell}{Om}\right)\right)\right)}\\ \end{array}\]
Alternative 2
Error29.3
Cost8328
\[\begin{array}{l} \mathbf{if}\;U \leq -5.2674285102742717 \cdot 10^{-73} \lor \neg \left(U \leq 1.2779642366095113 \cdot 10^{-21}\right):\\ \;\;\;\;\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(t + \frac{\ell}{Om} \cdot \left(\ell \cdot -2 + U* \cdot \left(n \cdot \frac{\ell}{Om}\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\left(2 \cdot n\right) \cdot \left(U \cdot \left(t + \frac{\ell}{Om} \cdot \left(\frac{\ell}{Om} \cdot \left(n \cdot \left(U* - U\right)\right) + \ell \cdot -2\right)\right)\right)}\\ \end{array}\]
Alternative 3
Error29.4
Cost8200
\[\begin{array}{l} \mathbf{if}\;U \leq -1.5213259132166573 \cdot 10^{-70} \lor \neg \left(U \leq 8.437199943290809 \cdot 10^{-22}\right):\\ \;\;\;\;\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(t + \frac{\ell}{Om} \cdot \left(\ell \cdot -2 + U* \cdot \left(n \cdot \frac{\ell}{Om}\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\left(2 \cdot n\right) \cdot \left(U \cdot \left(t + \frac{\ell}{Om} \cdot \left(\ell \cdot -2 + \frac{\ell}{Om} \cdot \left(n \cdot U*\right)\right)\right)\right)}\\ \end{array}\]
Alternative 4
Error30.4
Cost8200
\[\begin{array}{l} \mathbf{if}\;U \leq -1.3128009189473633 \cdot 10^{+102} \lor \neg \left(U \leq 130038674.03470507\right):\\ \;\;\;\;\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(t + \frac{\ell}{Om} \cdot \left(\ell \cdot -2\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\left(2 \cdot n\right) \cdot \left(U \cdot \left(t + \frac{\ell}{Om} \cdot \left(\ell \cdot -2 + \frac{\ell}{Om} \cdot \left(n \cdot U*\right)\right)\right)\right)}\\ \end{array}\]
Alternative 5
Error35.1
Cost8065
\[\begin{array}{l} \mathbf{if}\;U \leq -9.678987921765244 \cdot 10^{-208}:\\ \;\;\;\;\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(t + \frac{\ell}{Om} \cdot \left(\frac{\ell}{Om} \cdot \left(n \cdot \left(U* - U\right)\right)\right)\right)}\\ \mathbf{elif}\;U \leq 1.507264015722949 \cdot 10^{+99}:\\ \;\;\;\;\sqrt{\left(2 \cdot n\right) \cdot \left(U \cdot \left(t - 2 \cdot \left(\ell \cdot \frac{\ell}{Om}\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(t + \frac{\ell}{Om} \cdot \left(\ell \cdot -2\right)\right)}\\ \end{array}\]
Alternative 6
Error32.4
Cost7688
\[\begin{array}{l} \mathbf{if}\;U \leq -1.8800940374351994 \cdot 10^{-84} \lor \neg \left(U \leq 3.94950672956852 \cdot 10^{-22}\right):\\ \;\;\;\;\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(t + \frac{\ell}{Om} \cdot \left(\ell \cdot -2\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\left(2 \cdot n\right) \cdot \left(U \cdot \left(t - 2 \cdot \left(\ell \cdot \frac{\ell}{Om}\right)\right)\right)}\\ \end{array}\]
Alternative 7
Error35.1
Cost7688
\[\begin{array}{l} \mathbf{if}\;U \leq -3.6220077831847705 \cdot 10^{-73} \lor \neg \left(U \leq 1.5189341496471785 \cdot 10^{-60}\right):\\ \;\;\;\;\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(t + \frac{\ell}{Om} \cdot \left(\ell \cdot -2\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\left(2 \cdot n\right) \cdot \left(U \cdot t\right)}\\ \end{array}\]
Alternative 8
Error39.9
Cost7308
\[\begin{array}{l} \mathbf{if}\;t \leq -3.22089757041123 \cdot 10^{+204} \lor \neg \left(t \leq 6.65881863915787 \cdot 10^{-150}\right) \land t \leq 9.202617622269927 \cdot 10^{+166}:\\ \;\;\;\;\sqrt{\left(2 \cdot n\right) \cdot \left(U \cdot t\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{2 \cdot \left(t \cdot \left(n \cdot U\right)\right)}\\ \end{array}\]
Alternative 9
Error40.3
Cost6848
\[\sqrt{\left(2 \cdot n\right) \cdot \left(U \cdot t\right)}\]
Alternative 10
Error60.1
Cost64
\[1\]

Error

Derivation

  1. Split input into 3 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*))))) < 3.486260874876501e-161

    1. Initial program 56.5

      \[\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.5

      \[\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 associate-*l*_binary64_36038.6

      \[\leadsto \sqrt{\color{blue}{\left(2 \cdot n\right) \cdot \left(U \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)\right)}}\]
    5. Using strategy rm
    6. Applied sqrt-prod_binary64_43538.4

      \[\leadsto \color{blue}{\sqrt{2 \cdot n} \cdot \sqrt{U \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)}}\]
    7. Simplified38.4

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

    if 3.486260874876501e-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*))))) < +inf.0

    1. Initial program 24.2

      \[\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. Simplified22.5

      \[\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 associate-*r*_binary64_35920.1

      \[\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(\frac{\ell}{Om} \cdot n\right) \cdot \left(U* - U\right)}\right)\right)}\]
    5. Simplified20.1

      \[\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(n \cdot \frac{\ell}{Om}\right)} \cdot \left(U* - U\right)\right)\right)}\]
    6. Simplified20.1

      \[\leadsto \color{blue}{\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(t + \frac{\ell}{Om} \cdot \left(\ell \cdot -2 + \left(U* - U\right) \cdot \left(n \cdot \frac{\ell}{Om}\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. Simplified58.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 + \frac{\ell}{Om} \cdot \left(n \cdot \left(U* - U\right)\right)\right)\right)}}\]
    3. Using strategy rm
    4. Applied associate-*l*_binary64_36052.6

      \[\leadsto \sqrt{\color{blue}{\left(2 \cdot n\right) \cdot \left(U \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)\right)}}\]
    5. Using strategy rm
    6. Applied div-inv_binary64_41652.6

      \[\leadsto \sqrt{\left(2 \cdot n\right) \cdot \left(U \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)\right)}\]
    7. Applied associate-*l*_binary64_36052.6

      \[\leadsto \sqrt{\left(2 \cdot n\right) \cdot \left(U \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)\right)}\]
    8. Simplified52.6

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

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

    \[\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 3.486260874876501 \cdot 10^{-161}:\\ \;\;\;\;\sqrt{2 \cdot n} \cdot \sqrt{U \cdot \left(t + \frac{\ell}{Om} \cdot \left(\frac{\ell}{Om} \cdot \left(n \cdot \left(U* - U\right)\right) + \ell \cdot -2\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(\left(2 \cdot n\right) \cdot U\right) \cdot \left(t + \frac{\ell}{Om} \cdot \left(\ell \cdot -2 + \left(U* - U\right) \cdot \left(n \cdot \frac{\ell}{Om}\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\left(2 \cdot n\right) \cdot \left(U \cdot \left(t + \frac{\ell}{Om} \cdot \left(\ell \cdot -2 + \ell \cdot \frac{n \cdot \left(U* - U\right)}{Om}\right)\right)\right)}\\ \end{array}\]

Reproduce

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