Quadratic roots, medium range

Percentage Accurate: 30.7% → 99.6%
Time: 6.1s
Alternatives: 9
Speedup: 4.3×

Specification

?
\[\left(\left(1.1102230246251565 \cdot 10^{-16} < a \land a < 9007199254740992\right) \land \left(1.1102230246251565 \cdot 10^{-16} < b \land b < 9007199254740992\right)\right) \land \left(1.1102230246251565 \cdot 10^{-16} < c \land c < 9007199254740992\right)\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
(FPCore (a b c)
  :precision binary64
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))
double code(double a, double b, double c) {
	return (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
}
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(a, b, c)
use fmin_fmax_functions
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    code = (-b + sqrt(((b * b) - ((4.0d0 * a) * c)))) / (2.0d0 * a)
end function
public static double code(double a, double b, double c) {
	return (-b + Math.sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
}
def code(a, b, c):
	return (-b + math.sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a)
function code(a, b, c)
	return Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c)))) / Float64(2.0 * a))
end
function tmp = code(a, b, c)
	tmp = (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
end
code[a_, b_, c_] := N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}

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

\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
(FPCore (a b c)
  :precision binary64
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))
double code(double a, double b, double c) {
	return (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
}
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(a, b, c)
use fmin_fmax_functions
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    code = (-b + sqrt(((b * b) - ((4.0d0 * a) * c)))) / (2.0d0 * a)
end function
public static double code(double a, double b, double c) {
	return (-b + Math.sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
}
def code(a, b, c):
	return (-b + math.sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a)
function code(a, b, c)
	return Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c)))) / Float64(2.0 * a))
end
function tmp = code(a, b, c)
	tmp = (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
end
code[a_, b_, c_] := N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}

Alternative 1: 99.6% accurate, 0.6× speedup?

\[\frac{\left(-2 \cdot a\right) \cdot \frac{-c}{a}}{\left(\frac{a}{a + a} \cdot -2\right) \cdot \sqrt{\mathsf{fma}\left(c \cdot a, -4, b \cdot b\right)} - b} \]
(FPCore (a b c)
  :precision binary64
  (/
 (* (* -2.0 a) (/ (- c) a))
 (- (* (* (/ a (+ a a)) -2.0) (sqrt (fma (* c a) -4.0 (* b b)))) b)))
double code(double a, double b, double c) {
	return ((-2.0 * a) * (-c / a)) / ((((a / (a + a)) * -2.0) * sqrt(fma((c * a), -4.0, (b * b)))) - b);
}
function code(a, b, c)
	return Float64(Float64(Float64(-2.0 * a) * Float64(Float64(-c) / a)) / Float64(Float64(Float64(Float64(a / Float64(a + a)) * -2.0) * sqrt(fma(Float64(c * a), -4.0, Float64(b * b)))) - b))
end
code[a_, b_, c_] := N[(N[(N[(-2.0 * a), $MachinePrecision] * N[((-c) / a), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(N[(a / N[(a + a), $MachinePrecision]), $MachinePrecision] * -2.0), $MachinePrecision] * N[Sqrt[N[(N[(c * a), $MachinePrecision] * -4.0 + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]
\frac{\left(-2 \cdot a\right) \cdot \frac{-c}{a}}{\left(\frac{a}{a + a} \cdot -2\right) \cdot \sqrt{\mathsf{fma}\left(c \cdot a, -4, b \cdot b\right)} - b}
Derivation
  1. Initial program 30.7%

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
  2. Step-by-step derivation
    1. lift-/.f64N/A

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}} \]
    2. lift-+.f64N/A

      \[\leadsto \frac{\color{blue}{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a} \]
    3. +-commutativeN/A

      \[\leadsto \frac{\color{blue}{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} + \left(-b\right)}}{2 \cdot a} \]
    4. div-addN/A

      \[\leadsto \color{blue}{\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} + \frac{-b}{2 \cdot a}} \]
    5. flip-+N/A

      \[\leadsto \color{blue}{\frac{\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \cdot \frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} - \frac{-b}{2 \cdot a} \cdot \frac{-b}{2 \cdot a}}{\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} - \frac{-b}{2 \cdot a}}} \]
    6. lower-unsound-/.f64N/A

      \[\leadsto \color{blue}{\frac{\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \cdot \frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} - \frac{-b}{2 \cdot a} \cdot \frac{-b}{2 \cdot a}}{\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} - \frac{-b}{2 \cdot a}}} \]
  3. Applied rewrites30.2%

    \[\leadsto \color{blue}{\frac{\frac{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}}{a + a} \cdot \frac{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}}{a + a} - \frac{b}{-2 \cdot a} \cdot \frac{b}{-2 \cdot a}}{\frac{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}}{a + a} - \frac{b}{-2 \cdot a}}} \]
  4. Taylor expanded in b around inf

    \[\leadsto \frac{\color{blue}{-1 \cdot \frac{c}{a}}}{\frac{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}}{a + a} - \frac{b}{-2 \cdot a}} \]
  5. Step-by-step derivation
    1. lower-*.f64N/A

      \[\leadsto \frac{-1 \cdot \color{blue}{\frac{c}{a}}}{\frac{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}}{a + a} - \frac{b}{-2 \cdot a}} \]
    2. lower-/.f6499.4%

      \[\leadsto \frac{-1 \cdot \frac{c}{\color{blue}{a}}}{\frac{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}}{a + a} - \frac{b}{-2 \cdot a}} \]
  6. Applied rewrites99.4%

    \[\leadsto \frac{\color{blue}{-1 \cdot \frac{c}{a}}}{\frac{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}}{a + a} - \frac{b}{-2 \cdot a}} \]
  7. Applied rewrites99.4%

    \[\leadsto \color{blue}{\frac{\frac{-c}{a}}{\left(\sqrt{\mathsf{fma}\left(-4 \cdot c, a, b \cdot b\right)} \cdot \frac{a}{a + a}\right) \cdot -2 - b} \cdot \left(-2 \cdot a\right)} \]
  8. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \color{blue}{\frac{\frac{-c}{a}}{\left(\sqrt{\mathsf{fma}\left(-4 \cdot c, a, b \cdot b\right)} \cdot \frac{a}{a + a}\right) \cdot -2 - b} \cdot \left(-2 \cdot a\right)} \]
    2. lift-/.f64N/A

      \[\leadsto \color{blue}{\frac{\frac{-c}{a}}{\left(\sqrt{\mathsf{fma}\left(-4 \cdot c, a, b \cdot b\right)} \cdot \frac{a}{a + a}\right) \cdot -2 - b}} \cdot \left(-2 \cdot a\right) \]
    3. associate-*l/N/A

      \[\leadsto \color{blue}{\frac{\frac{-c}{a} \cdot \left(-2 \cdot a\right)}{\left(\sqrt{\mathsf{fma}\left(-4 \cdot c, a, b \cdot b\right)} \cdot \frac{a}{a + a}\right) \cdot -2 - b}} \]
  9. Applied rewrites99.6%

    \[\leadsto \color{blue}{\frac{\left(-2 \cdot a\right) \cdot \frac{-c}{a}}{\left(\frac{a}{a + a} \cdot -2\right) \cdot \sqrt{\mathsf{fma}\left(c \cdot a, -4, b \cdot b\right)} - b}} \]
  10. Add Preprocessing

