Bouland and Aaronson, Equation (26)

Percentage Accurate: 99.9% → 100.0%
Time: 6.2s
Alternatives: 10
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \end{array} \]
(FPCore (a b)
 :precision binary64
 (- (+ (pow (+ (* a a) (* b b)) 2.0) (* 4.0 (* b b))) 1.0))
double code(double a, double b) {
	return (pow(((a * a) + (b * b)), 2.0) + (4.0 * (b * b))) - 1.0;
}
real(8) function code(a, b)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = ((((a * a) + (b * b)) ** 2.0d0) + (4.0d0 * (b * b))) - 1.0d0
end function
public static double code(double a, double b) {
	return (Math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (b * b))) - 1.0;
}
def code(a, b):
	return (math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (b * b))) - 1.0
function code(a, b)
	return Float64(Float64((Float64(Float64(a * a) + Float64(b * b)) ^ 2.0) + Float64(4.0 * Float64(b * b))) - 1.0)
end
function tmp = code(a, b)
	tmp = ((((a * a) + (b * b)) ^ 2.0) + (4.0 * (b * b))) - 1.0;
end
code[a_, b_] := N[(N[(N[Power[N[(N[(a * a), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(4.0 * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]
\begin{array}{l}

\\
\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1
\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 10 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: 99.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \end{array} \]
(FPCore (a b)
 :precision binary64
 (- (+ (pow (+ (* a a) (* b b)) 2.0) (* 4.0 (* b b))) 1.0))
double code(double a, double b) {
	return (pow(((a * a) + (b * b)), 2.0) + (4.0 * (b * b))) - 1.0;
}
real(8) function code(a, b)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = ((((a * a) + (b * b)) ** 2.0d0) + (4.0d0 * (b * b))) - 1.0d0
end function
public static double code(double a, double b) {
	return (Math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (b * b))) - 1.0;
}
def code(a, b):
	return (math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (b * b))) - 1.0
function code(a, b)
	return Float64(Float64((Float64(Float64(a * a) + Float64(b * b)) ^ 2.0) + Float64(4.0 * Float64(b * b))) - 1.0)
end
function tmp = code(a, b)
	tmp = ((((a * a) + (b * b)) ^ 2.0) + (4.0 * (b * b))) - 1.0;
end
code[a_, b_] := N[(N[(N[Power[N[(N[(a * a), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(4.0 * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]
\begin{array}{l}

\\
\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1
\end{array}

Alternative 1: 100.0% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \left(\left({a}^{4} + \left(a \cdot \left(b \cdot \left(a \cdot b\right)\right)\right) \cdot 2\right) + {b}^{4}\right) + \mathsf{fma}\left(b, 4 \cdot b, -1\right) \end{array} \]
(FPCore (a b)
 :precision binary64
 (+
  (+ (+ (pow a 4.0) (* (* a (* b (* a b))) 2.0)) (pow b 4.0))
  (fma b (* 4.0 b) -1.0)))
double code(double a, double b) {
	return ((pow(a, 4.0) + ((a * (b * (a * b))) * 2.0)) + pow(b, 4.0)) + fma(b, (4.0 * b), -1.0);
}
function code(a, b)
	return Float64(Float64(Float64((a ^ 4.0) + Float64(Float64(a * Float64(b * Float64(a * b))) * 2.0)) + (b ^ 4.0)) + fma(b, Float64(4.0 * b), -1.0))
end
code[a_, b_] := N[(N[(N[(N[Power[a, 4.0], $MachinePrecision] + N[(N[(a * N[(b * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision] + N[Power[b, 4.0], $MachinePrecision]), $MachinePrecision] + N[(b * N[(4.0 * b), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(\left({a}^{4} + \left(a \cdot \left(b \cdot \left(a \cdot b\right)\right)\right) \cdot 2\right) + {b}^{4}\right) + \mathsf{fma}\left(b, 4 \cdot b, -1\right)
\end{array}
Derivation
  1. Initial program 99.9%

    \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
  2. Step-by-step derivation
    1. associate--l+99.9%

      \[\leadsto \color{blue}{{\left(a \cdot a + b \cdot b\right)}^{2} + \left(4 \cdot \left(b \cdot b\right) - 1\right)} \]
    2. unpow299.9%

      \[\leadsto \color{blue}{\left(a \cdot a + b \cdot b\right) \cdot \left(a \cdot a + b \cdot b\right)} + \left(4 \cdot \left(b \cdot b\right) - 1\right) \]
    3. unpow199.9%

      \[\leadsto \left(a \cdot a + b \cdot b\right) \cdot \color{blue}{{\left(a \cdot a + b \cdot b\right)}^{1}} + \left(4 \cdot \left(b \cdot b\right) - 1\right) \]
    4. sqr-pow99.9%

      \[\leadsto \left(a \cdot a + b \cdot b\right) \cdot \color{blue}{\left({\left(a \cdot a + b \cdot b\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(a \cdot a + b \cdot b\right)}^{\left(\frac{1}{2}\right)}\right)} + \left(4 \cdot \left(b \cdot b\right) - 1\right) \]
    5. associate-*r*99.9%

      \[\leadsto \color{blue}{\left(\left(a \cdot a + b \cdot b\right) \cdot {\left(a \cdot a + b \cdot b\right)}^{\left(\frac{1}{2}\right)}\right) \cdot {\left(a \cdot a + b \cdot b\right)}^{\left(\frac{1}{2}\right)}} + \left(4 \cdot \left(b \cdot b\right) - 1\right) \]
    6. unpow199.9%

      \[\leadsto \left(\color{blue}{{\left(a \cdot a + b \cdot b\right)}^{1}} \cdot {\left(a \cdot a + b \cdot b\right)}^{\left(\frac{1}{2}\right)}\right) \cdot {\left(a \cdot a + b \cdot b\right)}^{\left(\frac{1}{2}\right)} + \left(4 \cdot \left(b \cdot b\right) - 1\right) \]
    7. sqr-pow99.9%

      \[\leadsto \left(\color{blue}{\left({\left(a \cdot a + b \cdot b\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(a \cdot a + b \cdot b\right)}^{\left(\frac{1}{2}\right)}\right)} \cdot {\left(a \cdot a + b \cdot b\right)}^{\left(\frac{1}{2}\right)}\right) \cdot {\left(a \cdot a + b \cdot b\right)}^{\left(\frac{1}{2}\right)} + \left(4 \cdot \left(b \cdot b\right) - 1\right) \]
    8. unpow399.9%

      \[\leadsto \color{blue}{{\left({\left(a \cdot a + b \cdot b\right)}^{\left(\frac{1}{2}\right)}\right)}^{3}} \cdot {\left(a \cdot a + b \cdot b\right)}^{\left(\frac{1}{2}\right)} + \left(4 \cdot \left(b \cdot b\right) - 1\right) \]
    9. pow-plus100.0%

      \[\leadsto \color{blue}{{\left({\left(a \cdot a + b \cdot b\right)}^{\left(\frac{1}{2}\right)}\right)}^{\left(3 + 1\right)}} + \left(4 \cdot \left(b \cdot b\right) - 1\right) \]
    10. metadata-eval100.0%

      \[\leadsto {\left({\left(a \cdot a + b \cdot b\right)}^{\color{blue}{0.5}}\right)}^{\left(3 + 1\right)} + \left(4 \cdot \left(b \cdot b\right) - 1\right) \]
    11. unpow1/2100.0%

      \[\leadsto {\color{blue}{\left(\sqrt{a \cdot a + b \cdot b}\right)}}^{\left(3 + 1\right)} + \left(4 \cdot \left(b \cdot b\right) - 1\right) \]
    12. hypot-def100.0%

      \[\leadsto {\color{blue}{\left(\mathsf{hypot}\left(a, b\right)\right)}}^{\left(3 + 1\right)} + \left(4 \cdot \left(b \cdot b\right) - 1\right) \]
    13. metadata-eval100.0%

      \[\leadsto {\left(\mathsf{hypot}\left(a, b\right)\right)}^{\color{blue}{4}} + \left(4 \cdot \left(b \cdot b\right) - 1\right) \]
    14. associate-*r*100.0%

      \[\leadsto {\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} + \left(\color{blue}{\left(4 \cdot b\right) \cdot b} - 1\right) \]
    15. *-commutative100.0%

      \[\leadsto {\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} + \left(\color{blue}{b \cdot \left(4 \cdot b\right)} - 1\right) \]
  3. Simplified100.0%

    \[\leadsto \color{blue}{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} + \mathsf{fma}\left(b, b \cdot 4, -1\right)} \]
  4. Taylor expanded in a around 0 87.5%

    \[\leadsto \color{blue}{\left(2 \cdot \left({a}^{2} \cdot {b}^{2}\right) + \left({a}^{4} + {b}^{4}\right)\right)} + \mathsf{fma}\left(b, b \cdot 4, -1\right) \]
  5. Step-by-step derivation
    1. associate-+r+87.5%

      \[\leadsto \color{blue}{\left(\left(2 \cdot \left({a}^{2} \cdot {b}^{2}\right) + {a}^{4}\right) + {b}^{4}\right)} + \mathsf{fma}\left(b, b \cdot 4, -1\right) \]
    2. fma-def87.5%

      \[\leadsto \left(\color{blue}{\mathsf{fma}\left(2, {a}^{2} \cdot {b}^{2}, {a}^{4}\right)} + {b}^{4}\right) + \mathsf{fma}\left(b, b \cdot 4, -1\right) \]
    3. unpow287.5%

      \[\leadsto \left(\mathsf{fma}\left(2, \color{blue}{\left(a \cdot a\right)} \cdot {b}^{2}, {a}^{4}\right) + {b}^{4}\right) + \mathsf{fma}\left(b, b \cdot 4, -1\right) \]
    4. unpow287.5%

      \[\leadsto \left(\mathsf{fma}\left(2, \left(a \cdot a\right) \cdot \color{blue}{\left(b \cdot b\right)}, {a}^{4}\right) + {b}^{4}\right) + \mathsf{fma}\left(b, b \cdot 4, -1\right) \]
  6. Simplified87.5%

    \[\leadsto \color{blue}{\left(\mathsf{fma}\left(2, \left(a \cdot a\right) \cdot \left(b \cdot b\right), {a}^{4}\right) + {b}^{4}\right)} + \mathsf{fma}\left(b, b \cdot 4, -1\right) \]
  7. Step-by-step derivation
    1. fma-udef87.5%

      \[\leadsto \left(\color{blue}{\left(2 \cdot \left(\left(a \cdot a\right) \cdot \left(b \cdot b\right)\right) + {a}^{4}\right)} + {b}^{4}\right) + \mathsf{fma}\left(b, b \cdot 4, -1\right) \]
    2. +-commutative87.5%

      \[\leadsto \left(\color{blue}{\left({a}^{4} + 2 \cdot \left(\left(a \cdot a\right) \cdot \left(b \cdot b\right)\right)\right)} + {b}^{4}\right) + \mathsf{fma}\left(b, b \cdot 4, -1\right) \]
    3. *-commutative87.5%

      \[\leadsto \left(\left({a}^{4} + \color{blue}{\left(\left(a \cdot a\right) \cdot \left(b \cdot b\right)\right) \cdot 2}\right) + {b}^{4}\right) + \mathsf{fma}\left(b, b \cdot 4, -1\right) \]
    4. unswap-sqr100.0%

      \[\leadsto \left(\left({a}^{4} + \color{blue}{\left(\left(a \cdot b\right) \cdot \left(a \cdot b\right)\right)} \cdot 2\right) + {b}^{4}\right) + \mathsf{fma}\left(b, b \cdot 4, -1\right) \]
    5. pow2100.0%

      \[\leadsto \left(\left({a}^{4} + \color{blue}{{\left(a \cdot b\right)}^{2}} \cdot 2\right) + {b}^{4}\right) + \mathsf{fma}\left(b, b \cdot 4, -1\right) \]
  8. Applied egg-rr100.0%

    \[\leadsto \left(\color{blue}{\left({a}^{4} + {\left(a \cdot b\right)}^{2} \cdot 2\right)} + {b}^{4}\right) + \mathsf{fma}\left(b, b \cdot 4, -1\right) \]
  9. Step-by-step derivation
    1. unpow2100.0%

      \[\leadsto \left(\left({a}^{4} + \color{blue}{\left(\left(a \cdot b\right) \cdot \left(a \cdot b\right)\right)} \cdot 2\right) + {b}^{4}\right) + \mathsf{fma}\left(b, b \cdot 4, -1\right) \]
    2. *-commutative100.0%

      \[\leadsto \left(\left({a}^{4} + \left(\left(a \cdot b\right) \cdot \color{blue}{\left(b \cdot a\right)}\right) \cdot 2\right) + {b}^{4}\right) + \mathsf{fma}\left(b, b \cdot 4, -1\right) \]
    3. associate-*r*100.0%

      \[\leadsto \left(\left({a}^{4} + \color{blue}{\left(\left(\left(a \cdot b\right) \cdot b\right) \cdot a\right)} \cdot 2\right) + {b}^{4}\right) + \mathsf{fma}\left(b, b \cdot 4, -1\right) \]
  10. Applied egg-rr100.0%

    \[\leadsto \left(\left({a}^{4} + \color{blue}{\left(\left(\left(a \cdot b\right) \cdot b\right) \cdot a\right)} \cdot 2\right) + {b}^{4}\right) + \mathsf{fma}\left(b, b \cdot 4, -1\right) \]
  11. Final simplification100.0%

    \[\leadsto \left(\left({a}^{4} + \left(a \cdot \left(b \cdot \left(a \cdot b\right)\right)\right) \cdot 2\right) + {b}^{4}\right) + \mathsf{fma}\left(b, 4 \cdot b, -1\right) \]

Alternative 2: 100.0% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(b, 4 \cdot b, -1\right) + {\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} \end{array} \]
(FPCore (a b)
 :precision binary64
 (+ (fma b (* 4.0 b) -1.0) (pow (hypot a b) 4.0)))
double code(double a, double b) {
	return fma(b, (4.0 * b), -1.0) + pow(hypot(a, b), 4.0);
}
function code(a, b)
	return Float64(fma(b, Float64(4.0 * b), -1.0) + (hypot(a, b) ^ 4.0))
end
code[a_, b_] := N[(N[(b * N[(4.0 * b), $MachinePrecision] + -1.0), $MachinePrecision] + N[Power[N[Sqrt[a ^ 2 + b ^ 2], $MachinePrecision], 4.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(b, 4 \cdot b, -1\right) + {\left(\mathsf{hypot}\left(a, b\right)\right)}^{4}
\end{array}
Derivation
  1. Initial program 99.9%

    \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
  2. Step-by-step derivation
    1. associate--l+99.9%

      \[\leadsto \color{blue}{{\left(a \cdot a + b \cdot b\right)}^{2} + \left(4 \cdot \left(b \cdot b\right) - 1\right)} \]
    2. unpow299.9%

      \[\leadsto \color{blue}{\left(a \cdot a + b \cdot b\right) \cdot \left(a \cdot a + b \cdot b\right)} + \left(4 \cdot \left(b \cdot b\right) - 1\right) \]
    3. unpow199.9%

      \[\leadsto \left(a \cdot a + b \cdot b\right) \cdot \color{blue}{{\left(a \cdot a + b \cdot b\right)}^{1}} + \left(4 \cdot \left(b \cdot b\right) - 1\right) \]
    4. sqr-pow99.9%

      \[\leadsto \left(a \cdot a + b \cdot b\right) \cdot \color{blue}{\left({\left(a \cdot a + b \cdot b\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(a \cdot a + b \cdot b\right)}^{\left(\frac{1}{2}\right)}\right)} + \left(4 \cdot \left(b \cdot b\right) - 1\right) \]
    5. associate-*r*99.9%

      \[\leadsto \color{blue}{\left(\left(a \cdot a + b \cdot b\right) \cdot {\left(a \cdot a + b \cdot b\right)}^{\left(\frac{1}{2}\right)}\right) \cdot {\left(a \cdot a + b \cdot b\right)}^{\left(\frac{1}{2}\right)}} + \left(4 \cdot \left(b \cdot b\right) - 1\right) \]
    6. unpow199.9%

      \[\leadsto \left(\color{blue}{{\left(a \cdot a + b \cdot b\right)}^{1}} \cdot {\left(a \cdot a + b \cdot b\right)}^{\left(\frac{1}{2}\right)}\right) \cdot {\left(a \cdot a + b \cdot b\right)}^{\left(\frac{1}{2}\right)} + \left(4 \cdot \left(b \cdot b\right) - 1\right) \]
    7. sqr-pow99.9%

      \[\leadsto \left(\color{blue}{\left({\left(a \cdot a + b \cdot b\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(a \cdot a + b \cdot b\right)}^{\left(\frac{1}{2}\right)}\right)} \cdot {\left(a \cdot a + b \cdot b\right)}^{\left(\frac{1}{2}\right)}\right) \cdot {\left(a \cdot a + b \cdot b\right)}^{\left(\frac{1}{2}\right)} + \left(4 \cdot \left(b \cdot b\right) - 1\right) \]
    8. unpow399.9%

      \[\leadsto \color{blue}{{\left({\left(a \cdot a + b \cdot b\right)}^{\left(\frac{1}{2}\right)}\right)}^{3}} \cdot {\left(a \cdot a + b \cdot b\right)}^{\left(\frac{1}{2}\right)} + \left(4 \cdot \left(b \cdot b\right) - 1\right) \]
    9. pow-plus100.0%

      \[\leadsto \color{blue}{{\left({\left(a \cdot a + b \cdot b\right)}^{\left(\frac{1}{2}\right)}\right)}^{\left(3 + 1\right)}} + \left(4 \cdot \left(b \cdot b\right) - 1\right) \]
    10. metadata-eval100.0%

      \[\leadsto {\left({\left(a \cdot a + b \cdot b\right)}^{\color{blue}{0.5}}\right)}^{\left(3 + 1\right)} + \left(4 \cdot \left(b \cdot b\right) - 1\right) \]
    11. unpow1/2100.0%

      \[\leadsto {\color{blue}{\left(\sqrt{a \cdot a + b \cdot b}\right)}}^{\left(3 + 1\right)} + \left(4 \cdot \left(b \cdot b\right) - 1\right) \]
    12. hypot-def100.0%

      \[\leadsto {\color{blue}{\left(\mathsf{hypot}\left(a, b\right)\right)}}^{\left(3 + 1\right)} + \left(4 \cdot \left(b \cdot b\right) - 1\right) \]
    13. metadata-eval100.0%

      \[\leadsto {\left(\mathsf{hypot}\left(a, b\right)\right)}^{\color{blue}{4}} + \left(4 \cdot \left(b \cdot b\right) - 1\right) \]
    14. associate-*r*100.0%

      \[\leadsto {\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} + \left(\color{blue}{\left(4 \cdot b\right) \cdot b} - 1\right) \]
    15. *-commutative100.0%

      \[\leadsto {\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} + \left(\color{blue}{b \cdot \left(4 \cdot b\right)} - 1\right) \]
  3. Simplified100.0%

    \[\leadsto \color{blue}{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} + \mathsf{fma}\left(b, b \cdot 4, -1\right)} \]
  4. Final simplification100.0%

    \[\leadsto \mathsf{fma}\left(b, 4 \cdot b, -1\right) + {\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} \]

Alternative 3: 99.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) + -1 \end{array} \]
(FPCore (a b)
 :precision binary64
 (+ (+ (pow (+ (* a a) (* b b)) 2.0) (* 4.0 (* b b))) -1.0))
double code(double a, double b) {
	return (pow(((a * a) + (b * b)), 2.0) + (4.0 * (b * b))) + -1.0;
}
real(8) function code(a, b)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = ((((a * a) + (b * b)) ** 2.0d0) + (4.0d0 * (b * b))) + (-1.0d0)
end function
public static double code(double a, double b) {
	return (Math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (b * b))) + -1.0;
}
def code(a, b):
	return (math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (b * b))) + -1.0
function code(a, b)
	return Float64(Float64((Float64(Float64(a * a) + Float64(b * b)) ^ 2.0) + Float64(4.0 * Float64(b * b))) + -1.0)
end
function tmp = code(a, b)
	tmp = ((((a * a) + (b * b)) ^ 2.0) + (4.0 * (b * b))) + -1.0;
end
code[a_, b_] := N[(N[(N[Power[N[(N[(a * a), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(4.0 * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]
\begin{array}{l}

\\
\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) + -1
\end{array}
Derivation
  1. Initial program 99.9%

    \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
  2. Final simplification99.9%

    \[\leadsto \left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) + -1 \]

Alternative 4: 97.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 4 \cdot \left(b \cdot b\right)\\ \mathbf{if}\;a \cdot a \leq 7.5 \cdot 10^{+15}:\\ \;\;\;\;\left({b}^{4} + t_0\right) + -1\\ \mathbf{else}:\\ \;\;\;\;\left(t_0 + \left(a \cdot a\right) \cdot \left(a \cdot a\right)\right) + -1\\ \end{array} \end{array} \]
(FPCore (a b)
 :precision binary64
 (let* ((t_0 (* 4.0 (* b b))))
   (if (<= (* a a) 7.5e+15)
     (+ (+ (pow b 4.0) t_0) -1.0)
     (+ (+ t_0 (* (* a a) (* a a))) -1.0))))
double code(double a, double b) {
	double t_0 = 4.0 * (b * b);
	double tmp;
	if ((a * a) <= 7.5e+15) {
		tmp = (pow(b, 4.0) + t_0) + -1.0;
	} else {
		tmp = (t_0 + ((a * a) * (a * a))) + -1.0;
	}
	return tmp;
}
real(8) function code(a, b)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: t_0
    real(8) :: tmp
    t_0 = 4.0d0 * (b * b)
    if ((a * a) <= 7.5d+15) then
        tmp = ((b ** 4.0d0) + t_0) + (-1.0d0)
    else
        tmp = (t_0 + ((a * a) * (a * a))) + (-1.0d0)
    end if
    code = tmp
end function
public static double code(double a, double b) {
	double t_0 = 4.0 * (b * b);
	double tmp;
	if ((a * a) <= 7.5e+15) {
		tmp = (Math.pow(b, 4.0) + t_0) + -1.0;
	} else {
		tmp = (t_0 + ((a * a) * (a * a))) + -1.0;
	}
	return tmp;
}
def code(a, b):
	t_0 = 4.0 * (b * b)
	tmp = 0
	if (a * a) <= 7.5e+15:
		tmp = (math.pow(b, 4.0) + t_0) + -1.0
	else:
		tmp = (t_0 + ((a * a) * (a * a))) + -1.0
	return tmp
function code(a, b)
	t_0 = Float64(4.0 * Float64(b * b))
	tmp = 0.0
	if (Float64(a * a) <= 7.5e+15)
		tmp = Float64(Float64((b ^ 4.0) + t_0) + -1.0);
	else
		tmp = Float64(Float64(t_0 + Float64(Float64(a * a) * Float64(a * a))) + -1.0);
	end
	return tmp
end
function tmp_2 = code(a, b)
	t_0 = 4.0 * (b * b);
	tmp = 0.0;
	if ((a * a) <= 7.5e+15)
		tmp = ((b ^ 4.0) + t_0) + -1.0;
	else
		tmp = (t_0 + ((a * a) * (a * a))) + -1.0;
	end
	tmp_2 = tmp;
end
code[a_, b_] := Block[{t$95$0 = N[(4.0 * N[(b * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * a), $MachinePrecision], 7.5e+15], N[(N[(N[Power[b, 4.0], $MachinePrecision] + t$95$0), $MachinePrecision] + -1.0), $MachinePrecision], N[(N[(t$95$0 + N[(N[(a * a), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 4 \cdot \left(b \cdot b\right)\\
\mathbf{if}\;a \cdot a \leq 7.5 \cdot 10^{+15}:\\
\;\;\;\;\left({b}^{4} + t_0\right) + -1\\

\mathbf{else}:\\
\;\;\;\;\left(t_0 + \left(a \cdot a\right) \cdot \left(a \cdot a\right)\right) + -1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 a a) < 7.5e15

    1. Initial program 99.8%

      \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
    2. Taylor expanded in a around 0 98.6%

      \[\leadsto \left({\color{blue}{\left({b}^{2}\right)}}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
    3. Step-by-step derivation
      1. unpow298.6%

        \[\leadsto \left({\color{blue}{\left(b \cdot b\right)}}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
    4. Simplified98.6%

      \[\leadsto \left({\color{blue}{\left(b \cdot b\right)}}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
    5. Step-by-step derivation
      1. unpow-prod-down98.6%

        \[\leadsto \left(\color{blue}{{b}^{2} \cdot {b}^{2}} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
      2. pow-prod-up98.8%

        \[\leadsto \left(\color{blue}{{b}^{\left(2 + 2\right)}} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
      3. metadata-eval98.8%

        \[\leadsto \left({b}^{\color{blue}{4}} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
      4. +-commutative98.8%

        \[\leadsto \color{blue}{\left(4 \cdot \left(b \cdot b\right) + {b}^{4}\right)} - 1 \]
      5. metadata-eval98.8%

        \[\leadsto \left(4 \cdot \left(b \cdot b\right) + {b}^{\color{blue}{\left(2 + 2\right)}}\right) - 1 \]
      6. pow-prod-up98.6%

        \[\leadsto \left(4 \cdot \left(b \cdot b\right) + \color{blue}{{b}^{2} \cdot {b}^{2}}\right) - 1 \]
      7. pow298.6%

        \[\leadsto \left(4 \cdot \left(b \cdot b\right) + \color{blue}{\left(b \cdot b\right)} \cdot {b}^{2}\right) - 1 \]
      8. pow298.6%

        \[\leadsto \left(4 \cdot \left(b \cdot b\right) + \left(b \cdot b\right) \cdot \color{blue}{\left(b \cdot b\right)}\right) - 1 \]
      9. distribute-rgt-out98.6%

        \[\leadsto \color{blue}{\left(b \cdot b\right) \cdot \left(4 + b \cdot b\right)} - 1 \]
    6. Applied egg-rr98.6%

      \[\leadsto \color{blue}{\left(b \cdot b\right) \cdot \left(4 + b \cdot b\right)} - 1 \]
    7. Step-by-step derivation
      1. +-commutative98.6%

        \[\leadsto \left(b \cdot b\right) \cdot \color{blue}{\left(b \cdot b + 4\right)} - 1 \]
      2. distribute-rgt-in98.6%

        \[\leadsto \color{blue}{\left(\left(b \cdot b\right) \cdot \left(b \cdot b\right) + 4 \cdot \left(b \cdot b\right)\right)} - 1 \]
      3. pow298.6%

        \[\leadsto \left(\color{blue}{{b}^{2}} \cdot \left(b \cdot b\right) + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
      4. pow298.6%

        \[\leadsto \left({b}^{2} \cdot \color{blue}{{b}^{2}} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
      5. pow-sqr98.8%

        \[\leadsto \left(\color{blue}{{b}^{\left(2 \cdot 2\right)}} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
      6. metadata-eval98.8%

        \[\leadsto \left({b}^{\color{blue}{4}} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
    8. Applied egg-rr98.8%

      \[\leadsto \color{blue}{\left({b}^{4} + 4 \cdot \left(b \cdot b\right)\right)} - 1 \]

    if 7.5e15 < (*.f64 a a)

    1. Initial program 99.9%

      \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
    2. Taylor expanded in a around inf 96.3%

      \[\leadsto \left({\color{blue}{\left({a}^{2}\right)}}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
    3. Step-by-step derivation
      1. unpow296.3%

        \[\leadsto \left({\color{blue}{\left(a \cdot a\right)}}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
    4. Simplified96.3%

      \[\leadsto \left({\color{blue}{\left(a \cdot a\right)}}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
    5. Step-by-step derivation
      1. unpow296.4%

        \[\leadsto \left(\color{blue}{\left(a \cdot a\right) \cdot \left(a \cdot a\right)} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
    6. Applied egg-rr96.4%

      \[\leadsto \left(\color{blue}{\left(a \cdot a\right) \cdot \left(a \cdot a\right)} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
  3. Recombined 2 regimes into one program.
  4. Final simplification97.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot a \leq 7.5 \cdot 10^{+15}:\\ \;\;\;\;\left({b}^{4} + 4 \cdot \left(b \cdot b\right)\right) + -1\\ \mathbf{else}:\\ \;\;\;\;\left(4 \cdot \left(b \cdot b\right) + \left(a \cdot a\right) \cdot \left(a \cdot a\right)\right) + -1\\ \end{array} \]

Alternative 5: 97.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 4 \cdot \left(b \cdot b\right)\\ \mathbf{if}\;a \cdot a \leq 10^{+16}:\\ \;\;\;\;\left({b}^{4} + t_0\right) + -1\\ \mathbf{else}:\\ \;\;\;\;\left({a}^{4} + t_0\right) + -1\\ \end{array} \end{array} \]
(FPCore (a b)
 :precision binary64
 (let* ((t_0 (* 4.0 (* b b))))
   (if (<= (* a a) 1e+16)
     (+ (+ (pow b 4.0) t_0) -1.0)
     (+ (+ (pow a 4.0) t_0) -1.0))))
double code(double a, double b) {
	double t_0 = 4.0 * (b * b);
	double tmp;
	if ((a * a) <= 1e+16) {
		tmp = (pow(b, 4.0) + t_0) + -1.0;
	} else {
		tmp = (pow(a, 4.0) + t_0) + -1.0;
	}
	return tmp;
}
real(8) function code(a, b)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: t_0
    real(8) :: tmp
    t_0 = 4.0d0 * (b * b)
    if ((a * a) <= 1d+16) then
        tmp = ((b ** 4.0d0) + t_0) + (-1.0d0)
    else
        tmp = ((a ** 4.0d0) + t_0) + (-1.0d0)
    end if
    code = tmp
end function
public static double code(double a, double b) {
	double t_0 = 4.0 * (b * b);
	double tmp;
	if ((a * a) <= 1e+16) {
		tmp = (Math.pow(b, 4.0) + t_0) + -1.0;
	} else {
		tmp = (Math.pow(a, 4.0) + t_0) + -1.0;
	}
	return tmp;
}
def code(a, b):
	t_0 = 4.0 * (b * b)
	tmp = 0
	if (a * a) <= 1e+16:
		tmp = (math.pow(b, 4.0) + t_0) + -1.0
	else:
		tmp = (math.pow(a, 4.0) + t_0) + -1.0
	return tmp
function code(a, b)
	t_0 = Float64(4.0 * Float64(b * b))
	tmp = 0.0
	if (Float64(a * a) <= 1e+16)
		tmp = Float64(Float64((b ^ 4.0) + t_0) + -1.0);
	else
		tmp = Float64(Float64((a ^ 4.0) + t_0) + -1.0);
	end
	return tmp
end
function tmp_2 = code(a, b)
	t_0 = 4.0 * (b * b);
	tmp = 0.0;
	if ((a * a) <= 1e+16)
		tmp = ((b ^ 4.0) + t_0) + -1.0;
	else
		tmp = ((a ^ 4.0) + t_0) + -1.0;
	end
	tmp_2 = tmp;
end
code[a_, b_] := Block[{t$95$0 = N[(4.0 * N[(b * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * a), $MachinePrecision], 1e+16], N[(N[(N[Power[b, 4.0], $MachinePrecision] + t$95$0), $MachinePrecision] + -1.0), $MachinePrecision], N[(N[(N[Power[a, 4.0], $MachinePrecision] + t$95$0), $MachinePrecision] + -1.0), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 4 \cdot \left(b \cdot b\right)\\
\mathbf{if}\;a \cdot a \leq 10^{+16}:\\
\;\;\;\;\left({b}^{4} + t_0\right) + -1\\

\mathbf{else}:\\
\;\;\;\;\left({a}^{4} + t_0\right) + -1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 a a) < 1e16

    1. Initial program 99.8%

      \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
    2. Taylor expanded in a around 0 98.6%

      \[\leadsto \left({\color{blue}{\left({b}^{2}\right)}}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
    3. Step-by-step derivation
      1. unpow298.6%

        \[\leadsto \left({\color{blue}{\left(b \cdot b\right)}}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
    4. Simplified98.6%

      \[\leadsto \left({\color{blue}{\left(b \cdot b\right)}}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
    5. Step-by-step derivation
      1. unpow-prod-down98.6%

        \[\leadsto \left(\color{blue}{{b}^{2} \cdot {b}^{2}} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
      2. pow-prod-up98.8%

        \[\leadsto \left(\color{blue}{{b}^{\left(2 + 2\right)}} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
      3. metadata-eval98.8%

        \[\leadsto \left({b}^{\color{blue}{4}} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
      4. +-commutative98.8%

        \[\leadsto \color{blue}{\left(4 \cdot \left(b \cdot b\right) + {b}^{4}\right)} - 1 \]
      5. metadata-eval98.8%

        \[\leadsto \left(4 \cdot \left(b \cdot b\right) + {b}^{\color{blue}{\left(2 + 2\right)}}\right) - 1 \]
      6. pow-prod-up98.6%

        \[\leadsto \left(4 \cdot \left(b \cdot b\right) + \color{blue}{{b}^{2} \cdot {b}^{2}}\right) - 1 \]
      7. pow298.6%

        \[\leadsto \left(4 \cdot \left(b \cdot b\right) + \color{blue}{\left(b \cdot b\right)} \cdot {b}^{2}\right) - 1 \]
      8. pow298.6%

        \[\leadsto \left(4 \cdot \left(b \cdot b\right) + \left(b \cdot b\right) \cdot \color{blue}{\left(b \cdot b\right)}\right) - 1 \]
      9. distribute-rgt-out98.6%

        \[\leadsto \color{blue}{\left(b \cdot b\right) \cdot \left(4 + b \cdot b\right)} - 1 \]
    6. Applied egg-rr98.6%

      \[\leadsto \color{blue}{\left(b \cdot b\right) \cdot \left(4 + b \cdot b\right)} - 1 \]
    7. Step-by-step derivation
      1. +-commutative98.6%

        \[\leadsto \left(b \cdot b\right) \cdot \color{blue}{\left(b \cdot b + 4\right)} - 1 \]
      2. distribute-rgt-in98.6%

        \[\leadsto \color{blue}{\left(\left(b \cdot b\right) \cdot \left(b \cdot b\right) + 4 \cdot \left(b \cdot b\right)\right)} - 1 \]
      3. pow298.6%

        \[\leadsto \left(\color{blue}{{b}^{2}} \cdot \left(b \cdot b\right) + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
      4. pow298.6%

        \[\leadsto \left({b}^{2} \cdot \color{blue}{{b}^{2}} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
      5. pow-sqr98.8%

        \[\leadsto \left(\color{blue}{{b}^{\left(2 \cdot 2\right)}} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
      6. metadata-eval98.8%

        \[\leadsto \left({b}^{\color{blue}{4}} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
    8. Applied egg-rr98.8%

      \[\leadsto \color{blue}{\left({b}^{4} + 4 \cdot \left(b \cdot b\right)\right)} - 1 \]

    if 1e16 < (*.f64 a a)

    1. Initial program 99.9%

      \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
    2. Taylor expanded in a around inf 96.3%

      \[\leadsto \left({\color{blue}{\left({a}^{2}\right)}}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
    3. Step-by-step derivation
      1. unpow296.3%

        \[\leadsto \left({\color{blue}{\left(a \cdot a\right)}}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
    4. Simplified96.3%

      \[\leadsto \left({\color{blue}{\left(a \cdot a\right)}}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
    5. Step-by-step derivation
      1. unpow-prod-down96.4%

        \[\leadsto \left(\color{blue}{{a}^{2} \cdot {a}^{2}} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
      2. pow-sqr96.4%

        \[\leadsto \left(\color{blue}{{a}^{\left(2 \cdot 2\right)}} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
      3. metadata-eval96.4%

        \[\leadsto \left({a}^{\color{blue}{4}} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
      4. *-un-lft-identity96.4%

        \[\leadsto \left(\color{blue}{1 \cdot {a}^{4}} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
      5. *-commutative96.4%

        \[\leadsto \left(\color{blue}{{a}^{4} \cdot 1} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
    6. Applied egg-rr96.4%

      \[\leadsto \left(\color{blue}{{a}^{4} \cdot 1} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
  3. Recombined 2 regimes into one program.
  4. Final simplification97.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot a \leq 10^{+16}:\\ \;\;\;\;\left({b}^{4} + 4 \cdot \left(b \cdot b\right)\right) + -1\\ \mathbf{else}:\\ \;\;\;\;\left({a}^{4} + 4 \cdot \left(b \cdot b\right)\right) + -1\\ \end{array} \]

Alternative 6: 97.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot a \leq 7.5 \cdot 10^{+15}:\\ \;\;\;\;b \cdot \left(b \cdot \mathsf{fma}\left(b, b, 4\right)\right) + -1\\ \mathbf{else}:\\ \;\;\;\;\left(4 \cdot \left(b \cdot b\right) + \left(a \cdot a\right) \cdot \left(a \cdot a\right)\right) + -1\\ \end{array} \end{array} \]
(FPCore (a b)
 :precision binary64
 (if (<= (* a a) 7.5e+15)
   (+ (* b (* b (fma b b 4.0))) -1.0)
   (+ (+ (* 4.0 (* b b)) (* (* a a) (* a a))) -1.0)))
double code(double a, double b) {
	double tmp;
	if ((a * a) <= 7.5e+15) {
		tmp = (b * (b * fma(b, b, 4.0))) + -1.0;
	} else {
		tmp = ((4.0 * (b * b)) + ((a * a) * (a * a))) + -1.0;
	}
	return tmp;
}
function code(a, b)
	tmp = 0.0
	if (Float64(a * a) <= 7.5e+15)
		tmp = Float64(Float64(b * Float64(b * fma(b, b, 4.0))) + -1.0);
	else
		tmp = Float64(Float64(Float64(4.0 * Float64(b * b)) + Float64(Float64(a * a) * Float64(a * a))) + -1.0);
	end
	return tmp
end
code[a_, b_] := If[LessEqual[N[(a * a), $MachinePrecision], 7.5e+15], N[(N[(b * N[(b * N[(b * b + 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[(N[(N[(4.0 * N[(b * b), $MachinePrecision]), $MachinePrecision] + N[(N[(a * a), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \cdot a \leq 7.5 \cdot 10^{+15}:\\
\;\;\;\;b \cdot \left(b \cdot \mathsf{fma}\left(b, b, 4\right)\right) + -1\\

\mathbf{else}:\\
\;\;\;\;\left(4 \cdot \left(b \cdot b\right) + \left(a \cdot a\right) \cdot \left(a \cdot a\right)\right) + -1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 a a) < 7.5e15

    1. Initial program 99.8%

      \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
    2. Taylor expanded in a around 0 98.6%

      \[\leadsto \left({\color{blue}{\left({b}^{2}\right)}}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
    3. Step-by-step derivation
      1. unpow298.6%

        \[\leadsto \left({\color{blue}{\left(b \cdot b\right)}}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
    4. Simplified98.6%

      \[\leadsto \left({\color{blue}{\left(b \cdot b\right)}}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
    5. Taylor expanded in b around 0 98.8%

      \[\leadsto \color{blue}{\left(4 \cdot {b}^{2} + {b}^{4}\right)} - 1 \]
    6. Step-by-step derivation
      1. unpow298.8%

        \[\leadsto \left(4 \cdot \color{blue}{\left(b \cdot b\right)} + {b}^{4}\right) - 1 \]
      2. metadata-eval98.8%

        \[\leadsto \left(4 \cdot \left(b \cdot b\right) + {b}^{\color{blue}{\left(3 + 1\right)}}\right) - 1 \]
      3. pow-plus98.7%

        \[\leadsto \left(4 \cdot \left(b \cdot b\right) + \color{blue}{{b}^{3} \cdot b}\right) - 1 \]
      4. unpow398.7%

        \[\leadsto \left(4 \cdot \left(b \cdot b\right) + \color{blue}{\left(\left(b \cdot b\right) \cdot b\right)} \cdot b\right) - 1 \]
      5. associate-*r*98.6%

        \[\leadsto \left(4 \cdot \left(b \cdot b\right) + \color{blue}{\left(b \cdot b\right) \cdot \left(b \cdot b\right)}\right) - 1 \]
      6. distribute-rgt-in98.6%

        \[\leadsto \color{blue}{\left(b \cdot b\right) \cdot \left(4 + b \cdot b\right)} - 1 \]
      7. associate-*l*98.7%

        \[\leadsto \color{blue}{b \cdot \left(b \cdot \left(4 + b \cdot b\right)\right)} - 1 \]
      8. +-commutative98.7%

        \[\leadsto b \cdot \left(b \cdot \color{blue}{\left(b \cdot b + 4\right)}\right) - 1 \]
      9. fma-udef98.7%

        \[\leadsto b \cdot \left(b \cdot \color{blue}{\mathsf{fma}\left(b, b, 4\right)}\right) - 1 \]
    7. Simplified98.7%

      \[\leadsto \color{blue}{b \cdot \left(b \cdot \mathsf{fma}\left(b, b, 4\right)\right)} - 1 \]

    if 7.5e15 < (*.f64 a a)

    1. Initial program 99.9%

      \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
    2. Taylor expanded in a around inf 96.3%

      \[\leadsto \left({\color{blue}{\left({a}^{2}\right)}}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
    3. Step-by-step derivation
      1. unpow296.3%

        \[\leadsto \left({\color{blue}{\left(a \cdot a\right)}}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
    4. Simplified96.3%

      \[\leadsto \left({\color{blue}{\left(a \cdot a\right)}}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
    5. Step-by-step derivation
      1. unpow296.4%

        \[\leadsto \left(\color{blue}{\left(a \cdot a\right) \cdot \left(a \cdot a\right)} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
    6. Applied egg-rr96.4%

      \[\leadsto \left(\color{blue}{\left(a \cdot a\right) \cdot \left(a \cdot a\right)} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
  3. Recombined 2 regimes into one program.
  4. Final simplification97.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot a \leq 7.5 \cdot 10^{+15}:\\ \;\;\;\;b \cdot \left(b \cdot \mathsf{fma}\left(b, b, 4\right)\right) + -1\\ \mathbf{else}:\\ \;\;\;\;\left(4 \cdot \left(b \cdot b\right) + \left(a \cdot a\right) \cdot \left(a \cdot a\right)\right) + -1\\ \end{array} \]

Alternative 7: 97.3% accurate, 6.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot a \leq 7.5 \cdot 10^{+15}:\\ \;\;\;\;\left(b \cdot b\right) \cdot \left(4 + b \cdot b\right) + -1\\ \mathbf{else}:\\ \;\;\;\;\left(4 \cdot \left(b \cdot b\right) + \left(a \cdot a\right) \cdot \left(a \cdot a\right)\right) + -1\\ \end{array} \end{array} \]
(FPCore (a b)
 :precision binary64
 (if (<= (* a a) 7.5e+15)
   (+ (* (* b b) (+ 4.0 (* b b))) -1.0)
   (+ (+ (* 4.0 (* b b)) (* (* a a) (* a a))) -1.0)))
double code(double a, double b) {
	double tmp;
	if ((a * a) <= 7.5e+15) {
		tmp = ((b * b) * (4.0 + (b * b))) + -1.0;
	} else {
		tmp = ((4.0 * (b * b)) + ((a * a) * (a * a))) + -1.0;
	}
	return tmp;
}
real(8) function code(a, b)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: tmp
    if ((a * a) <= 7.5d+15) then
        tmp = ((b * b) * (4.0d0 + (b * b))) + (-1.0d0)
    else
        tmp = ((4.0d0 * (b * b)) + ((a * a) * (a * a))) + (-1.0d0)
    end if
    code = tmp
end function
public static double code(double a, double b) {
	double tmp;
	if ((a * a) <= 7.5e+15) {
		tmp = ((b * b) * (4.0 + (b * b))) + -1.0;
	} else {
		tmp = ((4.0 * (b * b)) + ((a * a) * (a * a))) + -1.0;
	}
	return tmp;
}
def code(a, b):
	tmp = 0
	if (a * a) <= 7.5e+15:
		tmp = ((b * b) * (4.0 + (b * b))) + -1.0
	else:
		tmp = ((4.0 * (b * b)) + ((a * a) * (a * a))) + -1.0
	return tmp
function code(a, b)
	tmp = 0.0
	if (Float64(a * a) <= 7.5e+15)
		tmp = Float64(Float64(Float64(b * b) * Float64(4.0 + Float64(b * b))) + -1.0);
	else
		tmp = Float64(Float64(Float64(4.0 * Float64(b * b)) + Float64(Float64(a * a) * Float64(a * a))) + -1.0);
	end
	return tmp
end
function tmp_2 = code(a, b)
	tmp = 0.0;
	if ((a * a) <= 7.5e+15)
		tmp = ((b * b) * (4.0 + (b * b))) + -1.0;
	else
		tmp = ((4.0 * (b * b)) + ((a * a) * (a * a))) + -1.0;
	end
	tmp_2 = tmp;
end
code[a_, b_] := If[LessEqual[N[(a * a), $MachinePrecision], 7.5e+15], N[(N[(N[(b * b), $MachinePrecision] * N[(4.0 + N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[(N[(N[(4.0 * N[(b * b), $MachinePrecision]), $MachinePrecision] + N[(N[(a * a), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \cdot a \leq 7.5 \cdot 10^{+15}:\\
\;\;\;\;\left(b \cdot b\right) \cdot \left(4 + b \cdot b\right) + -1\\

\mathbf{else}:\\
\;\;\;\;\left(4 \cdot \left(b \cdot b\right) + \left(a \cdot a\right) \cdot \left(a \cdot a\right)\right) + -1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 a a) < 7.5e15

    1. Initial program 99.8%

      \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
    2. Taylor expanded in a around 0 98.6%

      \[\leadsto \left({\color{blue}{\left({b}^{2}\right)}}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
    3. Step-by-step derivation
      1. unpow298.6%

        \[\leadsto \left({\color{blue}{\left(b \cdot b\right)}}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
    4. Simplified98.6%

      \[\leadsto \left({\color{blue}{\left(b \cdot b\right)}}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
    5. Step-by-step derivation
      1. unpow-prod-down98.6%

        \[\leadsto \left(\color{blue}{{b}^{2} \cdot {b}^{2}} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
      2. pow-prod-up98.8%

        \[\leadsto \left(\color{blue}{{b}^{\left(2 + 2\right)}} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
      3. metadata-eval98.8%

        \[\leadsto \left({b}^{\color{blue}{4}} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
      4. +-commutative98.8%

        \[\leadsto \color{blue}{\left(4 \cdot \left(b \cdot b\right) + {b}^{4}\right)} - 1 \]
      5. metadata-eval98.8%

        \[\leadsto \left(4 \cdot \left(b \cdot b\right) + {b}^{\color{blue}{\left(2 + 2\right)}}\right) - 1 \]
      6. pow-prod-up98.6%

        \[\leadsto \left(4 \cdot \left(b \cdot b\right) + \color{blue}{{b}^{2} \cdot {b}^{2}}\right) - 1 \]
      7. pow298.6%

        \[\leadsto \left(4 \cdot \left(b \cdot b\right) + \color{blue}{\left(b \cdot b\right)} \cdot {b}^{2}\right) - 1 \]
      8. pow298.6%

        \[\leadsto \left(4 \cdot \left(b \cdot b\right) + \left(b \cdot b\right) \cdot \color{blue}{\left(b \cdot b\right)}\right) - 1 \]
      9. distribute-rgt-out98.6%

        \[\leadsto \color{blue}{\left(b \cdot b\right) \cdot \left(4 + b \cdot b\right)} - 1 \]
    6. Applied egg-rr98.6%

      \[\leadsto \color{blue}{\left(b \cdot b\right) \cdot \left(4 + b \cdot b\right)} - 1 \]

    if 7.5e15 < (*.f64 a a)

    1. Initial program 99.9%

      \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
    2. Taylor expanded in a around inf 96.3%

      \[\leadsto \left({\color{blue}{\left({a}^{2}\right)}}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
    3. Step-by-step derivation
      1. unpow296.3%

        \[\leadsto \left({\color{blue}{\left(a \cdot a\right)}}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
    4. Simplified96.3%

      \[\leadsto \left({\color{blue}{\left(a \cdot a\right)}}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
    5. Step-by-step derivation
      1. unpow296.4%

        \[\leadsto \left(\color{blue}{\left(a \cdot a\right) \cdot \left(a \cdot a\right)} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
    6. Applied egg-rr96.4%

      \[\leadsto \left(\color{blue}{\left(a \cdot a\right) \cdot \left(a \cdot a\right)} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
  3. Recombined 2 regimes into one program.
  4. Final simplification97.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot a \leq 7.5 \cdot 10^{+15}:\\ \;\;\;\;\left(b \cdot b\right) \cdot \left(4 + b \cdot b\right) + -1\\ \mathbf{else}:\\ \;\;\;\;\left(4 \cdot \left(b \cdot b\right) + \left(a \cdot a\right) \cdot \left(a \cdot a\right)\right) + -1\\ \end{array} \]

Alternative 8: 69.8% accurate, 10.5× speedup?

\[\begin{array}{l} \\ \left(b \cdot b\right) \cdot \left(4 + b \cdot b\right) + -1 \end{array} \]
(FPCore (a b) :precision binary64 (+ (* (* b b) (+ 4.0 (* b b))) -1.0))
double code(double a, double b) {
	return ((b * b) * (4.0 + (b * b))) + -1.0;
}
real(8) function code(a, b)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = ((b * b) * (4.0d0 + (b * b))) + (-1.0d0)
end function
public static double code(double a, double b) {
	return ((b * b) * (4.0 + (b * b))) + -1.0;
}
def code(a, b):
	return ((b * b) * (4.0 + (b * b))) + -1.0
function code(a, b)
	return Float64(Float64(Float64(b * b) * Float64(4.0 + Float64(b * b))) + -1.0)
end
function tmp = code(a, b)
	tmp = ((b * b) * (4.0 + (b * b))) + -1.0;
end
code[a_, b_] := N[(N[(N[(b * b), $MachinePrecision] * N[(4.0 + N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]
\begin{array}{l}

\\
\left(b \cdot b\right) \cdot \left(4 + b \cdot b\right) + -1
\end{array}
Derivation
  1. Initial program 99.9%

    \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
  2. Taylor expanded in a around 0 70.2%

    \[\leadsto \left({\color{blue}{\left({b}^{2}\right)}}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
  3. Step-by-step derivation
    1. unpow270.2%

      \[\leadsto \left({\color{blue}{\left(b \cdot b\right)}}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
  4. Simplified70.2%

    \[\leadsto \left({\color{blue}{\left(b \cdot b\right)}}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
  5. Step-by-step derivation
    1. unpow-prod-down70.2%

      \[\leadsto \left(\color{blue}{{b}^{2} \cdot {b}^{2}} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
    2. pow-prod-up70.3%

      \[\leadsto \left(\color{blue}{{b}^{\left(2 + 2\right)}} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
    3. metadata-eval70.3%

      \[\leadsto \left({b}^{\color{blue}{4}} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
    4. +-commutative70.3%

      \[\leadsto \color{blue}{\left(4 \cdot \left(b \cdot b\right) + {b}^{4}\right)} - 1 \]
    5. metadata-eval70.3%

      \[\leadsto \left(4 \cdot \left(b \cdot b\right) + {b}^{\color{blue}{\left(2 + 2\right)}}\right) - 1 \]
    6. pow-prod-up70.2%

      \[\leadsto \left(4 \cdot \left(b \cdot b\right) + \color{blue}{{b}^{2} \cdot {b}^{2}}\right) - 1 \]
    7. pow270.2%

      \[\leadsto \left(4 \cdot \left(b \cdot b\right) + \color{blue}{\left(b \cdot b\right)} \cdot {b}^{2}\right) - 1 \]
    8. pow270.2%

      \[\leadsto \left(4 \cdot \left(b \cdot b\right) + \left(b \cdot b\right) \cdot \color{blue}{\left(b \cdot b\right)}\right) - 1 \]
    9. distribute-rgt-out70.2%

      \[\leadsto \color{blue}{\left(b \cdot b\right) \cdot \left(4 + b \cdot b\right)} - 1 \]
  6. Applied egg-rr70.2%

    \[\leadsto \color{blue}{\left(b \cdot b\right) \cdot \left(4 + b \cdot b\right)} - 1 \]
  7. Final simplification70.2%

    \[\leadsto \left(b \cdot b\right) \cdot \left(4 + b \cdot b\right) + -1 \]

Alternative 9: 51.5% accurate, 16.6× speedup?

\[\begin{array}{l} \\ b \cdot \left(4 \cdot b\right) + -1 \end{array} \]
(FPCore (a b) :precision binary64 (+ (* b (* 4.0 b)) -1.0))
double code(double a, double b) {
	return (b * (4.0 * b)) + -1.0;
}
real(8) function code(a, b)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = (b * (4.0d0 * b)) + (-1.0d0)
end function
public static double code(double a, double b) {
	return (b * (4.0 * b)) + -1.0;
}
def code(a, b):
	return (b * (4.0 * b)) + -1.0
function code(a, b)
	return Float64(Float64(b * Float64(4.0 * b)) + -1.0)
end
function tmp = code(a, b)
	tmp = (b * (4.0 * b)) + -1.0;
end
code[a_, b_] := N[(N[(b * N[(4.0 * b), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]
\begin{array}{l}

\\
b \cdot \left(4 \cdot b\right) + -1
\end{array}
Derivation
  1. Initial program 99.9%

    \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
  2. Taylor expanded in a around 0 70.2%

    \[\leadsto \left({\color{blue}{\left({b}^{2}\right)}}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
  3. Step-by-step derivation
    1. unpow270.2%

      \[\leadsto \left({\color{blue}{\left(b \cdot b\right)}}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
  4. Simplified70.2%

    \[\leadsto \left({\color{blue}{\left(b \cdot b\right)}}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
  5. Taylor expanded in b around 0 49.7%

    \[\leadsto \color{blue}{4 \cdot {b}^{2}} - 1 \]
  6. Step-by-step derivation
    1. unpow249.7%

      \[\leadsto 4 \cdot \color{blue}{\left(b \cdot b\right)} - 1 \]
    2. *-commutative49.7%

      \[\leadsto \color{blue}{\left(b \cdot b\right) \cdot 4} - 1 \]
    3. associate-*l*49.7%

      \[\leadsto \color{blue}{b \cdot \left(b \cdot 4\right)} - 1 \]
  7. Simplified49.7%

    \[\leadsto \color{blue}{b \cdot \left(b \cdot 4\right)} - 1 \]
  8. Final simplification49.7%

    \[\leadsto b \cdot \left(4 \cdot b\right) + -1 \]

Alternative 10: 25.2% accurate, 116.0× speedup?

\[\begin{array}{l} \\ -1 \end{array} \]
(FPCore (a b) :precision binary64 -1.0)
double code(double a, double b) {
	return -1.0;
}
real(8) function code(a, b)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = -1.0d0
end function
public static double code(double a, double b) {
	return -1.0;
}
def code(a, b):
	return -1.0
function code(a, b)
	return -1.0
end
function tmp = code(a, b)
	tmp = -1.0;
end
code[a_, b_] := -1.0
\begin{array}{l}

\\
-1
\end{array}
Derivation
  1. Initial program 99.9%

    \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
  2. Step-by-step derivation
    1. associate--l+99.9%

      \[\leadsto \color{blue}{{\left(a \cdot a + b \cdot b\right)}^{2} + \left(4 \cdot \left(b \cdot b\right) - 1\right)} \]
    2. unpow299.9%

      \[\leadsto \color{blue}{\left(a \cdot a + b \cdot b\right) \cdot \left(a \cdot a + b \cdot b\right)} + \left(4 \cdot \left(b \cdot b\right) - 1\right) \]
    3. unpow199.9%

      \[\leadsto \left(a \cdot a + b \cdot b\right) \cdot \color{blue}{{\left(a \cdot a + b \cdot b\right)}^{1}} + \left(4 \cdot \left(b \cdot b\right) - 1\right) \]
    4. sqr-pow99.9%

      \[\leadsto \left(a \cdot a + b \cdot b\right) \cdot \color{blue}{\left({\left(a \cdot a + b \cdot b\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(a \cdot a + b \cdot b\right)}^{\left(\frac{1}{2}\right)}\right)} + \left(4 \cdot \left(b \cdot b\right) - 1\right) \]
    5. associate-*r*99.9%

      \[\leadsto \color{blue}{\left(\left(a \cdot a + b \cdot b\right) \cdot {\left(a \cdot a + b \cdot b\right)}^{\left(\frac{1}{2}\right)}\right) \cdot {\left(a \cdot a + b \cdot b\right)}^{\left(\frac{1}{2}\right)}} + \left(4 \cdot \left(b \cdot b\right) - 1\right) \]
    6. unpow199.9%

      \[\leadsto \left(\color{blue}{{\left(a \cdot a + b \cdot b\right)}^{1}} \cdot {\left(a \cdot a + b \cdot b\right)}^{\left(\frac{1}{2}\right)}\right) \cdot {\left(a \cdot a + b \cdot b\right)}^{\left(\frac{1}{2}\right)} + \left(4 \cdot \left(b \cdot b\right) - 1\right) \]
    7. sqr-pow99.9%

      \[\leadsto \left(\color{blue}{\left({\left(a \cdot a + b \cdot b\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(a \cdot a + b \cdot b\right)}^{\left(\frac{1}{2}\right)}\right)} \cdot {\left(a \cdot a + b \cdot b\right)}^{\left(\frac{1}{2}\right)}\right) \cdot {\left(a \cdot a + b \cdot b\right)}^{\left(\frac{1}{2}\right)} + \left(4 \cdot \left(b \cdot b\right) - 1\right) \]
    8. unpow399.9%

      \[\leadsto \color{blue}{{\left({\left(a \cdot a + b \cdot b\right)}^{\left(\frac{1}{2}\right)}\right)}^{3}} \cdot {\left(a \cdot a + b \cdot b\right)}^{\left(\frac{1}{2}\right)} + \left(4 \cdot \left(b \cdot b\right) - 1\right) \]
    9. pow-plus100.0%

      \[\leadsto \color{blue}{{\left({\left(a \cdot a + b \cdot b\right)}^{\left(\frac{1}{2}\right)}\right)}^{\left(3 + 1\right)}} + \left(4 \cdot \left(b \cdot b\right) - 1\right) \]
    10. metadata-eval100.0%

      \[\leadsto {\left({\left(a \cdot a + b \cdot b\right)}^{\color{blue}{0.5}}\right)}^{\left(3 + 1\right)} + \left(4 \cdot \left(b \cdot b\right) - 1\right) \]
    11. unpow1/2100.0%

      \[\leadsto {\color{blue}{\left(\sqrt{a \cdot a + b \cdot b}\right)}}^{\left(3 + 1\right)} + \left(4 \cdot \left(b \cdot b\right) - 1\right) \]
    12. hypot-def100.0%

      \[\leadsto {\color{blue}{\left(\mathsf{hypot}\left(a, b\right)\right)}}^{\left(3 + 1\right)} + \left(4 \cdot \left(b \cdot b\right) - 1\right) \]
    13. metadata-eval100.0%

      \[\leadsto {\left(\mathsf{hypot}\left(a, b\right)\right)}^{\color{blue}{4}} + \left(4 \cdot \left(b \cdot b\right) - 1\right) \]
    14. associate-*r*100.0%

      \[\leadsto {\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} + \left(\color{blue}{\left(4 \cdot b\right) \cdot b} - 1\right) \]
    15. *-commutative100.0%

      \[\leadsto {\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} + \left(\color{blue}{b \cdot \left(4 \cdot b\right)} - 1\right) \]
  3. Simplified100.0%

    \[\leadsto \color{blue}{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} + \mathsf{fma}\left(b, b \cdot 4, -1\right)} \]
  4. Taylor expanded in a around 0 70.3%

    \[\leadsto \color{blue}{{b}^{4}} + \mathsf{fma}\left(b, b \cdot 4, -1\right) \]
  5. Taylor expanded in b around 0 26.8%

    \[\leadsto \color{blue}{-1} \]
  6. Final simplification26.8%

    \[\leadsto -1 \]

Reproduce

?
herbie shell --seed 2023271 
(FPCore (a b)
  :name "Bouland and Aaronson, Equation (26)"
  :precision binary64
  (- (+ (pow (+ (* a a) (* b b)) 2.0) (* 4.0 (* b b))) 1.0))