bug323 (missed optimization)

Percentage Accurate: 7.0% → 10.6%
Time: 2.9s
Alternatives: 12
Speedup: 0.7×

Specification

?
\[0 \leq x \land x \leq 0.5\]
\[\begin{array}{l} \\ \cos^{-1} \left(1 - x\right) \end{array} \]
(FPCore (x) :precision binary64 (acos (- 1.0 x)))
double code(double x) {
	return acos((1.0 - x));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x)
use fmin_fmax_functions
    real(8), intent (in) :: x
    code = acos((1.0d0 - x))
end function
public static double code(double x) {
	return Math.acos((1.0 - x));
}
def code(x):
	return math.acos((1.0 - x))
function code(x)
	return acos(Float64(1.0 - x))
end
function tmp = code(x)
	tmp = acos((1.0 - x));
end
code[x_] := N[ArcCos[N[(1.0 - x), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\cos^{-1} \left(1 - x\right)
\end{array}

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 12 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: 7.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \cos^{-1} \left(1 - x\right) \end{array} \]
(FPCore (x) :precision binary64 (acos (- 1.0 x)))
double code(double x) {
	return acos((1.0 - x));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x)
use fmin_fmax_functions
    real(8), intent (in) :: x
    code = acos((1.0d0 - x))
end function
public static double code(double x) {
	return Math.acos((1.0 - x));
}
def code(x):
	return math.acos((1.0 - x))
function code(x)
	return acos(Float64(1.0 - x))
end
function tmp = code(x)
	tmp = acos((1.0 - x));
end
code[x_] := N[ArcCos[N[(1.0 - x), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\cos^{-1} \left(1 - x\right)
\end{array}

Alternative 1: 10.6% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin^{-1} \left(1 - x\right)\\ t_1 := {\left(\frac{\pi}{2}\right)}^{1.5}\\ \frac{\mathsf{fma}\left(t\_1, t\_1, \sin^{-1} \left(\frac{1 - x \cdot x}{-1 - x}\right) \cdot \left(t\_0 \cdot t\_0\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(t\_0, t\_0, \sqrt{\pi} \cdot \left(\frac{\sqrt{\pi}}{2} \cdot t\_0\right)\right)\right)} \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (let* ((t_0 (asin (- 1.0 x))) (t_1 (pow (/ PI 2.0) 1.5)))
   (/
    (fma t_1 t_1 (* (asin (/ (- 1.0 (* x x)) (- -1.0 x))) (* t_0 t_0)))
    (fma
     (/ PI 2.0)
     (/ PI 2.0)
     (fma t_0 t_0 (* (sqrt PI) (* (/ (sqrt PI) 2.0) t_0)))))))
double code(double x) {
	double t_0 = asin((1.0 - x));
	double t_1 = pow((((double) M_PI) / 2.0), 1.5);
	return fma(t_1, t_1, (asin(((1.0 - (x * x)) / (-1.0 - x))) * (t_0 * t_0))) / fma((((double) M_PI) / 2.0), (((double) M_PI) / 2.0), fma(t_0, t_0, (sqrt(((double) M_PI)) * ((sqrt(((double) M_PI)) / 2.0) * t_0))));
}
function code(x)
	t_0 = asin(Float64(1.0 - x))
	t_1 = Float64(pi / 2.0) ^ 1.5
	return Float64(fma(t_1, t_1, Float64(asin(Float64(Float64(1.0 - Float64(x * x)) / Float64(-1.0 - x))) * Float64(t_0 * t_0))) / fma(Float64(pi / 2.0), Float64(pi / 2.0), fma(t_0, t_0, Float64(sqrt(pi) * Float64(Float64(sqrt(pi) / 2.0) * t_0)))))
end
code[x_] := Block[{t$95$0 = N[ArcSin[N[(1.0 - x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(Pi / 2.0), $MachinePrecision], 1.5], $MachinePrecision]}, N[(N[(t$95$1 * t$95$1 + N[(N[ArcSin[N[(N[(1.0 - N[(x * x), $MachinePrecision]), $MachinePrecision] / N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(Pi / 2.0), $MachinePrecision] * N[(Pi / 2.0), $MachinePrecision] + N[(t$95$0 * t$95$0 + N[(N[Sqrt[Pi], $MachinePrecision] * N[(N[(N[Sqrt[Pi], $MachinePrecision] / 2.0), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin^{-1} \left(1 - x\right)\\
t_1 := {\left(\frac{\pi}{2}\right)}^{1.5}\\
\frac{\mathsf{fma}\left(t\_1, t\_1, \sin^{-1} \left(\frac{1 - x \cdot x}{-1 - x}\right) \cdot \left(t\_0 \cdot t\_0\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(t\_0, t\_0, \sqrt{\pi} \cdot \left(\frac{\sqrt{\pi}}{2} \cdot t\_0\right)\right)\right)}
\end{array}
\end{array}
Derivation
  1. Initial program 7.0%

    \[\cos^{-1} \left(1 - x\right) \]
  2. Step-by-step derivation
    1. lift--.f64N/A

      \[\leadsto \cos^{-1} \color{blue}{\left(1 - x\right)} \]
    2. lift-acos.f64N/A

      \[\leadsto \color{blue}{\cos^{-1} \left(1 - x\right)} \]
    3. acos-asinN/A

      \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{2} - \sin^{-1} \left(1 - x\right)} \]
    4. flip3--N/A

      \[\leadsto \color{blue}{\frac{{\left(\frac{\mathsf{PI}\left(\right)}{2}\right)}^{3} - {\sin^{-1} \left(1 - x\right)}^{3}}{\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{\mathsf{PI}\left(\right)}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)}} \]
    5. lower-/.f64N/A

      \[\leadsto \color{blue}{\frac{{\left(\frac{\mathsf{PI}\left(\right)}{2}\right)}^{3} - {\sin^{-1} \left(1 - x\right)}^{3}}{\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{\mathsf{PI}\left(\right)}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)}} \]
    6. lower--.f64N/A

      \[\leadsto \frac{\color{blue}{{\left(\frac{\mathsf{PI}\left(\right)}{2}\right)}^{3} - {\sin^{-1} \left(1 - x\right)}^{3}}}{\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{\mathsf{PI}\left(\right)}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)} \]
    7. lower-pow.f64N/A

      \[\leadsto \frac{\color{blue}{{\left(\frac{\mathsf{PI}\left(\right)}{2}\right)}^{3}} - {\sin^{-1} \left(1 - x\right)}^{3}}{\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{\mathsf{PI}\left(\right)}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)} \]
    8. lower-/.f64N/A

      \[\leadsto \frac{{\color{blue}{\left(\frac{\mathsf{PI}\left(\right)}{2}\right)}}^{3} - {\sin^{-1} \left(1 - x\right)}^{3}}{\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{\mathsf{PI}\left(\right)}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)} \]
    9. lower-PI.f64N/A

      \[\leadsto \frac{{\left(\frac{\color{blue}{\pi}}{2}\right)}^{3} - {\sin^{-1} \left(1 - x\right)}^{3}}{\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{\mathsf{PI}\left(\right)}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)} \]
    10. lower-pow.f64N/A

      \[\leadsto \frac{{\left(\frac{\pi}{2}\right)}^{3} - \color{blue}{{\sin^{-1} \left(1 - x\right)}^{3}}}{\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{\mathsf{PI}\left(\right)}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)} \]
    11. lower-asin.f64N/A

      \[\leadsto \frac{{\left(\frac{\pi}{2}\right)}^{3} - {\color{blue}{\sin^{-1} \left(1 - x\right)}}^{3}}{\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{\mathsf{PI}\left(\right)}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)} \]
    12. lift--.f64N/A

      \[\leadsto \frac{{\left(\frac{\pi}{2}\right)}^{3} - {\sin^{-1} \color{blue}{\left(1 - x\right)}}^{3}}{\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{\mathsf{PI}\left(\right)}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)} \]
    13. lower-fma.f64N/A

      \[\leadsto \frac{{\left(\frac{\pi}{2}\right)}^{3} - {\sin^{-1} \left(1 - x\right)}^{3}}{\color{blue}{\mathsf{fma}\left(\frac{\mathsf{PI}\left(\right)}{2}, \frac{\mathsf{PI}\left(\right)}{2}, \sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)}} \]
  3. Applied rewrites7.0%

    \[\leadsto \color{blue}{\frac{{\left(\frac{\pi}{2}\right)}^{3} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)}} \]
  4. Step-by-step derivation
    1. lift--.f64N/A

      \[\leadsto \frac{\color{blue}{{\left(\frac{\pi}{2}\right)}^{3} - {\sin^{-1} \left(1 - x\right)}^{3}}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    2. lift-pow.f64N/A

      \[\leadsto \frac{{\left(\frac{\pi}{2}\right)}^{3} - \color{blue}{{\sin^{-1} \left(1 - x\right)}^{3}}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    3. lift--.f64N/A

      \[\leadsto \frac{{\left(\frac{\pi}{2}\right)}^{3} - {\sin^{-1} \color{blue}{\left(1 - x\right)}}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    4. lift-asin.f64N/A

      \[\leadsto \frac{{\left(\frac{\pi}{2}\right)}^{3} - {\color{blue}{\sin^{-1} \left(1 - x\right)}}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    5. cube-multN/A

      \[\leadsto \frac{{\left(\frac{\pi}{2}\right)}^{3} - \color{blue}{\sin^{-1} \left(1 - x\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    6. fp-cancel-sub-sign-invN/A

      \[\leadsto \frac{\color{blue}{{\left(\frac{\pi}{2}\right)}^{3} + \left(\mathsf{neg}\left(\sin^{-1} \left(1 - x\right)\right)\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    7. lift-pow.f64N/A

      \[\leadsto \frac{\color{blue}{{\left(\frac{\pi}{2}\right)}^{3}} + \left(\mathsf{neg}\left(\sin^{-1} \left(1 - x\right)\right)\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    8. sqr-powN/A

      \[\leadsto \frac{\color{blue}{{\left(\frac{\pi}{2}\right)}^{\left(\frac{3}{2}\right)} \cdot {\left(\frac{\pi}{2}\right)}^{\left(\frac{3}{2}\right)}} + \left(\mathsf{neg}\left(\sin^{-1} \left(1 - x\right)\right)\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    9. lower-fma.f64N/A

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\left(\frac{3}{2}\right)}, {\left(\frac{\pi}{2}\right)}^{\left(\frac{3}{2}\right)}, \left(\mathsf{neg}\left(\sin^{-1} \left(1 - x\right)\right)\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    10. lower-pow.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{{\left(\frac{\pi}{2}\right)}^{\left(\frac{3}{2}\right)}}, {\left(\frac{\pi}{2}\right)}^{\left(\frac{3}{2}\right)}, \left(\mathsf{neg}\left(\sin^{-1} \left(1 - x\right)\right)\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    11. metadata-evalN/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\color{blue}{\frac{3}{2}}}, {\left(\frac{\pi}{2}\right)}^{\left(\frac{3}{2}\right)}, \left(\mathsf{neg}\left(\sin^{-1} \left(1 - x\right)\right)\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    12. lower-pow.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, \color{blue}{{\left(\frac{\pi}{2}\right)}^{\left(\frac{3}{2}\right)}}, \left(\mathsf{neg}\left(\sin^{-1} \left(1 - x\right)\right)\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    13. metadata-evalN/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, {\left(\frac{\pi}{2}\right)}^{\color{blue}{\frac{3}{2}}}, \left(\mathsf{neg}\left(\sin^{-1} \left(1 - x\right)\right)\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    14. lower-*.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, {\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, \color{blue}{\left(\mathsf{neg}\left(\sin^{-1} \left(1 - x\right)\right)\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)}\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
  5. Applied rewrites10.5%

    \[\leadsto \frac{\color{blue}{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{1.5}, {\left(\frac{\pi}{2}\right)}^{1.5}, \sin^{-1} \left(-1 + x\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
  6. Step-by-step derivation
    1. lift-+.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, {\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, \sin^{-1} \color{blue}{\left(-1 + x\right)} \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    2. flip-+N/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, {\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, \sin^{-1} \color{blue}{\left(\frac{-1 \cdot -1 - x \cdot x}{-1 - x}\right)} \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    3. metadata-evalN/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, {\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, \sin^{-1} \left(\frac{\color{blue}{1} - x \cdot x}{-1 - x}\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    4. metadata-evalN/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, {\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, \sin^{-1} \left(\frac{\color{blue}{1 \cdot 1} - x \cdot x}{-1 - x}\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    5. lower-/.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, {\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, \sin^{-1} \color{blue}{\left(\frac{1 \cdot 1 - x \cdot x}{-1 - x}\right)} \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    6. metadata-evalN/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, {\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, \sin^{-1} \left(\frac{\color{blue}{1} - x \cdot x}{-1 - x}\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    7. lower--.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, {\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, \sin^{-1} \left(\frac{\color{blue}{1 - x \cdot x}}{-1 - x}\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    8. lower-*.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, {\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, \sin^{-1} \left(\frac{1 - \color{blue}{x \cdot x}}{-1 - x}\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    9. lower--.f6410.6

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{1.5}, {\left(\frac{\pi}{2}\right)}^{1.5}, \sin^{-1} \left(\frac{1 - x \cdot x}{\color{blue}{-1 - x}}\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
  7. Applied rewrites10.6%

    \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{1.5}, {\left(\frac{\pi}{2}\right)}^{1.5}, \sin^{-1} \color{blue}{\left(\frac{1 - x \cdot x}{-1 - x}\right)} \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
  8. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, {\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, \sin^{-1} \left(\frac{1 - x \cdot x}{-1 - x}\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \color{blue}{\frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)}\right)\right)} \]
    2. lift-PI.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, {\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, \sin^{-1} \left(\frac{1 - x \cdot x}{-1 - x}\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\color{blue}{\mathsf{PI}\left(\right)}}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    3. lift-/.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, {\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, \sin^{-1} \left(\frac{1 - x \cdot x}{-1 - x}\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \color{blue}{\frac{\mathsf{PI}\left(\right)}{2}} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    4. add-sqr-sqrtN/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, {\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, \sin^{-1} \left(\frac{1 - x \cdot x}{-1 - x}\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\color{blue}{\sqrt{\mathsf{PI}\left(\right)} \cdot \sqrt{\mathsf{PI}\left(\right)}}}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    5. associate-*r/N/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, {\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, \sin^{-1} \left(\frac{1 - x \cdot x}{-1 - x}\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \color{blue}{\left(\sqrt{\mathsf{PI}\left(\right)} \cdot \frac{\sqrt{\mathsf{PI}\left(\right)}}{2}\right)} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    6. lift-sqrt.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, {\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, \sin^{-1} \left(\frac{1 - x \cdot x}{-1 - x}\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \left(\sqrt{\mathsf{PI}\left(\right)} \cdot \frac{\color{blue}{\sqrt{\mathsf{PI}\left(\right)}}}{2}\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    7. lift-PI.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, {\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, \sin^{-1} \left(\frac{1 - x \cdot x}{-1 - x}\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \left(\sqrt{\mathsf{PI}\left(\right)} \cdot \frac{\sqrt{\color{blue}{\pi}}}{2}\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    8. lift-/.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, {\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, \sin^{-1} \left(\frac{1 - x \cdot x}{-1 - x}\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \left(\sqrt{\mathsf{PI}\left(\right)} \cdot \color{blue}{\frac{\sqrt{\pi}}{2}}\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    9. associate-*l*N/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, {\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, \sin^{-1} \left(\frac{1 - x \cdot x}{-1 - x}\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \color{blue}{\sqrt{\mathsf{PI}\left(\right)} \cdot \left(\frac{\sqrt{\pi}}{2} \cdot \sin^{-1} \left(1 - x\right)\right)}\right)\right)} \]
    10. lower-*.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, {\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, \sin^{-1} \left(\frac{1 - x \cdot x}{-1 - x}\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \color{blue}{\sqrt{\mathsf{PI}\left(\right)} \cdot \left(\frac{\sqrt{\pi}}{2} \cdot \sin^{-1} \left(1 - x\right)\right)}\right)\right)} \]
    11. lift-sqrt.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, {\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, \sin^{-1} \left(\frac{1 - x \cdot x}{-1 - x}\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \color{blue}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \left(\frac{\sqrt{\pi}}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)\right)} \]
    12. lift-PI.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, {\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, \sin^{-1} \left(\frac{1 - x \cdot x}{-1 - x}\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \sqrt{\color{blue}{\pi}} \cdot \left(\frac{\sqrt{\pi}}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)\right)} \]
    13. lower-*.f6410.6

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{1.5}, {\left(\frac{\pi}{2}\right)}^{1.5}, \sin^{-1} \left(\frac{1 - x \cdot x}{-1 - x}\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \sqrt{\pi} \cdot \color{blue}{\left(\frac{\sqrt{\pi}}{2} \cdot \sin^{-1} \left(1 - x\right)\right)}\right)\right)} \]
  9. Applied rewrites10.6%

    \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{1.5}, {\left(\frac{\pi}{2}\right)}^{1.5}, \sin^{-1} \left(\frac{1 - x \cdot x}{-1 - x}\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \color{blue}{\sqrt{\pi} \cdot \left(\frac{\sqrt{\pi}}{2} \cdot \sin^{-1} \left(1 - x\right)\right)}\right)\right)} \]
  10. Add Preprocessing

Alternative 2: 10.6% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin^{-1} \left(1 - x\right)\\ t_1 := {\left(\frac{\pi}{2}\right)}^{1.5}\\ \frac{\mathsf{fma}\left(t\_1, t\_1, \sin^{-1} \left(\frac{1 - x \cdot x}{-1 - x}\right) \cdot \left(t\_0 \cdot t\_0\right)\right)}{\mathsf{fma}\left(t\_0, t\_0 + \frac{\pi}{2}, \frac{\pi \cdot \pi}{4}\right)} \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (let* ((t_0 (asin (- 1.0 x))) (t_1 (pow (/ PI 2.0) 1.5)))
   (/
    (fma t_1 t_1 (* (asin (/ (- 1.0 (* x x)) (- -1.0 x))) (* t_0 t_0)))
    (fma t_0 (+ t_0 (/ PI 2.0)) (/ (* PI PI) 4.0)))))
double code(double x) {
	double t_0 = asin((1.0 - x));
	double t_1 = pow((((double) M_PI) / 2.0), 1.5);
	return fma(t_1, t_1, (asin(((1.0 - (x * x)) / (-1.0 - x))) * (t_0 * t_0))) / fma(t_0, (t_0 + (((double) M_PI) / 2.0)), ((((double) M_PI) * ((double) M_PI)) / 4.0));
}
function code(x)
	t_0 = asin(Float64(1.0 - x))
	t_1 = Float64(pi / 2.0) ^ 1.5
	return Float64(fma(t_1, t_1, Float64(asin(Float64(Float64(1.0 - Float64(x * x)) / Float64(-1.0 - x))) * Float64(t_0 * t_0))) / fma(t_0, Float64(t_0 + Float64(pi / 2.0)), Float64(Float64(pi * pi) / 4.0)))
end
code[x_] := Block[{t$95$0 = N[ArcSin[N[(1.0 - x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(Pi / 2.0), $MachinePrecision], 1.5], $MachinePrecision]}, N[(N[(t$95$1 * t$95$1 + N[(N[ArcSin[N[(N[(1.0 - N[(x * x), $MachinePrecision]), $MachinePrecision] / N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 * N[(t$95$0 + N[(Pi / 2.0), $MachinePrecision]), $MachinePrecision] + N[(N[(Pi * Pi), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin^{-1} \left(1 - x\right)\\
t_1 := {\left(\frac{\pi}{2}\right)}^{1.5}\\
\frac{\mathsf{fma}\left(t\_1, t\_1, \sin^{-1} \left(\frac{1 - x \cdot x}{-1 - x}\right) \cdot \left(t\_0 \cdot t\_0\right)\right)}{\mathsf{fma}\left(t\_0, t\_0 + \frac{\pi}{2}, \frac{\pi \cdot \pi}{4}\right)}
\end{array}
\end{array}
Derivation
  1. Initial program 7.0%

    \[\cos^{-1} \left(1 - x\right) \]
  2. Step-by-step derivation
    1. lift--.f64N/A

      \[\leadsto \cos^{-1} \color{blue}{\left(1 - x\right)} \]
    2. lift-acos.f64N/A

      \[\leadsto \color{blue}{\cos^{-1} \left(1 - x\right)} \]
    3. acos-asinN/A

      \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{2} - \sin^{-1} \left(1 - x\right)} \]
    4. flip3--N/A

      \[\leadsto \color{blue}{\frac{{\left(\frac{\mathsf{PI}\left(\right)}{2}\right)}^{3} - {\sin^{-1} \left(1 - x\right)}^{3}}{\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{\mathsf{PI}\left(\right)}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)}} \]
    5. lower-/.f64N/A

      \[\leadsto \color{blue}{\frac{{\left(\frac{\mathsf{PI}\left(\right)}{2}\right)}^{3} - {\sin^{-1} \left(1 - x\right)}^{3}}{\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{\mathsf{PI}\left(\right)}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)}} \]
    6. lower--.f64N/A

      \[\leadsto \frac{\color{blue}{{\left(\frac{\mathsf{PI}\left(\right)}{2}\right)}^{3} - {\sin^{-1} \left(1 - x\right)}^{3}}}{\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{\mathsf{PI}\left(\right)}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)} \]
    7. lower-pow.f64N/A

      \[\leadsto \frac{\color{blue}{{\left(\frac{\mathsf{PI}\left(\right)}{2}\right)}^{3}} - {\sin^{-1} \left(1 - x\right)}^{3}}{\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{\mathsf{PI}\left(\right)}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)} \]
    8. lower-/.f64N/A

      \[\leadsto \frac{{\color{blue}{\left(\frac{\mathsf{PI}\left(\right)}{2}\right)}}^{3} - {\sin^{-1} \left(1 - x\right)}^{3}}{\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{\mathsf{PI}\left(\right)}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)} \]
    9. lower-PI.f64N/A

      \[\leadsto \frac{{\left(\frac{\color{blue}{\pi}}{2}\right)}^{3} - {\sin^{-1} \left(1 - x\right)}^{3}}{\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{\mathsf{PI}\left(\right)}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)} \]
    10. lower-pow.f64N/A

      \[\leadsto \frac{{\left(\frac{\pi}{2}\right)}^{3} - \color{blue}{{\sin^{-1} \left(1 - x\right)}^{3}}}{\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{\mathsf{PI}\left(\right)}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)} \]
    11. lower-asin.f64N/A

      \[\leadsto \frac{{\left(\frac{\pi}{2}\right)}^{3} - {\color{blue}{\sin^{-1} \left(1 - x\right)}}^{3}}{\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{\mathsf{PI}\left(\right)}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)} \]
    12. lift--.f64N/A

      \[\leadsto \frac{{\left(\frac{\pi}{2}\right)}^{3} - {\sin^{-1} \color{blue}{\left(1 - x\right)}}^{3}}{\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{\mathsf{PI}\left(\right)}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)} \]
    13. lower-fma.f64N/A

      \[\leadsto \frac{{\left(\frac{\pi}{2}\right)}^{3} - {\sin^{-1} \left(1 - x\right)}^{3}}{\color{blue}{\mathsf{fma}\left(\frac{\mathsf{PI}\left(\right)}{2}, \frac{\mathsf{PI}\left(\right)}{2}, \sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)}} \]
  3. Applied rewrites7.0%

    \[\leadsto \color{blue}{\frac{{\left(\frac{\pi}{2}\right)}^{3} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)}} \]
  4. Step-by-step derivation
    1. lift--.f64N/A

      \[\leadsto \frac{\color{blue}{{\left(\frac{\pi}{2}\right)}^{3} - {\sin^{-1} \left(1 - x\right)}^{3}}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    2. lift-pow.f64N/A

      \[\leadsto \frac{{\left(\frac{\pi}{2}\right)}^{3} - \color{blue}{{\sin^{-1} \left(1 - x\right)}^{3}}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    3. lift--.f64N/A

      \[\leadsto \frac{{\left(\frac{\pi}{2}\right)}^{3} - {\sin^{-1} \color{blue}{\left(1 - x\right)}}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    4. lift-asin.f64N/A

      \[\leadsto \frac{{\left(\frac{\pi}{2}\right)}^{3} - {\color{blue}{\sin^{-1} \left(1 - x\right)}}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    5. cube-multN/A

      \[\leadsto \frac{{\left(\frac{\pi}{2}\right)}^{3} - \color{blue}{\sin^{-1} \left(1 - x\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    6. fp-cancel-sub-sign-invN/A

      \[\leadsto \frac{\color{blue}{{\left(\frac{\pi}{2}\right)}^{3} + \left(\mathsf{neg}\left(\sin^{-1} \left(1 - x\right)\right)\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    7. lift-pow.f64N/A

      \[\leadsto \frac{\color{blue}{{\left(\frac{\pi}{2}\right)}^{3}} + \left(\mathsf{neg}\left(\sin^{-1} \left(1 - x\right)\right)\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    8. sqr-powN/A

      \[\leadsto \frac{\color{blue}{{\left(\frac{\pi}{2}\right)}^{\left(\frac{3}{2}\right)} \cdot {\left(\frac{\pi}{2}\right)}^{\left(\frac{3}{2}\right)}} + \left(\mathsf{neg}\left(\sin^{-1} \left(1 - x\right)\right)\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    9. lower-fma.f64N/A

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\left(\frac{3}{2}\right)}, {\left(\frac{\pi}{2}\right)}^{\left(\frac{3}{2}\right)}, \left(\mathsf{neg}\left(\sin^{-1} \left(1 - x\right)\right)\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    10. lower-pow.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{{\left(\frac{\pi}{2}\right)}^{\left(\frac{3}{2}\right)}}, {\left(\frac{\pi}{2}\right)}^{\left(\frac{3}{2}\right)}, \left(\mathsf{neg}\left(\sin^{-1} \left(1 - x\right)\right)\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    11. metadata-evalN/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\color{blue}{\frac{3}{2}}}, {\left(\frac{\pi}{2}\right)}^{\left(\frac{3}{2}\right)}, \left(\mathsf{neg}\left(\sin^{-1} \left(1 - x\right)\right)\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    12. lower-pow.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, \color{blue}{{\left(\frac{\pi}{2}\right)}^{\left(\frac{3}{2}\right)}}, \left(\mathsf{neg}\left(\sin^{-1} \left(1 - x\right)\right)\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    13. metadata-evalN/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, {\left(\frac{\pi}{2}\right)}^{\color{blue}{\frac{3}{2}}}, \left(\mathsf{neg}\left(\sin^{-1} \left(1 - x\right)\right)\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    14. lower-*.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, {\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, \color{blue}{\left(\mathsf{neg}\left(\sin^{-1} \left(1 - x\right)\right)\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)}\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
  5. Applied rewrites10.5%

    \[\leadsto \frac{\color{blue}{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{1.5}, {\left(\frac{\pi}{2}\right)}^{1.5}, \sin^{-1} \left(-1 + x\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
  6. Step-by-step derivation
    1. lift-+.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, {\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, \sin^{-1} \color{blue}{\left(-1 + x\right)} \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    2. flip-+N/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, {\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, \sin^{-1} \color{blue}{\left(\frac{-1 \cdot -1 - x \cdot x}{-1 - x}\right)} \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    3. metadata-evalN/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, {\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, \sin^{-1} \left(\frac{\color{blue}{1} - x \cdot x}{-1 - x}\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    4. metadata-evalN/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, {\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, \sin^{-1} \left(\frac{\color{blue}{1 \cdot 1} - x \cdot x}{-1 - x}\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    5. lower-/.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, {\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, \sin^{-1} \color{blue}{\left(\frac{1 \cdot 1 - x \cdot x}{-1 - x}\right)} \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    6. metadata-evalN/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, {\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, \sin^{-1} \left(\frac{\color{blue}{1} - x \cdot x}{-1 - x}\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    7. lower--.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, {\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, \sin^{-1} \left(\frac{\color{blue}{1 - x \cdot x}}{-1 - x}\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    8. lower-*.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, {\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, \sin^{-1} \left(\frac{1 - \color{blue}{x \cdot x}}{-1 - x}\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    9. lower--.f6410.6

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{1.5}, {\left(\frac{\pi}{2}\right)}^{1.5}, \sin^{-1} \left(\frac{1 - x \cdot x}{\color{blue}{-1 - x}}\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
  7. Applied rewrites10.6%

    \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{1.5}, {\left(\frac{\pi}{2}\right)}^{1.5}, \sin^{-1} \color{blue}{\left(\frac{1 - x \cdot x}{-1 - x}\right)} \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
  8. Step-by-step derivation
    1. lift-fma.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, {\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, \sin^{-1} \left(\frac{1 - x \cdot x}{-1 - x}\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\color{blue}{\frac{\pi}{2} \cdot \frac{\pi}{2} + \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)}} \]
    2. lift-fma.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, {\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, \sin^{-1} \left(\frac{1 - x \cdot x}{-1 - x}\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\frac{\pi}{2} \cdot \frac{\pi}{2} + \color{blue}{\left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)}} \]
    3. lift--.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, {\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, \sin^{-1} \left(\frac{1 - x \cdot x}{-1 - x}\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\frac{\pi}{2} \cdot \frac{\pi}{2} + \left(\sin^{-1} \color{blue}{\left(1 - x\right)} \cdot \sin^{-1} \left(1 - x\right) + \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)} \]
    4. lift-asin.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, {\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, \sin^{-1} \left(\frac{1 - x \cdot x}{-1 - x}\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\frac{\pi}{2} \cdot \frac{\pi}{2} + \left(\color{blue}{\sin^{-1} \left(1 - x\right)} \cdot \sin^{-1} \left(1 - x\right) + \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)} \]
    5. lift--.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, {\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, \sin^{-1} \left(\frac{1 - x \cdot x}{-1 - x}\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\frac{\pi}{2} \cdot \frac{\pi}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \color{blue}{\left(1 - x\right)} + \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)} \]
    6. lift-asin.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, {\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, \sin^{-1} \left(\frac{1 - x \cdot x}{-1 - x}\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\frac{\pi}{2} \cdot \frac{\pi}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \color{blue}{\sin^{-1} \left(1 - x\right)} + \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)} \]
    7. lift-*.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, {\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, \sin^{-1} \left(\frac{1 - x \cdot x}{-1 - x}\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\frac{\pi}{2} \cdot \frac{\pi}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \color{blue}{\frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)}\right)} \]
    8. lift-PI.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, {\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, \sin^{-1} \left(\frac{1 - x \cdot x}{-1 - x}\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\frac{\pi}{2} \cdot \frac{\pi}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\color{blue}{\mathsf{PI}\left(\right)}}{2} \cdot \sin^{-1} \left(1 - x\right)\right)} \]
    9. lift-/.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, {\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, \sin^{-1} \left(\frac{1 - x \cdot x}{-1 - x}\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\frac{\pi}{2} \cdot \frac{\pi}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \color{blue}{\frac{\mathsf{PI}\left(\right)}{2}} \cdot \sin^{-1} \left(1 - x\right)\right)} \]
    10. lift--.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, {\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, \sin^{-1} \left(\frac{1 - x \cdot x}{-1 - x}\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\frac{\pi}{2} \cdot \frac{\pi}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \color{blue}{\left(1 - x\right)}\right)} \]
    11. lift-asin.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, {\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, \sin^{-1} \left(\frac{1 - x \cdot x}{-1 - x}\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\frac{\pi}{2} \cdot \frac{\pi}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \color{blue}{\sin^{-1} \left(1 - x\right)}\right)} \]
    12. +-commutativeN/A

      \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, {\left(\frac{\pi}{2}\right)}^{\frac{3}{2}}, \sin^{-1} \left(\frac{1 - x \cdot x}{-1 - x}\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\color{blue}{\left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right) + \frac{\pi}{2} \cdot \frac{\pi}{2}}} \]
  9. Applied rewrites10.6%

    \[\leadsto \frac{\mathsf{fma}\left({\left(\frac{\pi}{2}\right)}^{1.5}, {\left(\frac{\pi}{2}\right)}^{1.5}, \sin^{-1} \left(\frac{1 - x \cdot x}{-1 - x}\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}{\color{blue}{\mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right) + \frac{\pi}{2}, \frac{\pi \cdot \pi}{4}\right)}} \]
  10. Add Preprocessing

Alternative 3: 10.5% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin^{-1} \left(1 - x\right)\\ \frac{{\pi}^{1.5} \cdot \frac{{\pi}^{1.5}}{8} - {t\_0}^{3}}{\frac{\pi \cdot \pi}{4} + t\_0 \cdot \left(t\_0 + \frac{\pi}{2}\right)} \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (let* ((t_0 (asin (- 1.0 x))))
   (/
    (- (* (pow PI 1.5) (/ (pow PI 1.5) 8.0)) (pow t_0 3.0))
    (+ (/ (* PI PI) 4.0) (* t_0 (+ t_0 (/ PI 2.0)))))))
double code(double x) {
	double t_0 = asin((1.0 - x));
	return ((pow(((double) M_PI), 1.5) * (pow(((double) M_PI), 1.5) / 8.0)) - pow(t_0, 3.0)) / (((((double) M_PI) * ((double) M_PI)) / 4.0) + (t_0 * (t_0 + (((double) M_PI) / 2.0))));
}
public static double code(double x) {
	double t_0 = Math.asin((1.0 - x));
	return ((Math.pow(Math.PI, 1.5) * (Math.pow(Math.PI, 1.5) / 8.0)) - Math.pow(t_0, 3.0)) / (((Math.PI * Math.PI) / 4.0) + (t_0 * (t_0 + (Math.PI / 2.0))));
}
def code(x):
	t_0 = math.asin((1.0 - x))
	return ((math.pow(math.pi, 1.5) * (math.pow(math.pi, 1.5) / 8.0)) - math.pow(t_0, 3.0)) / (((math.pi * math.pi) / 4.0) + (t_0 * (t_0 + (math.pi / 2.0))))
function code(x)
	t_0 = asin(Float64(1.0 - x))
	return Float64(Float64(Float64((pi ^ 1.5) * Float64((pi ^ 1.5) / 8.0)) - (t_0 ^ 3.0)) / Float64(Float64(Float64(pi * pi) / 4.0) + Float64(t_0 * Float64(t_0 + Float64(pi / 2.0)))))
end
function tmp = code(x)
	t_0 = asin((1.0 - x));
	tmp = (((pi ^ 1.5) * ((pi ^ 1.5) / 8.0)) - (t_0 ^ 3.0)) / (((pi * pi) / 4.0) + (t_0 * (t_0 + (pi / 2.0))));
end
code[x_] := Block[{t$95$0 = N[ArcSin[N[(1.0 - x), $MachinePrecision]], $MachinePrecision]}, N[(N[(N[(N[Power[Pi, 1.5], $MachinePrecision] * N[(N[Power[Pi, 1.5], $MachinePrecision] / 8.0), $MachinePrecision]), $MachinePrecision] - N[Power[t$95$0, 3.0], $MachinePrecision]), $MachinePrecision] / N[(N[(N[(Pi * Pi), $MachinePrecision] / 4.0), $MachinePrecision] + N[(t$95$0 * N[(t$95$0 + N[(Pi / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin^{-1} \left(1 - x\right)\\
\frac{{\pi}^{1.5} \cdot \frac{{\pi}^{1.5}}{8} - {t\_0}^{3}}{\frac{\pi \cdot \pi}{4} + t\_0 \cdot \left(t\_0 + \frac{\pi}{2}\right)}
\end{array}
\end{array}
Derivation
  1. Initial program 7.0%

    \[\cos^{-1} \left(1 - x\right) \]
  2. Step-by-step derivation
    1. lift--.f64N/A

      \[\leadsto \cos^{-1} \color{blue}{\left(1 - x\right)} \]
    2. lift-acos.f64N/A

      \[\leadsto \color{blue}{\cos^{-1} \left(1 - x\right)} \]
    3. acos-asinN/A

      \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{2} - \sin^{-1} \left(1 - x\right)} \]
    4. flip3--N/A

      \[\leadsto \color{blue}{\frac{{\left(\frac{\mathsf{PI}\left(\right)}{2}\right)}^{3} - {\sin^{-1} \left(1 - x\right)}^{3}}{\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{\mathsf{PI}\left(\right)}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)}} \]
    5. lower-/.f64N/A

      \[\leadsto \color{blue}{\frac{{\left(\frac{\mathsf{PI}\left(\right)}{2}\right)}^{3} - {\sin^{-1} \left(1 - x\right)}^{3}}{\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{\mathsf{PI}\left(\right)}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)}} \]
    6. lower--.f64N/A

      \[\leadsto \frac{\color{blue}{{\left(\frac{\mathsf{PI}\left(\right)}{2}\right)}^{3} - {\sin^{-1} \left(1 - x\right)}^{3}}}{\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{\mathsf{PI}\left(\right)}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)} \]
    7. lower-pow.f64N/A

      \[\leadsto \frac{\color{blue}{{\left(\frac{\mathsf{PI}\left(\right)}{2}\right)}^{3}} - {\sin^{-1} \left(1 - x\right)}^{3}}{\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{\mathsf{PI}\left(\right)}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)} \]
    8. lower-/.f64N/A

      \[\leadsto \frac{{\color{blue}{\left(\frac{\mathsf{PI}\left(\right)}{2}\right)}}^{3} - {\sin^{-1} \left(1 - x\right)}^{3}}{\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{\mathsf{PI}\left(\right)}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)} \]
    9. lower-PI.f64N/A

      \[\leadsto \frac{{\left(\frac{\color{blue}{\pi}}{2}\right)}^{3} - {\sin^{-1} \left(1 - x\right)}^{3}}{\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{\mathsf{PI}\left(\right)}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)} \]
    10. lower-pow.f64N/A

      \[\leadsto \frac{{\left(\frac{\pi}{2}\right)}^{3} - \color{blue}{{\sin^{-1} \left(1 - x\right)}^{3}}}{\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{\mathsf{PI}\left(\right)}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)} \]
    11. lower-asin.f64N/A

      \[\leadsto \frac{{\left(\frac{\pi}{2}\right)}^{3} - {\color{blue}{\sin^{-1} \left(1 - x\right)}}^{3}}{\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{\mathsf{PI}\left(\right)}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)} \]
    12. lift--.f64N/A

      \[\leadsto \frac{{\left(\frac{\pi}{2}\right)}^{3} - {\sin^{-1} \color{blue}{\left(1 - x\right)}}^{3}}{\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{\mathsf{PI}\left(\right)}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)} \]
    13. lower-fma.f64N/A

      \[\leadsto \frac{{\left(\frac{\pi}{2}\right)}^{3} - {\sin^{-1} \left(1 - x\right)}^{3}}{\color{blue}{\mathsf{fma}\left(\frac{\mathsf{PI}\left(\right)}{2}, \frac{\mathsf{PI}\left(\right)}{2}, \sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)}} \]
  3. Applied rewrites7.0%

    \[\leadsto \color{blue}{\frac{{\left(\frac{\pi}{2}\right)}^{3} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)}} \]
  4. Step-by-step derivation
    1. lift-pow.f64N/A

      \[\leadsto \frac{\color{blue}{{\left(\frac{\pi}{2}\right)}^{3}} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    2. lift-PI.f64N/A

      \[\leadsto \frac{{\left(\frac{\color{blue}{\mathsf{PI}\left(\right)}}{2}\right)}^{3} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    3. lift-/.f64N/A

      \[\leadsto \frac{{\color{blue}{\left(\frac{\mathsf{PI}\left(\right)}{2}\right)}}^{3} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    4. cube-divN/A

      \[\leadsto \frac{\color{blue}{\frac{{\mathsf{PI}\left(\right)}^{3}}{{2}^{3}}} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    5. sqr-powN/A

      \[\leadsto \frac{\frac{\color{blue}{{\mathsf{PI}\left(\right)}^{\left(\frac{3}{2}\right)} \cdot {\mathsf{PI}\left(\right)}^{\left(\frac{3}{2}\right)}}}{{2}^{3}} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    6. associate-/l*N/A

      \[\leadsto \frac{\color{blue}{{\mathsf{PI}\left(\right)}^{\left(\frac{3}{2}\right)} \cdot \frac{{\mathsf{PI}\left(\right)}^{\left(\frac{3}{2}\right)}}{{2}^{3}}} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    7. lower-*.f64N/A

      \[\leadsto \frac{\color{blue}{{\mathsf{PI}\left(\right)}^{\left(\frac{3}{2}\right)} \cdot \frac{{\mathsf{PI}\left(\right)}^{\left(\frac{3}{2}\right)}}{{2}^{3}}} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    8. lower-pow.f64N/A

      \[\leadsto \frac{\color{blue}{{\mathsf{PI}\left(\right)}^{\left(\frac{3}{2}\right)}} \cdot \frac{{\mathsf{PI}\left(\right)}^{\left(\frac{3}{2}\right)}}{{2}^{3}} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    9. lift-PI.f64N/A

      \[\leadsto \frac{{\color{blue}{\pi}}^{\left(\frac{3}{2}\right)} \cdot \frac{{\mathsf{PI}\left(\right)}^{\left(\frac{3}{2}\right)}}{{2}^{3}} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    10. metadata-evalN/A

      \[\leadsto \frac{{\pi}^{\color{blue}{\frac{3}{2}}} \cdot \frac{{\mathsf{PI}\left(\right)}^{\left(\frac{3}{2}\right)}}{{2}^{3}} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    11. lower-/.f64N/A

      \[\leadsto \frac{{\pi}^{\frac{3}{2}} \cdot \color{blue}{\frac{{\mathsf{PI}\left(\right)}^{\left(\frac{3}{2}\right)}}{{2}^{3}}} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    12. lower-pow.f64N/A

      \[\leadsto \frac{{\pi}^{\frac{3}{2}} \cdot \frac{\color{blue}{{\mathsf{PI}\left(\right)}^{\left(\frac{3}{2}\right)}}}{{2}^{3}} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    13. lift-PI.f64N/A

      \[\leadsto \frac{{\pi}^{\frac{3}{2}} \cdot \frac{{\color{blue}{\pi}}^{\left(\frac{3}{2}\right)}}{{2}^{3}} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    14. metadata-evalN/A

      \[\leadsto \frac{{\pi}^{\frac{3}{2}} \cdot \frac{{\pi}^{\color{blue}{\frac{3}{2}}}}{{2}^{3}} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    15. metadata-eval10.5

      \[\leadsto \frac{{\pi}^{1.5} \cdot \frac{{\pi}^{1.5}}{\color{blue}{8}} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
  5. Applied rewrites10.5%

    \[\leadsto \frac{\color{blue}{{\pi}^{1.5} \cdot \frac{{\pi}^{1.5}}{8}} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
  6. Step-by-step derivation
    1. lift-fma.f64N/A

      \[\leadsto \frac{{\pi}^{\frac{3}{2}} \cdot \frac{{\pi}^{\frac{3}{2}}}{8} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \color{blue}{\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)}\right)} \]
    2. lift--.f64N/A

      \[\leadsto \frac{{\pi}^{\frac{3}{2}} \cdot \frac{{\pi}^{\frac{3}{2}}}{8} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \sin^{-1} \color{blue}{\left(1 - x\right)} \cdot \sin^{-1} \left(1 - x\right) + \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)} \]
    3. lift-asin.f64N/A

      \[\leadsto \frac{{\pi}^{\frac{3}{2}} \cdot \frac{{\pi}^{\frac{3}{2}}}{8} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \color{blue}{\sin^{-1} \left(1 - x\right)} \cdot \sin^{-1} \left(1 - x\right) + \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)} \]
    4. lift--.f64N/A

      \[\leadsto \frac{{\pi}^{\frac{3}{2}} \cdot \frac{{\pi}^{\frac{3}{2}}}{8} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \color{blue}{\left(1 - x\right)} + \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)} \]
    5. lift-asin.f64N/A

      \[\leadsto \frac{{\pi}^{\frac{3}{2}} \cdot \frac{{\pi}^{\frac{3}{2}}}{8} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \sin^{-1} \left(1 - x\right) \cdot \color{blue}{\sin^{-1} \left(1 - x\right)} + \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)} \]
    6. lift-*.f64N/A

      \[\leadsto \frac{{\pi}^{\frac{3}{2}} \cdot \frac{{\pi}^{\frac{3}{2}}}{8} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \color{blue}{\frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)}\right)} \]
    7. lift-PI.f64N/A

      \[\leadsto \frac{{\pi}^{\frac{3}{2}} \cdot \frac{{\pi}^{\frac{3}{2}}}{8} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\color{blue}{\mathsf{PI}\left(\right)}}{2} \cdot \sin^{-1} \left(1 - x\right)\right)} \]
    8. lift-/.f64N/A

      \[\leadsto \frac{{\pi}^{\frac{3}{2}} \cdot \frac{{\pi}^{\frac{3}{2}}}{8} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \color{blue}{\frac{\mathsf{PI}\left(\right)}{2}} \cdot \sin^{-1} \left(1 - x\right)\right)} \]
    9. lift--.f64N/A

      \[\leadsto \frac{{\pi}^{\frac{3}{2}} \cdot \frac{{\pi}^{\frac{3}{2}}}{8} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \color{blue}{\left(1 - x\right)}\right)} \]
    10. lift-asin.f64N/A

      \[\leadsto \frac{{\pi}^{\frac{3}{2}} \cdot \frac{{\pi}^{\frac{3}{2}}}{8} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \color{blue}{\sin^{-1} \left(1 - x\right)}\right)} \]
    11. lower-fma.f64N/A

      \[\leadsto \frac{{\pi}^{\frac{3}{2}} \cdot \frac{{\pi}^{\frac{3}{2}}}{8} - {\sin^{-1} \left(1 - x\right)}^{3}}{\color{blue}{\frac{\pi}{2} \cdot \frac{\pi}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)}} \]
    12. lower-+.f64N/A

      \[\leadsto \frac{{\pi}^{\frac{3}{2}} \cdot \frac{{\pi}^{\frac{3}{2}}}{8} - {\sin^{-1} \left(1 - x\right)}^{3}}{\color{blue}{\frac{\pi}{2} \cdot \frac{\pi}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)}} \]
  7. Applied rewrites10.5%

    \[\leadsto \frac{{\pi}^{1.5} \cdot \frac{{\pi}^{1.5}}{8} - {\sin^{-1} \left(1 - x\right)}^{3}}{\color{blue}{\frac{\pi \cdot \pi}{4} + \sin^{-1} \left(1 - x\right) \cdot \left(\sin^{-1} \left(1 - x\right) + \frac{\pi}{2}\right)}} \]
  8. Add Preprocessing

Alternative 4: 10.5% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin^{-1} \left(1 - x\right)\\ \frac{\frac{{\left({\pi}^{1.5}\right)}^{2}}{8} - {t\_0}^{3}}{\mathsf{fma}\left(t\_0, t\_0 + \frac{\pi}{2}, \frac{\pi \cdot \pi}{4}\right)} \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (let* ((t_0 (asin (- 1.0 x))))
   (/
    (- (/ (pow (pow PI 1.5) 2.0) 8.0) (pow t_0 3.0))
    (fma t_0 (+ t_0 (/ PI 2.0)) (/ (* PI PI) 4.0)))))
double code(double x) {
	double t_0 = asin((1.0 - x));
	return ((pow(pow(((double) M_PI), 1.5), 2.0) / 8.0) - pow(t_0, 3.0)) / fma(t_0, (t_0 + (((double) M_PI) / 2.0)), ((((double) M_PI) * ((double) M_PI)) / 4.0));
}
function code(x)
	t_0 = asin(Float64(1.0 - x))
	return Float64(Float64(Float64(((pi ^ 1.5) ^ 2.0) / 8.0) - (t_0 ^ 3.0)) / fma(t_0, Float64(t_0 + Float64(pi / 2.0)), Float64(Float64(pi * pi) / 4.0)))
end
code[x_] := Block[{t$95$0 = N[ArcSin[N[(1.0 - x), $MachinePrecision]], $MachinePrecision]}, N[(N[(N[(N[Power[N[Power[Pi, 1.5], $MachinePrecision], 2.0], $MachinePrecision] / 8.0), $MachinePrecision] - N[Power[t$95$0, 3.0], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 * N[(t$95$0 + N[(Pi / 2.0), $MachinePrecision]), $MachinePrecision] + N[(N[(Pi * Pi), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin^{-1} \left(1 - x\right)\\
\frac{\frac{{\left({\pi}^{1.5}\right)}^{2}}{8} - {t\_0}^{3}}{\mathsf{fma}\left(t\_0, t\_0 + \frac{\pi}{2}, \frac{\pi \cdot \pi}{4}\right)}
\end{array}
\end{array}
Derivation
  1. Initial program 7.0%

    \[\cos^{-1} \left(1 - x\right) \]
  2. Step-by-step derivation
    1. lift--.f64N/A

      \[\leadsto \cos^{-1} \color{blue}{\left(1 - x\right)} \]
    2. lift-acos.f64N/A

      \[\leadsto \color{blue}{\cos^{-1} \left(1 - x\right)} \]
    3. acos-asinN/A

      \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{2} - \sin^{-1} \left(1 - x\right)} \]
    4. flip3--N/A

      \[\leadsto \color{blue}{\frac{{\left(\frac{\mathsf{PI}\left(\right)}{2}\right)}^{3} - {\sin^{-1} \left(1 - x\right)}^{3}}{\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{\mathsf{PI}\left(\right)}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)}} \]
    5. lower-/.f64N/A

      \[\leadsto \color{blue}{\frac{{\left(\frac{\mathsf{PI}\left(\right)}{2}\right)}^{3} - {\sin^{-1} \left(1 - x\right)}^{3}}{\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{\mathsf{PI}\left(\right)}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)}} \]
    6. lower--.f64N/A

      \[\leadsto \frac{\color{blue}{{\left(\frac{\mathsf{PI}\left(\right)}{2}\right)}^{3} - {\sin^{-1} \left(1 - x\right)}^{3}}}{\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{\mathsf{PI}\left(\right)}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)} \]
    7. lower-pow.f64N/A

      \[\leadsto \frac{\color{blue}{{\left(\frac{\mathsf{PI}\left(\right)}{2}\right)}^{3}} - {\sin^{-1} \left(1 - x\right)}^{3}}{\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{\mathsf{PI}\left(\right)}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)} \]
    8. lower-/.f64N/A

      \[\leadsto \frac{{\color{blue}{\left(\frac{\mathsf{PI}\left(\right)}{2}\right)}}^{3} - {\sin^{-1} \left(1 - x\right)}^{3}}{\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{\mathsf{PI}\left(\right)}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)} \]
    9. lower-PI.f64N/A

      \[\leadsto \frac{{\left(\frac{\color{blue}{\pi}}{2}\right)}^{3} - {\sin^{-1} \left(1 - x\right)}^{3}}{\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{\mathsf{PI}\left(\right)}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)} \]
    10. lower-pow.f64N/A

      \[\leadsto \frac{{\left(\frac{\pi}{2}\right)}^{3} - \color{blue}{{\sin^{-1} \left(1 - x\right)}^{3}}}{\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{\mathsf{PI}\left(\right)}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)} \]
    11. lower-asin.f64N/A

      \[\leadsto \frac{{\left(\frac{\pi}{2}\right)}^{3} - {\color{blue}{\sin^{-1} \left(1 - x\right)}}^{3}}{\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{\mathsf{PI}\left(\right)}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)} \]
    12. lift--.f64N/A

      \[\leadsto \frac{{\left(\frac{\pi}{2}\right)}^{3} - {\sin^{-1} \color{blue}{\left(1 - x\right)}}^{3}}{\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{\mathsf{PI}\left(\right)}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)} \]
    13. lower-fma.f64N/A

      \[\leadsto \frac{{\left(\frac{\pi}{2}\right)}^{3} - {\sin^{-1} \left(1 - x\right)}^{3}}{\color{blue}{\mathsf{fma}\left(\frac{\mathsf{PI}\left(\right)}{2}, \frac{\mathsf{PI}\left(\right)}{2}, \sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)}} \]
  3. Applied rewrites7.0%

    \[\leadsto \color{blue}{\frac{{\left(\frac{\pi}{2}\right)}^{3} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)}} \]
  4. Step-by-step derivation
    1. lift-pow.f64N/A

      \[\leadsto \frac{\color{blue}{{\left(\frac{\pi}{2}\right)}^{3}} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    2. lift-PI.f64N/A

      \[\leadsto \frac{{\left(\frac{\color{blue}{\mathsf{PI}\left(\right)}}{2}\right)}^{3} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    3. lift-/.f64N/A

      \[\leadsto \frac{{\color{blue}{\left(\frac{\mathsf{PI}\left(\right)}{2}\right)}}^{3} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    4. cube-divN/A

      \[\leadsto \frac{\color{blue}{\frac{{\mathsf{PI}\left(\right)}^{3}}{{2}^{3}}} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    5. sqr-powN/A

      \[\leadsto \frac{\frac{\color{blue}{{\mathsf{PI}\left(\right)}^{\left(\frac{3}{2}\right)} \cdot {\mathsf{PI}\left(\right)}^{\left(\frac{3}{2}\right)}}}{{2}^{3}} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    6. associate-/l*N/A

      \[\leadsto \frac{\color{blue}{{\mathsf{PI}\left(\right)}^{\left(\frac{3}{2}\right)} \cdot \frac{{\mathsf{PI}\left(\right)}^{\left(\frac{3}{2}\right)}}{{2}^{3}}} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    7. lower-*.f64N/A

      \[\leadsto \frac{\color{blue}{{\mathsf{PI}\left(\right)}^{\left(\frac{3}{2}\right)} \cdot \frac{{\mathsf{PI}\left(\right)}^{\left(\frac{3}{2}\right)}}{{2}^{3}}} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    8. lower-pow.f64N/A

      \[\leadsto \frac{\color{blue}{{\mathsf{PI}\left(\right)}^{\left(\frac{3}{2}\right)}} \cdot \frac{{\mathsf{PI}\left(\right)}^{\left(\frac{3}{2}\right)}}{{2}^{3}} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    9. lift-PI.f64N/A

      \[\leadsto \frac{{\color{blue}{\pi}}^{\left(\frac{3}{2}\right)} \cdot \frac{{\mathsf{PI}\left(\right)}^{\left(\frac{3}{2}\right)}}{{2}^{3}} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    10. metadata-evalN/A

      \[\leadsto \frac{{\pi}^{\color{blue}{\frac{3}{2}}} \cdot \frac{{\mathsf{PI}\left(\right)}^{\left(\frac{3}{2}\right)}}{{2}^{3}} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    11. lower-/.f64N/A

      \[\leadsto \frac{{\pi}^{\frac{3}{2}} \cdot \color{blue}{\frac{{\mathsf{PI}\left(\right)}^{\left(\frac{3}{2}\right)}}{{2}^{3}}} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    12. lower-pow.f64N/A

      \[\leadsto \frac{{\pi}^{\frac{3}{2}} \cdot \frac{\color{blue}{{\mathsf{PI}\left(\right)}^{\left(\frac{3}{2}\right)}}}{{2}^{3}} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    13. lift-PI.f64N/A

      \[\leadsto \frac{{\pi}^{\frac{3}{2}} \cdot \frac{{\color{blue}{\pi}}^{\left(\frac{3}{2}\right)}}{{2}^{3}} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    14. metadata-evalN/A

      \[\leadsto \frac{{\pi}^{\frac{3}{2}} \cdot \frac{{\pi}^{\color{blue}{\frac{3}{2}}}}{{2}^{3}} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    15. metadata-eval10.5

      \[\leadsto \frac{{\pi}^{1.5} \cdot \frac{{\pi}^{1.5}}{\color{blue}{8}} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
  5. Applied rewrites10.5%

    \[\leadsto \frac{\color{blue}{{\pi}^{1.5} \cdot \frac{{\pi}^{1.5}}{8}} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
  6. Applied rewrites10.5%

    \[\leadsto \color{blue}{\frac{\frac{{\left({\pi}^{1.5}\right)}^{2}}{8} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right) + \frac{\pi}{2}, \frac{\pi \cdot \pi}{4}\right)}} \]
  7. Add Preprocessing

Alternative 5: 10.5% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin^{-1} \left(1 - x\right)\\ \frac{\mathsf{fma}\left(\pi \cdot \pi, \frac{\pi}{8}, \sin^{-1} \left(-1 + x\right) \cdot \left(t\_0 \cdot t\_0\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(t\_0, t\_0, \frac{\pi}{2} \cdot t\_0\right)\right)} \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (let* ((t_0 (asin (- 1.0 x))))
   (/
    (fma (* PI PI) (/ PI 8.0) (* (asin (+ -1.0 x)) (* t_0 t_0)))
    (fma (/ PI 2.0) (/ PI 2.0) (fma t_0 t_0 (* (/ PI 2.0) t_0))))))
double code(double x) {
	double t_0 = asin((1.0 - x));
	return fma((((double) M_PI) * ((double) M_PI)), (((double) M_PI) / 8.0), (asin((-1.0 + x)) * (t_0 * t_0))) / fma((((double) M_PI) / 2.0), (((double) M_PI) / 2.0), fma(t_0, t_0, ((((double) M_PI) / 2.0) * t_0)));
}
function code(x)
	t_0 = asin(Float64(1.0 - x))
	return Float64(fma(Float64(pi * pi), Float64(pi / 8.0), Float64(asin(Float64(-1.0 + x)) * Float64(t_0 * t_0))) / fma(Float64(pi / 2.0), Float64(pi / 2.0), fma(t_0, t_0, Float64(Float64(pi / 2.0) * t_0))))
end
code[x_] := Block[{t$95$0 = N[ArcSin[N[(1.0 - x), $MachinePrecision]], $MachinePrecision]}, N[(N[(N[(Pi * Pi), $MachinePrecision] * N[(Pi / 8.0), $MachinePrecision] + N[(N[ArcSin[N[(-1.0 + x), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(Pi / 2.0), $MachinePrecision] * N[(Pi / 2.0), $MachinePrecision] + N[(t$95$0 * t$95$0 + N[(N[(Pi / 2.0), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin^{-1} \left(1 - x\right)\\
\frac{\mathsf{fma}\left(\pi \cdot \pi, \frac{\pi}{8}, \sin^{-1} \left(-1 + x\right) \cdot \left(t\_0 \cdot t\_0\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(t\_0, t\_0, \frac{\pi}{2} \cdot t\_0\right)\right)}
\end{array}
\end{array}
Derivation
  1. Initial program 7.0%

    \[\cos^{-1} \left(1 - x\right) \]
  2. Step-by-step derivation
    1. lift--.f64N/A

      \[\leadsto \cos^{-1} \color{blue}{\left(1 - x\right)} \]
    2. lift-acos.f64N/A

      \[\leadsto \color{blue}{\cos^{-1} \left(1 - x\right)} \]
    3. acos-asinN/A

      \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{2} - \sin^{-1} \left(1 - x\right)} \]
    4. flip3--N/A

      \[\leadsto \color{blue}{\frac{{\left(\frac{\mathsf{PI}\left(\right)}{2}\right)}^{3} - {\sin^{-1} \left(1 - x\right)}^{3}}{\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{\mathsf{PI}\left(\right)}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)}} \]
    5. lower-/.f64N/A

      \[\leadsto \color{blue}{\frac{{\left(\frac{\mathsf{PI}\left(\right)}{2}\right)}^{3} - {\sin^{-1} \left(1 - x\right)}^{3}}{\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{\mathsf{PI}\left(\right)}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)}} \]
    6. lower--.f64N/A

      \[\leadsto \frac{\color{blue}{{\left(\frac{\mathsf{PI}\left(\right)}{2}\right)}^{3} - {\sin^{-1} \left(1 - x\right)}^{3}}}{\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{\mathsf{PI}\left(\right)}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)} \]
    7. lower-pow.f64N/A

      \[\leadsto \frac{\color{blue}{{\left(\frac{\mathsf{PI}\left(\right)}{2}\right)}^{3}} - {\sin^{-1} \left(1 - x\right)}^{3}}{\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{\mathsf{PI}\left(\right)}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)} \]
    8. lower-/.f64N/A

      \[\leadsto \frac{{\color{blue}{\left(\frac{\mathsf{PI}\left(\right)}{2}\right)}}^{3} - {\sin^{-1} \left(1 - x\right)}^{3}}{\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{\mathsf{PI}\left(\right)}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)} \]
    9. lower-PI.f64N/A

      \[\leadsto \frac{{\left(\frac{\color{blue}{\pi}}{2}\right)}^{3} - {\sin^{-1} \left(1 - x\right)}^{3}}{\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{\mathsf{PI}\left(\right)}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)} \]
    10. lower-pow.f64N/A

      \[\leadsto \frac{{\left(\frac{\pi}{2}\right)}^{3} - \color{blue}{{\sin^{-1} \left(1 - x\right)}^{3}}}{\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{\mathsf{PI}\left(\right)}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)} \]
    11. lower-asin.f64N/A

      \[\leadsto \frac{{\left(\frac{\pi}{2}\right)}^{3} - {\color{blue}{\sin^{-1} \left(1 - x\right)}}^{3}}{\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{\mathsf{PI}\left(\right)}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)} \]
    12. lift--.f64N/A

      \[\leadsto \frac{{\left(\frac{\pi}{2}\right)}^{3} - {\sin^{-1} \color{blue}{\left(1 - x\right)}}^{3}}{\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{\mathsf{PI}\left(\right)}{2} + \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)} \]
    13. lower-fma.f64N/A

      \[\leadsto \frac{{\left(\frac{\pi}{2}\right)}^{3} - {\sin^{-1} \left(1 - x\right)}^{3}}{\color{blue}{\mathsf{fma}\left(\frac{\mathsf{PI}\left(\right)}{2}, \frac{\mathsf{PI}\left(\right)}{2}, \sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right) + \frac{\mathsf{PI}\left(\right)}{2} \cdot \sin^{-1} \left(1 - x\right)\right)}} \]
  3. Applied rewrites7.0%

    \[\leadsto \color{blue}{\frac{{\left(\frac{\pi}{2}\right)}^{3} - {\sin^{-1} \left(1 - x\right)}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)}} \]
  4. Step-by-step derivation
    1. lift--.f64N/A

      \[\leadsto \frac{\color{blue}{{\left(\frac{\pi}{2}\right)}^{3} - {\sin^{-1} \left(1 - x\right)}^{3}}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    2. lift-pow.f64N/A

      \[\leadsto \frac{{\left(\frac{\pi}{2}\right)}^{3} - \color{blue}{{\sin^{-1} \left(1 - x\right)}^{3}}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    3. lift--.f64N/A

      \[\leadsto \frac{{\left(\frac{\pi}{2}\right)}^{3} - {\sin^{-1} \color{blue}{\left(1 - x\right)}}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    4. lift-asin.f64N/A

      \[\leadsto \frac{{\left(\frac{\pi}{2}\right)}^{3} - {\color{blue}{\sin^{-1} \left(1 - x\right)}}^{3}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    5. cube-multN/A

      \[\leadsto \frac{{\left(\frac{\pi}{2}\right)}^{3} - \color{blue}{\sin^{-1} \left(1 - x\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    6. fp-cancel-sub-sign-invN/A

      \[\leadsto \frac{\color{blue}{{\left(\frac{\pi}{2}\right)}^{3} + \left(\mathsf{neg}\left(\sin^{-1} \left(1 - x\right)\right)\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    7. lift-pow.f64N/A

      \[\leadsto \frac{\color{blue}{{\left(\frac{\pi}{2}\right)}^{3}} + \left(\mathsf{neg}\left(\sin^{-1} \left(1 - x\right)\right)\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    8. lift-PI.f64N/A

      \[\leadsto \frac{{\left(\frac{\color{blue}{\mathsf{PI}\left(\right)}}{2}\right)}^{3} + \left(\mathsf{neg}\left(\sin^{-1} \left(1 - x\right)\right)\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    9. lift-/.f64N/A

      \[\leadsto \frac{{\color{blue}{\left(\frac{\mathsf{PI}\left(\right)}{2}\right)}}^{3} + \left(\mathsf{neg}\left(\sin^{-1} \left(1 - x\right)\right)\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    10. cube-divN/A

      \[\leadsto \frac{\color{blue}{\frac{{\mathsf{PI}\left(\right)}^{3}}{{2}^{3}}} + \left(\mathsf{neg}\left(\sin^{-1} \left(1 - x\right)\right)\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    11. unpow3N/A

      \[\leadsto \frac{\frac{\color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)}}{{2}^{3}} + \left(\mathsf{neg}\left(\sin^{-1} \left(1 - x\right)\right)\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    12. unpow2N/A

      \[\leadsto \frac{\frac{\color{blue}{{\mathsf{PI}\left(\right)}^{2}} \cdot \mathsf{PI}\left(\right)}{{2}^{3}} + \left(\mathsf{neg}\left(\sin^{-1} \left(1 - x\right)\right)\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    13. associate-/l*N/A

      \[\leadsto \frac{\color{blue}{{\mathsf{PI}\left(\right)}^{2} \cdot \frac{\mathsf{PI}\left(\right)}{{2}^{3}}} + \left(\mathsf{neg}\left(\sin^{-1} \left(1 - x\right)\right)\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
    14. lower-fma.f64N/A

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left({\mathsf{PI}\left(\right)}^{2}, \frac{\mathsf{PI}\left(\right)}{{2}^{3}}, \left(\mathsf{neg}\left(\sin^{-1} \left(1 - x\right)\right)\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
  5. Applied rewrites10.5%

    \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\pi \cdot \pi, \frac{\pi}{8}, \sin^{-1} \left(-1 + x\right) \cdot \left(\sin^{-1} \left(1 - x\right) \cdot \sin^{-1} \left(1 - x\right)\right)\right)}}{\mathsf{fma}\left(\frac{\pi}{2}, \frac{\pi}{2}, \mathsf{fma}\left(\sin^{-1} \left(1 - x\right), \sin^{-1} \left(1 - x\right), \frac{\pi}{2} \cdot \sin^{-1} \left(1 - x\right)\right)\right)} \]
  6. Add Preprocessing

Alternative 6: 10.5% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{\sin^{-1} \left(1 - x\right)}\\ \mathsf{fma}\left(\frac{\sqrt{\pi}}{2}, \sqrt{\pi}, \left(-t\_0\right) \cdot t\_0\right) \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (let* ((t_0 (sqrt (asin (- 1.0 x)))))
   (fma (/ (sqrt PI) 2.0) (sqrt PI) (* (- t_0) t_0))))
double code(double x) {
	double t_0 = sqrt(asin((1.0 - x)));
	return fma((sqrt(((double) M_PI)) / 2.0), sqrt(((double) M_PI)), (-t_0 * t_0));
}
function code(x)
	t_0 = sqrt(asin(Float64(1.0 - x)))
	return fma(Float64(sqrt(pi) / 2.0), sqrt(pi), Float64(Float64(-t_0) * t_0))
end
code[x_] := Block[{t$95$0 = N[Sqrt[N[ArcSin[N[(1.0 - x), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, N[(N[(N[Sqrt[Pi], $MachinePrecision] / 2.0), $MachinePrecision] * N[Sqrt[Pi], $MachinePrecision] + N[((-t$95$0) * t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt{\sin^{-1} \left(1 - x\right)}\\
\mathsf{fma}\left(\frac{\sqrt{\pi}}{2}, \sqrt{\pi}, \left(-t\_0\right) \cdot t\_0\right)
\end{array}
\end{array}
Derivation
  1. Initial program 7.0%

    \[\cos^{-1} \left(1 - x\right) \]
  2. Step-by-step derivation
    1. lift--.f64N/A

      \[\leadsto \cos^{-1} \color{blue}{\left(1 - x\right)} \]
    2. lift-acos.f64N/A

      \[\leadsto \color{blue}{\cos^{-1} \left(1 - x\right)} \]
    3. acos-asinN/A

      \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{2} - \sin^{-1} \left(1 - x\right)} \]
    4. lower--.f64N/A

      \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{2} - \sin^{-1} \left(1 - x\right)} \]
    5. lower-/.f64N/A

      \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{2}} - \sin^{-1} \left(1 - x\right) \]
    6. lower-PI.f64N/A

      \[\leadsto \frac{\color{blue}{\pi}}{2} - \sin^{-1} \left(1 - x\right) \]
    7. lower-asin.f64N/A

      \[\leadsto \frac{\pi}{2} - \color{blue}{\sin^{-1} \left(1 - x\right)} \]
    8. lift--.f647.0

      \[\leadsto \frac{\pi}{2} - \sin^{-1} \color{blue}{\left(1 - x\right)} \]
  3. Applied rewrites7.0%

    \[\leadsto \color{blue}{\frac{\pi}{2} - \sin^{-1} \left(1 - x\right)} \]
  4. Step-by-step derivation
    1. lift--.f64N/A

      \[\leadsto \frac{\pi}{2} - \sin^{-1} \color{blue}{\left(1 - x\right)} \]
    2. lift-asin.f64N/A

      \[\leadsto \frac{\pi}{2} - \color{blue}{\sin^{-1} \left(1 - x\right)} \]
    3. unpow1N/A

      \[\leadsto \frac{\pi}{2} - \color{blue}{{\sin^{-1} \left(1 - x\right)}^{1}} \]
    4. sqr-powN/A

      \[\leadsto \frac{\pi}{2} - \color{blue}{{\sin^{-1} \left(1 - x\right)}^{\left(\frac{1}{2}\right)} \cdot {\sin^{-1} \left(1 - x\right)}^{\left(\frac{1}{2}\right)}} \]
    5. lower-*.f64N/A

      \[\leadsto \frac{\pi}{2} - \color{blue}{{\sin^{-1} \left(1 - x\right)}^{\left(\frac{1}{2}\right)} \cdot {\sin^{-1} \left(1 - x\right)}^{\left(\frac{1}{2}\right)}} \]
    6. metadata-evalN/A

      \[\leadsto \frac{\pi}{2} - {\sin^{-1} \left(1 - x\right)}^{\color{blue}{\frac{1}{2}}} \cdot {\sin^{-1} \left(1 - x\right)}^{\left(\frac{1}{2}\right)} \]
    7. lower-pow.f64N/A

      \[\leadsto \frac{\pi}{2} - \color{blue}{{\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}}} \cdot {\sin^{-1} \left(1 - x\right)}^{\left(\frac{1}{2}\right)} \]
    8. lift-asin.f64N/A

      \[\leadsto \frac{\pi}{2} - {\color{blue}{\sin^{-1} \left(1 - x\right)}}^{\frac{1}{2}} \cdot {\sin^{-1} \left(1 - x\right)}^{\left(\frac{1}{2}\right)} \]
    9. lift--.f64N/A

      \[\leadsto \frac{\pi}{2} - {\sin^{-1} \color{blue}{\left(1 - x\right)}}^{\frac{1}{2}} \cdot {\sin^{-1} \left(1 - x\right)}^{\left(\frac{1}{2}\right)} \]
    10. metadata-evalN/A

      \[\leadsto \frac{\pi}{2} - {\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}} \cdot {\sin^{-1} \left(1 - x\right)}^{\color{blue}{\frac{1}{2}}} \]
    11. lower-pow.f64N/A

      \[\leadsto \frac{\pi}{2} - {\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}} \cdot \color{blue}{{\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}}} \]
    12. lift-asin.f64N/A

      \[\leadsto \frac{\pi}{2} - {\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}} \cdot {\color{blue}{\sin^{-1} \left(1 - x\right)}}^{\frac{1}{2}} \]
    13. lift--.f6410.5

      \[\leadsto \frac{\pi}{2} - {\sin^{-1} \left(1 - x\right)}^{0.5} \cdot {\sin^{-1} \color{blue}{\left(1 - x\right)}}^{0.5} \]
  5. Applied rewrites10.5%

    \[\leadsto \frac{\pi}{2} - \color{blue}{{\sin^{-1} \left(1 - x\right)}^{0.5} \cdot {\sin^{-1} \left(1 - x\right)}^{0.5}} \]
  6. Step-by-step derivation
    1. lift--.f64N/A

      \[\leadsto \color{blue}{\frac{\pi}{2} - {\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}} \cdot {\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}}} \]
    2. lift-*.f64N/A

      \[\leadsto \frac{\pi}{2} - \color{blue}{{\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}} \cdot {\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}}} \]
    3. fp-cancel-sub-sign-invN/A

      \[\leadsto \color{blue}{\frac{\pi}{2} + \left(\mathsf{neg}\left({\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}}\right)\right) \cdot {\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}}} \]
    4. lift-PI.f64N/A

      \[\leadsto \frac{\color{blue}{\mathsf{PI}\left(\right)}}{2} + \left(\mathsf{neg}\left({\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}}\right)\right) \cdot {\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}} \]
    5. lift-/.f64N/A

      \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{2}} + \left(\mathsf{neg}\left({\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}}\right)\right) \cdot {\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}} \]
    6. add-sqr-sqrtN/A

      \[\leadsto \frac{\color{blue}{\sqrt{\mathsf{PI}\left(\right)} \cdot \sqrt{\mathsf{PI}\left(\right)}}}{2} + \left(\mathsf{neg}\left({\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}}\right)\right) \cdot {\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}} \]
    7. associate-*r/N/A

      \[\leadsto \color{blue}{\sqrt{\mathsf{PI}\left(\right)} \cdot \frac{\sqrt{\mathsf{PI}\left(\right)}}{2}} + \left(\mathsf{neg}\left({\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}}\right)\right) \cdot {\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}} \]
    8. lift-sqrt.f64N/A

      \[\leadsto \sqrt{\mathsf{PI}\left(\right)} \cdot \frac{\color{blue}{\sqrt{\mathsf{PI}\left(\right)}}}{2} + \left(\mathsf{neg}\left({\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}}\right)\right) \cdot {\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}} \]
    9. lift-PI.f64N/A

      \[\leadsto \sqrt{\mathsf{PI}\left(\right)} \cdot \frac{\sqrt{\color{blue}{\pi}}}{2} + \left(\mathsf{neg}\left({\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}}\right)\right) \cdot {\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}} \]
    10. lift-/.f64N/A

      \[\leadsto \sqrt{\mathsf{PI}\left(\right)} \cdot \color{blue}{\frac{\sqrt{\pi}}{2}} + \left(\mathsf{neg}\left({\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}}\right)\right) \cdot {\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}} \]
    11. *-commutativeN/A

      \[\leadsto \color{blue}{\frac{\sqrt{\pi}}{2} \cdot \sqrt{\mathsf{PI}\left(\right)}} + \left(\mathsf{neg}\left({\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}}\right)\right) \cdot {\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}} \]
    12. lower-fma.f64N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\sqrt{\pi}}{2}, \sqrt{\mathsf{PI}\left(\right)}, \left(\mathsf{neg}\left({\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}}\right)\right) \cdot {\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}}\right)} \]
    13. lift-sqrt.f64N/A

      \[\leadsto \mathsf{fma}\left(\frac{\sqrt{\pi}}{2}, \color{blue}{\sqrt{\mathsf{PI}\left(\right)}}, \left(\mathsf{neg}\left({\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}}\right)\right) \cdot {\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}}\right) \]
    14. lift-PI.f64N/A

      \[\leadsto \mathsf{fma}\left(\frac{\sqrt{\pi}}{2}, \sqrt{\color{blue}{\pi}}, \left(\mathsf{neg}\left({\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}}\right)\right) \cdot {\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}}\right) \]
    15. lower-*.f64N/A

      \[\leadsto \mathsf{fma}\left(\frac{\sqrt{\pi}}{2}, \sqrt{\pi}, \color{blue}{\left(\mathsf{neg}\left({\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}}\right)\right) \cdot {\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}}}\right) \]
  7. Applied rewrites10.5%

    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\sqrt{\pi}}{2}, \sqrt{\pi}, \left(-\sqrt{\sin^{-1} \left(1 - x\right)}\right) \cdot \sqrt{\sin^{-1} \left(1 - x\right)}\right)} \]
  8. Add Preprocessing

Alternative 7: 10.5% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{\sin^{-1} \left(1 - x\right)}\\ 0.5 \cdot \pi - t\_0 \cdot t\_0 \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (let* ((t_0 (sqrt (asin (- 1.0 x))))) (- (* 0.5 PI) (* t_0 t_0))))
double code(double x) {
	double t_0 = sqrt(asin((1.0 - x)));
	return (0.5 * ((double) M_PI)) - (t_0 * t_0);
}
public static double code(double x) {
	double t_0 = Math.sqrt(Math.asin((1.0 - x)));
	return (0.5 * Math.PI) - (t_0 * t_0);
}
def code(x):
	t_0 = math.sqrt(math.asin((1.0 - x)))
	return (0.5 * math.pi) - (t_0 * t_0)
function code(x)
	t_0 = sqrt(asin(Float64(1.0 - x)))
	return Float64(Float64(0.5 * pi) - Float64(t_0 * t_0))
end
function tmp = code(x)
	t_0 = sqrt(asin((1.0 - x)));
	tmp = (0.5 * pi) - (t_0 * t_0);
end
code[x_] := Block[{t$95$0 = N[Sqrt[N[ArcSin[N[(1.0 - x), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, N[(N[(0.5 * Pi), $MachinePrecision] - N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt{\sin^{-1} \left(1 - x\right)}\\
0.5 \cdot \pi - t\_0 \cdot t\_0
\end{array}
\end{array}
Derivation
  1. Initial program 7.0%

    \[\cos^{-1} \left(1 - x\right) \]
  2. Step-by-step derivation
    1. lift--.f64N/A

      \[\leadsto \cos^{-1} \color{blue}{\left(1 - x\right)} \]
    2. lift-acos.f64N/A

      \[\leadsto \color{blue}{\cos^{-1} \left(1 - x\right)} \]
    3. acos-asinN/A

      \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{2} - \sin^{-1} \left(1 - x\right)} \]
    4. lower--.f64N/A

      \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{2} - \sin^{-1} \left(1 - x\right)} \]
    5. lower-/.f64N/A

      \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{2}} - \sin^{-1} \left(1 - x\right) \]
    6. lower-PI.f64N/A

      \[\leadsto \frac{\color{blue}{\pi}}{2} - \sin^{-1} \left(1 - x\right) \]
    7. lower-asin.f64N/A

      \[\leadsto \frac{\pi}{2} - \color{blue}{\sin^{-1} \left(1 - x\right)} \]
    8. lift--.f647.0

      \[\leadsto \frac{\pi}{2} - \sin^{-1} \color{blue}{\left(1 - x\right)} \]
  3. Applied rewrites7.0%

    \[\leadsto \color{blue}{\frac{\pi}{2} - \sin^{-1} \left(1 - x\right)} \]
  4. Step-by-step derivation
    1. lift--.f64N/A

      \[\leadsto \frac{\pi}{2} - \sin^{-1} \color{blue}{\left(1 - x\right)} \]
    2. lift-asin.f64N/A

      \[\leadsto \frac{\pi}{2} - \color{blue}{\sin^{-1} \left(1 - x\right)} \]
    3. unpow1N/A

      \[\leadsto \frac{\pi}{2} - \color{blue}{{\sin^{-1} \left(1 - x\right)}^{1}} \]
    4. sqr-powN/A

      \[\leadsto \frac{\pi}{2} - \color{blue}{{\sin^{-1} \left(1 - x\right)}^{\left(\frac{1}{2}\right)} \cdot {\sin^{-1} \left(1 - x\right)}^{\left(\frac{1}{2}\right)}} \]
    5. lower-*.f64N/A

      \[\leadsto \frac{\pi}{2} - \color{blue}{{\sin^{-1} \left(1 - x\right)}^{\left(\frac{1}{2}\right)} \cdot {\sin^{-1} \left(1 - x\right)}^{\left(\frac{1}{2}\right)}} \]
    6. metadata-evalN/A

      \[\leadsto \frac{\pi}{2} - {\sin^{-1} \left(1 - x\right)}^{\color{blue}{\frac{1}{2}}} \cdot {\sin^{-1} \left(1 - x\right)}^{\left(\frac{1}{2}\right)} \]
    7. lower-pow.f64N/A

      \[\leadsto \frac{\pi}{2} - \color{blue}{{\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}}} \cdot {\sin^{-1} \left(1 - x\right)}^{\left(\frac{1}{2}\right)} \]
    8. lift-asin.f64N/A

      \[\leadsto \frac{\pi}{2} - {\color{blue}{\sin^{-1} \left(1 - x\right)}}^{\frac{1}{2}} \cdot {\sin^{-1} \left(1 - x\right)}^{\left(\frac{1}{2}\right)} \]
    9. lift--.f64N/A

      \[\leadsto \frac{\pi}{2} - {\sin^{-1} \color{blue}{\left(1 - x\right)}}^{\frac{1}{2}} \cdot {\sin^{-1} \left(1 - x\right)}^{\left(\frac{1}{2}\right)} \]
    10. metadata-evalN/A

      \[\leadsto \frac{\pi}{2} - {\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}} \cdot {\sin^{-1} \left(1 - x\right)}^{\color{blue}{\frac{1}{2}}} \]
    11. lower-pow.f64N/A

      \[\leadsto \frac{\pi}{2} - {\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}} \cdot \color{blue}{{\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}}} \]
    12. lift-asin.f64N/A

      \[\leadsto \frac{\pi}{2} - {\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}} \cdot {\color{blue}{\sin^{-1} \left(1 - x\right)}}^{\frac{1}{2}} \]
    13. lift--.f6410.5

      \[\leadsto \frac{\pi}{2} - {\sin^{-1} \left(1 - x\right)}^{0.5} \cdot {\sin^{-1} \color{blue}{\left(1 - x\right)}}^{0.5} \]
  5. Applied rewrites10.5%

    \[\leadsto \frac{\pi}{2} - \color{blue}{{\sin^{-1} \left(1 - x\right)}^{0.5} \cdot {\sin^{-1} \left(1 - x\right)}^{0.5}} \]
  6. Taylor expanded in x around 0

    \[\leadsto \color{blue}{\frac{1}{2} \cdot \mathsf{PI}\left(\right) - {\left(\sqrt{\sin^{-1} \left(1 - x\right)}\right)}^{2}} \]
  7. Step-by-step derivation
    1. lift-asin.f64N/A

      \[\leadsto \frac{1}{2} \cdot \mathsf{PI}\left(\right) - {\left(\sqrt{\sin^{-1} \left(1 - x\right)}\right)}^{2} \]
    2. lift--.f64N/A

      \[\leadsto \frac{1}{2} \cdot \mathsf{PI}\left(\right) - {\left(\sqrt{\sin^{-1} \left(1 - x\right)}\right)}^{2} \]
    3. sqrt-pow2N/A

      \[\leadsto \frac{1}{2} \cdot \mathsf{PI}\left(\right) - {\sin^{-1} \left(1 - x\right)}^{\color{blue}{\left(\frac{2}{2}\right)}} \]
    4. metadata-evalN/A

      \[\leadsto \frac{1}{2} \cdot \mathsf{PI}\left(\right) - {\sin^{-1} \left(1 - x\right)}^{1} \]
    5. metadata-evalN/A

      \[\leadsto \frac{1}{2} \cdot \mathsf{PI}\left(\right) - {\sin^{-1} \left(1 - x\right)}^{\left(2 \cdot \color{blue}{\frac{1}{2}}\right)} \]
    6. pow-sqrN/A

      \[\leadsto \frac{1}{2} \cdot \mathsf{PI}\left(\right) - {\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}} \cdot \color{blue}{{\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}}} \]
    7. lift--.f64N/A

      \[\leadsto \frac{1}{2} \cdot \mathsf{PI}\left(\right) - {\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}} \cdot {\sin^{-1} \left(\color{blue}{1} - x\right)}^{\frac{1}{2}} \]
    8. lift-asin.f64N/A

      \[\leadsto \frac{1}{2} \cdot \mathsf{PI}\left(\right) - {\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}} \cdot {\sin^{-1} \color{blue}{\left(1 - x\right)}}^{\frac{1}{2}} \]
    9. lift--.f64N/A

      \[\leadsto \frac{1}{2} \cdot \mathsf{PI}\left(\right) - {\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}} \cdot {\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}} \]
    10. lift-asin.f64N/A

      \[\leadsto \frac{1}{2} \cdot \mathsf{PI}\left(\right) - {\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}} \cdot {\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}} \]
    11. lower--.f64N/A

      \[\leadsto \frac{1}{2} \cdot \mathsf{PI}\left(\right) - \color{blue}{{\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}} \cdot {\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}}} \]
    12. lift-*.f64N/A

      \[\leadsto \frac{1}{2} \cdot \mathsf{PI}\left(\right) - \color{blue}{{\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}}} \cdot {\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}} \]
    13. lift-PI.f64N/A

      \[\leadsto \frac{1}{2} \cdot \pi - {\sin^{-1} \left(1 - x\right)}^{\color{blue}{\frac{1}{2}}} \cdot {\sin^{-1} \left(1 - x\right)}^{\frac{1}{2}} \]
  8. Applied rewrites10.5%

    \[\leadsto \color{blue}{0.5 \cdot \pi - \sqrt{\sin^{-1} \left(1 - x\right)} \cdot \sqrt{\sin^{-1} \left(1 - x\right)}} \]
  9. Add Preprocessing

Alternative 8: 9.6% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 5.2 \cdot 10^{-19}:\\ \;\;\;\;\cos^{-1} \left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;\cos^{-1} \left(\left(\frac{1}{x} - 1\right) \cdot x\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= x 5.2e-19) (acos (- x)) (acos (* (- (/ 1.0 x) 1.0) x))))
double code(double x) {
	double tmp;
	if (x <= 5.2e-19) {
		tmp = acos(-x);
	} else {
		tmp = acos((((1.0 / x) - 1.0) * x));
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8) :: tmp
    if (x <= 5.2d-19) then
        tmp = acos(-x)
    else
        tmp = acos((((1.0d0 / x) - 1.0d0) * x))
    end if
    code = tmp
end function
public static double code(double x) {
	double tmp;
	if (x <= 5.2e-19) {
		tmp = Math.acos(-x);
	} else {
		tmp = Math.acos((((1.0 / x) - 1.0) * x));
	}
	return tmp;
}
def code(x):
	tmp = 0
	if x <= 5.2e-19:
		tmp = math.acos(-x)
	else:
		tmp = math.acos((((1.0 / x) - 1.0) * x))
	return tmp
function code(x)
	tmp = 0.0
	if (x <= 5.2e-19)
		tmp = acos(Float64(-x));
	else
		tmp = acos(Float64(Float64(Float64(1.0 / x) - 1.0) * x));
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = 0.0;
	if (x <= 5.2e-19)
		tmp = acos(-x);
	else
		tmp = acos((((1.0 / x) - 1.0) * x));
	end
	tmp_2 = tmp;
end
code[x_] := If[LessEqual[x, 5.2e-19], N[ArcCos[(-x)], $MachinePrecision], N[ArcCos[N[(N[(N[(1.0 / x), $MachinePrecision] - 1.0), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 5.2 \cdot 10^{-19}:\\
\;\;\;\;\cos^{-1} \left(-x\right)\\

\mathbf{else}:\\
\;\;\;\;\cos^{-1} \left(\left(\frac{1}{x} - 1\right) \cdot x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 5.20000000000000026e-19

    1. Initial program 7.0%

      \[\cos^{-1} \left(1 - x\right) \]
    2. Taylor expanded in x around inf

      \[\leadsto \cos^{-1} \color{blue}{\left(-1 \cdot x\right)} \]
    3. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \cos^{-1} \left(\mathsf{neg}\left(x\right)\right) \]
      2. lower-neg.f646.9

        \[\leadsto \cos^{-1} \left(-x\right) \]
    4. Applied rewrites6.9%

      \[\leadsto \cos^{-1} \color{blue}{\left(-x\right)} \]

    if 5.20000000000000026e-19 < x

    1. Initial program 7.0%

      \[\cos^{-1} \left(1 - x\right) \]
    2. Taylor expanded in x around inf

      \[\leadsto \cos^{-1} \color{blue}{\left(x \cdot \left(\frac{1}{x} - 1\right)\right)} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \cos^{-1} \left(\left(\frac{1}{x} - 1\right) \cdot \color{blue}{x}\right) \]
      2. lower-*.f64N/A

        \[\leadsto \cos^{-1} \left(\left(\frac{1}{x} - 1\right) \cdot \color{blue}{x}\right) \]
      3. lower--.f64N/A

        \[\leadsto \cos^{-1} \left(\left(\frac{1}{x} - 1\right) \cdot x\right) \]
      4. lower-/.f647.4

        \[\leadsto \cos^{-1} \left(\left(\frac{1}{x} - 1\right) \cdot x\right) \]
    4. Applied rewrites7.4%

      \[\leadsto \cos^{-1} \color{blue}{\left(\left(\frac{1}{x} - 1\right) \cdot x\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 9: 9.6% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 5.5 \cdot 10^{-17}:\\ \;\;\;\;\cos^{-1} \left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \pi - \sin^{-1} \left(1 - x\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= x 5.5e-17) (acos (- x)) (- (* 0.5 PI) (asin (- 1.0 x)))))
double code(double x) {
	double tmp;
	if (x <= 5.5e-17) {
		tmp = acos(-x);
	} else {
		tmp = (0.5 * ((double) M_PI)) - asin((1.0 - x));
	}
	return tmp;
}
public static double code(double x) {
	double tmp;
	if (x <= 5.5e-17) {
		tmp = Math.acos(-x);
	} else {
		tmp = (0.5 * Math.PI) - Math.asin((1.0 - x));
	}
	return tmp;
}
def code(x):
	tmp = 0
	if x <= 5.5e-17:
		tmp = math.acos(-x)
	else:
		tmp = (0.5 * math.pi) - math.asin((1.0 - x))
	return tmp
function code(x)
	tmp = 0.0
	if (x <= 5.5e-17)
		tmp = acos(Float64(-x));
	else
		tmp = Float64(Float64(0.5 * pi) - asin(Float64(1.0 - x)));
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = 0.0;
	if (x <= 5.5e-17)
		tmp = acos(-x);
	else
		tmp = (0.5 * pi) - asin((1.0 - x));
	end
	tmp_2 = tmp;
end
code[x_] := If[LessEqual[x, 5.5e-17], N[ArcCos[(-x)], $MachinePrecision], N[(N[(0.5 * Pi), $MachinePrecision] - N[ArcSin[N[(1.0 - x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 5.5 \cdot 10^{-17}:\\
\;\;\;\;\cos^{-1} \left(-x\right)\\

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \pi - \sin^{-1} \left(1 - x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 5.50000000000000001e-17

    1. Initial program 7.0%

      \[\cos^{-1} \left(1 - x\right) \]
    2. Taylor expanded in x around inf

      \[\leadsto \cos^{-1} \color{blue}{\left(-1 \cdot x\right)} \]
    3. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \cos^{-1} \left(\mathsf{neg}\left(x\right)\right) \]
      2. lower-neg.f646.9

        \[\leadsto \cos^{-1} \left(-x\right) \]
    4. Applied rewrites6.9%

      \[\leadsto \cos^{-1} \color{blue}{\left(-x\right)} \]

    if 5.50000000000000001e-17 < x

    1. Initial program 7.0%

      \[\cos^{-1} \left(1 - x\right) \]
    2. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \cos^{-1} \color{blue}{\left(1 - x\right)} \]
      2. lift-acos.f64N/A

        \[\leadsto \color{blue}{\cos^{-1} \left(1 - x\right)} \]
      3. acos-asinN/A

        \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{2} - \sin^{-1} \left(1 - x\right)} \]
      4. lower--.f64N/A

        \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{2} - \sin^{-1} \left(1 - x\right)} \]
      5. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{2}} - \sin^{-1} \left(1 - x\right) \]
      6. lower-PI.f64N/A

        \[\leadsto \frac{\color{blue}{\pi}}{2} - \sin^{-1} \left(1 - x\right) \]
      7. lower-asin.f64N/A

        \[\leadsto \frac{\pi}{2} - \color{blue}{\sin^{-1} \left(1 - x\right)} \]
      8. lift--.f647.0

        \[\leadsto \frac{\pi}{2} - \sin^{-1} \color{blue}{\left(1 - x\right)} \]
    3. Applied rewrites7.0%

      \[\leadsto \color{blue}{\frac{\pi}{2} - \sin^{-1} \left(1 - x\right)} \]
    4. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \mathsf{PI}\left(\right) - \sin^{-1} \left(1 - x\right)} \]
    5. Step-by-step derivation
      1. lower--.f64N/A

        \[\leadsto \frac{1}{2} \cdot \mathsf{PI}\left(\right) - \color{blue}{\sin^{-1} \left(1 - x\right)} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{1}{2} \cdot \mathsf{PI}\left(\right) - \sin^{-1} \color{blue}{\left(1 - x\right)} \]
      3. lift-PI.f64N/A

        \[\leadsto \frac{1}{2} \cdot \pi - \sin^{-1} \left(1 - \color{blue}{x}\right) \]
      4. lift-asin.f64N/A

        \[\leadsto \frac{1}{2} \cdot \pi - \sin^{-1} \left(1 - x\right) \]
      5. lift--.f647.0

        \[\leadsto 0.5 \cdot \pi - \sin^{-1} \left(1 - x\right) \]
    6. Applied rewrites7.0%

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

Alternative 10: 9.5% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 5.5 \cdot 10^{-17}:\\ \;\;\;\;\cos^{-1} \left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;\cos^{-1} \left(1 - x\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= x 5.5e-17) (acos (- x)) (acos (- 1.0 x))))
double code(double x) {
	double tmp;
	if (x <= 5.5e-17) {
		tmp = acos(-x);
	} else {
		tmp = acos((1.0 - x));
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8) :: tmp
    if (x <= 5.5d-17) then
        tmp = acos(-x)
    else
        tmp = acos((1.0d0 - x))
    end if
    code = tmp
end function
public static double code(double x) {
	double tmp;
	if (x <= 5.5e-17) {
		tmp = Math.acos(-x);
	} else {
		tmp = Math.acos((1.0 - x));
	}
	return tmp;
}
def code(x):
	tmp = 0
	if x <= 5.5e-17:
		tmp = math.acos(-x)
	else:
		tmp = math.acos((1.0 - x))
	return tmp
function code(x)
	tmp = 0.0
	if (x <= 5.5e-17)
		tmp = acos(Float64(-x));
	else
		tmp = acos(Float64(1.0 - x));
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = 0.0;
	if (x <= 5.5e-17)
		tmp = acos(-x);
	else
		tmp = acos((1.0 - x));
	end
	tmp_2 = tmp;
end
code[x_] := If[LessEqual[x, 5.5e-17], N[ArcCos[(-x)], $MachinePrecision], N[ArcCos[N[(1.0 - x), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 5.5 \cdot 10^{-17}:\\
\;\;\;\;\cos^{-1} \left(-x\right)\\

\mathbf{else}:\\
\;\;\;\;\cos^{-1} \left(1 - x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 5.50000000000000001e-17

    1. Initial program 7.0%

      \[\cos^{-1} \left(1 - x\right) \]
    2. Taylor expanded in x around inf

      \[\leadsto \cos^{-1} \color{blue}{\left(-1 \cdot x\right)} \]
    3. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \cos^{-1} \left(\mathsf{neg}\left(x\right)\right) \]
      2. lower-neg.f646.9

        \[\leadsto \cos^{-1} \left(-x\right) \]
    4. Applied rewrites6.9%

      \[\leadsto \cos^{-1} \color{blue}{\left(-x\right)} \]

    if 5.50000000000000001e-17 < x

    1. Initial program 7.0%

      \[\cos^{-1} \left(1 - x\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 11: 6.9% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \cos^{-1} \left(-x\right) \end{array} \]
(FPCore (x) :precision binary64 (acos (- x)))
double code(double x) {
	return acos(-x);
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x)
use fmin_fmax_functions
    real(8), intent (in) :: x
    code = acos(-x)
end function
public static double code(double x) {
	return Math.acos(-x);
}
def code(x):
	return math.acos(-x)
function code(x)
	return acos(Float64(-x))
end
function tmp = code(x)
	tmp = acos(-x);
end
code[x_] := N[ArcCos[(-x)], $MachinePrecision]
\begin{array}{l}

\\
\cos^{-1} \left(-x\right)
\end{array}
Derivation
  1. Initial program 7.0%

    \[\cos^{-1} \left(1 - x\right) \]
  2. Taylor expanded in x around inf

    \[\leadsto \cos^{-1} \color{blue}{\left(-1 \cdot x\right)} \]
  3. Step-by-step derivation
    1. mul-1-negN/A

      \[\leadsto \cos^{-1} \left(\mathsf{neg}\left(x\right)\right) \]
    2. lower-neg.f646.9

      \[\leadsto \cos^{-1} \left(-x\right) \]
  4. Applied rewrites6.9%

    \[\leadsto \cos^{-1} \color{blue}{\left(-x\right)} \]
  5. Add Preprocessing

Alternative 12: 3.8% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \cos^{-1} 1 \end{array} \]
(FPCore (x) :precision binary64 (acos 1.0))
double code(double x) {
	return acos(1.0);
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x)
use fmin_fmax_functions
    real(8), intent (in) :: x
    code = acos(1.0d0)
end function
public static double code(double x) {
	return Math.acos(1.0);
}
def code(x):
	return math.acos(1.0)
function code(x)
	return acos(1.0)
end
function tmp = code(x)
	tmp = acos(1.0);
end
code[x_] := N[ArcCos[1.0], $MachinePrecision]
\begin{array}{l}

\\
\cos^{-1} 1
\end{array}
Derivation
  1. Initial program 7.0%

    \[\cos^{-1} \left(1 - x\right) \]
  2. Taylor expanded in x around 0

    \[\leadsto \cos^{-1} \color{blue}{1} \]
  3. Step-by-step derivation
    1. Applied rewrites3.8%

      \[\leadsto \cos^{-1} \color{blue}{1} \]
    2. Add Preprocessing

    Reproduce

    ?
    herbie shell --seed 2025142 
    (FPCore (x)
      :name "bug323 (missed optimization)"
      :precision binary64
      :pre (and (<= 0.0 x) (<= x 0.5))
      (acos (- 1.0 x)))