Average Error: 10.3 → 0.8
Time: 29.0s
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} t_1 := 1 - \frac{\frac{Om}{Omc}}{Omc} \cdot Om\\ \mathbf{if}\;\frac{t}{\ell} \leq -1 \cdot 10^{+156}:\\ \;\;\;\;\sin^{-1} \left(-\frac{\sqrt{0.5 \cdot t_1} \cdot \ell}{t}\right)\\ \mathbf{elif}\;\frac{t}{\ell} \leq 2 \cdot 10^{+100}:\\ \;\;\;\;\sin^{-1} \left(\sqrt{\frac{t_1}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} \left(-\frac{-\sqrt{0.5 \cdot \left(1 - {\left(\frac{Om}{Omc}\right)}^{2}\right)} \cdot \ell}{t}\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
 (let* ((t_1 (- 1.0 (* (/ (/ Om Omc) Omc) Om))))
   (if (<= (/ t l) -1e+156)
     (asin (- (/ (* (sqrt (* 0.5 t_1)) l) t)))
     (if (<= (/ t l) 2e+100)
       (asin (sqrt (/ t_1 (+ 1.0 (* 2.0 (pow (/ t l) 2.0))))))
       (asin
        (- (/ (- (* (sqrt (* 0.5 (- 1.0 (pow (/ Om Omc) 2.0)))) l)) t)))))))
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 t_1 = 1.0 - (((Om / Omc) / Omc) * Om);
	double tmp;
	if ((t / l) <= -1e+156) {
		tmp = asin(-((sqrt((0.5 * t_1)) * l) / t));
	} else if ((t / l) <= 2e+100) {
		tmp = asin(sqrt((t_1 / (1.0 + (2.0 * pow((t / l), 2.0))))));
	} else {
		tmp = asin(-(-(sqrt((0.5 * (1.0 - pow((Om / Omc), 2.0)))) * l) / t));
	}
	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) :: t_1
    real(8) :: tmp
    t_1 = 1.0d0 - (((om / omc) / omc) * om)
    if ((t / l) <= (-1d+156)) then
        tmp = asin(-((sqrt((0.5d0 * t_1)) * l) / t))
    else if ((t / l) <= 2d+100) then
        tmp = asin(sqrt((t_1 / (1.0d0 + (2.0d0 * ((t / l) ** 2.0d0))))))
    else
        tmp = asin(-(-(sqrt((0.5d0 * (1.0d0 - ((om / omc) ** 2.0d0)))) * l) / t))
    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 t_1 = 1.0 - (((Om / Omc) / Omc) * Om);
	double tmp;
	if ((t / l) <= -1e+156) {
		tmp = Math.asin(-((Math.sqrt((0.5 * t_1)) * l) / t));
	} else if ((t / l) <= 2e+100) {
		tmp = Math.asin(Math.sqrt((t_1 / (1.0 + (2.0 * Math.pow((t / l), 2.0))))));
	} else {
		tmp = Math.asin(-(-(Math.sqrt((0.5 * (1.0 - Math.pow((Om / Omc), 2.0)))) * l) / t));
	}
	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):
	t_1 = 1.0 - (((Om / Omc) / Omc) * Om)
	tmp = 0
	if (t / l) <= -1e+156:
		tmp = math.asin(-((math.sqrt((0.5 * t_1)) * l) / t))
	elif (t / l) <= 2e+100:
		tmp = math.asin(math.sqrt((t_1 / (1.0 + (2.0 * math.pow((t / l), 2.0))))))
	else:
		tmp = math.asin(-(-(math.sqrt((0.5 * (1.0 - math.pow((Om / Omc), 2.0)))) * l) / t))
	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)
	t_1 = Float64(1.0 - Float64(Float64(Float64(Om / Omc) / Omc) * Om))
	tmp = 0.0
	if (Float64(t / l) <= -1e+156)
		tmp = asin(Float64(-Float64(Float64(sqrt(Float64(0.5 * t_1)) * l) / t)));
	elseif (Float64(t / l) <= 2e+100)
		tmp = asin(sqrt(Float64(t_1 / Float64(1.0 + Float64(2.0 * (Float64(t / l) ^ 2.0))))));
	else
		tmp = asin(Float64(-Float64(Float64(-Float64(sqrt(Float64(0.5 * Float64(1.0 - (Float64(Om / Omc) ^ 2.0)))) * l)) / t)));
	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)
	t_1 = 1.0 - (((Om / Omc) / Omc) * Om);
	tmp = 0.0;
	if ((t / l) <= -1e+156)
		tmp = asin(-((sqrt((0.5 * t_1)) * l) / t));
	elseif ((t / l) <= 2e+100)
		tmp = asin(sqrt((t_1 / (1.0 + (2.0 * ((t / l) ^ 2.0))))));
	else
		tmp = asin(-(-(sqrt((0.5 * (1.0 - ((Om / Omc) ^ 2.0)))) * l) / t));
	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_] := Block[{t$95$1 = N[(1.0 - N[(N[(N[(Om / Omc), $MachinePrecision] / Omc), $MachinePrecision] * Om), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t / l), $MachinePrecision], -1e+156], N[ArcSin[(-N[(N[(N[Sqrt[N[(0.5 * t$95$1), $MachinePrecision]], $MachinePrecision] * l), $MachinePrecision] / t), $MachinePrecision])], $MachinePrecision], If[LessEqual[N[(t / l), $MachinePrecision], 2e+100], N[ArcSin[N[Sqrt[N[(t$95$1 / N[(1.0 + N[(2.0 * N[Power[N[(t / l), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[ArcSin[(-N[((-N[(N[Sqrt[N[(0.5 * N[(1.0 - N[Power[N[(Om / Omc), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * l), $MachinePrecision]) / t), $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}
t_1 := 1 - \frac{\frac{Om}{Omc}}{Omc} \cdot Om\\
\mathbf{if}\;\frac{t}{\ell} \leq -1 \cdot 10^{+156}:\\
\;\;\;\;\sin^{-1} \left(-\frac{\sqrt{0.5 \cdot t_1} \cdot \ell}{t}\right)\\

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

\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(-\frac{-\sqrt{0.5 \cdot \left(1 - {\left(\frac{Om}{Omc}\right)}^{2}\right)} \cdot \ell}{t}\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) < -9.9999999999999998e155

    1. Initial program 33.6

      \[\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 37.5

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

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

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

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

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

      \[\leadsto \sin^{-1} \left(-\frac{\color{blue}{\sqrt{0.5 \cdot \left(1 - {\left(\frac{Om}{Omc}\right)}^{2}\right)} \cdot \ell}}{t}\right) \]
      Proof
    8. Applied egg-rr0.2

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

    if -9.9999999999999998e155 < (/.f64 t l) < 2.00000000000000003e100

    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 - \color{blue}{\frac{\frac{Om}{Omc}}{Omc} \cdot Om}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right) \]

    if 2.00000000000000003e100 < (/.f64 t l)

    1. Initial program 28.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 39.2

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

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

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

      \[\leadsto \sin^{-1} \color{blue}{\left(-\frac{\sqrt{0.5 \cdot \left(\left(\ell \cdot \ell\right) \cdot \left(1 - \frac{Om \cdot Om}{Omc \cdot Omc}\right)\right)}}{t}\right)} \]
      Proof
    6. Taylor expanded in l around -inf 7.7

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

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

Alternatives

Alternative 1
Error22.2
Cost20560
\[\begin{array}{l} t_1 := \sqrt{\frac{0.5 \cdot \left(1 - \frac{Om \cdot Om}{Omc \cdot Omc}\right)}{t \cdot t}} \cdot \ell\\ t_2 := \sin^{-1} \left(\sqrt{1 - \frac{\frac{Om}{Omc}}{Omc} \cdot Om}\right)\\ \mathbf{if}\;\ell \leq -9.5 \cdot 10^{-51}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;\ell \leq -3.4 \cdot 10^{-96}:\\ \;\;\;\;\sin^{-1} \left(-t_1\right)\\ \mathbf{elif}\;\ell \leq -1.75 \cdot 10^{-116}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;\ell \leq 3.6 \cdot 10^{-215}:\\ \;\;\;\;\sin^{-1} \left(-\frac{\ell}{t} \cdot \sqrt{0.5 \cdot \left(1 - {\left(\frac{Om}{Omc}\right)}^{2}\right)}\right)\\ \mathbf{elif}\;\ell \leq 7.6 \cdot 10^{-113}:\\ \;\;\;\;\sin^{-1} t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 2
Error22.2
Cost14548
\[\begin{array}{l} t_1 := \sqrt{\frac{0.5 \cdot \left(1 - \frac{Om \cdot Om}{Omc \cdot Omc}\right)}{t \cdot t}} \cdot \ell\\ t_2 := 1 - \frac{\frac{Om}{Omc}}{Omc} \cdot Om\\ t_3 := \sin^{-1} \left(\sqrt{t_2}\right)\\ \mathbf{if}\;\ell \leq -9 \cdot 10^{-51}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;\ell \leq -1 \cdot 10^{-96}:\\ \;\;\;\;\sin^{-1} \left(-t_1\right)\\ \mathbf{elif}\;\ell \leq -9.8 \cdot 10^{-114}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;\ell \leq 2 \cdot 10^{-216}:\\ \;\;\;\;\sin^{-1} \left(-\frac{\sqrt{0.5 \cdot t_2} \cdot \ell}{t}\right)\\ \mathbf{elif}\;\ell \leq 1.65 \cdot 10^{-111}:\\ \;\;\;\;\sin^{-1} t_1\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \]
Alternative 3
Error22.3
Cost14284
\[\begin{array}{l} t_1 := 1 - \frac{\frac{Om}{Omc}}{Omc} \cdot Om\\ t_2 := \sin^{-1} \left(\sqrt{t_1}\right)\\ \mathbf{if}\;\ell \leq -9.5 \cdot 10^{-51}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;\ell \leq 1.6 \cdot 10^{-218}:\\ \;\;\;\;\sin^{-1} \left(-\frac{\sqrt{0.5 \cdot t_1} \cdot \ell}{t}\right)\\ \mathbf{elif}\;\ell \leq 1.2 \cdot 10^{-110}:\\ \;\;\;\;\sin^{-1} \left(\sqrt{\frac{0.5 \cdot \left(1 - \frac{Om \cdot Om}{Omc \cdot Omc}\right)}{t \cdot t}} \cdot \ell\right)\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 4
Error20.3
Cost14284
\[\begin{array}{l} \mathbf{if}\;t \leq -3.2 \cdot 10^{+72}:\\ \;\;\;\;\sin^{-1} \left(-\frac{\sqrt{\left(\ell \cdot \ell\right) \cdot 0.5}}{t}\right)\\ \mathbf{elif}\;t \leq 7.1 \cdot 10^{+81}:\\ \;\;\;\;\sin^{-1} \left(\sqrt{1 - \frac{\frac{Om}{Omc}}{Omc} \cdot Om}\right)\\ \mathbf{elif}\;t \leq 2.5 \cdot 10^{+206}:\\ \;\;\;\;\sin^{-1} \left(\frac{\sqrt{0.5 \cdot \left(\left(\ell \cdot \ell\right) \cdot \left(1 - \frac{Om \cdot Om}{Omc \cdot Omc}\right)\right)}}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} \left(-\frac{\sqrt{0.5} \cdot \ell}{t}\right)\\ \end{array} \]
Alternative 5
Error21.0
Cost13640
\[\begin{array}{l} \mathbf{if}\;t \leq -2.9 \cdot 10^{+72}:\\ \;\;\;\;\sin^{-1} \left(-\frac{\sqrt{\left(\ell \cdot \ell\right) \cdot 0.5}}{t}\right)\\ \mathbf{elif}\;t \leq 1.35 \cdot 10^{+82}:\\ \;\;\;\;\sin^{-1} \left(\sqrt{1 - \frac{\frac{Om}{Omc}}{Omc} \cdot Om}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} \left(-\frac{\sqrt{0.5} \cdot \ell}{t}\right)\\ \end{array} \]
Alternative 6
Error23.8
Cost13448
\[\begin{array}{l} \mathbf{if}\;\ell \leq -1.56 \cdot 10^{-50}:\\ \;\;\;\;\sin^{-1} 1\\ \mathbf{elif}\;\ell \leq 6.5 \cdot 10^{-169}:\\ \;\;\;\;\sin^{-1} \left(-\frac{\sqrt{0.5} \cdot \ell}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} 1\\ \end{array} \]
Alternative 7
Error21.3
Cost13448
\[\begin{array}{l} \mathbf{if}\;t \leq -2.1 \cdot 10^{+71}:\\ \;\;\;\;\sin^{-1} \left(-\frac{\sqrt{\left(\ell \cdot \ell\right) \cdot 0.5}}{t}\right)\\ \mathbf{elif}\;t \leq 4.8 \cdot 10^{+81}:\\ \;\;\;\;\sin^{-1} 1\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} \left(-\frac{\sqrt{0.5} \cdot \ell}{t}\right)\\ \end{array} \]
Alternative 8
Error31.5
Cost6464
\[\sin^{-1} 1 \]

Error

Reproduce

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