Alternative 2: 99.4% accurate, 0.8× speedup?

\[\frac{\frac{-c}{a}}{\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(c \cdot a, -4, b \cdot b\right)}, 1, b\right)} \cdot \left(a + a\right) \]
(FPCore (a b c)
  :precision binary64
  (*
 (/ (/ (- c) a) (fma (sqrt (fma (* c a) -4.0 (* b b))) 1.0 b))
 (+ a a)))
double code(double a, double b, double c) {
	return ((-c / a) / fma(sqrt(fma((c * a), -4.0, (b * b))), 1.0, b)) * (a + a);
}
function code(a, b, c)
	return Float64(Float64(Float64(Float64(-c) / a) / fma(sqrt(fma(Float64(c * a), -4.0, Float64(b * b))), 1.0, b)) * Float64(a + a))
end
code[a_, b_, c_] := N[(N[(N[((-c) / a), $MachinePrecision] / N[(N[Sqrt[N[(N[(c * a), $MachinePrecision] * -4.0 + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1.0 + b), $MachinePrecision]), $MachinePrecision] * N[(a + a), $MachinePrecision]), $MachinePrecision]
\frac{\frac{-c}{a}}{\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(c \cdot a, -4, b \cdot b\right)}, 1, b\right)} \cdot \left(a + a\right)
Derivation
  1. Initial program 30.7%

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
  2. Step-by-step derivation
    1. lift-/.f64N/A

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}} \]
    2. lift-+.f64N/A

      \[\leadsto \frac{\color{blue}{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a} \]
    3. +-commutativeN/A

      \[\leadsto \frac{\color{blue}{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} + \left(-b\right)}}{2 \cdot a} \]
    4. div-addN/A

      \[\leadsto \color{blue}{\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} + \frac{-b}{2 \cdot a}} \]
    5. flip-+N/A

      \[\leadsto \color{blue}{\frac{\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \cdot \frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} - \frac{-b}{2 \cdot a} \cdot \frac{-b}{2 \cdot a}}{\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} - \frac{-b}{2 \cdot a}}} \]
    6. lower-unsound-/.f64N/A

      \[\leadsto \color{blue}{\frac{\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \cdot \frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} - \frac{-b}{2 \cdot a} \cdot \frac{-b}{2 \cdot a}}{\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} - \frac{-b}{2 \cdot a}}} \]
  3. Applied rewrites30.2%

    \[\leadsto \color{blue}{\frac{\frac{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}}{a + a} \cdot \frac{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}}{a + a} - \frac{b}{-2 \cdot a} \cdot \frac{b}{-2 \cdot a}}{\frac{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}}{a + a} - \frac{b}{-2 \cdot a}}} \]
  4. Taylor expanded in b around inf

    \[\leadsto \frac{\color{blue}{-1 \cdot \frac{c}{a}}}{\frac{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}}{a + a} - \frac{b}{-2 \cdot a}} \]
  5. Step-by-step derivation
    1. lower-*.f64N/A

      \[\leadsto \frac{-1 \cdot \color{blue}{\frac{c}{a}}}{\frac{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}}{a + a} - \frac{b}{-2 \cdot a}} \]
    2. lower-/.f6499.4%

      \[\leadsto \frac{-1 \cdot \frac{c}{\color{blue}{a}}}{\frac{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}}{a + a} - \frac{b}{-2 \cdot a}} \]
  6. Applied rewrites99.4%

    \[\leadsto \frac{\color{blue}{-1 \cdot \frac{c}{a}}}{\frac{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}}{a + a} - \frac{b}{-2 \cdot a}} \]
  7. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \frac{-1 \cdot \color{blue}{\frac{c}{a}}}{\frac{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}}{a + a} - \frac{b}{-2 \cdot a}} \]
    2. mul-1-negN/A

      \[\leadsto \frac{\mathsf{neg}\left(\frac{c}{a}\right)}{\frac{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}}{a + a} - \frac{b}{-2 \cdot a}} \]
    3. lift-/.f64N/A

      \[\leadsto \frac{\mathsf{neg}\left(\frac{c}{a}\right)}{\frac{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}}{a + a} - \frac{b}{-2 \cdot a}} \]
    4. distribute-neg-fracN/A

      \[\leadsto \frac{\frac{\mathsf{neg}\left(c\right)}{\color{blue}{a}}}{\frac{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}}{a + a} - \frac{b}{-2 \cdot a}} \]
    5. lift-neg.f64N/A

      \[\leadsto \frac{\frac{-c}{a}}{\frac{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}}{a + a} - \frac{b}{-2 \cdot a}} \]
    6. lower-/.f6499.4%

      \[\leadsto \frac{\frac{-c}{\color{blue}{a}}}{\frac{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}}{a + a} - \frac{b}{-2 \cdot a}} \]
    7. lower-/.f64N/A

      \[\leadsto \frac{\frac{-c}{\color{blue}{a}}}{\mathsf{Rewrite=>}\left(lift--.f64, \left(\frac{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}}{a + a} - \frac{b}{-2 \cdot a}\right)\right)} \]
    8. lower-/.f64N/A

      \[\leadsto \frac{\frac{-c}{\color{blue}{a}}}{\mathsf{Rewrite=>}\left(sub-flip, \left(\frac{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}}{a + a} + \left(\mathsf{neg}\left(\frac{b}{-2 \cdot a}\right)\right)\right)\right)} \]
    9. lower-/.f64N/A

      \[\leadsto \frac{\frac{-c}{\color{blue}{a}}}{\mathsf{Rewrite=>}\left(lift-/.f64, \left(\frac{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}}{a + a}\right)\right) + \left(\mathsf{neg}\left(\frac{b}{-2 \cdot a}\right)\right)} \]
    10. lower-/.f64N/A

      \[\leadsto \frac{\frac{-c}{\color{blue}{a}}}{\mathsf{Rewrite=>}\left(mult-flip, \left(\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)} \cdot \frac{1}{a + a}\right)\right) + \left(\mathsf{neg}\left(\frac{b}{-2 \cdot a}\right)\right)} \]
    11. lower-/.f64N/A

      \[\leadsto \frac{\frac{-c}{\color{blue}{a}}}{\mathsf{Rewrite=>}\left(*-commutative, \left(\frac{1}{a + a} \cdot \sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}\right)\right) + \left(\mathsf{neg}\left(\frac{b}{-2 \cdot a}\right)\right)} \]
    12. lower-/.f64N/A

      \[\leadsto \frac{\frac{-c}{\color{blue}{a}}}{\mathsf{Rewrite=>}\left(lower-fma.f64, \left(\mathsf{fma}\left(\frac{1}{a + a}, \sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}, \mathsf{neg}\left(\frac{b}{-2 \cdot a}\right)\right)\right)\right)} \]
  8. Applied rewrites99.4%

    \[\leadsto \color{blue}{\frac{\frac{-c}{a}}{\mathsf{fma}\left(\frac{0.5}{a}, \sqrt{\mathsf{fma}\left(-4 \cdot c, a, b \cdot b\right)}, \frac{b}{a + a}\right)}} \]
  9. Step-by-step derivation
    1. lift-/.f64N/A

      \[\leadsto \color{blue}{\frac{\frac{-c}{a}}{\mathsf{fma}\left(\frac{\frac{1}{2}}{a}, \sqrt{\mathsf{fma}\left(-4 \cdot c, a, b \cdot b\right)}, \frac{b}{a + a}\right)}} \]
    2. lift-fma.f64N/A

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

      \[\leadsto \frac{\frac{-c}{a}}{\frac{\frac{1}{2}}{a} \cdot \sqrt{\mathsf{fma}\left(-4 \cdot c, a, b \cdot b\right)} + \color{blue}{\frac{b}{a + a}}} \]
    4. add-to-fractionN/A

      \[\leadsto \frac{\frac{-c}{a}}{\color{blue}{\frac{\left(\frac{\frac{1}{2}}{a} \cdot \sqrt{\mathsf{fma}\left(-4 \cdot c, a, b \cdot b\right)}\right) \cdot \left(a + a\right) + b}{a + a}}} \]
    5. associate-/r/N/A

      \[\leadsto \color{blue}{\frac{\frac{-c}{a}}{\left(\frac{\frac{1}{2}}{a} \cdot \sqrt{\mathsf{fma}\left(-4 \cdot c, a, b \cdot b\right)}\right) \cdot \left(a + a\right) + b} \cdot \left(a + a\right)} \]
  10. Applied rewrites99.4%

    \[\leadsto \color{blue}{\frac{\frac{-c}{a}}{\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(c \cdot a, -4, b \cdot b\right)}, 1, b\right)} \cdot \left(a + a\right)} \]
  11. Add Preprocessing

