Falkner and Boettcher, Equation (22+)

Percentage Accurate: 98.5% → 100.0%
Time: 2.4s
Alternatives: 6
Speedup: 29.1×

Specification

?
\[\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)}} \]
(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]
\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)}}

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?

\[\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)}} \]
(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]
\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)}}

Alternative 1: 100.0% accurate, 1.1× speedup?

\[\frac{\frac{-1.3333333333333333}{\mathsf{fma}\left(v, v, -1\right) \cdot \sqrt{\mathsf{fma}\left(v \cdot v, -6, 2\right)}}}{\pi} \]
(FPCore (v)
 :precision binary64
 (/
  (/ -1.3333333333333333 (* (fma v v -1.0) (sqrt (fma (* v v) -6.0 2.0))))
  PI))
double code(double v) {
	return (-1.3333333333333333 / (fma(v, v, -1.0) * sqrt(fma((v * v), -6.0, 2.0)))) / ((double) M_PI);
}
function code(v)
	return Float64(Float64(-1.3333333333333333 / Float64(fma(v, v, -1.0) * sqrt(fma(Float64(v * v), -6.0, 2.0)))) / pi)
end
code[v_] := N[(N[(-1.3333333333333333 / N[(N[(v * v + -1.0), $MachinePrecision] * N[Sqrt[N[(N[(v * v), $MachinePrecision] * -6.0 + 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / Pi), $MachinePrecision]
\frac{\frac{-1.3333333333333333}{\mathsf{fma}\left(v, v, -1\right) \cdot \sqrt{\mathsf{fma}\left(v \cdot v, -6, 2\right)}}}{\pi}
Derivation
  1. Initial program 98.5%

    \[\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. 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. *-commutativeN/A

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{\frac{4}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}}}{\pi \cdot 3}}}{1 - v \cdot v} \]
    3. associate-/l/N/A

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

      \[\leadsto \frac{\color{blue}{\frac{4}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}}}}{\left(\pi \cdot 3\right) \cdot \left(1 - v \cdot v\right)} \]
    5. mult-flipN/A

      \[\leadsto \frac{\color{blue}{4 \cdot \frac{1}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}}}}{\left(\pi \cdot 3\right) \cdot \left(1 - v \cdot v\right)} \]
    6. frac-timesN/A

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

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

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

      \[\leadsto \frac{4 \cdot 1}{\color{blue}{3 \cdot \pi}} \cdot \frac{\frac{1}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}}}{1 - v \cdot v} \]
    10. frac-timesN/A

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

      \[\leadsto \left(\color{blue}{\frac{4}{3}} \cdot \frac{1}{\pi}\right) \cdot \frac{\frac{1}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}}}{1 - v \cdot v} \]
    12. mult-flipN/A

      \[\leadsto \color{blue}{\frac{\frac{4}{3}}{\pi}} \cdot \frac{\frac{1}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}}}{1 - v \cdot v} \]
    13. times-fracN/A

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

      \[\leadsto \frac{\frac{4}{3} \cdot \frac{1}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}}}{\pi \cdot \color{blue}{\left(1 - v \cdot v\right)}} \]
    15. sub-negate-revN/A

      \[\leadsto \frac{\frac{4}{3} \cdot \frac{1}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}}}{\pi \cdot \color{blue}{\left(\mathsf{neg}\left(\left(v \cdot v - 1\right)\right)\right)}} \]
    16. metadata-evalN/A

      \[\leadsto \frac{\frac{4}{3} \cdot \frac{1}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}}}{\pi \cdot \left(\mathsf{neg}\left(\left(v \cdot v - \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)}\right)\right)\right)} \]
    17. add-flipN/A

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

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

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

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

Alternative 2: 100.0% accurate, 1.3× speedup?

\[\frac{\frac{-0.4244131815783876}{\sqrt{\mathsf{fma}\left(v \cdot v, -6, 2\right)}}}{\mathsf{fma}\left(v, v, -1\right)} \]
(FPCore (v)
 :precision binary64
 (/ (/ -0.4244131815783876 (sqrt (fma (* v v) -6.0 2.0))) (fma v v -1.0)))
