Falkner and Boettcher, Equation (22+)

Percentage Accurate: 98.5% → 100.0%
Time: 2.7s
Alternatives: 6
Speedup: 1.8×

Specification

?
\[\begin{array}{l} \\ \frac{4}{\left(\left(3 \cdot \pi\right) \cdot \left(1 - v \cdot v\right)\right) \cdot \sqrt{2 - 6 \cdot \left(v \cdot v\right)}} \end{array} \]
(FPCore (v)
 :precision binary64
 (/ 4.0 (* (* (* 3.0 PI) (- 1.0 (* v v))) (sqrt (- 2.0 (* 6.0 (* v v)))))))
double code(double v) {
	return 4.0 / (((3.0 * ((double) M_PI)) * (1.0 - (v * v))) * sqrt((2.0 - (6.0 * (v * v)))));
}
public static double code(double v) {
	return 4.0 / (((3.0 * Math.PI) * (1.0 - (v * v))) * Math.sqrt((2.0 - (6.0 * (v * v)))));
}
def code(v):
	return 4.0 / (((3.0 * math.pi) * (1.0 - (v * v))) * math.sqrt((2.0 - (6.0 * (v * v)))))
function code(v)
	return Float64(4.0 / Float64(Float64(Float64(3.0 * pi) * Float64(1.0 - Float64(v * v))) * sqrt(Float64(2.0 - Float64(6.0 * Float64(v * v))))))
end
function tmp = code(v)
	tmp = 4.0 / (((3.0 * pi) * (1.0 - (v * v))) * sqrt((2.0 - (6.0 * (v * v)))));