Alternative 3: 99.4% accurate, 0.8× speedup?

\[\frac{\frac{-c}{a}}{\frac{\sqrt{\mathsf{fma}\left(c \cdot a, -4, b \cdot b\right)} - \left(-b\right)}{a + a}} \]
(FPCore (a b c)
  :precision binary64
  (/
 (/ (- c) a)
 (/ (- (sqrt (fma (* c a) -4.0 (* b b))) (- b)) (+ a a))))
double code(double a, double b, double c) {
	return (-c / a) / ((sqrt(fma((c * a), -4.0, (b * b))) - -b) / (a + a));
}
function code(a, b, c)
	return Float64(Float64(Float64(-c) / a) / Float64(Float64(sqrt(fma(Float64(c * a), -4.0, Float64(b * b))) - Float64(-b)) / Float64(a + a)))
end
code[a_, b_, c_] := N[(N[((-c) / a), $MachinePrecision] / N[(N[(N[Sqrt[N[(N[(c * a), $MachinePrecision] * -4.0 + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - (-b)), $MachinePrecision] / N[(a + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{\frac{-c}{a}}{\frac{\sqrt{\mathsf{fma}\left(c \cdot a, -4, b \cdot b\right)} - \left(-b\right)}{a + a}}
Derivation
  1. Initial program 30.7%

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
  2. Step-by-step derivation
    1. lift-/.f64N/A

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}} \]
    2. lift-+.f64N/A

      \[\leadsto \frac{\color{blue}{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a} \]
    3. +-commutativeN/A

      \[\leadsto \frac{\color{blue}{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} + \left(-b\right)}}{2 \cdot a} \]
    4. div-addN/A

      \[\leadsto \color{blue}{\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} + \frac{-b}{2 \cdot a}} \]
    5. flip-+N/A

      \[\leadsto \color{blue}{\frac{\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \cdot \frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} - \frac{-b}{2 \cdot a} \cdot \frac{-b}{2 \cdot a}}{\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} - \frac{-b}{2 \cdot a}}} \]
    6. lower-unsound-/.f64N/A

      \[\leadsto \color{blue}{\frac{\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \cdot \frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} - \frac{-b}{2 \cdot a} \cdot \frac{-b}{2 \cdot a}}{\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} - \frac{-b}{2 \cdot a}}} \]
  3. Applied rewrites30.2%

    \[\leadsto \color{blue}{\frac{\frac{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}}{a + a} \cdot \frac{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}}{a + a} - \frac{b}{-2 \cdot a} \cdot \frac{b}{-2 \cdot a}}{\frac{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}}{a + a} - \frac{b}{-2 \cdot a}}} \]
  4. Taylor expanded in b around inf

    \[\leadsto \frac{\color{blue}{-1 \cdot \frac{c}{a}}}{\frac{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}}{a + a} - \frac{b}{-2 \cdot a}} \]
  5. Step-by-step derivation
    1. lower-*.f64N/A

      \[\leadsto \frac{-1 \cdot \color{blue}{\frac{c}{a}}}{\frac{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}}{a + a} - \frac{b}{-2 \cdot a}} \]
    2. lower-/.f6499.4%

      \[\leadsto \frac{-1 \cdot \frac{c}{\color{blue}{a}}}{\frac{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}}{a + a} - \frac{b}{-2 \cdot a}} \]
  6. Applied rewrites99.4%

    \[\leadsto \frac{\color{blue}{-1 \cdot \frac{c}{a}}}{\frac{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}}{a + a} - \frac{b}{-2 \cdot a}} \]
  7. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \frac{-1 \cdot \color{blue}{\frac{c}{a}}}{\frac{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}}{a + a} - \frac{b}{-2 \cdot a}} \]
    2. mul-1-negN/A

      \[\leadsto \frac{\mathsf{neg}\left(\frac{c}{a}\right)}{\frac{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}}{a + a} - \frac{b}{-2 \cdot a}} \]
    3. lift-/.f64N/A

      \[\leadsto \frac{\mathsf{neg}\left(\frac{c}{a}\right)}{\frac{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}}{a + a} - \frac{b}{-2 \cdot a}} \]
    4. distribute-neg-fracN/A

      \[\leadsto \frac{\frac{\mathsf{neg}\left(c\right)}{\color{blue}{a}}}{\frac{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}}{a + a} - \frac{b}{-2 \cdot a}} \]
    5. lift-neg.f64N/A

      \[\leadsto \frac{\frac{-c}{a}}{\frac{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}}{a + a} - \frac{b}{-2 \cdot a}} \]
    6. lower-/.f6499.4%

      \[\leadsto \frac{\frac{-c}{\color{blue}{a}}}{\frac{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}}{a + a} - \frac{b}{-2 \cdot a}} \]
    7. lower-/.f64N/A

      \[\leadsto \frac{\frac{-c}{\color{blue}{a}}}{\mathsf{Rewrite=>}\left(lift--.f64, \left(\frac{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}}{a + a} - \frac{b}{-2 \cdot a}\right)\right)} \]
    8. lower-/.f64N/A

      \[\leadsto \frac{\frac{-c}{\color{blue}{a}}}{\mathsf{Rewrite=>}\left(sub-flip, \left(\frac{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}}{a + a} + \left(\mathsf{neg}\left(\frac{b}{-2 \cdot a}\right)\right)\right)\right)} \]
    9. lower-/.f64N/A

      \[\leadsto \frac{\frac{-c}{\color{blue}{a}}}{\mathsf{Rewrite=>}\left(lift-/.f64, \left(\frac{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}}{a + a}\right)\right) + \left(\mathsf{neg}\left(\frac{b}{-2 \cdot a}\right)\right)} \]
    10. lower-/.f64N/A

      \[\leadsto \frac{\frac{-c}{\color{blue}{a}}}{\mathsf{Rewrite=>}\left(mult-flip, \left(\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)} \cdot \frac{1}{a + a}\right)\right) + \left(\mathsf{neg}\left(\frac{b}{-2 \cdot a}\right)\right)} \]
    11. lower-/.f64N/A

      \[\leadsto \frac{\frac{-c}{\color{blue}{a}}}{\mathsf{Rewrite=>}\left(*-commutative, \left(\frac{1}{a + a} \cdot \sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}\right)\right) + \left(\mathsf{neg}\left(\frac{b}{-2 \cdot a}\right)\right)} \]
    12. lower-/.f64N/A

      \[\leadsto \frac{\frac{-c}{\color{blue}{a}}}{\mathsf{Rewrite=>}\left(lower-fma.f64, \left(\mathsf{fma}\left(\frac{1}{a + a}, \sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}, \mathsf{neg}\left(\frac{b}{-2 \cdot a}\right)\right)\right)\right)} \]
  8. Applied rewrites99.4%

    \[\leadsto \color{blue}{\frac{\frac{-c}{a}}{\mathsf{fma}\left(\frac{0.5}{a}, \sqrt{\mathsf{fma}\left(-4 \cdot c, a, b \cdot b\right)}, \frac{b}{a + a}\right)}} \]
  9. Step-by-step derivation
    1. lift-fma.f64N/A

      \[\leadsto \frac{\frac{-c}{a}}{\color{blue}{\frac{\frac{1}{2}}{a} \cdot \sqrt{\mathsf{fma}\left(-4 \cdot c, a, b \cdot b\right)} + \frac{b}{a + a}}} \]
    2. add-flipN/A

      \[\leadsto \frac{\frac{-c}{a}}{\color{blue}{\frac{\frac{1}{2}}{a} \cdot \sqrt{\mathsf{fma}\left(-4 \cdot c, a, b \cdot b\right)} - \left(\mathsf{neg}\left(\frac{b}{a + a}\right)\right)}} \]
    3. *-commutativeN/A

      \[\leadsto \frac{\frac{-c}{a}}{\color{blue}{\sqrt{\mathsf{fma}\left(-4 \cdot c, a, b \cdot b\right)} \cdot \frac{\frac{1}{2}}{a}} - \left(\mathsf{neg}\left(\frac{b}{a + a}\right)\right)} \]
    4. lift-/.f64N/A

      \[\leadsto \frac{\frac{-c}{a}}{\sqrt{\mathsf{fma}\left(-4 \cdot c, a, b \cdot b\right)} \cdot \color{blue}{\frac{\frac{1}{2}}{a}} - \left(\mathsf{neg}\left(\frac{b}{a + a}\right)\right)} \]
    5. metadata-evalN/A

      \[\leadsto \frac{\frac{-c}{a}}{\sqrt{\mathsf{fma}\left(-4 \cdot c, a, b \cdot b\right)} \cdot \frac{\color{blue}{\frac{1}{2}}}{a} - \left(\mathsf{neg}\left(\frac{b}{a + a}\right)\right)} \]
    6. associate-/r*N/A

      \[\leadsto \frac{\frac{-c}{a}}{\sqrt{\mathsf{fma}\left(-4 \cdot c, a, b \cdot b\right)} \cdot \color{blue}{\frac{1}{2 \cdot a}} - \left(\mathsf{neg}\left(\frac{b}{a + a}\right)\right)} \]
    7. count-2-revN/A

      \[\leadsto \frac{\frac{-c}{a}}{\sqrt{\mathsf{fma}\left(-4 \cdot c, a, b \cdot b\right)} \cdot \frac{1}{\color{blue}{a + a}} - \left(\mathsf{neg}\left(\frac{b}{a + a}\right)\right)} \]
    8. lift-+.f64N/A

      \[\leadsto \frac{\frac{-c}{a}}{\sqrt{\mathsf{fma}\left(-4 \cdot c, a, b \cdot b\right)} \cdot \frac{1}{\color{blue}{a + a}} - \left(\mathsf{neg}\left(\frac{b}{a + a}\right)\right)} \]
    9. mult-flip-revN/A

      \[\leadsto \frac{\frac{-c}{a}}{\color{blue}{\frac{\sqrt{\mathsf{fma}\left(-4 \cdot c, a, b \cdot b\right)}}{a + a}} - \left(\mathsf{neg}\left(\frac{b}{a + a}\right)\right)} \]
    10. lift-/.f64N/A

      \[\leadsto \frac{\frac{-c}{a}}{\frac{\sqrt{\mathsf{fma}\left(-4 \cdot c, a, b \cdot b\right)}}{a + a} - \left(\mathsf{neg}\left(\color{blue}{\frac{b}{a + a}}\right)\right)} \]
    11. distribute-neg-fracN/A

      \[\leadsto \frac{\frac{-c}{a}}{\frac{\sqrt{\mathsf{fma}\left(-4 \cdot c, a, b \cdot b\right)}}{a + a} - \color{blue}{\frac{\mathsf{neg}\left(b\right)}{a + a}}} \]
    12. sub-divN/A

      \[\leadsto \frac{\frac{-c}{a}}{\color{blue}{\frac{\sqrt{\mathsf{fma}\left(-4 \cdot c, a, b \cdot b\right)} - \left(\mathsf{neg}\left(b\right)\right)}{a + a}}} \]
    13. lower--.f32N/A

      \[\leadsto \frac{\frac{-c}{a}}{\frac{\color{blue}{\sqrt{\mathsf{fma}\left(-4 \cdot c, a, b \cdot b\right)} - \left(\mathsf{neg}\left(b\right)\right)}}{a + a}} \]
    14. lower-unsound--.f32N/A

      \[\leadsto \frac{\frac{-c}{a}}{\frac{\color{blue}{\sqrt{\mathsf{fma}\left(-4 \cdot c, a, b \cdot b\right)} - \left(\mathsf{neg}\left(b\right)\right)}}{a + a}} \]
    15. lower-/.f64N/A

      \[\leadsto \frac{\frac{-c}{a}}{\color{blue}{\frac{\sqrt{\mathsf{fma}\left(-4 \cdot c, a, b \cdot b\right)} - \left(\mathsf{neg}\left(b\right)\right)}{a + a}}} \]
  10. Applied rewrites99.4%

    \[\leadsto \frac{\frac{-c}{a}}{\color{blue}{\frac{\sqrt{\mathsf{fma}\left(c \cdot a, -4, b \cdot b\right)} - \left(-b\right)}{a + a}}} \]
  11. Add Preprocessing