double code(double v) {
	return (-0.4244131815783876 / sqrt(fma((v * v), -6.0, 2.0))) / fma(v, v, -1.0);
}
function code(v)
	return Float64(Float64(-0.4244131815783876 / sqrt(fma(Float64(v * v), -6.0, 2.0))) / fma(v, v, -1.0))
end
code[v_] := N[(N[(-0.4244131815783876 / N[Sqrt[N[(N[(v * v), $MachinePrecision] * -6.0 + 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(v * v + -1.0), $MachinePrecision]), $MachinePrecision]
\frac{\frac{-0.4244131815783876}{\sqrt{\mathsf{fma}\left(v \cdot v, -6, 2\right)}}}{\mathsf{fma}\left(v, v, -1\right)}
Derivation
  1. Initial program 98.5%

    \[\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. 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. *-commutativeN/A

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{\frac{\frac{4}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}}}{\pi \cdot 3}}{1 - v \cdot v}} \]
  4. Evaluated real constant100.0%

    \[\leadsto \frac{\frac{\frac{4}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}}}{\color{blue}{\frac{2652839157010665}{281474976710656}}}}{1 - v \cdot v} \]
  5. Step-by-step derivation
    1. lift-/.f64N/A

      \[\leadsto \frac{\color{blue}{\frac{\frac{4}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}}}{\frac{2652839157010665}{281474976710656}}}}{1 - v \cdot v} \]
    2. mult-flipN/A

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

      \[\leadsto \frac{\color{blue}{\frac{4}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}}} \cdot \frac{1}{\frac{2652839157010665}{281474976710656}}}{1 - v \cdot v} \]
    4. associate-*l/N/A

      \[\leadsto \frac{\color{blue}{\frac{4 \cdot \frac{1}{\frac{2652839157010665}{281474976710656}}}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}}}}{1 - v \cdot v} \]
    5. metadata-evalN/A

      \[\leadsto \frac{\frac{4 \cdot \color{blue}{\frac{281474976710656}{2652839157010665}}}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}}}{1 - v \cdot v} \]
    6. metadata-evalN/A

      \[\leadsto \frac{\frac{\color{blue}{\frac{1125899906842624}{2652839157010665}}}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}}}{1 - v \cdot v} \]
    7. metadata-evalN/A

      \[\leadsto \frac{\frac{\color{blue}{\frac{4}{\frac{2652839157010665}{281474976710656}}}}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}}}{1 - v \cdot v} \]
    8. lower-/.f64N/A

      \[\leadsto \frac{\color{blue}{\frac{\frac{4}{\frac{2652839157010665}{281474976710656}}}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}}}}{1 - v \cdot v} \]
    9. metadata-eval100.0

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

    \[\leadsto \color{blue}{\frac{\frac{0.4244131815783876}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}}}{1 - v \cdot v}} \]
  7. Step-by-step derivation
    1. lift-/.f64N/A

      \[\leadsto \color{blue}{\frac{\frac{\frac{1125899906842624}{2652839157010665}}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}}}{1 - v \cdot v}} \]
    2. frac-2neg-revN/A

      \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\frac{\frac{1125899906842624}{2652839157010665}}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}}\right)}{\mathsf{neg}\left(\left(1 - v \cdot v\right)\right)}} \]
    3. lift--.f64N/A

      \[\leadsto \frac{\mathsf{neg}\left(\frac{\frac{1125899906842624}{2652839157010665}}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}}\right)}{\mathsf{neg}\left(\color{blue}{\left(1 - v \cdot v\right)}\right)} \]
    4. sub-negate-revN/A

      \[\leadsto \frac{\mathsf{neg}\left(\frac{\frac{1125899906842624}{2652839157010665}}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}}\right)}{\color{blue}{v \cdot v - 1}} \]
    5. metadata-evalN/A

      \[\leadsto \frac{\mathsf{neg}\left(\frac{\frac{1125899906842624}{2652839157010665}}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}}\right)}{v \cdot v - \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)}} \]
    6. add-flipN/A

      \[\leadsto \frac{\mathsf{neg}\left(\frac{\frac{1125899906842624}{2652839157010665}}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}}\right)}{\color{blue}{v \cdot v + -1}} \]
    7. lift-*.f64N/A

      \[\leadsto \frac{\mathsf{neg}\left(\frac{\frac{1125899906842624}{2652839157010665}}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}}\right)}{\color{blue}{v \cdot v} + -1} \]
    8. lower-/.f64N/A

      \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\frac{\frac{1125899906842624}{2652839157010665}}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}}\right)}{v \cdot v + -1}} \]
  8. Applied rewrites100.0%

    \[\leadsto \color{blue}{\frac{\frac{-0.4244131815783876}{\sqrt{\mathsf{fma}\left(v \cdot v, -6, 2\right)}}}{\mathsf{fma}\left(v, v, -1\right)}} \]
  9. Add Preprocessing

