Toniolo and Linder, Equation (2)

Percentage Accurate: 83.4% → 98.5%
Time: 19.3s
Alternatives: 6
Speedup: 1.3×

Specification

?
\[\begin{array}{l} \\ \sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\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)))))))
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))))));
}
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
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))))));
}
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))))))
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 tmp = code(t, l, Om, Omc)
	tmp = asin(sqrt(((1.0 - ((Om / Omc) ^ 2.0)) / (1.0 + (2.0 * ((t / l) ^ 2.0))))));
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]
\begin{array}{l}

\\
\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right)
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 6 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 83.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\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)))))))
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))))));
}
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
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))))));
}
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))))))
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 tmp = code(t, l, Om, Omc)
	tmp = asin(sqrt(((1.0 - ((Om / Omc) ^ 2.0)) / (1.0 + (2.0 * ((t / l) ^ 2.0))))));
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]
\begin{array}{l}

\\
\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right)
\end{array}

Alternative 1: 98.5% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \sin^{-1} \left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \frac{t}{\ell} \cdot \sqrt{2}\right)}\right) \end{array} \]
(FPCore (t l Om Omc)
 :precision binary64
 (asin
  (/ (sqrt (- 1.0 (pow (/ Om Omc) 2.0))) (hypot 1.0 (* (/ t l) (sqrt 2.0))))))
double code(double t, double l, double Om, double Omc) {
	return asin((sqrt((1.0 - pow((Om / Omc), 2.0))) / hypot(1.0, ((t / l) * sqrt(2.0)))));
}
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))) / Math.hypot(1.0, ((t / l) * Math.sqrt(2.0)))));
}
def code(t, l, Om, Omc):
	return math.asin((math.sqrt((1.0 - math.pow((Om / Omc), 2.0))) / math.hypot(1.0, ((t / l) * math.sqrt(2.0)))))
function code(t, l, Om, Omc)
	return asin(Float64(sqrt(Float64(1.0 - (Float64(Om / Omc) ^ 2.0))) / hypot(1.0, Float64(Float64(t / l) * sqrt(2.0)))))
end
function tmp = code(t, l, Om, Omc)
	tmp = asin((sqrt((1.0 - ((Om / Omc) ^ 2.0))) / hypot(1.0, ((t / l) * sqrt(2.0)))));
end
code[t_, l_, Om_, Omc_] := N[ArcSin[N[(N[Sqrt[N[(1.0 - N[Power[N[(Om / Omc), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[1.0 ^ 2 + N[(N[(t / l), $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\sin^{-1} \left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \frac{t}{\ell} \cdot \sqrt{2}\right)}\right)
\end{array}
Derivation
  1. Initial program 83.7%

    \[\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right) \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. sqrt-div83.7%

      \[\leadsto \sin^{-1} \color{blue}{\left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\sqrt{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right)} \]
    2. add-sqr-sqrt83.7%

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

      \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\color{blue}{\mathsf{hypot}\left(1, \sqrt{2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}\right)}}\right) \]
    4. *-commutative83.7%

      \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \sqrt{\color{blue}{{\left(\frac{t}{\ell}\right)}^{2} \cdot 2}}\right)}\right) \]
    5. sqrt-prod83.7%

      \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \color{blue}{\sqrt{{\left(\frac{t}{\ell}\right)}^{2}} \cdot \sqrt{2}}\right)}\right) \]
    6. sqrt-pow199.2%

      \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \color{blue}{{\left(\frac{t}{\ell}\right)}^{\left(\frac{2}{2}\right)}} \cdot \sqrt{2}\right)}\right) \]
    7. metadata-eval99.2%

      \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, {\left(\frac{t}{\ell}\right)}^{\color{blue}{1}} \cdot \sqrt{2}\right)}\right) \]
    8. pow199.2%

      \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \color{blue}{\frac{t}{\ell}} \cdot \sqrt{2}\right)}\right) \]
  4. Applied egg-rr99.2%

    \[\leadsto \sin^{-1} \color{blue}{\left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \frac{t}{\ell} \cdot \sqrt{2}\right)}\right)} \]
  5. Add Preprocessing

Alternative 2: 98.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \sin^{-1} \left(\frac{\sqrt{1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}}{\mathsf{hypot}\left(1, \frac{t \cdot \sqrt{2}}{\ell}\right)}\right) \end{array} \]
(FPCore (t l Om Omc)
 :precision binary64
 (asin
  (/
   (sqrt (- 1.0 (/ (/ Om Omc) (/ Omc Om))))
   (hypot 1.0 (/ (* t (sqrt 2.0)) l)))))
double code(double t, double l, double Om, double Omc) {
	return asin((sqrt((1.0 - ((Om / Omc) / (Omc / Om)))) / hypot(1.0, ((t * sqrt(2.0)) / l))));
}
public static double code(double t, double l, double Om, double Omc) {
	return Math.asin((Math.sqrt((1.0 - ((Om / Omc) / (Omc / Om)))) / Math.hypot(1.0, ((t * Math.sqrt(2.0)) / l))));
}
def code(t, l, Om, Omc):
	return math.asin((math.sqrt((1.0 - ((Om / Omc) / (Omc / Om)))) / math.hypot(1.0, ((t * math.sqrt(2.0)) / l))))