Alternative 4: 84.6% accurate, 0.4× speedup?

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

\mathbf{else}:\\
\;\;\;\;\frac{-c}{b}\\


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < -1.8e-5

    1. Initial program 30.7%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \frac{\color{blue}{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a} \]
      2. sum-to-multN/A

        \[\leadsto \frac{\color{blue}{\left(1 + \frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{-b}\right) \cdot \left(-b\right)}}{2 \cdot a} \]
      3. lower-unsound-*.f64N/A

        \[\leadsto \frac{\color{blue}{\left(1 + \frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{-b}\right) \cdot \left(-b\right)}}{2 \cdot a} \]
    3. Applied rewrites30.6%

      \[\leadsto \frac{\color{blue}{\left(1 + \frac{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}}{-b}\right) \cdot \left(-b\right)}}{2 \cdot a} \]

    if -1.8e-5 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a))

    1. Initial program 30.7%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Taylor expanded in b around inf

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto -1 \cdot \color{blue}{\frac{c}{b}} \]
      2. lower-/.f6481.8%

        \[\leadsto -1 \cdot \frac{c}{\color{blue}{b}} \]
    4. Applied rewrites81.8%

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto -1 \cdot \color{blue}{\frac{c}{b}} \]
      2. lift-/.f64N/A

        \[\leadsto -1 \cdot \frac{c}{\color{blue}{b}} \]
      3. associate-*r/N/A

        \[\leadsto \frac{-1 \cdot c}{\color{blue}{b}} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{-1 \cdot c}{\color{blue}{b}} \]
      5. mul-1-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(c\right)}{b} \]
      6. lower-neg.f6481.8%

        \[\leadsto \frac{-c}{b} \]
    6. Applied rewrites81.8%

      \[\leadsto \frac{-c}{\color{blue}{b}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 5: 84.6% accurate, 0.5× speedup?

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

\mathbf{else}:\\
\;\;\;\;\frac{-c}{b}\\


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < -1.8e-5

    1. Initial program 30.7%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}} \]
      2. div-flipN/A

        \[\leadsto \color{blue}{\frac{1}{\frac{2 \cdot a}{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}} \]
      3. lower-unsound-/.f64N/A

        \[\leadsto \color{blue}{\frac{1}{\frac{2 \cdot a}{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}} \]
      4. lower-unsound-/.f6430.7%

        \[\leadsto \frac{1}{\color{blue}{\frac{2 \cdot a}{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{1}{\frac{\color{blue}{2 \cdot a}}{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}} \]
      6. count-2-revN/A

        \[\leadsto \frac{1}{\frac{\color{blue}{a + a}}{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}} \]
      7. lower-+.f6430.7%

        \[\leadsto \frac{1}{\frac{\color{blue}{a + a}}{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}} \]
      8. lift-+.f64N/A

        \[\leadsto \frac{1}{\frac{a + a}{\color{blue}{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}} \]
      9. +-commutativeN/A

        \[\leadsto \frac{1}{\frac{a + a}{\color{blue}{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} + \left(-b\right)}}} \]
      10. add-flipN/A

        \[\leadsto \frac{1}{\frac{a + a}{\color{blue}{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - \left(\mathsf{neg}\left(\left(-b\right)\right)\right)}}} \]
      11. lower--.f64N/A

        \[\leadsto \frac{1}{\frac{a + a}{\color{blue}{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - \left(\mathsf{neg}\left(\left(-b\right)\right)\right)}}} \]
    3. Applied rewrites30.7%

      \[\leadsto \color{blue}{\frac{1}{\frac{a + a}{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)} - b}}} \]
    4. Step-by-step derivation
      1. lift-fma.f64N/A

        \[\leadsto \frac{1}{\frac{a + a}{\sqrt{\color{blue}{\left(c \cdot -4\right) \cdot a + b \cdot b}} - b}} \]
      2. +-commutativeN/A

        \[\leadsto \frac{1}{\frac{a + a}{\sqrt{\color{blue}{b \cdot b + \left(c \cdot -4\right) \cdot a}} - b}} \]
      3. lift-*.f64N/A

        \[\leadsto \frac{1}{\frac{a + a}{\sqrt{\color{blue}{b \cdot b} + \left(c \cdot -4\right) \cdot a} - b}} \]
      4. lower-fma.f64N/A

        \[\leadsto \frac{1}{\frac{a + a}{\sqrt{\color{blue}{\mathsf{fma}\left(b, b, \left(c \cdot -4\right) \cdot a\right)}} - b}} \]
      5. lower-*.f6430.8%

        \[\leadsto \frac{1}{\frac{a + a}{\sqrt{\mathsf{fma}\left(b, b, \color{blue}{\left(c \cdot -4\right) \cdot a}\right)} - b}} \]
      6. lift-*.f64N/A

        \[\leadsto \frac{1}{\frac{a + a}{\sqrt{\mathsf{fma}\left(b, b, \color{blue}{\left(c \cdot -4\right)} \cdot a\right)} - b}} \]
      7. *-commutativeN/A

        \[\leadsto \frac{1}{\frac{a + a}{\sqrt{\mathsf{fma}\left(b, b, \color{blue}{\left(-4 \cdot c\right)} \cdot a\right)} - b}} \]
      8. lift-*.f6430.8%

        \[\leadsto \frac{1}{\frac{a + a}{\sqrt{\mathsf{fma}\left(b, b, \color{blue}{\left(-4 \cdot c\right)} \cdot a\right)} - b}} \]
    5. Applied rewrites30.8%

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

    if -1.8e-5 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a))

    1. Initial program 30.7%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Taylor expanded in b around inf

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto -1 \cdot \color{blue}{\frac{c}{b}} \]
      2. lower-/.f6481.8%

        \[\leadsto -1 \cdot \frac{c}{\color{blue}{b}} \]
    4. Applied rewrites81.8%

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto -1 \cdot \color{blue}{\frac{c}{b}} \]
      2. lift-/.f64N/A

        \[\leadsto -1 \cdot \frac{c}{\color{blue}{b}} \]
      3. associate-*r/N/A

        \[\leadsto \frac{-1 \cdot c}{\color{blue}{b}} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{-1 \cdot c}{\color{blue}{b}} \]
      5. mul-1-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(c\right)}{b} \]
      6. lower-neg.f6481.8%

        \[\leadsto \frac{-c}{b} \]
    6. Applied rewrites81.8%

      \[\leadsto \frac{-c}{\color{blue}{b}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 6: 84.5% accurate, 0.5× speedup?

\[\begin{array}{l} \mathbf{if}\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \leq -1.8 \cdot 10^{-5}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, \left(-4 \cdot a\right) \cdot c\right)}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]
(FPCore (a b c)
  :precision binary64
  (if (<=
     (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a))
     -1.8e-5)
  (/ (+ (- b) (sqrt (fma b b (* (* -4.0 a) c)))) (* 2.0 a))
  (/ (- c) b)))
