?

Average Error: 10.0 → 0.8
Time: 2.2min
Precision: binary64
Cost: 20872

?

\[\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right) \]
\[\begin{array}{l} \mathbf{if}\;\frac{t}{\ell} \leq -5 \cdot 10^{+155}:\\ \;\;\;\;\sin^{-1} \left(\frac{\sqrt{0.5}}{-t} \cdot \ell\right)\\ \mathbf{elif}\;\frac{t}{\ell} \leq 2 \cdot 10^{+119}:\\ \;\;\;\;\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + \frac{2}{\frac{\ell}{t} \cdot \frac{\ell}{t}}}}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} \left(\frac{\sqrt{0.5}}{t} \cdot \ell\right)\\ \end{array} \]
(FPCore (t l Om Omc)
 :precision binary64
 (asin
  (sqrt (/ (- 1.0 (pow (/ Om Omc) 2.0)) (+ 1.0 (* 2.0 (pow (/ t l) 2.0)))))))
(FPCore (t l Om Omc)
 :precision binary64
 (if (<= (/ t l) -5e+155)
   (asin (* (/ (sqrt 0.5) (- t)) l))
   (if (<= (/ t l) 2e+119)
     (asin
      (sqrt
       (/ (- 1.0 (pow (/ Om Omc) 2.0)) (+ 1.0 (/ 2.0 (* (/ l t) (/ l t)))))))
     (asin (* (/ (sqrt 0.5) t) l)))))
double code(double t, double l, double Om, double Omc) {
	return asin(sqrt(((1.0 - pow((Om / Omc), 2.0)) / (1.0 + (2.0 * pow((t / l), 2.0))))));
}
double code(double t, double l, double Om, double Omc) {
	double tmp;
	if ((t / l) <= -5e+155) {
		tmp = asin(((sqrt(0.5) / -t) * l));
	} else if ((t / l) <= 2e+119) {
		tmp = asin(sqrt(((1.0 - pow((Om / Omc), 2.0)) / (1.0 + (2.0 / ((l / t) * (l / t)))))));
	} else {
		tmp = asin(((sqrt(0.5) / t) * l));
	}
	return tmp;
}
real(8) function code(t, l, om, omc)
    real(8), intent (in) :: t
    real(8), intent (in) :: l
    real(8), intent (in) :: om
    real(8), intent (in) :: omc
    code = asin(sqrt(((1.0d0 - ((om / omc) ** 2.0d0)) / (1.0d0 + (2.0d0 * ((t / l) ** 2.0d0))))))
end function
real(8) function code(t, l, om, omc)
    real(8), intent (in) :: t
    real(8), intent (in) :: l
    real(8), intent (in) :: om
    real(8), intent (in) :: omc
    real(8) :: tmp
    if ((t / l) <= (-5d+155)) then
        tmp = asin(((sqrt(0.5d0) / -t) * l))
    else if ((t / l) <= 2d+119) then
        tmp = asin(sqrt(((1.0d0 - ((om / omc) ** 2.0d0)) / (1.0d0 + (2.0d0 / ((l / t) * (l / t)))))))
    else
        tmp = asin(((sqrt(0.5d0) / t) * l))
    end if
    code = tmp
end function
public static double code(double t, double l, double Om, double Omc) {
	return Math.asin(Math.sqrt(((1.0 - Math.pow((Om / Omc), 2.0)) / (1.0 + (2.0 * Math.pow((t / l), 2.0))))));
}
public static double code(double t, double l, double Om, double Omc) {
	double tmp;
	if ((t / l) <= -5e+155) {
		tmp = Math.asin(((Math.sqrt(0.5) / -t) * l));
	} else if ((t / l) <= 2e+119) {
		tmp = Math.asin(Math.sqrt(((1.0 - Math.pow((Om / Omc), 2.0)) / (1.0 + (2.0 / ((l / t) * (l / t)))))));
	} else {
		tmp = Math.asin(((Math.sqrt(0.5) / t) * l));
	}
	return tmp;
}
def code(t, l, Om, Omc):
	return math.asin(math.sqrt(((1.0 - math.pow((Om / Omc), 2.0)) / (1.0 + (2.0 * math.pow((t / l), 2.0))))))