function code(t, l, Om, Omc)
	return asin(Float64(sqrt(Float64(1.0 - Float64(Float64(Om / Omc) / Float64(Omc / Om)))) / hypot(1.0, Float64(Float64(t * sqrt(2.0)) / l))))
end
function tmp = code(t, l, Om, Omc)
	tmp = asin((sqrt((1.0 - ((Om / Omc) / (Omc / Om)))) / hypot(1.0, ((t * sqrt(2.0)) / l))));
end
code[t_, l_, Om_, Omc_] := N[ArcSin[N[(N[Sqrt[N[(1.0 - N[(N[(Om / Omc), $MachinePrecision] / N[(Omc / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[1.0 ^ 2 + N[(N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\sin^{-1} \left(\frac{\sqrt{1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}}{\mathsf{hypot}\left(1, \frac{t \cdot \sqrt{2}}{\ell}\right)}\right)
\end{array}
Derivation
  1. Initial program 83.7%

    \[\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right) \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. sqrt-div83.7%

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

      \[\leadsto \sin^{-1} \color{blue}{\left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\sqrt{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right)} \]
    3. add-sqr-sqrt83.7%

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

      \[\leadsto \sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\color{blue}{\mathsf{hypot}\left(1, \sqrt{2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}\right)}}\right) \]
    5. *-commutative83.7%

      \[\leadsto \sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\mathsf{hypot}\left(1, \sqrt{\color{blue}{{\left(\frac{t}{\ell}\right)}^{2} \cdot 2}}\right)}\right) \]
    6. sqrt-prod83.7%

      \[\leadsto \sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\sqrt{{\left(\frac{t}{\ell}\right)}^{2}} \cdot \sqrt{2}}\right)}\right) \]
    7. sqrt-pow199.2%

      \[\leadsto \sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{{\left(\frac{t}{\ell}\right)}^{\left(\frac{2}{2}\right)}} \cdot \sqrt{2}\right)}\right) \]
    8. metadata-eval99.2%

      \[\leadsto \sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\mathsf{hypot}\left(1, {\left(\frac{t}{\ell}\right)}^{\color{blue}{1}} \cdot \sqrt{2}\right)}\right) \]
    9. pow199.2%

      \[\leadsto \sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\frac{t}{\ell}} \cdot \sqrt{2}\right)}\right) \]
  4. Applied egg-rr99.2%

    \[\leadsto \sin^{-1} \color{blue}{\left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\mathsf{hypot}\left(1, \frac{t}{\ell} \cdot \sqrt{2}\right)}\right)} \]
  5. Step-by-step derivation
    1. associate-*r/99.2%

      \[\leadsto \sin^{-1} \color{blue}{\left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot 1}{\mathsf{hypot}\left(1, \frac{t}{\ell} \cdot \sqrt{2}\right)}\right)} \]
    2. *-rgt-identity99.2%

      \[\leadsto \sin^{-1} \left(\frac{\color{blue}{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}}{\mathsf{hypot}\left(1, \frac{t}{\ell} \cdot \sqrt{2}\right)}\right) \]
    3. *-commutative99.2%

      \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \color{blue}{\sqrt{2} \cdot \frac{t}{\ell}}\right)}\right) \]
    4. associate-*r/98.8%

      \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \color{blue}{\frac{\sqrt{2} \cdot t}{\ell}}\right)}\right) \]
  6. Simplified98.8%

    \[\leadsto \sin^{-1} \color{blue}{\left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \frac{\sqrt{2} \cdot t}{\ell}\right)}\right)} \]
  7. Step-by-step derivation
    1. unpow298.8%

      \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - \color{blue}{\frac{Om}{Omc} \cdot \frac{Om}{Omc}}}}{\mathsf{hypot}\left(1, \frac{\sqrt{2} \cdot t}{\ell}\right)}\right) \]
    2. clear-num98.8%

      \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - \frac{Om}{Omc} \cdot \color{blue}{\frac{1}{\frac{Omc}{Om}}}}}{\mathsf{hypot}\left(1, \frac{\sqrt{2} \cdot t}{\ell}\right)}\right) \]
    3. un-div-inv98.8%

      \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - \color{blue}{\frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}}}{\mathsf{hypot}\left(1, \frac{\sqrt{2} \cdot t}{\ell}\right)}\right) \]
  8. Applied egg-rr98.8%

    \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - \color{blue}{\frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}}}{\mathsf{hypot}\left(1, \frac{\sqrt{2} \cdot t}{\ell}\right)}\right) \]
  9. Final simplification98.8%

    \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}}{\mathsf{hypot}\left(1, \frac{t \cdot \sqrt{2}}{\ell}\right)}\right) \]
  10. Add Preprocessing

Alternative 3: 97.6% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \sin^{-1} \left(\frac{1}{\mathsf{hypot}\left(1, t \cdot \frac{\sqrt{2}}{\ell}\right)}\right) \end{array} \]
(FPCore (t l Om Omc)
 :precision binary64
 (asin (/ 1.0 (hypot 1.0 (* t (/ (sqrt 2.0) l))))))