double code(double a, double b, double c) {
	double tmp;
	if (((-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a)) <= -1.8e-5) {
		tmp = (-b + sqrt(fma(b, b, ((-4.0 * a) * c)))) / (2.0 * a);
	} else {
		tmp = -c / b;
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c)))) / Float64(2.0 * a)) <= -1.8e-5)
		tmp = Float64(Float64(Float64(-b) + sqrt(fma(b, b, Float64(Float64(-4.0 * a) * c)))) / Float64(2.0 * a));
	else
		tmp = Float64(Float64(-c) / b);
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision], -1.8e-5], N[(N[((-b) + N[Sqrt[N[(b * b + N[(N[(-4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision], N[((-c) / b), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \leq -1.8 \cdot 10^{-5}:\\
\;\;\;\;\frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, \left(-4 \cdot a\right) \cdot c\right)}}{2 \cdot a}\\

\mathbf{else}:\\
\;\;\;\;\frac{-c}{b}\\


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < -1.8e-5

    1. Initial program 30.7%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{b \cdot b - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{\left(4 \cdot a\right) \cdot c}}}{2 \cdot a} \]
      3. fp-cancel-sub-sign-invN/A

        \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{b \cdot b + \left(\mathsf{neg}\left(4 \cdot a\right)\right) \cdot c}}}{2 \cdot a} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{b \cdot b} + \left(\mathsf{neg}\left(4 \cdot a\right)\right) \cdot c}}{2 \cdot a} \]
      5. sqr-neg-revN/A

        \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\left(\mathsf{neg}\left(b\right)\right) \cdot \left(\mathsf{neg}\left(b\right)\right)} + \left(\mathsf{neg}\left(4 \cdot a\right)\right) \cdot c}}{2 \cdot a} \]
      6. lift-neg.f64N/A

        \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\left(-b\right)} \cdot \left(\mathsf{neg}\left(b\right)\right) + \left(\mathsf{neg}\left(4 \cdot a\right)\right) \cdot c}}{2 \cdot a} \]
      7. lift-neg.f64N/A

        \[\leadsto \frac{\left(-b\right) + \sqrt{\left(-b\right) \cdot \color{blue}{\left(-b\right)} + \left(\mathsf{neg}\left(4 \cdot a\right)\right) \cdot c}}{2 \cdot a} \]
      8. sqr-neg-revN/A

        \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\left(\mathsf{neg}\left(\left(-b\right)\right)\right) \cdot \left(\mathsf{neg}\left(\left(-b\right)\right)\right)} + \left(\mathsf{neg}\left(4 \cdot a\right)\right) \cdot c}}{2 \cdot a} \]
      9. lower-fma.f64N/A

        \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(\left(-b\right)\right), \mathsf{neg}\left(\left(-b\right)\right), \left(\mathsf{neg}\left(4 \cdot a\right)\right) \cdot c\right)}}}{2 \cdot a} \]
      10. lift-neg.f64N/A

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(b\right)\right)}\right), \mathsf{neg}\left(\left(-b\right)\right), \left(\mathsf{neg}\left(4 \cdot a\right)\right) \cdot c\right)}}{2 \cdot a} \]
      11. remove-double-negN/A

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(\color{blue}{b}, \mathsf{neg}\left(\left(-b\right)\right), \left(\mathsf{neg}\left(4 \cdot a\right)\right) \cdot c\right)}}{2 \cdot a} \]
      12. lift-neg.f64N/A

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, \mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(b\right)\right)}\right), \left(\mathsf{neg}\left(4 \cdot a\right)\right) \cdot c\right)}}{2 \cdot a} \]
      13. remove-double-negN/A

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, \color{blue}{b}, \left(\mathsf{neg}\left(4 \cdot a\right)\right) \cdot c\right)}}{2 \cdot a} \]
      14. lower-*.f64N/A

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, \color{blue}{\left(\mathsf{neg}\left(4 \cdot a\right)\right) \cdot c}\right)}}{2 \cdot a} \]
      15. lift-*.f64N/A

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, \left(\mathsf{neg}\left(\color{blue}{4 \cdot a}\right)\right) \cdot c\right)}}{2 \cdot a} \]
      16. distribute-lft-neg-inN/A

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, \color{blue}{\left(\left(\mathsf{neg}\left(4\right)\right) \cdot a\right)} \cdot c\right)}}{2 \cdot a} \]
      17. lower-*.f64N/A

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, \color{blue}{\left(\left(\mathsf{neg}\left(4\right)\right) \cdot a\right)} \cdot c\right)}}{2 \cdot a} \]
      18. metadata-eval30.8%

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, \left(\color{blue}{-4} \cdot a\right) \cdot c\right)}}{2 \cdot a} \]
    3. Applied rewrites30.8%

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\mathsf{fma}\left(b, b, \left(-4 \cdot a\right) \cdot c\right)}}}{2 \cdot a} \]

    if -1.8e-5 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a))

    1. Initial program 30.7%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Taylor expanded in b around inf

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto -1 \cdot \color{blue}{\frac{c}{b}} \]
      2. lower-/.f6481.8%

        \[\leadsto -1 \cdot \frac{c}{\color{blue}{b}} \]
    4. Applied rewrites81.8%

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto -1 \cdot \color{blue}{\frac{c}{b}} \]
      2. lift-/.f64N/A

        \[\leadsto -1 \cdot \frac{c}{\color{blue}{b}} \]
      3. associate-*r/N/A

        \[\leadsto \frac{-1 \cdot c}{\color{blue}{b}} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{-1 \cdot c}{\color{blue}{b}} \]
      5. mul-1-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(c\right)}{b} \]
      6. lower-neg.f6481.8%

        \[\leadsto \frac{-c}{b} \]
    6. Applied rewrites81.8%

      \[\leadsto \frac{-c}{\color{blue}{b}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 7: 84.5% accurate, 0.5× speedup?

\[\begin{array}{l} \mathbf{if}\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \leq -1.8 \cdot 10^{-5}:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(c \cdot a, -4, b \cdot b\right)} - b}{a + a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]
(FPCore (a b c)
  :precision binary64
  (if (<=
     (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a))
     -1.8e-5)
  (/ (- (sqrt (fma (* c a) -4.0 (* b b))) b) (+ a a))
  (/ (- c) b)))