def code(t, l, Om, Omc):
	tmp = 0
	if (t / l) <= -5e+155:
		tmp = math.asin(((math.sqrt(0.5) / -t) * l))
	elif (t / l) <= 2e+119:
		tmp = math.asin(math.sqrt(((1.0 - math.pow((Om / Omc), 2.0)) / (1.0 + (2.0 / ((l / t) * (l / t)))))))
	else:
		tmp = math.asin(((math.sqrt(0.5) / t) * l))
	return tmp
function code(t, l, Om, Omc)
	return asin(sqrt(Float64(Float64(1.0 - (Float64(Om / Omc) ^ 2.0)) / Float64(1.0 + Float64(2.0 * (Float64(t / l) ^ 2.0))))))
end
function code(t, l, Om, Omc)
	tmp = 0.0
	if (Float64(t / l) <= -5e+155)
		tmp = asin(Float64(Float64(sqrt(0.5) / Float64(-t)) * l));
	elseif (Float64(t / l) <= 2e+119)
		tmp = asin(sqrt(Float64(Float64(1.0 - (Float64(Om / Omc) ^ 2.0)) / Float64(1.0 + Float64(2.0 / Float64(Float64(l / t) * Float64(l / t)))))));
	else
		tmp = asin(Float64(Float64(sqrt(0.5) / t) * l));
	end
	return tmp
end
function tmp = code(t, l, Om, Omc)
	tmp = asin(sqrt(((1.0 - ((Om / Omc) ^ 2.0)) / (1.0 + (2.0 * ((t / l) ^ 2.0))))));
end
function tmp_2 = code(t, l, Om, Omc)
	tmp = 0.0;
	if ((t / l) <= -5e+155)
		tmp = asin(((sqrt(0.5) / -t) * l));
	elseif ((t / l) <= 2e+119)
		tmp = asin(sqrt(((1.0 - ((Om / Omc) ^ 2.0)) / (1.0 + (2.0 / ((l / t) * (l / t)))))));
	else
		tmp = asin(((sqrt(0.5) / t) * l));
	end
	tmp_2 = tmp;