double code(double t, double l, double Om, double Omc) {
	return asin((1.0 / hypot(1.0, (t * (sqrt(2.0) / l)))));
}
public static double code(double t, double l, double Om, double Omc) {
	return Math.asin((1.0 / Math.hypot(1.0, (t * (Math.sqrt(2.0) / l)))));
}
def code(t, l, Om, Omc):
	return math.asin((1.0 / math.hypot(1.0, (t * (math.sqrt(2.0) / l)))))
function code(t, l, Om, Omc)
	return asin(Float64(1.0 / hypot(1.0, Float64(t * Float64(sqrt(2.0) / l)))))
end
function tmp = code(t, l, Om, Omc)
	tmp = asin((1.0 / hypot(1.0, (t * (sqrt(2.0) / l)))));
end
code[t_, l_, Om_, Omc_] := N[ArcSin[N[(1.0 / N[Sqrt[1.0 ^ 2 + N[(t * N[(N[Sqrt[2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\sin^{-1} \left(\frac{1}{\mathsf{hypot}\left(1, t \cdot \frac{\sqrt{2}}{\ell}\right)}\right)
\end{array}
Derivation
  1. Initial program 83.7%

    \[\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right) \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. add-exp-log82.4%

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

      \[\leadsto e^{\log \sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{\color{blue}{2 \cdot {\left(\frac{t}{\ell}\right)}^{2} + 1}}}\right)} \]
    3. fma-define82.4%

      \[\leadsto e^{\log \sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{\color{blue}{\mathsf{fma}\left(2, {\left(\frac{t}{\ell}\right)}^{2}, 1\right)}}}\right)} \]
  4. Applied egg-rr82.4%

    \[\leadsto \color{blue}{e^{\log \sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{\mathsf{fma}\left(2, {\left(\frac{t}{\ell}\right)}^{2}, 1\right)}}\right)}} \]
  5. Taylor expanded in Om around 0 66.5%

    \[\leadsto e^{\log \sin^{-1} \left(\sqrt{\color{blue}{\frac{1}{1 + 2 \cdot \frac{{t}^{2}}{{\ell}^{2}}}}}\right)} \]
  6. Step-by-step derivation
    1. +-commutative66.5%

      \[\leadsto e^{\log \sin^{-1} \left(\sqrt{\frac{1}{\color{blue}{2 \cdot \frac{{t}^{2}}{{\ell}^{2}} + 1}}}\right)} \]
    2. fma-define66.5%

      \[\leadsto e^{\log \sin^{-1} \left(\sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(2, \frac{{t}^{2}}{{\ell}^{2}}, 1\right)}}}\right)} \]
    3. unpow266.5%

      \[\leadsto e^{\log \sin^{-1} \left(\sqrt{\frac{1}{\mathsf{fma}\left(2, \frac{\color{blue}{t \cdot t}}{{\ell}^{2}}, 1\right)}}\right)} \]
    4. unpow266.5%

      \[\leadsto e^{\log \sin^{-1} \left(\sqrt{\frac{1}{\mathsf{fma}\left(2, \frac{t \cdot t}{\color{blue}{\ell \cdot \ell}}, 1\right)}}\right)} \]
    5. times-frac82.0%

      \[\leadsto e^{\log \sin^{-1} \left(\sqrt{\frac{1}{\mathsf{fma}\left(2, \color{blue}{\frac{t}{\ell} \cdot \frac{t}{\ell}}, 1\right)}}\right)} \]
    6. unpow282.0%

      \[\leadsto e^{\log \sin^{-1} \left(\sqrt{\frac{1}{\mathsf{fma}\left(2, \color{blue}{{\left(\frac{t}{\ell}\right)}^{2}}, 1\right)}}\right)} \]
  7. Simplified82.0%

    \[\leadsto e^{\log \sin^{-1} \left(\sqrt{\color{blue}{\frac{1}{\mathsf{fma}\left(2, {\left(\frac{t}{\ell}\right)}^{2}, 1\right)}}}\right)} \]
  8. Step-by-step derivation
    1. sqrt-div82.0%

      \[\leadsto e^{\log \sin^{-1} \color{blue}{\left(\frac{\sqrt{1}}{\sqrt{\mathsf{fma}\left(2, {\left(\frac{t}{\ell}\right)}^{2}, 1\right)}}\right)}} \]
    2. metadata-eval82.0%

      \[\leadsto e^{\log \sin^{-1} \left(\frac{\color{blue}{1}}{\sqrt{\mathsf{fma}\left(2, {\left(\frac{t}{\ell}\right)}^{2}, 1\right)}}\right)} \]
  9. Applied egg-rr82.0%

    \[\leadsto e^{\log \sin^{-1} \color{blue}{\left(\frac{1}{\sqrt{\mathsf{fma}\left(2, {\left(\frac{t}{\ell}\right)}^{2}, 1\right)}}\right)}} \]
  10. Step-by-step derivation
    1. unpow282.0%

      \[\leadsto e^{\log \sin^{-1} \left(\frac{1}{\sqrt{\mathsf{fma}\left(2, \color{blue}{\frac{t}{\ell} \cdot \frac{t}{\ell}}, 1\right)}}\right)} \]
    2. times-frac66.5%

      \[\leadsto e^{\log \sin^{-1} \left(\frac{1}{\sqrt{\mathsf{fma}\left(2, \color{blue}{\frac{t \cdot t}{\ell \cdot \ell}}, 1\right)}}\right)} \]
    3. unpow266.5%

      \[\leadsto e^{\log \sin^{-1} \left(\frac{1}{\sqrt{\mathsf{fma}\left(2, \frac{\color{blue}{{t}^{2}}}{\ell \cdot \ell}, 1\right)}}\right)} \]
    4. unpow266.5%

      \[\leadsto e^{\log \sin^{-1} \left(\frac{1}{\sqrt{\mathsf{fma}\left(2, \frac{{t}^{2}}{\color{blue}{{\ell}^{2}}}, 1\right)}}\right)} \]
    5. fma-define66.5%

      \[\leadsto e^{\log \sin^{-1} \left(\frac{1}{\sqrt{\color{blue}{2 \cdot \frac{{t}^{2}}{{\ell}^{2}} + 1}}}\right)} \]
    6. +-commutative66.5%

      \[\leadsto e^{\log \sin^{-1} \left(\frac{1}{\sqrt{\color{blue}{1 + 2 \cdot \frac{{t}^{2}}{{\ell}^{2}}}}}\right)} \]
    7. metadata-eval66.5%

      \[\leadsto e^{\log \sin^{-1} \left(\frac{1}{\sqrt{\color{blue}{1 \cdot 1} + 2 \cdot \frac{{t}^{2}}{{\ell}^{2}}}}\right)} \]
    8. rem-square-sqrt66.5%

      \[\leadsto e^{\log \sin^{-1} \left(\frac{1}{\sqrt{1 \cdot 1 + \color{blue}{\left(\sqrt{2} \cdot \sqrt{2}\right)} \cdot \frac{{t}^{2}}{{\ell}^{2}}}}\right)} \]
    9. unpow266.5%

      \[\leadsto e^{\log \sin^{-1} \left(\frac{1}{\sqrt{1 \cdot 1 + \left(\sqrt{2} \cdot \sqrt{2}\right) \cdot \frac{\color{blue}{t \cdot t}}{{\ell}^{2}}}}\right)} \]
    10. unpow266.5%

      \[\leadsto e^{\log \sin^{-1} \left(\frac{1}{\sqrt{1 \cdot 1 + \left(\sqrt{2} \cdot \sqrt{2}\right) \cdot \frac{t \cdot t}{\color{blue}{\ell \cdot \ell}}}}\right)} \]
    11. times-frac82.0%

      \[\leadsto e^{\log \sin^{-1} \left(\frac{1}{\sqrt{1 \cdot 1 + \left(\sqrt{2} \cdot \sqrt{2}\right) \cdot \color{blue}{\left(\frac{t}{\ell} \cdot \frac{t}{\ell}\right)}}}\right)} \]
    12. swap-sqr82.0%

      \[\leadsto e^{\log \sin^{-1} \left(\frac{1}{\sqrt{1 \cdot 1 + \color{blue}{\left(\sqrt{2} \cdot \frac{t}{\ell}\right) \cdot \left(\sqrt{2} \cdot \frac{t}{\ell}\right)}}}\right)} \]
    13. hypot-undefine95.9%

      \[\leadsto e^{\log \sin^{-1} \left(\frac{1}{\color{blue}{\mathsf{hypot}\left(1, \sqrt{2} \cdot \frac{t}{\ell}\right)}}\right)} \]
  11. Simplified95.9%

    \[\leadsto e^{\log \sin^{-1} \color{blue}{\left(\frac{1}{\mathsf{hypot}\left(1, \sqrt{2} \cdot \frac{t}{\ell}\right)}\right)}} \]
  12. Step-by-step derivation
    1. *-un-lft-identity95.9%

      \[\leadsto \color{blue}{1 \cdot e^{\log \sin^{-1} \left(\frac{1}{\mathsf{hypot}\left(1, \sqrt{2} \cdot \frac{t}{\ell}\right)}\right)}} \]
    2. rem-exp-log98.6%

      \[\leadsto 1 \cdot \color{blue}{\sin^{-1} \left(\frac{1}{\mathsf{hypot}\left(1, \sqrt{2} \cdot \frac{t}{\ell}\right)}\right)} \]
    3. associate-*r/98.3%

      \[\leadsto 1 \cdot \sin^{-1} \left(\frac{1}{\mathsf{hypot}\left(1, \color{blue}{\frac{\sqrt{2} \cdot t}{\ell}}\right)}\right) \]
  13. Applied egg-rr98.3%

    \[\leadsto \color{blue}{1 \cdot \sin^{-1} \left(\frac{1}{\mathsf{hypot}\left(1, \frac{\sqrt{2} \cdot t}{\ell}\right)}\right)} \]
  14. Step-by-step derivation
    1. *-lft-identity98.3%

      \[\leadsto \color{blue}{\sin^{-1} \left(\frac{1}{\mathsf{hypot}\left(1, \frac{\sqrt{2} \cdot t}{\ell}\right)}\right)} \]
    2. *-commutative98.3%

      \[\leadsto \sin^{-1} \left(\frac{1}{\mathsf{hypot}\left(1, \frac{\color{blue}{t \cdot \sqrt{2}}}{\ell}\right)}\right) \]
    3. associate-/l*98.6%

      \[\leadsto \sin^{-1} \left(\frac{1}{\mathsf{hypot}\left(1, \color{blue}{t \cdot \frac{\sqrt{2}}{\ell}}\right)}\right) \]
  15. Simplified98.6%

    \[\leadsto \color{blue}{\sin^{-1} \left(\frac{1}{\mathsf{hypot}\left(1, t \cdot \frac{\sqrt{2}}{\ell}\right)}\right)} \]
  16. Add Preprocessing

Alternative 4: 55.9% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \sin^{-1} \left(\sqrt{1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}\right)\\ \mathbf{if}\;t \leq 3.8 \cdot 10^{-55}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq 2.9 \cdot 10^{-22}:\\ \;\;\;\;\sin^{-1} \left(\frac{\ell}{\frac{t}{\sqrt{0.5}}}\right)\\ \mathbf{elif}\;t \leq 7 \cdot 10^{+83}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} \left(\frac{1}{t} \cdot \left(\ell \cdot \sqrt{0.5}\right)\right)\\ \end{array} \end{array} \]
(FPCore (t l Om Omc)
 :precision binary64
 (let* ((t_1 (asin (sqrt (- 1.0 (/ (/ Om Omc) (/ Omc Om)))))))
   (if (<= t 3.8e-55)
     t_1
     (if (<= t 2.9e-22)
       (asin (/ l (/ t (sqrt 0.5))))
       (if (<= t 7e+83) t_1 (asin (* (/ 1.0 t) (* l (sqrt 0.5)))))))))
double code(double t, double l, double Om, double Omc) {
	double t_1 = asin(sqrt((1.0 - ((Om / Omc) / (Omc / Om)))));
	double tmp;
	if (t <= 3.8e-55) {
		tmp = t_1;
	} else if (t <= 2.9e-22) {
		tmp = asin((l / (t / sqrt(0.5))));
	} else if (t <= 7e+83) {
		tmp = t_1;
	} else {
		tmp = asin(((1.0 / t) * (l * sqrt(0.5))));
	}
	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
    real(8) :: t_1
    real(8) :: tmp
    t_1 = asin(sqrt((1.0d0 - ((om / omc) / (omc / om)))))
    if (t <= 3.8d-55) then
        tmp = t_1
    else if (t <= 2.9d-22) then
        tmp = asin((l / (t / sqrt(0.5d0))))
    else if (t <= 7d+83) then
        tmp = t_1
    else
        tmp = asin(((1.0d0 / t) * (l * sqrt(0.5d0))))
    end if
    code = tmp
end function
public static double code(double t, double l, double Om, double Omc) {
	double t_1 = Math.asin(Math.sqrt((1.0 - ((Om / Omc) / (Omc / Om)))));
	double tmp;
	if (t <= 3.8e-55) {
		tmp = t_1;
	} else if (t <= 2.9e-22) {
		tmp = Math.asin((l / (t / Math.sqrt(0.5))));
	} else if (t <= 7e+83) {
		tmp = t_1;
	} else {
		tmp = Math.asin(((1.0 / t) * (l * Math.sqrt(0.5))));
	}
	return tmp;
}
def code(t, l, Om, Omc):
	t_1 = math.asin(math.sqrt((1.0 - ((Om / Omc) / (Omc / Om)))))
	tmp = 0
	if t <= 3.8e-55:
		tmp = t_1
	elif t <= 2.9e-22:
		tmp = math.asin((l / (t / math.sqrt(0.5))))
	elif t <= 7e+83:
		tmp = t_1
	else:
		tmp = math.asin(((1.0 / t) * (l * math.sqrt(0.5))))
	return tmp
function code(t, l, Om, Omc)
	t_1 = asin(sqrt(Float64(1.0 - Float64(Float64(Om / Omc) / Float64(Omc / Om)))))
	tmp = 0.0
	if (t <= 3.8e-55)
		tmp = t_1;
	elseif (t <= 2.9e-22)
		tmp = asin(Float64(l / Float64(t / sqrt(0.5))));
	elseif (t <= 7e+83)
		tmp = t_1;
	else
		tmp = asin(Float64(Float64(1.0 / t) * Float64(l * sqrt(0.5))));
	end
	return tmp
end
function tmp_2 = code(t, l, Om, Omc)
	t_1 = asin(sqrt((1.0 - ((Om / Omc) / (Omc / Om)))));
	tmp = 0.0;
	if (t <= 3.8e-55)
		tmp = t_1;
	elseif (t <= 2.9e-22)
		tmp = asin((l / (t / sqrt(0.5))));
	elseif (t <= 7e+83)
		tmp = t_1;
	else
		tmp = asin(((1.0 / t) * (l * sqrt(0.5))));
	end
	tmp_2 = tmp;
end
code[t_, l_, Om_, Omc_] := Block[{t$95$1 = N[ArcSin[N[Sqrt[N[(1.0 - N[(N[(Om / Omc), $MachinePrecision] / N[(Omc / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 3.8e-55], t$95$1, If[LessEqual[t, 2.9e-22], N[ArcSin[N[(l / N[(t / N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[t, 7e+83], t$95$1, N[ArcSin[N[(N[(1.0 / t), $MachinePrecision] * N[(l * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \sin^{-1} \left(\sqrt{1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}\right)\\
\mathbf{if}\;t \leq 3.8 \cdot 10^{-55}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t \leq 2.9 \cdot 10^{-22}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{\frac{t}{\sqrt{0.5}}}\right)\\

\mathbf{elif}\;t \leq 7 \cdot 10^{+83}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < 3.7999999999999997e-55 or 2.9000000000000002e-22 < t < 6.99999999999999954e83

    1. Initial program 87.7%

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

      \[\leadsto \sin^{-1} \color{blue}{\left(\sqrt{1 - \frac{{Om}^{2}}{{Omc}^{2}}}\right)} \]
    4. Step-by-step derivation
      1. unpow255.7%

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

        \[\leadsto \sin^{-1} \left(\sqrt{1 - \frac{Om \cdot Om}{\color{blue}{Omc \cdot Omc}}}\right) \]
      3. times-frac61.7%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - \color{blue}{\frac{Om}{Omc} \cdot \frac{Om}{Omc}}}\right) \]
      4. unpow261.7%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - \color{blue}{{\left(\frac{Om}{Omc}\right)}^{2}}}\right) \]
    5. Simplified61.7%

      \[\leadsto \sin^{-1} \color{blue}{\left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}\right)} \]
    6. Step-by-step derivation
      1. unpow299.1%

        \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - \color{blue}{\frac{Om}{Omc} \cdot \frac{Om}{Omc}}}}{\mathsf{hypot}\left(1, \frac{\sqrt{2} \cdot t}{\ell}\right)}\right) \]
      2. clear-num99.1%

        \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - \frac{Om}{Omc} \cdot \color{blue}{\frac{1}{\frac{Omc}{Om}}}}}{\mathsf{hypot}\left(1, \frac{\sqrt{2} \cdot t}{\ell}\right)}\right) \]
      3. un-div-inv99.1%

        \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - \color{blue}{\frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}}}{\mathsf{hypot}\left(1, \frac{\sqrt{2} \cdot t}{\ell}\right)}\right) \]
    7. Applied egg-rr61.7%

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

    if 3.7999999999999997e-55 < t < 2.9000000000000002e-22

    1. Initial program 52.8%

      \[\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in t around inf 50.5%

      \[\leadsto \sin^{-1} \color{blue}{\left(\frac{\ell \cdot \sqrt{0.5}}{t} \cdot \sqrt{1 - \frac{{Om}^{2}}{{Omc}^{2}}}\right)} \]
    4. Step-by-step derivation
      1. *-commutative50.5%

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

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

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

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

        \[\leadsto \sin^{-1} \left(\sqrt{1 - \color{blue}{{\left(\frac{Om}{Omc}\right)}^{2}}} \cdot \frac{\ell \cdot \sqrt{0.5}}{t}\right) \]
      6. associate-/l*50.2%

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

      \[\leadsto \sin^{-1} \color{blue}{\left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \left(\ell \cdot \frac{\sqrt{0.5}}{t}\right)\right)} \]
    6. Step-by-step derivation
      1. unpow299.3%

        \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - \color{blue}{\frac{Om}{Omc} \cdot \frac{Om}{Omc}}}}{\mathsf{hypot}\left(1, \frac{\sqrt{2} \cdot t}{\ell}\right)}\right) \]
      2. clear-num99.3%

        \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - \frac{Om}{Omc} \cdot \color{blue}{\frac{1}{\frac{Omc}{Om}}}}}{\mathsf{hypot}\left(1, \frac{\sqrt{2} \cdot t}{\ell}\right)}\right) \]
      3. un-div-inv99.3%

        \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - \color{blue}{\frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}}}{\mathsf{hypot}\left(1, \frac{\sqrt{2} \cdot t}{\ell}\right)}\right) \]
    7. Applied egg-rr50.2%

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

      \[\leadsto \sin^{-1} \color{blue}{\left(\frac{\ell \cdot \sqrt{0.5}}{t}\right)} \]
    9. Step-by-step derivation
      1. associate-/l*50.2%

        \[\leadsto \sin^{-1} \color{blue}{\left(\ell \cdot \frac{\sqrt{0.5}}{t}\right)} \]
    10. Simplified50.2%

      \[\leadsto \sin^{-1} \color{blue}{\left(\ell \cdot \frac{\sqrt{0.5}}{t}\right)} \]
    11. Step-by-step derivation
      1. clear-num50.2%

        \[\leadsto \sin^{-1} \left(\ell \cdot \color{blue}{\frac{1}{\frac{t}{\sqrt{0.5}}}}\right) \]
      2. un-div-inv50.5%

        \[\leadsto \sin^{-1} \color{blue}{\left(\frac{\ell}{\frac{t}{\sqrt{0.5}}}\right)} \]
    12. Applied egg-rr50.5%

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

    if 6.99999999999999954e83 < t

    1. Initial program 72.4%

      \[\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in t around inf 58.5%

      \[\leadsto \sin^{-1} \color{blue}{\left(\frac{\ell \cdot \sqrt{0.5}}{t} \cdot \sqrt{1 - \frac{{Om}^{2}}{{Omc}^{2}}}\right)} \]
    4. Step-by-step derivation
      1. *-commutative58.5%

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

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

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

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

        \[\leadsto \sin^{-1} \left(\sqrt{1 - \color{blue}{{\left(\frac{Om}{Omc}\right)}^{2}}} \cdot \frac{\ell \cdot \sqrt{0.5}}{t}\right) \]
      6. associate-/l*60.9%

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

      \[\leadsto \sin^{-1} \color{blue}{\left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \left(\ell \cdot \frac{\sqrt{0.5}}{t}\right)\right)} \]
    6. Step-by-step derivation
      1. unpow297.3%

        \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - \color{blue}{\frac{Om}{Omc} \cdot \frac{Om}{Omc}}}}{\mathsf{hypot}\left(1, \frac{\sqrt{2} \cdot t}{\ell}\right)}\right) \]
      2. clear-num97.3%

        \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - \frac{Om}{Omc} \cdot \color{blue}{\frac{1}{\frac{Omc}{Om}}}}}{\mathsf{hypot}\left(1, \frac{\sqrt{2} \cdot t}{\ell}\right)}\right) \]
      3. un-div-inv97.3%

        \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - \color{blue}{\frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}}}{\mathsf{hypot}\left(1, \frac{\sqrt{2} \cdot t}{\ell}\right)}\right) \]
    7. Applied egg-rr60.9%

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

      \[\leadsto \sin^{-1} \color{blue}{\left(\frac{\ell \cdot \sqrt{0.5}}{t}\right)} \]
    9. Step-by-step derivation
      1. associate-/l*60.9%

        \[\leadsto \sin^{-1} \color{blue}{\left(\ell \cdot \frac{\sqrt{0.5}}{t}\right)} \]
    10. Simplified60.9%

      \[\leadsto \sin^{-1} \color{blue}{\left(\ell \cdot \frac{\sqrt{0.5}}{t}\right)} \]
    11. Step-by-step derivation
      1. associate-*r/60.8%

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

        \[\leadsto \sin^{-1} \color{blue}{\left(\frac{1}{\frac{t}{\ell \cdot \sqrt{0.5}}}\right)} \]
    12. Applied egg-rr60.7%

      \[\leadsto \sin^{-1} \color{blue}{\left(\frac{1}{\frac{t}{\ell \cdot \sqrt{0.5}}}\right)} \]
    13. Step-by-step derivation
      1. associate-/r/60.9%

        \[\leadsto \sin^{-1} \color{blue}{\left(\frac{1}{t} \cdot \left(\ell \cdot \sqrt{0.5}\right)\right)} \]
    14. Simplified60.9%

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