Alternative 3: 100.0% accurate, 1.3× speedup?

\[\frac{-0.4244131815783876}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)} \cdot \mathsf{fma}\left(v, v, -1\right)} \]
(FPCore (v)
 :precision binary64
 (/ -0.4244131815783876 (* (sqrt (fma -6.0 (* v v) 2.0)) (fma v v -1.0))))
double code(double v) {
	return -0.4244131815783876 / (sqrt(fma(-6.0, (v * v), 2.0)) * fma(v, v, -1.0));
}
function code(v)
	return Float64(-0.4244131815783876 / Float64(sqrt(fma(-6.0, Float64(v * v), 2.0)) * fma(v, v, -1.0)))
end
code[v_] := N[(-0.4244131815783876 / N[(N[Sqrt[N[(-6.0 * N[(v * v), $MachinePrecision] + 2.0), $MachinePrecision]], $MachinePrecision] * N[(v * v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{-0.4244131815783876}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)} \cdot \mathsf{fma}\left(v, v, -1\right)}
Derivation
  1. Initial program 98.5%

    \[\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. 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. *-commutativeN/A

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{\frac{\frac{4}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}}}{\pi \cdot 3}}{1 - v \cdot v}} \]
  4. Evaluated real constant100.0%

    \[\leadsto \frac{\frac{\frac{4}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}}}{\color{blue}{\frac{2652839157010665}{281474976710656}}}}{1 - v \cdot v} \]
  5. Step-by-step derivation
    1. lift-/.f64N/A

      \[\leadsto \color{blue}{\frac{\frac{\frac{4}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}}}{\frac{2652839157010665}{281474976710656}}}{1 - v \cdot v}} \]
    2. mult-flipN/A

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

      \[\leadsto \color{blue}{\frac{\frac{4}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}}}{\frac{2652839157010665}{281474976710656}}} \cdot \frac{1}{1 - v \cdot v} \]
    4. mult-flipN/A

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

      \[\leadsto \left(\color{blue}{\frac{4}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}}} \cdot \frac{1}{\frac{2652839157010665}{281474976710656}}\right) \cdot \frac{1}{1 - v \cdot v} \]
    6. associate-*l/N/A

      \[\leadsto \color{blue}{\frac{4 \cdot \frac{1}{\frac{2652839157010665}{281474976710656}}}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}}} \cdot \frac{1}{1 - v \cdot v} \]
    7. metadata-evalN/A

      \[\leadsto \frac{4 \cdot \color{blue}{\frac{281474976710656}{2652839157010665}}}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}} \cdot \frac{1}{1 - v \cdot v} \]
    8. metadata-evalN/A

      \[\leadsto \frac{\color{blue}{\frac{1125899906842624}{2652839157010665}}}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}} \cdot \frac{1}{1 - v \cdot v} \]
    9. metadata-evalN/A

      \[\leadsto \frac{\color{blue}{\frac{4}{\frac{2652839157010665}{281474976710656}}}}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}} \cdot \frac{1}{1 - v \cdot v} \]
    10. metadata-evalN/A

      \[\leadsto \frac{\frac{4}{\frac{2652839157010665}{281474976710656}}}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}} \cdot \frac{\color{blue}{\mathsf{neg}\left(-1\right)}}{1 - v \cdot v} \]
    11. lift--.f64N/A

      \[\leadsto \frac{\frac{4}{\frac{2652839157010665}{281474976710656}}}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}} \cdot \frac{\mathsf{neg}\left(-1\right)}{\color{blue}{1 - v \cdot v}} \]
    12. sub-negate-revN/A

      \[\leadsto \frac{\frac{4}{\frac{2652839157010665}{281474976710656}}}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}} \cdot \frac{\mathsf{neg}\left(-1\right)}{\color{blue}{\mathsf{neg}\left(\left(v \cdot v - 1\right)\right)}} \]
    13. metadata-evalN/A

      \[\leadsto \frac{\frac{4}{\frac{2652839157010665}{281474976710656}}}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}} \cdot \frac{\mathsf{neg}\left(-1\right)}{\mathsf{neg}\left(\left(v \cdot v - \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)}\right)\right)} \]
    14. add-flipN/A

      \[\leadsto \frac{\frac{4}{\frac{2652839157010665}{281474976710656}}}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}} \cdot \frac{\mathsf{neg}\left(-1\right)}{\mathsf{neg}\left(\color{blue}{\left(v \cdot v + -1\right)}\right)} \]
    15. lift-*.f64N/A

      \[\leadsto \frac{\frac{4}{\frac{2652839157010665}{281474976710656}}}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}} \cdot \frac{\mathsf{neg}\left(-1\right)}{\mathsf{neg}\left(\left(\color{blue}{v \cdot v} + -1\right)\right)} \]
    16. lift-fma.f64N/A

      \[\leadsto \frac{\frac{4}{\frac{2652839157010665}{281474976710656}}}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}} \cdot \frac{\mathsf{neg}\left(-1\right)}{\mathsf{neg}\left(\color{blue}{\mathsf{fma}\left(v, v, -1\right)}\right)} \]
    17. frac-2neg-revN/A

      \[\leadsto \frac{\frac{4}{\frac{2652839157010665}{281474976710656}}}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}} \cdot \color{blue}{\frac{-1}{\mathsf{fma}\left(v, v, -1\right)}} \]
    18. frac-timesN/A

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

    \[\leadsto \color{blue}{\frac{-0.4244131815783876}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)} \cdot \mathsf{fma}\left(v, v, -1\right)}} \]
  7. Add Preprocessing