double code(double a, double b, double c) {
	double tmp;
	if (((-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a)) <= -1.8e-5) {
		tmp = (sqrt(fma((c * a), -4.0, (b * b))) - b) / (a + a);
	} else {
		tmp = -c / b;
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c)))) / Float64(2.0 * a)) <= -1.8e-5)
		tmp = Float64(Float64(sqrt(fma(Float64(c * a), -4.0, Float64(b * b))) - b) / Float64(a + a));
	else
		tmp = Float64(Float64(-c) / b);
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision], -1.8e-5], N[(N[(N[Sqrt[N[(N[(c * a), $MachinePrecision] * -4.0 + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a + a), $MachinePrecision]), $MachinePrecision], N[((-c) / b), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \leq -1.8 \cdot 10^{-5}:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(c \cdot a, -4, b \cdot b\right)} - b}{a + a}\\

\mathbf{else}:\\
\;\;\;\;\frac{-c}{b}\\


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < -1.8e-5

    1. Initial program 30.7%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}} \]
      2. lift-+.f64N/A

        \[\leadsto \frac{\color{blue}{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a} \]
      3. div-addN/A

        \[\leadsto \color{blue}{\frac{-b}{2 \cdot a} + \frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}} \]
      4. frac-2negN/A

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(-b\right)\right)}{\mathsf{neg}\left(2 \cdot a\right)}} + \frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
      5. mult-flipN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(-b\right)\right)\right) \cdot \frac{1}{\mathsf{neg}\left(2 \cdot a\right)}} + \frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
      6. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(\left(-b\right)\right), \frac{1}{\mathsf{neg}\left(2 \cdot a\right)}, \frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\right)} \]
      7. lift-neg.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(b\right)\right)}\right), \frac{1}{\mathsf{neg}\left(2 \cdot a\right)}, \frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\right) \]
      8. remove-double-negN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{b}, \frac{1}{\mathsf{neg}\left(2 \cdot a\right)}, \frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\right) \]
      9. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{1}{\mathsf{neg}\left(\color{blue}{2 \cdot a}\right)}, \frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\right) \]
      10. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{1}{\color{blue}{\left(\mathsf{neg}\left(2\right)\right) \cdot a}}, \frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\right) \]
      11. associate-/r*N/A

        \[\leadsto \mathsf{fma}\left(b, \color{blue}{\frac{\frac{1}{\mathsf{neg}\left(2\right)}}{a}}, \frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\right) \]
      12. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{\frac{1}{\color{blue}{-2}}}{a}, \frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\right) \]
      13. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{\color{blue}{\frac{-1}{2}}}{a}, \frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\right) \]
      14. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{\color{blue}{\mathsf{neg}\left(\frac{1}{2}\right)}}{a}, \frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\right) \]
      15. lower-/.f64N/A

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

        \[\leadsto \mathsf{fma}\left(b, \frac{\color{blue}{\frac{-1}{2}}}{a}, \frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\right) \]
      17. lower-/.f6432.0%

        \[\leadsto \mathsf{fma}\left(b, \frac{-0.5}{a}, \color{blue}{\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}}\right) \]
    3. Applied rewrites32.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(b, \frac{-0.5}{a}, \frac{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}}{a + a}\right)} \]
    4. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{\frac{-1}{2}}{a}, \color{blue}{\frac{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}}{a + a}}\right) \]
      2. div-flipN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{\frac{-1}{2}}{a}, \color{blue}{\frac{1}{\frac{a + a}{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}}}}\right) \]
      3. lower-unsound-/.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{\frac{-1}{2}}{a}, \color{blue}{\frac{1}{\frac{a + a}{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}}}}\right) \]
      4. lower-unsound-/.f6431.8%

        \[\leadsto \mathsf{fma}\left(b, \frac{-0.5}{a}, \frac{1}{\color{blue}{\frac{a + a}{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)}}}}\right) \]
      5. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{\frac{-1}{2}}{a}, \frac{1}{\frac{a + a}{\sqrt{\mathsf{fma}\left(\color{blue}{c \cdot -4}, a, b \cdot b\right)}}}\right) \]
      6. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{\frac{-1}{2}}{a}, \frac{1}{\frac{a + a}{\sqrt{\mathsf{fma}\left(\color{blue}{-4 \cdot c}, a, b \cdot b\right)}}}\right) \]
      7. lower-*.f6431.8%

        \[\leadsto \mathsf{fma}\left(b, \frac{-0.5}{a}, \frac{1}{\frac{a + a}{\sqrt{\mathsf{fma}\left(\color{blue}{-4 \cdot c}, a, b \cdot b\right)}}}\right) \]
    5. Applied rewrites31.8%

      \[\leadsto \mathsf{fma}\left(b, \frac{-0.5}{a}, \color{blue}{\frac{1}{\frac{a + a}{\sqrt{\mathsf{fma}\left(-4 \cdot c, a, b \cdot b\right)}}}}\right) \]
    6. Step-by-step derivation
      1. lift-fma.f64N/A

        \[\leadsto \color{blue}{b \cdot \frac{\frac{-1}{2}}{a} + \frac{1}{\frac{a + a}{\sqrt{\mathsf{fma}\left(-4 \cdot c, a, b \cdot b\right)}}}} \]
      2. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{1}{\frac{a + a}{\sqrt{\mathsf{fma}\left(-4 \cdot c, a, b \cdot b\right)}}} + b \cdot \frac{\frac{-1}{2}}{a}} \]
      3. *-commutativeN/A

        \[\leadsto \frac{1}{\frac{a + a}{\sqrt{\mathsf{fma}\left(-4 \cdot c, a, b \cdot b\right)}}} + \color{blue}{\frac{\frac{-1}{2}}{a} \cdot b} \]
      4. fp-cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\frac{1}{\frac{a + a}{\sqrt{\mathsf{fma}\left(-4 \cdot c, a, b \cdot b\right)}}} - \left(\mathsf{neg}\left(\frac{\frac{-1}{2}}{a}\right)\right) \cdot b} \]
      5. lift-/.f64N/A

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

        \[\leadsto \frac{1}{\color{blue}{\frac{a + a}{\sqrt{\mathsf{fma}\left(-4 \cdot c, a, b \cdot b\right)}}}} - \left(\mathsf{neg}\left(\frac{\frac{-1}{2}}{a}\right)\right) \cdot b \]
      7. div-flip-revN/A

        \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(-4 \cdot c, a, b \cdot b\right)}}{a + a}} - \left(\mathsf{neg}\left(\frac{\frac{-1}{2}}{a}\right)\right) \cdot b \]
      8. lift-/.f64N/A

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(-4 \cdot c, a, b \cdot b\right)}}{a + a} - \left(\mathsf{neg}\left(\color{blue}{\frac{\frac{-1}{2}}{a}}\right)\right) \cdot b \]
      9. distribute-frac-negN/A

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(-4 \cdot c, a, b \cdot b\right)}}{a + a} - \color{blue}{\frac{\mathsf{neg}\left(\frac{-1}{2}\right)}{a}} \cdot b \]
      10. metadata-evalN/A

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(-4 \cdot c, a, b \cdot b\right)}}{a + a} - \frac{\color{blue}{\frac{1}{2}}}{a} \cdot b \]
      11. metadata-evalN/A

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(-4 \cdot c, a, b \cdot b\right)}}{a + a} - \frac{\color{blue}{\frac{1}{2}}}{a} \cdot b \]
      12. associate-/r*N/A

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(-4 \cdot c, a, b \cdot b\right)}}{a + a} - \color{blue}{\frac{1}{2 \cdot a}} \cdot b \]
      13. count-2-revN/A

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(-4 \cdot c, a, b \cdot b\right)}}{a + a} - \frac{1}{\color{blue}{a + a}} \cdot b \]
      14. lift-+.f64N/A

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(-4 \cdot c, a, b \cdot b\right)}}{a + a} - \frac{1}{\color{blue}{a + a}} \cdot b \]
      15. *-commutativeN/A

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(-4 \cdot c, a, b \cdot b\right)}}{a + a} - \color{blue}{b \cdot \frac{1}{a + a}} \]
      16. mult-flipN/A

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(-4 \cdot c, a, b \cdot b\right)}}{a + a} - \color{blue}{\frac{b}{a + a}} \]
      17. sub-divN/A

        \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(-4 \cdot c, a, b \cdot b\right)} - b}{a + a}} \]
    7. Applied rewrites30.7%

      \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(c \cdot a, -4, b \cdot b\right)} - b}{a + a}} \]

    if -1.8e-5 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a))

    1. Initial program 30.7%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Taylor expanded in b around inf

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto -1 \cdot \color{blue}{\frac{c}{b}} \]
      2. lower-/.f6481.8%

        \[\leadsto -1 \cdot \frac{c}{\color{blue}{b}} \]
    4. Applied rewrites81.8%

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto -1 \cdot \color{blue}{\frac{c}{b}} \]
      2. lift-/.f64N/A

        \[\leadsto -1 \cdot \frac{c}{\color{blue}{b}} \]
      3. associate-*r/N/A

        \[\leadsto \frac{-1 \cdot c}{\color{blue}{b}} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{-1 \cdot c}{\color{blue}{b}} \]
      5. mul-1-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(c\right)}{b} \]
      6. lower-neg.f6481.8%

        \[\leadsto \frac{-c}{b} \]
    6. Applied rewrites81.8%

      \[\leadsto \frac{-c}{\color{blue}{b}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 8: 84.5% accurate, 0.5× speedup?

\[\begin{array}{l} \mathbf{if}\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \leq -1.8 \cdot 10^{-5}:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)} - b}{a + a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]
(FPCore (a b c)
  :precision binary64
  (if (<=
     (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a))
     -1.8e-5)
  (/ (- (sqrt (fma (* c -4.0) a (* b b))) b) (+ a a))
  (/ (- c) b)))