Alternative 5: 31.1% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \sin^{-1} \left(\frac{1}{t} \cdot \left(\ell \cdot \sqrt{0.5}\right)\right) \end{array} \]
(FPCore (t l Om Omc) :precision binary64 (asin (* (/ 1.0 t) (* l (sqrt 0.5)))))
double code(double t, double l, double Om, double Omc) {
	return asin(((1.0 / t) * (l * sqrt(0.5))));
}
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(((1.0d0 / t) * (l * sqrt(0.5d0))))
end function
public static double code(double t, double l, double Om, double Omc) {
	return Math.asin(((1.0 / t) * (l * Math.sqrt(0.5))));
}
def code(t, l, Om, Omc):
	return math.asin(((1.0 / t) * (l * math.sqrt(0.5))))
function code(t, l, Om, Omc)
	return asin(Float64(Float64(1.0 / t) * Float64(l * sqrt(0.5))))
end
function tmp = code(t, l, Om, Omc)
	tmp = asin(((1.0 / t) * (l * sqrt(0.5))));
end
code[t_, l_, Om_, Omc_] := N[ArcSin[N[(N[(1.0 / t), $MachinePrecision] * N[(l * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\sin^{-1} \left(\frac{1}{t} \cdot \left(\ell \cdot \sqrt{0.5}\right)\right)
\end{array}
Derivation
  1. Initial program 83.7%

    \[\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right) \]
  2. Add Preprocessing
  3. Taylor expanded in t around inf 32.3%

    \[\leadsto \sin^{-1} \color{blue}{\left(\frac{\ell \cdot \sqrt{0.5}}{t} \cdot \sqrt{1 - \frac{{Om}^{2}}{{Omc}^{2}}}\right)} \]
  4. Step-by-step derivation
    1. *-commutative32.3%

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

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

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

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

      \[\leadsto \sin^{-1} \left(\sqrt{1 - \color{blue}{{\left(\frac{Om}{Omc}\right)}^{2}}} \cdot \frac{\ell \cdot \sqrt{0.5}}{t}\right) \]
    6. associate-/l*33.9%

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

    \[\leadsto \sin^{-1} \color{blue}{\left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \left(\ell \cdot \frac{\sqrt{0.5}}{t}\right)\right)} \]
  6. Step-by-step derivation
    1. unpow298.8%

      \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - \color{blue}{\frac{Om}{Omc} \cdot \frac{Om}{Omc}}}}{\mathsf{hypot}\left(1, \frac{\sqrt{2} \cdot t}{\ell}\right)}\right) \]
    2. clear-num98.8%

      \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - \frac{Om}{Omc} \cdot \color{blue}{\frac{1}{\frac{Omc}{Om}}}}}{\mathsf{hypot}\left(1, \frac{\sqrt{2} \cdot t}{\ell}\right)}\right) \]
    3. un-div-inv98.8%

      \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - \color{blue}{\frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}}}{\mathsf{hypot}\left(1, \frac{\sqrt{2} \cdot t}{\ell}\right)}\right) \]
  7. Applied egg-rr33.9%

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

    \[\leadsto \sin^{-1} \color{blue}{\left(\frac{\ell \cdot \sqrt{0.5}}{t}\right)} \]
  9. Step-by-step derivation
    1. associate-/l*33.9%

      \[\leadsto \sin^{-1} \color{blue}{\left(\ell \cdot \frac{\sqrt{0.5}}{t}\right)} \]
  10. Simplified33.9%

    \[\leadsto \sin^{-1} \color{blue}{\left(\ell \cdot \frac{\sqrt{0.5}}{t}\right)} \]
  11. Step-by-step derivation
    1. associate-*r/33.9%

      \[\leadsto \sin^{-1} \color{blue}{\left(\frac{\ell \cdot \sqrt{0.5}}{t}\right)} \]
    2. clear-num33.8%

      \[\leadsto \sin^{-1} \color{blue}{\left(\frac{1}{\frac{t}{\ell \cdot \sqrt{0.5}}}\right)} \]
  12. Applied egg-rr33.8%

    \[\leadsto \sin^{-1} \color{blue}{\left(\frac{1}{\frac{t}{\ell \cdot \sqrt{0.5}}}\right)} \]
  13. Step-by-step derivation
    1. associate-/r/33.9%

      \[\leadsto \sin^{-1} \color{blue}{\left(\frac{1}{t} \cdot \left(\ell \cdot \sqrt{0.5}\right)\right)} \]
  14. Simplified33.9%

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