Alternative 4: 99.0% accurate, 1.7× speedup?

\[\frac{0.4244131815783876}{\sqrt{\mathsf{fma}\left(v \cdot -6, v, 1\right) - -1}} \]
(FPCore (v)
 :precision binary64
 (/ 0.4244131815783876 (sqrt (- (fma (* v -6.0) v 1.0) -1.0))))
double code(double v) {
	return 0.4244131815783876 / sqrt((fma((v * -6.0), v, 1.0) - -1.0));
}
function code(v)
	return Float64(0.4244131815783876 / sqrt(Float64(fma(Float64(v * -6.0), v, 1.0) - -1.0)))
end
code[v_] := N[(0.4244131815783876 / N[Sqrt[N[(N[(N[(v * -6.0), $MachinePrecision] * v + 1.0), $MachinePrecision] - -1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\frac{0.4244131815783876}{\sqrt{\mathsf{fma}\left(v \cdot -6, v, 1\right) - -1}}
Derivation
  1. Initial program 98.5%

    \[\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. 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. associate-/r*N/A

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

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

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

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

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

      \[\leadsto \frac{\frac{1.3333333333333333}{\pi}}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}} \]
  6. Applied rewrites99.0%

    \[\leadsto \frac{\color{blue}{\frac{1.3333333333333333}{\pi}}}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}} \]
  7. Evaluated real constant99.0%

    \[\leadsto \frac{\frac{1911387046407553}{4503599627370496}}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}} \]
  8. Step-by-step derivation
    1. lift-fma.f64N/A

      \[\leadsto \frac{\frac{1911387046407553}{4503599627370496}}{\sqrt{\color{blue}{-6 \cdot \left(v \cdot v\right) + 2}}} \]
    2. metadata-evalN/A

      \[\leadsto \frac{\frac{1911387046407553}{4503599627370496}}{\sqrt{-6 \cdot \left(v \cdot v\right) + \color{blue}{\left(1 + 1\right)}}} \]
    3. associate-+r+N/A

      \[\leadsto \frac{\frac{1911387046407553}{4503599627370496}}{\sqrt{\color{blue}{\left(-6 \cdot \left(v \cdot v\right) + 1\right) + 1}}} \]
    4. add-flipN/A

      \[\leadsto \frac{\frac{1911387046407553}{4503599627370496}}{\sqrt{\color{blue}{\left(-6 \cdot \left(v \cdot v\right) + 1\right) - \left(\mathsf{neg}\left(1\right)\right)}}} \]
    5. *-commutativeN/A

      \[\leadsto \frac{\frac{1911387046407553}{4503599627370496}}{\sqrt{\left(\color{blue}{\left(v \cdot v\right) \cdot -6} + 1\right) - \left(\mathsf{neg}\left(1\right)\right)}} \]
    6. metadata-evalN/A

      \[\leadsto \frac{\frac{1911387046407553}{4503599627370496}}{\sqrt{\left(\left(v \cdot v\right) \cdot \color{blue}{\left(\mathsf{neg}\left(6\right)\right)} + 1\right) - \left(\mathsf{neg}\left(1\right)\right)}} \]
    7. distribute-rgt-neg-outN/A

      \[\leadsto \frac{\frac{1911387046407553}{4503599627370496}}{\sqrt{\left(\color{blue}{\left(\mathsf{neg}\left(\left(v \cdot v\right) \cdot 6\right)\right)} + 1\right) - \left(\mathsf{neg}\left(1\right)\right)}} \]
    8. *-commutativeN/A

      \[\leadsto \frac{\frac{1911387046407553}{4503599627370496}}{\sqrt{\left(\left(\mathsf{neg}\left(\color{blue}{6 \cdot \left(v \cdot v\right)}\right)\right) + 1\right) - \left(\mathsf{neg}\left(1\right)\right)}} \]
    9. lift-*.f64N/A

      \[\leadsto \frac{\frac{1911387046407553}{4503599627370496}}{\sqrt{\left(\left(\mathsf{neg}\left(6 \cdot \color{blue}{\left(v \cdot v\right)}\right)\right) + 1\right) - \left(\mathsf{neg}\left(1\right)\right)}} \]
    10. metadata-evalN/A

      \[\leadsto \frac{\frac{1911387046407553}{4503599627370496}}{\sqrt{\left(\left(\mathsf{neg}\left(6 \cdot \left(v \cdot v\right)\right)\right) + \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)}\right) - \left(\mathsf{neg}\left(1\right)\right)}} \]
    11. distribute-neg-outN/A

      \[\leadsto \frac{\frac{1911387046407553}{4503599627370496}}{\sqrt{\color{blue}{\left(\mathsf{neg}\left(\left(6 \cdot \left(v \cdot v\right) + -1\right)\right)\right)} - \left(\mathsf{neg}\left(1\right)\right)}} \]
    12. add-flip-revN/A

      \[\leadsto \frac{\frac{1911387046407553}{4503599627370496}}{\sqrt{\left(\mathsf{neg}\left(\color{blue}{\left(6 \cdot \left(v \cdot v\right) - \left(\mathsf{neg}\left(-1\right)\right)\right)}\right)\right) - \left(\mathsf{neg}\left(1\right)\right)}} \]
    13. metadata-evalN/A

      \[\leadsto \frac{\frac{1911387046407553}{4503599627370496}}{\sqrt{\left(\mathsf{neg}\left(\left(6 \cdot \left(v \cdot v\right) - \color{blue}{1}\right)\right)\right) - \left(\mathsf{neg}\left(1\right)\right)}} \]
    14. sub-negate-revN/A

      \[\leadsto \frac{\frac{1911387046407553}{4503599627370496}}{\sqrt{\color{blue}{\left(1 - 6 \cdot \left(v \cdot v\right)\right)} - \left(\mathsf{neg}\left(1\right)\right)}} \]
    15. metadata-evalN/A

      \[\leadsto \frac{\frac{1911387046407553}{4503599627370496}}{\sqrt{\left(1 - \color{blue}{\left(\mathsf{neg}\left(-6\right)\right)} \cdot \left(v \cdot v\right)\right) - \left(\mathsf{neg}\left(1\right)\right)}} \]
    16. lift-*.f64N/A

      \[\leadsto \frac{\frac{1911387046407553}{4503599627370496}}{\sqrt{\left(1 - \left(\mathsf{neg}\left(-6\right)\right) \cdot \color{blue}{\left(v \cdot v\right)}\right) - \left(\mathsf{neg}\left(1\right)\right)}} \]
    17. fp-cancel-sign-sub-invN/A

      \[\leadsto \frac{\frac{1911387046407553}{4503599627370496}}{\sqrt{\color{blue}{\left(1 + -6 \cdot \left(v \cdot v\right)\right)} - \left(\mathsf{neg}\left(1\right)\right)}} \]
    18. metadata-evalN/A

      \[\leadsto \frac{\frac{1911387046407553}{4503599627370496}}{\sqrt{\left(1 + -6 \cdot \left(v \cdot v\right)\right) - \color{blue}{-1}}} \]
    19. lower--.f64N/A

      \[\leadsto \frac{\frac{1911387046407553}{4503599627370496}}{\sqrt{\color{blue}{\left(1 + -6 \cdot \left(v \cdot v\right)\right) - -1}}} \]
  9. Applied rewrites99.0%

    \[\leadsto \frac{0.4244131815783876}{\sqrt{\color{blue}{\mathsf{fma}\left(v \cdot -6, v, 1\right) - -1}}} \]
  10. Add Preprocessing