end
code[v_] := N[(4.0 / N[(N[(N[(3.0 * Pi), $MachinePrecision] * N[(1.0 - N[(v * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(2.0 - N[(6.0 * N[(v * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{4}{\left(\left(3 \cdot \pi\right) \cdot \left(1 - v \cdot v\right)\right) \cdot \sqrt{2 - 6 \cdot \left(v \cdot v\right)}}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 6 alternatives:

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

Initial Program: 98.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{4}{\left(\left(3 \cdot \pi\right) \cdot \left(1 - v \cdot v\right)\right) \cdot \sqrt{2 - 6 \cdot \left(v \cdot v\right)}} \end{array} \]
(FPCore (v)
 :precision binary64
 (/ 4.0 (* (* (* 3.0 PI) (- 1.0 (* v v))) (sqrt (- 2.0 (* 6.0 (* v v)))))))
double code(double v) {
	return 4.0 / (((3.0 * ((double) M_PI)) * (1.0 - (v * v))) * sqrt((2.0 - (6.0 * (v * v)))));
}
public static double code(double v) {
	return 4.0 / (((3.0 * Math.PI) * (1.0 - (v * v))) * Math.sqrt((2.0 - (6.0 * (v * v)))));
}
def code(v):
	return 4.0 / (((3.0 * math.pi) * (1.0 - (v * v))) * math.sqrt((2.0 - (6.0 * (v * v)))))
function code(v)
	return Float64(4.0 / Float64(Float64(Float64(3.0 * pi) * Float64(1.0 - Float64(v * v))) * sqrt(Float64(2.0 - Float64(6.0 * Float64(v * v))))))
end
function tmp = code(v)
	tmp = 4.0 / (((3.0 * pi) * (1.0 - (v * v))) * sqrt((2.0 - (6.0 * (v * v)))));
end
code[v_] := N[(4.0 / N[(N[(N[(3.0 * Pi), $MachinePrecision] * N[(1.0 - N[(v * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(2.0 - N[(6.0 * N[(v * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{4}{\left(\left(3 \cdot \pi\right) \cdot \left(1 - v \cdot v\right)\right) \cdot \sqrt{2 - 6 \cdot \left(v \cdot v\right)}}
\end{array}

Alternative 1: 100.0% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \frac{\frac{\frac{4}{1 - v \cdot v}}{\pi \cdot 3}}{\sqrt{-6 \cdot \left(v \cdot v\right) + 2}} \end{array} \]
(FPCore (v)
 :precision binary64
 (/ (/ (/ 4.0 (- 1.0 (* v v))) (* PI 3.0)) (sqrt (+ (* -6.0 (* v v)) 2.0))))
double code(double v) {
	return ((4.0 / (1.0 - (v * v))) / (((double) M_PI) * 3.0)) / sqrt(((-6.0 * (v * v)) + 2.0));
}
public static double code(double v) {
	return ((4.0 / (1.0 - (v * v))) / (Math.PI * 3.0)) / Math.sqrt(((-6.0 * (v * v)) + 2.0));
}
def code(v):
	return ((4.0 / (1.0 - (v * v))) / (math.pi * 3.0)) / math.sqrt(((-6.0 * (v * v)) + 2.0))
function code(v)
	return Float64(Float64(Float64(4.0 / Float64(1.0 - Float64(v * v))) / Float64(pi * 3.0)) / sqrt(Float64(Float64(-6.0 * Float64(v * v)) + 2.0)))
end
function tmp = code(v)
	tmp = ((4.0 / (1.0 - (v * v))) / (pi * 3.0)) / sqrt(((-6.0 * (v * v)) + 2.0));
end
code[v_] := N[(N[(N[(4.0 / N[(1.0 - N[(v * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(Pi * 3.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(N[(-6.0 * N[(v * v), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\frac{\frac{4}{1 - v \cdot v}}{\pi \cdot 3}}{\sqrt{-6 \cdot \left(v \cdot v\right) + 2}}
\end{array}
Derivation
  1. Initial program 98.4%

    \[\frac{4}{\left(\left(3 \cdot \pi\right) \cdot \left(1 - v \cdot v\right)\right) \cdot \sqrt{2 - 6 \cdot \left(v \cdot v\right)}} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-/.f64N/A

      \[\leadsto \color{blue}{\frac{4}{\left(\left(3 \cdot \pi\right) \cdot \left(1 - v \cdot v\right)\right) \cdot \sqrt{2 - 6 \cdot \left(v \cdot v\right)}}} \]
    2. lift-*.f64N/A

      \[\leadsto \frac{4}{\color{blue}{\left(\left(3 \cdot \pi\right) \cdot \left(1 - v \cdot v\right)\right) \cdot \sqrt{2 - 6 \cdot \left(v \cdot v\right)}}} \]
    3. lift-*.f64N/A

      \[\leadsto \frac{4}{\color{blue}{\left(\left(3 \cdot \pi\right) \cdot \left(1 - v \cdot v\right)\right)} \cdot \sqrt{2 - 6 \cdot \left(v \cdot v\right)}} \]
    4. lift-PI.f64N/A

      \[\leadsto \frac{4}{\left(\left(3 \cdot \color{blue}{\mathsf{PI}\left(\right)}\right) \cdot \left(1 - v \cdot v\right)\right) \cdot \sqrt{2 - 6 \cdot \left(v \cdot v\right)}} \]
    5. lift-*.f64N/A

      \[\leadsto \frac{4}{\left(\color{blue}{\left(3 \cdot \mathsf{PI}\left(\right)\right)} \cdot \left(1 - v \cdot v\right)\right) \cdot \sqrt{2 - 6 \cdot \left(v \cdot v\right)}} \]
    6. lift--.f64N/A

      \[\leadsto \frac{4}{\left(\left(3 \cdot \mathsf{PI}\left(\right)\right) \cdot \color{blue}{\left(1 - v \cdot v\right)}\right) \cdot \sqrt{2 - 6 \cdot \left(v \cdot v\right)}} \]
    7. lift-*.f64N/A

      \[\leadsto \frac{4}{\left(\left(3 \cdot \mathsf{PI}\left(\right)\right) \cdot \left(1 - \color{blue}{v \cdot v}\right)\right) \cdot \sqrt{2 - 6 \cdot \left(v \cdot v\right)}} \]
    8. lift-sqrt.f64N/A

      \[\leadsto \frac{4}{\left(\left(3 \cdot \mathsf{PI}\left(\right)\right) \cdot \left(1 - v \cdot v\right)\right) \cdot \color{blue}{\sqrt{2 - 6 \cdot \left(v \cdot v\right)}}} \]
    9. lift--.f64N/A

      \[\leadsto \frac{4}{\left(\left(3 \cdot \mathsf{PI}\left(\right)\right) \cdot \left(1 - v \cdot v\right)\right) \cdot \sqrt{\color{blue}{2 - 6 \cdot \left(v \cdot v\right)}}} \]
    10. lift-*.f64N/A

      \[\leadsto \frac{4}{\left(\left(3 \cdot \mathsf{PI}\left(\right)\right) \cdot \left(1 - v \cdot v\right)\right) \cdot \sqrt{2 - \color{blue}{6 \cdot \left(v \cdot v\right)}}} \]
    11. lift-*.f64N/A

      \[\leadsto \frac{4}{\left(\left(3 \cdot \mathsf{PI}\left(\right)\right) \cdot \left(1 - v \cdot v\right)\right) \cdot \sqrt{2 - 6 \cdot \color{blue}{\left(v \cdot v\right)}}} \]
    12. associate-/r*N/A

      \[\leadsto \color{blue}{\frac{\frac{4}{\left(3 \cdot \mathsf{PI}\left(\right)\right) \cdot \left(1 - v \cdot v\right)}}{\sqrt{2 - 6 \cdot \left(v \cdot v\right)}}} \]
    13. lower-/.f64N/A

      \[\leadsto \color{blue}{\frac{\frac{4}{\left(3 \cdot \mathsf{PI}\left(\right)\right) \cdot \left(1 - v \cdot v\right)}}{\sqrt{2 - 6 \cdot \left(v \cdot v\right)}}} \]
  4. Applied rewrites100.0%

    \[\leadsto \color{blue}{\frac{\frac{4}{\left(1 - v \cdot v\right) \cdot \left(\pi \cdot 3\right)}}{\sqrt{-6 \cdot \left(v \cdot v\right) + 2}}} \]
  5. Step-by-step derivation
    1. lift-/.f64N/A

      \[\leadsto \frac{\color{blue}{\frac{4}{\left(1 - v \cdot v\right) \cdot \left(\pi \cdot 3\right)}}}{\sqrt{-6 \cdot \left(v \cdot v\right) + 2}} \]
    2. lift-*.f64N/A

      \[\leadsto \frac{\frac{4}{\color{blue}{\left(1 - v \cdot v\right) \cdot \left(\pi \cdot 3\right)}}}{\sqrt{-6 \cdot \left(v \cdot v\right) + 2}} \]
    3. lift--.f64N/A

      \[\leadsto \frac{\frac{4}{\color{blue}{\left(1 - v \cdot v\right)} \cdot \left(\pi \cdot 3\right)}}{\sqrt{-6 \cdot \left(v \cdot v\right) + 2}} \]
    4. lift-*.f64N/A

      \[\leadsto \frac{\frac{4}{\left(1 - \color{blue}{v \cdot v}\right) \cdot \left(\pi \cdot 3\right)}}{\sqrt{-6 \cdot \left(v \cdot v\right) + 2}} \]
    5. associate-/r*N/A

      \[\leadsto \frac{\color{blue}{\frac{\frac{4}{1 - v \cdot v}}{\pi \cdot 3}}}{\sqrt{-6 \cdot \left(v \cdot v\right) + 2}} \]
    6. lift-PI.f64N/A

      \[\leadsto \frac{\frac{\frac{4}{1 - v \cdot v}}{\color{blue}{\mathsf{PI}\left(\right)} \cdot 3}}{\sqrt{-6 \cdot \left(v \cdot v\right) + 2}} \]
    7. lift-*.f64N/A

      \[\leadsto \frac{\frac{\frac{4}{1 - v \cdot v}}{\color{blue}{\mathsf{PI}\left(\right) \cdot 3}}}{\sqrt{-6 \cdot \left(v \cdot v\right) + 2}} \]
    8. *-commutativeN/A

      \[\leadsto \frac{\frac{\frac{4}{1 - v \cdot v}}{\color{blue}{3 \cdot \mathsf{PI}\left(\right)}}}{\sqrt{-6 \cdot \left(v \cdot v\right) + 2}} \]
    9. lower-/.f64N/A

      \[\leadsto \frac{\color{blue}{\frac{\frac{4}{1 - v \cdot v}}{3 \cdot \mathsf{PI}\left(\right)}}}{\sqrt{-6 \cdot \left(v \cdot v\right) + 2}} \]
    10. lower-/.f64N/A

      \[\leadsto \frac{\frac{\color{blue}{\frac{4}{1 - v \cdot v}}}{3 \cdot \mathsf{PI}\left(\right)}}{\sqrt{-6 \cdot \left(v \cdot v\right) + 2}} \]
    11. lift-*.f64N/A

      \[\leadsto \frac{\frac{\frac{4}{1 - \color{blue}{v \cdot v}}}{3 \cdot \mathsf{PI}\left(\right)}}{\sqrt{-6 \cdot \left(v \cdot v\right) + 2}} \]
    12. lift--.f64N/A

      \[\leadsto \frac{\frac{\frac{4}{\color{blue}{1 - v \cdot v}}}{3 \cdot \mathsf{PI}\left(\right)}}{\sqrt{-6 \cdot \left(v \cdot v\right) + 2}} \]
    13. *-commutativeN/A

      \[\leadsto \frac{\frac{\frac{4}{1 - v \cdot v}}{\color{blue}{\mathsf{PI}\left(\right) \cdot 3}}}{\sqrt{-6 \cdot \left(v \cdot v\right) + 2}} \]
    14. lift-*.f64N/A

      \[\leadsto \frac{\frac{\frac{4}{1 - v \cdot v}}{\color{blue}{\mathsf{PI}\left(\right) \cdot 3}}}{\sqrt{-6 \cdot \left(v \cdot v\right) + 2}} \]
    15. lift-PI.f64100.0

      \[\leadsto \frac{\frac{\frac{4}{1 - v \cdot v}}{\color{blue}{\pi} \cdot 3}}{\sqrt{-6 \cdot \left(v \cdot v\right) + 2}} \]
  6. Applied rewrites100.0%

    \[\leadsto \frac{\color{blue}{\frac{\frac{4}{1 - v \cdot v}}{\pi \cdot 3}}}{\sqrt{-6 \cdot \left(v \cdot v\right) + 2}} \]
  7. Add Preprocessing

Alternative 2: 100.0% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \frac{\frac{4}{\left(1 - v \cdot v\right) \cdot \left(\pi \cdot 3\right)}}{\sqrt{-6 \cdot \left(v \cdot v\right) + 2}} \end{array} \]
(FPCore (v)
 :precision binary64
 (/ (/ 4.0 (* (- 1.0 (* v v)) (* PI 3.0))) (sqrt (+ (* -6.0 (* v v)) 2.0))))
double code(double v) {
	return (4.0 / ((1.0 - (v * v)) * (((double) M_PI) * 3.0))) / sqrt(((-6.0 * (v * v)) + 2.0));
}
public static double code(double v) {
	return (4.0 / ((1.0 - (v * v)) * (Math.PI * 3.0))) / Math.sqrt(((-6.0 * (v * v)) + 2.0));
}
def code(v):
	return (4.0 / ((1.0 - (v * v)) * (math.pi * 3.0))) / math.sqrt(((-6.0 * (v * v)) + 2.0))
function code(v)
	return Float64(Float64(4.0 / Float64(Float64(1.0 - Float64(v * v)) * Float64(pi * 3.0))) / sqrt(Float64(Float64(-6.0 * Float64(v * v)) + 2.0)))
end
function tmp = code(v)
	tmp = (4.0 / ((1.0 - (v * v)) * (pi * 3.0))) / sqrt(((-6.0 * (v * v)) + 2.0));
end
code[v_] := N[(N[(4.0 / N[(N[(1.0 - N[(v * v), $MachinePrecision]), $MachinePrecision] * N[(Pi * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(N[(-6.0 * N[(v * v), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\frac{4}{\left(1 - v \cdot v\right) \cdot \left(\pi \cdot 3\right)}}{\sqrt{-6 \cdot \left(v \cdot v\right) + 2}}
\end{array}
Derivation
  1. Initial program 98.4%

    \[\frac{4}{\left(\left(3 \cdot \pi\right) \cdot \left(1 - v \cdot v\right)\right) \cdot \sqrt{2 - 6 \cdot \left(v \cdot v\right)}} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-/.f64N/A

      \[\leadsto \color{blue}{\frac{4}{\left(\left(3 \cdot \pi\right) \cdot \left(1 - v \cdot v\right)\right) \cdot \sqrt{2 - 6 \cdot \left(v \cdot v\right)}}} \]
    2. lift-*.f64N/A

      \[\leadsto \frac{4}{\color{blue}{\left(\left(3 \cdot \pi\right) \cdot \left(1 - v \cdot v\right)\right) \cdot \sqrt{2 - 6 \cdot \left(v \cdot v\right)}}} \]
    3. lift-*.f64N/A

      \[\leadsto \frac{4}{\color{blue}{\left(\left(3 \cdot \pi\right) \cdot \left(1 - v \cdot v\right)\right)} \cdot \sqrt{2 - 6 \cdot \left(v \cdot v\right)}} \]
    4. lift-PI.f64N/A

      \[\leadsto \frac{4}{\left(\left(3 \cdot \color{blue}{\mathsf{PI}\left(\right)}\right) \cdot \left(1 - v \cdot v\right)\right) \cdot \sqrt{2 - 6 \cdot \left(v \cdot v\right)}} \]
    5. lift-*.f64N/A

      \[\leadsto \frac{4}{\left(\color{blue}{\left(3 \cdot \mathsf{PI}\left(\right)\right)} \cdot \left(1 - v \cdot v\right)\right) \cdot \sqrt{2 - 6 \cdot \left(v \cdot v\right)}} \]
    6. lift--.f64N/A

      \[\leadsto \frac{4}{\left(\left(3 \cdot \mathsf{PI}\left(\right)\right) \cdot \color{blue}{\left(1 - v \cdot v\right)}\right) \cdot \sqrt{2 - 6 \cdot \left(v \cdot v\right)}} \]
    7. lift-*.f64N/A

      \[\leadsto \frac{4}{\left(\left(3 \cdot \mathsf{PI}\left(\right)\right) \cdot \left(1 - \color{blue}{v \cdot v}\right)\right) \cdot \sqrt{2 - 6 \cdot \left(v \cdot v\right)}} \]
    8. lift-sqrt.f64N/A

      \[\leadsto \frac{4}{\left(\left(3 \cdot \mathsf{PI}\left(\right)\right) \cdot \left(1 - v \cdot v\right)\right) \cdot \color{blue}{\sqrt{2 - 6 \cdot \left(v \cdot v\right)}}} \]
    9. lift--.f64N/A

      \[\leadsto \frac{4}{\left(\left(3 \cdot \mathsf{PI}\left(\right)\right) \cdot \left(1 - v \cdot v\right)\right) \cdot \sqrt{\color{blue}{2 - 6 \cdot \left(v \cdot v\right)}}} \]
    10. lift-*.f64N/A

      \[\leadsto \frac{4}{\left(\left(3 \cdot \mathsf{PI}\left(\right)\right) \cdot \left(1 - v \cdot v\right)\right) \cdot \sqrt{2 - \color{blue}{6 \cdot \left(v \cdot v\right)}}} \]
    11. lift-*.f64N/A

      \[\leadsto \frac{4}{\left(\left(3 \cdot \mathsf{PI}\left(\right)\right) \cdot \left(1 - v \cdot v\right)\right) \cdot \sqrt{2 - 6 \cdot \color{blue}{\left(v \cdot v\right)}}} \]
    12. associate-/r*N/A

      \[\leadsto \color{blue}{\frac{\frac{4}{\left(3 \cdot \mathsf{PI}\left(\right)\right) \cdot \left(1 - v \cdot v\right)}}{\sqrt{2 - 6 \cdot \left(v \cdot v\right)}}} \]
    13. lower-/.f64N/A

      \[\leadsto \color{blue}{\frac{\frac{4}{\left(3 \cdot \mathsf{PI}\left(\right)\right) \cdot \left(1 - v \cdot v\right)}}{\sqrt{2 - 6 \cdot \left(v \cdot v\right)}}} \]
  4. Applied rewrites100.0%

    \[\leadsto \color{blue}{\frac{\frac{4}{\left(1 - v \cdot v\right) \cdot \left(\pi \cdot 3\right)}}{\sqrt{-6 \cdot \left(v \cdot v\right) + 2}}} \]
  5. Add Preprocessing

Alternative 3: 99.0% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \frac{\frac{4}{\pi \cdot 3}}{\sqrt{\left(v \cdot v\right) \cdot -6 + 2}} \end{array} \]
(FPCore (v)
 :precision binary64
 (/ (/ 4.0 (* PI 3.0)) (sqrt (+ (* (* v v) -6.0) 2.0))))
double code(double v) {
	return (4.0 / (((double) M_PI) * 3.0)) / sqrt((((v * v) * -6.0) + 2.0));
}
public static double code(double v) {
	return (4.0 / (Math.PI * 3.0)) / Math.sqrt((((v * v) * -6.0) + 2.0));
}
def code(v):
	return (4.0 / (math.pi * 3.0)) / math.sqrt((((v * v) * -6.0) + 2.0))
function code(v)
	return Float64(Float64(4.0 / Float64(pi * 3.0)) / sqrt(Float64(Float64(Float64(v * v) * -6.0) + 2.0)))
end
function tmp = code(v)
	tmp = (4.0 / (pi * 3.0)) / sqrt((((v * v) * -6.0) + 2.0));
end
code[v_] := N[(N[(4.0 / N[(Pi * 3.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(N[(N[(v * v), $MachinePrecision] * -6.0), $MachinePrecision] + 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\frac{4}{\pi \cdot 3}}{\sqrt{\left(v \cdot v\right) \cdot -6 + 2}}
\end{array}
Derivation
  1. Initial program 98.4%

    \[\frac{4}{\left(\left(3 \cdot \pi\right) \cdot \left(1 - v \cdot v\right)\right) \cdot \sqrt{2 - 6 \cdot \left(v \cdot v\right)}} \]
  2. Add Preprocessing
  3. Taylor expanded in v around 0

    \[\leadsto \frac{4}{\color{blue}{\left(3 \cdot \mathsf{PI}\left(\right)\right)} \cdot \sqrt{2 - 6 \cdot \left(v \cdot v\right)}} \]
  4. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto \frac{4}{\left(\mathsf{PI}\left(\right) \cdot \color{blue}{3}\right) \cdot \sqrt{2 - 6 \cdot \left(v \cdot v\right)}} \]
    2. lower-*.f64N/A

      \[\leadsto \frac{4}{\left(\mathsf{PI}\left(\right) \cdot \color{blue}{3}\right) \cdot \sqrt{2 - 6 \cdot \left(v \cdot v\right)}} \]
    3. lift-PI.f6497.8

      \[\leadsto \frac{4}{\left(\pi \cdot 3\right) \cdot \sqrt{2 - 6 \cdot \left(v \cdot v\right)}} \]
  5. Applied rewrites97.8%

    \[\leadsto \frac{4}{\color{blue}{\left(\pi \cdot 3\right)} \cdot \sqrt{2 - 6 \cdot \left(v \cdot v\right)}} \]
  6. Step-by-step derivation
    1. lift-/.f64N/A

      \[\leadsto \color{blue}{\frac{4}{\left(\pi \cdot 3\right) \cdot \sqrt{2 - 6 \cdot \left(v \cdot v\right)}}} \]
    2. lift-*.f64N/A

      \[\leadsto \frac{4}{\color{blue}{\left(\pi \cdot 3\right) \cdot \sqrt{2 - 6 \cdot \left(v \cdot v\right)}}} \]
    3. lift-sqrt.f64N/A

      \[\leadsto \frac{4}{\left(\pi \cdot 3\right) \cdot \color{blue}{\sqrt{2 - 6 \cdot \left(v \cdot v\right)}}} \]
    4. lift--.f64N/A

      \[\leadsto \frac{4}{\left(\pi \cdot 3\right) \cdot \sqrt{\color{blue}{2 - 6 \cdot \left(v \cdot v\right)}}} \]
    5. lift-*.f64N/A

      \[\leadsto \frac{4}{\left(\pi \cdot 3\right) \cdot \sqrt{2 - \color{blue}{6 \cdot \left(v \cdot v\right)}}} \]
    6. lift-*.f64N/A

      \[\leadsto \frac{4}{\left(\pi \cdot 3\right) \cdot \sqrt{2 - 6 \cdot \color{blue}{\left(v \cdot v\right)}}} \]
    7. associate-/r*N/A

      \[\leadsto \color{blue}{\frac{\frac{4}{\pi \cdot 3}}{\sqrt{2 - 6 \cdot \left(v \cdot v\right)}}} \]
    8. lower-/.f64N/A

      \[\leadsto \color{blue}{\frac{\frac{4}{\pi \cdot 3}}{\sqrt{2 - 6 \cdot \left(v \cdot v\right)}}} \]
    9. lower-/.f64N/A

      \[\leadsto \frac{\color{blue}{\frac{4}{\pi \cdot 3}}}{\sqrt{2 - 6 \cdot \left(v \cdot v\right)}} \]
    10. lower-sqrt.f64N/A

      \[\leadsto \frac{\frac{4}{\pi \cdot 3}}{\color{blue}{\sqrt{2 - 6 \cdot \left(v \cdot v\right)}}} \]
    11. pow2N/A

      \[\leadsto \frac{\frac{4}{\pi \cdot 3}}{\sqrt{2 - 6 \cdot \color{blue}{{v}^{2}}}} \]
    12. fp-cancel-sub-sign-invN/A

      \[\leadsto \frac{\frac{4}{\pi \cdot 3}}{\sqrt{\color{blue}{2 + \left(\mathsf{neg}\left(6\right)\right) \cdot {v}^{2}}}} \]
  7. Applied rewrites99.3%

    \[\leadsto \color{blue}{\frac{\frac{4}{\pi \cdot 3}}{\sqrt{\left(v \cdot v\right) \cdot -6 + 2}}} \]
  8. Add Preprocessing

Alternative 4: 99.0% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \frac{\frac{1.3333333333333333}{\pi}}{\sqrt{-6 \cdot \left(v \cdot v\right) + 2}} \end{array} \]
(FPCore (v)
 :precision binary64
 (/ (/ 1.3333333333333333 PI) (sqrt (+ (* -6.0 (* v v)) 2.0))))
double code(double v) {
	return (1.3333333333333333 / ((double) M_PI)) / sqrt(((-6.0 * (v * v)) + 2.0));
}
public static double code(double v) {
	return (1.3333333333333333 / Math.PI) / Math.sqrt(((-6.0 * (v * v)) + 2.0));
}
def code(v):
	return (1.3333333333333333 / math.pi) / math.sqrt(((-6.0 * (v * v)) + 2.0))
function code(v)
	return Float64(Float64(1.3333333333333333 / pi) / sqrt(Float64(Float64(-6.0 * Float64(v * v)) + 2.0)))
end
function tmp = code(v)
	tmp = (1.3333333333333333 / pi) / sqrt(((-6.0 * (v * v)) + 2.0));
end
code[v_] := N[(N[(1.3333333333333333 / Pi), $MachinePrecision] / N[Sqrt[N[(N[(-6.0 * N[(v * v), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\frac{1.3333333333333333}{\pi}}{\sqrt{-6 \cdot \left(v \cdot v\right) + 2}}
\end{array}
Derivation
  1. Initial program 98.4%

    \[\frac{4}{\left(\left(3 \cdot \pi\right) \cdot \left(1 - v \cdot v\right)\right) \cdot \sqrt{2 - 6 \cdot \left(v \cdot v\right)}} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-/.f64N/A

      \[\leadsto \color{blue}{\frac{4}{\left(\left(3 \cdot \pi\right) \cdot \left(1 - v \cdot v\right)\right) \cdot \sqrt{2 - 6 \cdot \left(v \cdot v\right)}}} \]
    2. lift-*.f64N/A

      \[\leadsto \frac{4}{\color{blue}{\left(\left(3 \cdot \pi\right) \cdot \left(1 - v \cdot v\right)\right) \cdot \sqrt{2 - 6 \cdot \left(v \cdot v\right)}}} \]
    3. lift-*.f64N/A

      \[\leadsto \frac{4}{\color{blue}{\left(\left(3 \cdot \pi\right) \cdot \left(1 - v \cdot v\right)\right)} \cdot \sqrt{2 - 6 \cdot \left(v \cdot v\right)}} \]
    4. lift-PI.f64N/A

      \[\leadsto \frac{4}{\left(\left(3 \cdot \color{blue}{\mathsf{PI}\left(\right)}\right) \cdot \left(1 - v \cdot v\right)\right) \cdot \sqrt{2 - 6 \cdot \left(v \cdot v\right)}} \]
    5. lift-*.f64N/A

      \[\leadsto \frac{4}{\left(\color{blue}{\left(3 \cdot \mathsf{PI}\left(\right)\right)} \cdot \left(1 - v \cdot v\right)\right) \cdot \sqrt{2 - 6 \cdot \left(v \cdot v\right)}} \]
    6. lift--.f64N/A

      \[\leadsto \frac{4}{\left(\left(3 \cdot \mathsf{PI}\left(\right)\right) \cdot \color{blue}{\left(1 - v \cdot v\right)}\right) \cdot \sqrt{2 - 6 \cdot \left(v \cdot v\right)}} \]
    7. lift-*.f64N/A

      \[\leadsto \frac{4}{\left(\left(3 \cdot \mathsf{PI}\left(\right)\right) \cdot \left(1 - \color{blue}{v \cdot v}\right)\right) \cdot \sqrt{2 - 6 \cdot \left(v \cdot v\right)}} \]
    8. lift-sqrt.f64N/A

      \[\leadsto \frac{4}{\left(\left(3 \cdot \mathsf{PI}\left(\right)\right) \cdot \left(1 - v \cdot v\right)\right) \cdot \color{blue}{\sqrt{2 - 6 \cdot \left(v \cdot v\right)}}} \]
    9. lift--.f64N/A

      \[\leadsto \frac{4}{\left(\left(3 \cdot \mathsf{PI}\left(\right)\right) \cdot \left(1 - v \cdot v\right)\right) \cdot \sqrt{\color{blue}{2 - 6 \cdot \left(v \cdot v\right)}}} \]
    10. lift-*.f64N/A

      \[\leadsto \frac{4}{\left(\left(3 \cdot \mathsf{PI}\left(\right)\right) \cdot \left(1 - v \cdot v\right)\right) \cdot \sqrt{2 - \color{blue}{6 \cdot \left(v \cdot v\right)}}} \]
    11. lift-*.f64N/A

      \[\leadsto \frac{4}{\left(\left(3 \cdot \mathsf{PI}\left(\right)\right) \cdot \left(1 - v \cdot v\right)\right) \cdot \sqrt{2 - 6 \cdot \color{blue}{\left(v \cdot v\right)}}} \]
    12. associate-/r*N/A

      \[\leadsto \color{blue}{\frac{\frac{4}{\left(3 \cdot \mathsf{PI}\left(\right)\right) \cdot \left(1 - v \cdot v\right)}}{\sqrt{2 - 6 \cdot \left(v \cdot v\right)}}} \]
    13. lower-/.f64N/A

      \[\leadsto \color{blue}{\frac{\frac{4}{\left(3 \cdot \mathsf{PI}\left(\right)\right) \cdot \left(1 - v \cdot v\right)}}{\sqrt{2 - 6 \cdot \left(v \cdot v\right)}}} \]
  4. Applied rewrites100.0%

    \[\leadsto \color{blue}{\frac{\frac{4}{\left(1 - v \cdot v\right) \cdot \left(\pi \cdot 3\right)}}{\sqrt{-6 \cdot \left(v \cdot v\right) + 2}}} \]
  5. Taylor expanded in v around 0

    \[\leadsto \frac{\color{blue}{\frac{\frac{4}{3}}{\mathsf{PI}\left(\right)}}}{\sqrt{-6 \cdot \left(v \cdot v\right) + 2}} \]
  6. Step-by-step derivation
    1. lower-/.f64N/A

      \[\leadsto \frac{\frac{\frac{4}{3}}{\color{blue}{\mathsf{PI}\left(\right)}}}{\sqrt{-6 \cdot \left(v \cdot v\right) + 2}} \]
    2. lift-PI.f6499.3

      \[\leadsto \frac{\frac{1.3333333333333333}{\pi}}{\sqrt{-6 \cdot \left(v \cdot v\right) + 2}} \]
  7. Applied rewrites99.3%

    \[\leadsto \frac{\color{blue}{\frac{1.3333333333333333}{\pi}}}{\sqrt{-6 \cdot \left(v \cdot v\right) + 2}} \]
  8. Add Preprocessing

Alternative 5: 98.9% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \frac{\frac{1.3333333333333333}{\pi}}{\sqrt{2}} \end{array} \]
(FPCore (v) :precision binary64 (/ (/ 1.3333333333333333 PI) (sqrt 2.0)))
double code(double v) {
	return (1.3333333333333333 / ((double) M_PI)) / sqrt(2.0);
}
public static double code(double v) {
	return (1.3333333333333333 / Math.PI) / Math.sqrt(2.0);
}
def code(v):
	return (1.3333333333333333 / math.pi) / math.sqrt(2.0)
function code(v)
	return Float64(Float64(1.3333333333333333 / pi) / sqrt(2.0))
end
function tmp = code(v)
	tmp = (1.3333333333333333 / pi) / sqrt(2.0);
end
code[v_] := N[(N[(1.3333333333333333 / Pi), $MachinePrecision] / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\frac{1.3333333333333333}{\pi}}{\sqrt{2}}
\end{array}
Derivation
  1. Initial program 98.4%

    \[\frac{4}{\left(\left(3 \cdot \pi\right) \cdot \left(1 - v \cdot v\right)\right) \cdot \sqrt{2 - 6 \cdot \left(v \cdot v\right)}} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-/.f64N/A

      \[\leadsto \color{blue}{\frac{4}{\left(\left(3 \cdot \pi\right) \cdot \left(1 - v \cdot v\right)\right) \cdot \sqrt{2 - 6 \cdot \left(v \cdot v\right)}}} \]
    2. lift-*.f64N/A

      \[\leadsto \frac{4}{\color{blue}{\left(\left(3 \cdot \pi\right) \cdot \left(1 - v \cdot v\right)\right) \cdot \sqrt{2 - 6 \cdot \left(v \cdot v\right)}}} \]
    3. lift-*.f64N/A

      \[\leadsto \frac{4}{\color{blue}{\left(\left(3 \cdot \pi\right) \cdot \left(1 - v \cdot v\right)\right)} \cdot \sqrt{2 - 6 \cdot \left(v \cdot v\right)}} \]
    4. lift-PI.f64N/A

      \[\leadsto \frac{4}{\left(\left(3 \cdot \color{blue}{\mathsf{PI}\left(\right)}\right) \cdot \left(1 - v \cdot v\right)\right) \cdot \sqrt{2 - 6 \cdot \left(v \cdot v\right)}} \]
    5. lift-*.f64N/A

      \[\leadsto \frac{4}{\left(\color{blue}{\left(3 \cdot \mathsf{PI}\left(\right)\right)} \cdot \left(1 - v \cdot v\right)\right) \cdot \sqrt{2 - 6 \cdot \left(v \cdot v\right)}} \]
    6. lift--.f64N/A

      \[\leadsto \frac{4}{\left(\left(3 \cdot \mathsf{PI}\left(\right)\right) \cdot \color{blue}{\left(1 - v \cdot v\right)}\right) \cdot \sqrt{2 - 6 \cdot \left(v \cdot v\right)}} \]
    7. lift-*.f64N/A

      \[\leadsto \frac{4}{\left(\left(3 \cdot \mathsf{PI}\left(\right)\right) \cdot \left(1 - \color{blue}{v \cdot v}\right)\right) \cdot \sqrt{2 - 6 \cdot \left(v \cdot v\right)}} \]
    8. lift-sqrt.f64N/A

      \[\leadsto \frac{4}{\left(\left(3 \cdot \mathsf{PI}\left(\right)\right) \cdot \left(1 - v \cdot v\right)\right) \cdot \color{blue}{\sqrt{2 - 6 \cdot \left(v \cdot v\right)}}} \]
    9. lift--.f64N/A

      \[\leadsto \frac{4}{\left(\left(3 \cdot \mathsf{PI}\left(\right)\right) \cdot \left(1 - v \cdot v\right)\right) \cdot \sqrt{\color{blue}{2 - 6 \cdot \left(v \cdot v\right)}}} \]
    10. lift-*.f64N/A

      \[\leadsto \frac{4}{\left(\left(3 \cdot \mathsf{PI}\left(\right)\right) \cdot \left(1 - v \cdot v\right)\right) \cdot \sqrt{2 - \color{blue}{6 \cdot \left(v \cdot v\right)}}} \]
    11. lift-*.f64N/A

      \[\leadsto \frac{4}{\left(\left(3 \cdot \mathsf{PI}\left(\right)\right) \cdot \left(1 - v \cdot v\right)\right) \cdot \sqrt{2 - 6 \cdot \color{blue}{\left(v \cdot v\right)}}} \]
    12. associate-/r*N/A

      \[\leadsto \color{blue}{\frac{\frac{4}{\left(3 \cdot \mathsf{PI}\left(\right)\right) \cdot \left(1 - v \cdot v\right)}}{\sqrt{2 - 6 \cdot \left(v \cdot v\right)}}} \]
    13. lower-/.f64N/A

      \[\leadsto \color{blue}{\frac{\frac{4}{\left(3 \cdot \mathsf{PI}\left(\right)\right) \cdot \left(1 - v \cdot v\right)}}{\sqrt{2 - 6 \cdot \left(v \cdot v\right)}}} \]
  4. Applied rewrites100.0%

    \[\leadsto \color{blue}{\frac{\frac{4}{\left(1 - v \cdot v\right) \cdot \left(\pi \cdot 3\right)}}{\sqrt{-6 \cdot \left(v \cdot v\right) + 2}}} \]
  5. Taylor expanded in v around 0

    \[\leadsto \frac{\color{blue}{\frac{\frac{4}{3}}{\mathsf{PI}\left(\right)}}}{\sqrt{-6 \cdot \left(v \cdot v\right) + 2}} \]
  6. Step-by-step derivation
    1. lower-/.f64N/A

      \[\leadsto \frac{\frac{\frac{4}{3}}{\color{blue}{\mathsf{PI}\left(\right)}}}{\sqrt{-6 \cdot \left(v \cdot v\right) + 2}} \]
    2. lift-PI.f6499.3

      \[\leadsto \frac{\frac{1.3333333333333333}{\pi}}{\sqrt{-6 \cdot \left(v \cdot v\right) + 2}} \]
  7. Applied rewrites99.3%

    \[\leadsto \frac{\color{blue}{\frac{1.3333333333333333}{\pi}}}{\sqrt{-6 \cdot \left(v \cdot v\right) + 2}} \]
  8. Taylor expanded in v around 0

    \[\leadsto \frac{\frac{\frac{4}{3}}{\pi}}{\sqrt{\color{blue}{2}}} \]
  9. Step-by-step derivation
    1. pow299.3

      \[\leadsto \frac{\frac{1.3333333333333333}{\pi}}{\sqrt{2}} \]
    2. *-commutative99.3

      \[\leadsto \frac{\frac{1.3333333333333333}{\pi}}{\sqrt{2}} \]
    3. pow299.3

      \[\leadsto \frac{\frac{1.3333333333333333}{\pi}}{\sqrt{2}} \]
  10. Applied rewrites99.3%

    \[\leadsto \frac{\frac{1.3333333333333333}{\pi}}{\sqrt{\color{blue}{2}}} \]
  11. Add Preprocessing

Alternative 6: 97.4% accurate, 2.1× speedup?

\[\begin{array}{l} \\ \frac{\sqrt{0.5}}{\pi} \cdot 1.3333333333333333 \end{array} \]
(FPCore (v) :precision binary64 (* (/ (sqrt 0.5) PI) 1.3333333333333333))
double code(double v) {
	return (sqrt(0.5) / ((double) M_PI)) * 1.3333333333333333;
}
public static double code(double v) {
	return (Math.sqrt(0.5) / Math.PI) * 1.3333333333333333;
}
def code(v):
	return (math.sqrt(0.5) / math.pi) * 1.3333333333333333
function code(v)
	return Float64(Float64(sqrt(0.5) / pi) * 1.3333333333333333)
end
function tmp = code(v)
	tmp = (sqrt(0.5) / pi) * 1.3333333333333333;
end
code[v_] := N[(N[(N[Sqrt[0.5], $MachinePrecision] / Pi), $MachinePrecision] * 1.3333333333333333), $MachinePrecision]
\begin{array}{l}

\\
\frac{\sqrt{0.5}}{\pi} \cdot 1.3333333333333333
\end{array}
Derivation
  1. Initial program 98.4%

    \[\frac{4}{\left(\left(3 \cdot \pi\right) \cdot \left(1 - v \cdot v\right)\right) \cdot \sqrt{2 - 6 \cdot \left(v \cdot v\right)}} \]
  2. Add Preprocessing
  3. Taylor expanded in v around 0

    \[\leadsto \color{blue}{\frac{4}{3} \cdot \frac{\sqrt{\frac{1}{2}}}{\mathsf{PI}\left(\right)}} \]
  4. Step-by-step derivation
    1. *-commutativeN/A

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

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

      \[\leadsto \frac{\sqrt{\frac{1}{2}}}{\mathsf{PI}\left(\right)} \cdot \frac{4}{3} \]
    4. lower-sqrt.f64N/A

      \[\leadsto \frac{\sqrt{\frac{1}{2}}}{\mathsf{PI}\left(\right)} \cdot \frac{4}{3} \]
    5. lift-PI.f6497.8

      \[\leadsto \frac{\sqrt{0.5}}{\pi} \cdot 1.3333333333333333 \]
  5. Applied rewrites97.8%

    \[\leadsto \color{blue}{\frac{\sqrt{0.5}}{\pi} \cdot 1.3333333333333333} \]
  6. Add Preprocessing

Reproduce

?
herbie shell --seed 2025058 
(FPCore (v)
  :name "Falkner and Boettcher, Equation (22+)"
  :precision binary64
  (/ 4.0 (* (* (* 3.0 PI) (- 1.0 (* v v))) (sqrt (- 2.0 (* 6.0 (* v v)))))))