Alternative 6: 31.1% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \sin^{-1} \left(\ell \cdot \frac{\sqrt{0.5}}{t}\right) \end{array} \]
(FPCore (t l Om Omc) :precision binary64 (asin (* l (/ (sqrt 0.5) t))))
double code(double t, double l, double Om, double Omc) {
	return asin((l * (sqrt(0.5) / t)));
}
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((l * (sqrt(0.5d0) / t)))
end function
public static double code(double t, double l, double Om, double Omc) {
	return Math.asin((l * (Math.sqrt(0.5) / t)));
}
def code(t, l, Om, Omc):
	return math.asin((l * (math.sqrt(0.5) / t)))
function code(t, l, Om, Omc)
	return asin(Float64(l * Float64(sqrt(0.5) / t)))
end
function tmp = code(t, l, Om, Omc)
	tmp = asin((l * (sqrt(0.5) / t)));
end
code[t_, l_, Om_, Omc_] := N[ArcSin[N[(l * N[(N[Sqrt[0.5], $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\sin^{-1} \left(\ell \cdot \frac{\sqrt{0.5}}{t}\right)
\end{array}
Derivation
  1. Initial program 83.7%

    \[\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right) \]
  2. Add Preprocessing
  3. Taylor expanded in t around inf 32.3%

    \[\leadsto \sin^{-1} \color{blue}{\left(\frac{\ell \cdot \sqrt{0.5}}{t} \cdot \sqrt{1 - \frac{{Om}^{2}}{{Omc}^{2}}}\right)} \]
  4. Step-by-step derivation
    1. *-commutative32.3%

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

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

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

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

      \[\leadsto \sin^{-1} \left(\sqrt{1 - \color{blue}{{\left(\frac{Om}{Omc}\right)}^{2}}} \cdot \frac{\ell \cdot \sqrt{0.5}}{t}\right) \]
    6. associate-/l*33.9%

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

    \[\leadsto \sin^{-1} \color{blue}{\left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \left(\ell \cdot \frac{\sqrt{0.5}}{t}\right)\right)} \]
  6. Step-by-step derivation
    1. unpow298.8%

      \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - \color{blue}{\frac{Om}{Omc} \cdot \frac{Om}{Omc}}}}{\mathsf{hypot}\left(1, \frac{\sqrt{2} \cdot t}{\ell}\right)}\right) \]
    2. clear-num98.8%

      \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - \frac{Om}{Omc} \cdot \color{blue}{\frac{1}{\frac{Omc}{Om}}}}}{\mathsf{hypot}\left(1, \frac{\sqrt{2} \cdot t}{\ell}\right)}\right) \]
    3. un-div-inv98.8%

      \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - \color{blue}{\frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}}}{\mathsf{hypot}\left(1, \frac{\sqrt{2} \cdot t}{\ell}\right)}\right) \]
  7. Applied egg-rr33.9%

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

    \[\leadsto \sin^{-1} \color{blue}{\left(\frac{\ell \cdot \sqrt{0.5}}{t}\right)} \]
  9. Step-by-step derivation
    1. associate-/l*33.9%

      \[\leadsto \sin^{-1} \color{blue}{\left(\ell \cdot \frac{\sqrt{0.5}}{t}\right)} \]
  10. Simplified33.9%

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

Reproduce

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