double code(double a, double b, double c) {
	double tmp;
	if (((-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a)) <= -1.8e-5) {
		tmp = (sqrt(fma((c * -4.0), a, (b * b))) - b) / (a + a);
	} else {
		tmp = -c / b;
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c)))) / Float64(2.0 * a)) <= -1.8e-5)
		tmp = Float64(Float64(sqrt(fma(Float64(c * -4.0), a, Float64(b * b))) - b) / Float64(a + a));
	else
		tmp = Float64(Float64(-c) / b);
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision], -1.8e-5], N[(N[(N[Sqrt[N[(N[(c * -4.0), $MachinePrecision] * a + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a + a), $MachinePrecision]), $MachinePrecision], N[((-c) / b), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \leq -1.8 \cdot 10^{-5}:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)} - b}{a + a}\\

\mathbf{else}:\\
\;\;\;\;\frac{-c}{b}\\


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < -1.8e-5

    1. Initial program 30.7%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Step-by-step derivation
      1. Applied rewrites30.7%

        \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(c \cdot -4, a, b \cdot b\right)} - b}{a + a}} \]

      if -1.8e-5 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a))

      1. Initial program 30.7%

        \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
      2. Taylor expanded in b around inf

        \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
      3. Step-by-step derivation
        1. lower-*.f64N/A

          \[\leadsto -1 \cdot \color{blue}{\frac{c}{b}} \]
        2. lower-/.f6481.8%

          \[\leadsto -1 \cdot \frac{c}{\color{blue}{b}} \]
      4. Applied rewrites81.8%

        \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
      5. Step-by-step derivation
        1. lift-*.f64N/A

          \[\leadsto -1 \cdot \color{blue}{\frac{c}{b}} \]
        2. lift-/.f64N/A

          \[\leadsto -1 \cdot \frac{c}{\color{blue}{b}} \]
        3. associate-*r/N/A

          \[\leadsto \frac{-1 \cdot c}{\color{blue}{b}} \]
        4. lower-/.f64N/A

          \[\leadsto \frac{-1 \cdot c}{\color{blue}{b}} \]
        5. mul-1-negN/A

          \[\leadsto \frac{\mathsf{neg}\left(c\right)}{b} \]
        6. lower-neg.f6481.8%

          \[\leadsto \frac{-c}{b} \]
      6. Applied rewrites81.8%

        \[\leadsto \frac{-c}{\color{blue}{b}} \]
    3. Recombined 2 regimes into one program.
    4. Add Preprocessing

    Alternative 9: 81.8% accurate, 4.3× speedup?

    \[\frac{-c}{b} \]
    (FPCore (a b c)
      :precision binary64
      (/ (- c) b))
    double code(double a, double b, double c) {
    	return -c / b;
    }
    
    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(a, b, c)
    use fmin_fmax_functions
        real(8), intent (in) :: a
        real(8), intent (in) :: b
        real(8), intent (in) :: c
        code = -c / b
    end function
    
    public static double code(double a, double b, double c) {
    	return -c / b;
    }
    
    def code(a, b, c):
    	return -c / b
    
    function code(a, b, c)
    	return Float64(Float64(-c) / b)
    end
    
    function tmp = code(a, b, c)
    	tmp = -c / b;
    end
    
    code[a_, b_, c_] := N[((-c) / b), $MachinePrecision]
    
    \frac{-c}{b}
    
    Derivation
    1. Initial program 30.7%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Taylor expanded in b around inf

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto -1 \cdot \color{blue}{\frac{c}{b}} \]
      2. lower-/.f6481.8%

        \[\leadsto -1 \cdot \frac{c}{\color{blue}{b}} \]
    4. Applied rewrites81.8%

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto -1 \cdot \color{blue}{\frac{c}{b}} \]
      2. lift-/.f64N/A

        \[\leadsto -1 \cdot \frac{c}{\color{blue}{b}} \]
      3. associate-*r/N/A

        \[\leadsto \frac{-1 \cdot c}{\color{blue}{b}} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{-1 \cdot c}{\color{blue}{b}} \]
      5. mul-1-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(c\right)}{b} \]
      6. lower-neg.f6481.8%

        \[\leadsto \frac{-c}{b} \]
    6. Applied rewrites81.8%

      \[\leadsto \frac{-c}{\color{blue}{b}} \]
    7. Add Preprocessing

    Reproduce

    ?
    herbie shell --seed 2025255 
    (FPCore (a b c)
      :name "Quadratic roots, medium range"
      :precision binary64
      :pre (and (and (and (< 1.1102230246251565e-16 a) (< a 9007199254740992.0)) (and (< 1.1102230246251565e-16 b) (< b 9007199254740992.0))) (and (< 1.1102230246251565e-16 c) (< c 9007199254740992.0)))
      (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))