Alternative 5: 99.0% accurate, 2.1× speedup?

\[\frac{0.4244131815783876}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}} \]
(FPCore (v)
 :precision binary64
 (/ 0.4244131815783876 (sqrt (fma -6.0 (* v v) 2.0))))
double code(double v) {
	return 0.4244131815783876 / sqrt(fma(-6.0, (v * v), 2.0));
}
function code(v)
	return Float64(0.4244131815783876 / sqrt(fma(-6.0, Float64(v * v), 2.0)))
end
code[v_] := N[(0.4244131815783876 / N[Sqrt[N[(-6.0 * N[(v * v), $MachinePrecision] + 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\frac{0.4244131815783876}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}}
Derivation
  1. Initial program 98.5%

    \[\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. 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. associate-/r*N/A

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

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

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

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

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

      \[\leadsto \frac{\frac{1.3333333333333333}{\pi}}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}} \]
  6. Applied rewrites99.0%

    \[\leadsto \frac{\color{blue}{\frac{1.3333333333333333}{\pi}}}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}} \]
  7. Evaluated real constant99.0%

    \[\leadsto \frac{\frac{1911387046407553}{4503599627370496}}{\sqrt{\mathsf{fma}\left(-6, v \cdot v, 2\right)}} \]
  8. Add Preprocessing

Alternative 6: 99.0% accurate, 29.1× speedup?

\[0.30010543871903533 \]
(FPCore (v) :precision binary64 0.30010543871903533)
double code(double v) {
	return 0.30010543871903533;
}
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(v)
use fmin_fmax_functions
    real(8), intent (in) :: v
    code = 0.30010543871903533d0
end function
public static double code(double v) {
	return 0.30010543871903533;
}
def code(v):
	return 0.30010543871903533
function code(v)
	return 0.30010543871903533
end
function tmp = code(v)
	tmp = 0.30010543871903533;
end
code[v_] := 0.30010543871903533
0.30010543871903533
Derivation
  1. Initial program 98.5%

    \[\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. Taylor expanded in v around 0

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

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

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

      \[\leadsto \frac{\frac{4}{3}}{\pi \cdot \sqrt{\color{blue}{2}}} \]
    4. lower-sqrt.f6499.0

      \[\leadsto \frac{1.3333333333333333}{\pi \cdot \sqrt{2}} \]
  4. Applied rewrites99.0%

    \[\leadsto \color{blue}{\frac{1.3333333333333333}{\pi \cdot \sqrt{2}}} \]
  5. Evaluated real constant99.0%

    \[\leadsto \frac{5406218967947627}{18014398509481984} \]
  6. Add Preprocessing

Reproduce

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