end
code[t_, l_, Om_, Omc_] := N[ArcSin[N[Sqrt[N[(N[(1.0 - N[Power[N[(Om / Omc), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(2.0 * N[Power[N[(t / l), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]
code[t_, l_, Om_, Omc_] := If[LessEqual[N[(t / l), $MachinePrecision], -5e+155], N[ArcSin[N[(N[(N[Sqrt[0.5], $MachinePrecision] / (-t)), $MachinePrecision] * l), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(t / l), $MachinePrecision], 2e+119], N[ArcSin[N[Sqrt[N[(N[(1.0 - N[Power[N[(Om / Omc), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(2.0 / N[(N[(l / t), $MachinePrecision] * N[(l / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(N[(N[Sqrt[0.5], $MachinePrecision] / t), $MachinePrecision] * l), $MachinePrecision]], $MachinePrecision]]]
\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right)
\begin{array}{l}
\mathbf{if}\;\frac{t}{\ell} \leq -5 \cdot 10^{+155}:\\
\;\;\;\;\sin^{-1} \left(\frac{\sqrt{0.5}}{-t} \cdot \ell\right)\\

\mathbf{elif}\;\frac{t}{\ell} \leq 2 \cdot 10^{+119}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + \frac{2}{\frac{\ell}{t} \cdot \frac{\ell}{t}}}}\right)\\

\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\sqrt{0.5}}{t} \cdot \ell\right)\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Split input into 3 regimes
  2. if (/.f64 t l) < -4.9999999999999999e155

    1. Initial program 33.2

      \[\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right) \]
    2. Taylor expanded in l around 0 28.2

      \[\leadsto \sin^{-1} \color{blue}{\left(\sqrt{0.5 \cdot \frac{1 - \frac{{Om}^{2}}{{Omc}^{2}}}{{t}^{2}}} \cdot \ell\right)} \]
    3. Simplified22.4

      \[\leadsto \sin^{-1} \color{blue}{\left(\sqrt{0.5 \cdot \frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{{t}^{2}}} \cdot \ell\right)} \]
      Proof
    4. Taylor expanded in Om around 0 22.5

      \[\leadsto \sin^{-1} \left(\color{blue}{\sqrt{\frac{0.5}{{t}^{2}}}} \cdot \ell\right) \]
    5. Taylor expanded in t around -inf 0.6

      \[\leadsto \sin^{-1} \left(\color{blue}{\left(-1 \cdot \frac{\sqrt{0.5}}{t}\right)} \cdot \ell\right) \]
    6. Simplified0.6

      \[\leadsto \sin^{-1} \left(\color{blue}{\frac{\sqrt{0.5}}{-t}} \cdot \ell\right) \]
      Proof

    if -4.9999999999999999e155 < (/.f64 t l) < 1.99999999999999989e119

    1. Initial program 1.0

      \[\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right) \]
    2. Applied egg-rr1.0

      \[\leadsto \sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot \color{blue}{\left(\frac{t}{\ell} \cdot \frac{t}{\ell}\right)}}}\right) \]
    3. Taylor expanded in t around inf 15.9

      \[\leadsto \color{blue}{\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot \frac{1}{{\ell}^{2} \cdot {\left(\frac{1}{t}\right)}^{2}}}}\right)} \]
    4. Simplified1.0

      \[\leadsto \color{blue}{\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + \frac{2}{\frac{\ell}{t} \cdot \frac{\ell}{t}}}}\right)} \]
      Proof

    if 1.99999999999999989e119 < (/.f64 t l)

    1. Initial program 29.3

      \[\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right) \]
    2. Taylor expanded in l around 0 30.7

      \[\leadsto \sin^{-1} \color{blue}{\left(\sqrt{0.5 \cdot \frac{1 - \frac{{Om}^{2}}{{Omc}^{2}}}{{t}^{2}}} \cdot \ell\right)} \]
    3. Simplified26.4

      \[\leadsto \sin^{-1} \color{blue}{\left(\sqrt{0.5 \cdot \frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{{t}^{2}}} \cdot \ell\right)} \]
      Proof
    4. Taylor expanded in Om around 0 26.3

      \[\leadsto \sin^{-1} \left(\color{blue}{\sqrt{\frac{0.5}{{t}^{2}}}} \cdot \ell\right) \]
    5. Taylor expanded in t around 0 0.6

      \[\leadsto \sin^{-1} \left(\color{blue}{\frac{\sqrt{0.5}}{t}} \cdot \ell\right) \]
  3. Recombined 3 regimes into one program.

Alternatives

Alternative 1
Error0.8
Cost20872
\[\begin{array}{l} \mathbf{if}\;\frac{t}{\ell} \leq -5 \cdot 10^{+155}:\\ \;\;\;\;\sin^{-1} \left(\frac{\sqrt{0.5}}{-t} \cdot \ell\right)\\ \mathbf{elif}\;\frac{t}{\ell} \leq 2 \cdot 10^{+119}:\\ \;\;\;\;\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot \left(\frac{t}{\ell} \cdot \frac{t}{\ell}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} \left(\frac{\sqrt{0.5}}{t} \cdot \ell\right)\\ \end{array} \]
Alternative 2
Error21.6
Cost20044
\[\begin{array}{l} t_1 := \sin^{-1} \left(\sqrt{1 - \frac{\frac{Om}{Omc}}{Omc} \cdot Om}\right)\\ \mathbf{if}\;\ell \leq -1.45 \cdot 10^{-132}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\ell \leq 1.5 \cdot 10^{-278}:\\ \;\;\;\;\sin^{-1} \left(\frac{\sqrt{0.5}}{t} \cdot \ell\right)\\ \mathbf{elif}\;\ell \leq 1.9 \cdot 10^{-149}:\\ \;\;\;\;\sin^{-1} \left(\frac{1}{\left|t \cdot \sqrt{2}\right|} \cdot \ell\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Error23.4
Cost13772
\[\begin{array}{l} t_1 := \sin^{-1} \left(\sqrt{1 - \frac{\frac{Om}{Omc}}{Omc} \cdot Om}\right)\\ \mathbf{if}\;\ell \leq -1.5 \cdot 10^{-131}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\ell \leq 1.35 \cdot 10^{-201}:\\ \;\;\;\;\sin^{-1} \left(\frac{\sqrt{0.5}}{t} \cdot \ell\right)\\ \mathbf{elif}\;\ell \leq 1.9 \cdot 10^{-149}:\\ \;\;\;\;\sin^{-1} \left(\frac{\sqrt{0.5}}{-t} \cdot \ell\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Error23.5
Cost13708
\[\begin{array}{l} t_1 := \sin^{-1} \left({\left(\frac{Om}{Omc}\right)}^{2} \cdot -0.5 - -1\right)\\ \mathbf{if}\;\ell \leq -6.2 \cdot 10^{-132}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\ell \leq 1.1 \cdot 10^{-199}:\\ \;\;\;\;\sin^{-1} \left(\frac{\sqrt{0.5}}{t} \cdot \ell\right)\\ \mathbf{elif}\;\ell \leq 1.9 \cdot 10^{-149}:\\ \;\;\;\;\sin^{-1} \left(\frac{\sqrt{0.5}}{-t} \cdot \ell\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Error23.7
Cost13580
\[\begin{array}{l} \mathbf{if}\;\ell \leq -1.5 \cdot 10^{-131}:\\ \;\;\;\;\sin^{-1} 1\\ \mathbf{elif}\;\ell \leq 2.05 \cdot 10^{-198}:\\ \;\;\;\;\sin^{-1} \left(\frac{\sqrt{0.5}}{t} \cdot \ell\right)\\ \mathbf{elif}\;\ell \leq 3.2 \cdot 10^{-150}:\\ \;\;\;\;\sin^{-1} \left(\frac{\sqrt{0.5}}{-t} \cdot \ell\right)\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} 1\\ \end{array} \]
Alternative 6
Error25.0
Cost13384
\[\begin{array}{l} \mathbf{if}\;\ell \leq -1.1 \cdot 10^{-132}:\\ \;\;\;\;\sin^{-1} 1\\ \mathbf{elif}\;\ell \leq 6.8 \cdot 10^{-220}:\\ \;\;\;\;\sin^{-1} \left(\frac{\sqrt{0.5}}{t} \cdot \ell\right)\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} 1\\ \end{array} \]
Alternative 7
Error25.0
Cost13384
\[\begin{array}{l} \mathbf{if}\;\ell \leq -1.4 \cdot 10^{-131}:\\ \;\;\;\;\sin^{-1} 1\\ \mathbf{elif}\;\ell \leq 6.8 \cdot 10^{-220}:\\ \;\;\;\;\sin^{-1} \left(\frac{\sqrt{0.5} \cdot \ell}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} 1\\ \end{array} \]
Alternative 8
Error31.7
Cost6464
\[\sin^{-1} 1 \]

Error

Reproduce?

herbie shell --seed 2023033 
(FPCore (t l Om Omc)
  :name "Toniolo and Linder, Equation (2)"
  :precision binary64
  (asin (sqrt (/ (- 1.0 (pow (/ Om Omc) 2.0)) (+ 1.0 (* 2.0 (pow (/ t l) 2.0)))))))