(sqrt (* (* (+ z0 z0) z1) (- (- z2 (* (/ z3 z4) (+ z3 z3))) (* (* z0 (* (/ z3 z4) (/ z3 z4))) (- z1 z5)))))

Percentage Accurate: 53.4% → 64.9%
Time: 30.8s
Alternatives: 7
Speedup: 1.2×

Specification

?
\[\sqrt{\left(\left(z0 + z0\right) \cdot z1\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)} \]
(FPCore (z0 z1 z2 z3 z4 z5)
  :precision binary64
  (sqrt
 (*
  (* (+ z0 z0) z1)
  (-
   (- z2 (* (/ z3 z4) (+ z3 z3)))
   (* (* z0 (* (/ z3 z4) (/ z3 z4))) (- z1 z5))))))
double code(double z0, double z1, double z2, double z3, double z4, double z5) {
	return sqrt((((z0 + z0) * z1) * ((z2 - ((z3 / z4) * (z3 + z3))) - ((z0 * ((z3 / z4) * (z3 / z4))) * (z1 - z5)))));
}
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(z0, z1, z2, z3, z4, z5)
use fmin_fmax_functions
    real(8), intent (in) :: z0
    real(8), intent (in) :: z1
    real(8), intent (in) :: z2
    real(8), intent (in) :: z3
    real(8), intent (in) :: z4
    real(8), intent (in) :: z5
    code = sqrt((((z0 + z0) * z1) * ((z2 - ((z3 / z4) * (z3 + z3))) - ((z0 * ((z3 / z4) * (z3 / z4))) * (z1 - z5)))))
end function
public static double code(double z0, double z1, double z2, double z3, double z4, double z5) {
	return Math.sqrt((((z0 + z0) * z1) * ((z2 - ((z3 / z4) * (z3 + z3))) - ((z0 * ((z3 / z4) * (z3 / z4))) * (z1 - z5)))));
}
def code(z0, z1, z2, z3, z4, z5):
	return math.sqrt((((z0 + z0) * z1) * ((z2 - ((z3 / z4) * (z3 + z3))) - ((z0 * ((z3 / z4) * (z3 / z4))) * (z1 - z5)))))
function code(z0, z1, z2, z3, z4, z5)
	return sqrt(Float64(Float64(Float64(z0 + z0) * z1) * Float64(Float64(z2 - Float64(Float64(z3 / z4) * Float64(z3 + z3))) - Float64(Float64(z0 * Float64(Float64(z3 / z4) * Float64(z3 / z4))) * Float64(z1 - z5)))))
end
function tmp = code(z0, z1, z2, z3, z4, z5)
	tmp = sqrt((((z0 + z0) * z1) * ((z2 - ((z3 / z4) * (z3 + z3))) - ((z0 * ((z3 / z4) * (z3 / z4))) * (z1 - z5)))));
end
code[z0_, z1_, z2_, z3_, z4_, z5_] := N[Sqrt[N[(N[(N[(z0 + z0), $MachinePrecision] * z1), $MachinePrecision] * N[(N[(z2 - N[(N[(z3 / z4), $MachinePrecision] * N[(z3 + z3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(z0 * N[(N[(z3 / z4), $MachinePrecision] * N[(z3 / z4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(z1 - z5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\sqrt{\left(\left(z0 + z0\right) \cdot z1\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)}

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 7 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: 53.4% accurate, 1.0× speedup?

\[\sqrt{\left(\left(z0 + z0\right) \cdot z1\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)} \]
(FPCore (z0 z1 z2 z3 z4 z5)
  :precision binary64
  (sqrt
 (*
  (* (+ z0 z0) z1)
  (-
   (- z2 (* (/ z3 z4) (+ z3 z3)))
   (* (* z0 (* (/ z3 z4) (/ z3 z4))) (- z1 z5))))))
double code(double z0, double z1, double z2, double z3, double z4, double z5) {
	return sqrt((((z0 + z0) * z1) * ((z2 - ((z3 / z4) * (z3 + z3))) - ((z0 * ((z3 / z4) * (z3 / z4))) * (z1 - z5)))));
}
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(z0, z1, z2, z3, z4, z5)
use fmin_fmax_functions
    real(8), intent (in) :: z0
    real(8), intent (in) :: z1
    real(8), intent (in) :: z2
    real(8), intent (in) :: z3
    real(8), intent (in) :: z4
    real(8), intent (in) :: z5
    code = sqrt((((z0 + z0) * z1) * ((z2 - ((z3 / z4) * (z3 + z3))) - ((z0 * ((z3 / z4) * (z3 / z4))) * (z1 - z5)))))
end function
public static double code(double z0, double z1, double z2, double z3, double z4, double z5) {
	return Math.sqrt((((z0 + z0) * z1) * ((z2 - ((z3 / z4) * (z3 + z3))) - ((z0 * ((z3 / z4) * (z3 / z4))) * (z1 - z5)))));
}
def code(z0, z1, z2, z3, z4, z5):
	return math.sqrt((((z0 + z0) * z1) * ((z2 - ((z3 / z4) * (z3 + z3))) - ((z0 * ((z3 / z4) * (z3 / z4))) * (z1 - z5)))))
function code(z0, z1, z2, z3, z4, z5)
	return sqrt(Float64(Float64(Float64(z0 + z0) * z1) * Float64(Float64(z2 - Float64(Float64(z3 / z4) * Float64(z3 + z3))) - Float64(Float64(z0 * Float64(Float64(z3 / z4) * Float64(z3 / z4))) * Float64(z1 - z5)))))
end
function tmp = code(z0, z1, z2, z3, z4, z5)
	tmp = sqrt((((z0 + z0) * z1) * ((z2 - ((z3 / z4) * (z3 + z3))) - ((z0 * ((z3 / z4) * (z3 / z4))) * (z1 - z5)))));
end
code[z0_, z1_, z2_, z3_, z4_, z5_] := N[Sqrt[N[(N[(N[(z0 + z0), $MachinePrecision] * z1), $MachinePrecision] * N[(N[(z2 - N[(N[(z3 / z4), $MachinePrecision] * N[(z3 + z3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(z0 * N[(N[(z3 / z4), $MachinePrecision] * N[(z3 / z4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(z1 - z5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\sqrt{\left(\left(z0 + z0\right) \cdot z1\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)}

Alternative 1: 64.9% accurate, 0.5× speedup?

\[\begin{array}{l} t_0 := \frac{z3}{z4} \cdot z0\\ \mathbf{if}\;\left(\left(z0 + z0\right) \cdot z1\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right) \leq 1000000000000000017652801462756379714374878780719864776839443139119744823869255243069012222883470359078822072829219411228534934402712624705615450492327979456500795456339201761949451160807447294527656222743617592048849967890105831362861792425329827928397252374398383022243308510390698430058459037696:\\ \;\;\;\;\sqrt{\mathsf{304\_z0z1z2z3z4}\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(z3 + z3\right) - \left(z5 - z1\right) \cdot t\_0\right)\right), z1, z0, \left(-z1\right), z0\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(t\_0 \cdot \left(z1 - z5\right) + z3\right) + z3\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1}\\ \end{array} \]
(FPCore (z0 z1 z2 z3 z4 z5)
  :precision binary64
  (let* ((t_0 (* (/ z3 z4) z0)))
  (if (<=
       (*
        (* (+ z0 z0) z1)
        (-
         (- z2 (* (/ z3 z4) (+ z3 z3)))
         (* (* z0 (* (/ z3 z4) (/ z3 z4))) (- z1 z5))))
       1000000000000000017652801462756379714374878780719864776839443139119744823869255243069012222883470359078822072829219411228534934402712624705615450492327979456500795456339201761949451160807447294527656222743617592048849967890105831362861792425329827928397252374398383022243308510390698430058459037696)
    (sqrt
     (304-z0z1z2z3z4
      (- z2 (* (/ z3 z4) (- (+ z3 z3) (* (- z5 z1) t_0))))
      z1
      z0
      (- z1)
      z0))
    (sqrt
     (*
      (*
       (- z2 (* (/ z3 z4) (+ (+ (* t_0 (- z1 z5)) z3) z3)))
       (+ z0 z0))
      z1)))))
\begin{array}{l}
t_0 := \frac{z3}{z4} \cdot z0\\
\mathbf{if}\;\left(\left(z0 + z0\right) \cdot z1\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right) \leq 1000000000000000017652801462756379714374878780719864776839443139119744823869255243069012222883470359078822072829219411228534934402712624705615450492327979456500795456339201761949451160807447294527656222743617592048849967890105831362861792425329827928397252374398383022243308510390698430058459037696:\\
\;\;\;\;\sqrt{\mathsf{304\_z0z1z2z3z4}\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(z3 + z3\right) - \left(z5 - z1\right) \cdot t\_0\right)\right), z1, z0, \left(-z1\right), z0\right)}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(t\_0 \cdot \left(z1 - z5\right) + z3\right) + z3\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1}\\


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (*.f64 (+.f64 z0 z0) z1) (-.f64 (-.f64 z2 (*.f64 (/.f64 z3 z4) (+.f64 z3 z3))) (*.f64 (*.f64 z0 (*.f64 (/.f64 z3 z4) (/.f64 z3 z4))) (-.f64 z1 z5)))) < 1e297

    1. Initial program 53.4%

      \[\sqrt{\left(\left(z0 + z0\right) \cdot z1\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)} \]
    2. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \sqrt{\color{blue}{\left(\left(z0 + z0\right) \cdot z1\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)}} \]
      2. *-commutativeN/A

        \[\leadsto \sqrt{\color{blue}{\left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right) \cdot \left(\left(z0 + z0\right) \cdot z1\right)}} \]
      3. lift-*.f64N/A

        \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right) \cdot \color{blue}{\left(\left(z0 + z0\right) \cdot z1\right)}} \]
      4. *-commutativeN/A

        \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right) \cdot \color{blue}{\left(z1 \cdot \left(z0 + z0\right)\right)}} \]
      5. lift-+.f64N/A

        \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right) \cdot \left(z1 \cdot \color{blue}{\left(z0 + z0\right)}\right)} \]
      6. distribute-lft-inN/A

        \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right) \cdot \color{blue}{\left(z1 \cdot z0 + z1 \cdot z0\right)}} \]
      7. fp-cancel-sign-sub-invN/A

        \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right) \cdot \color{blue}{\left(z1 \cdot z0 - \left(\mathsf{neg}\left(z1\right)\right) \cdot z0\right)}} \]
      8. lower-304-z0z1z2z3z4N/A

        \[\leadsto \sqrt{\color{blue}{\mathsf{304\_z0z1z2z3z4}\left(\left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right), z1, z0, \left(\mathsf{neg}\left(z1\right)\right), z0\right)}} \]
    3. Applied rewrites48.3%

      \[\leadsto \sqrt{\color{blue}{\mathsf{304\_z0z1z2z3z4}\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4} + \left(z3 + z3\right)\right)\right), z1, z0, \left(-z1\right), z0\right)}} \]
    4. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \sqrt{\mathsf{304\_z0z1z2z3z4}\left(\left(z2 - \frac{z3}{z4} \cdot \color{blue}{\left(\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4} + \left(z3 + z3\right)\right)}\right), z1, z0, \left(-z1\right), z0\right)} \]
      2. +-commutativeN/A

        \[\leadsto \sqrt{\mathsf{304\_z0z1z2z3z4}\left(\left(z2 - \frac{z3}{z4} \cdot \color{blue}{\left(\left(z3 + z3\right) + \left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4}\right)}\right), z1, z0, \left(-z1\right), z0\right)} \]
      3. lift-*.f64N/A

        \[\leadsto \sqrt{\mathsf{304\_z0z1z2z3z4}\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(z3 + z3\right) + \color{blue}{\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4}}\right)\right), z1, z0, \left(-z1\right), z0\right)} \]
      4. lift-*.f64N/A

        \[\leadsto \sqrt{\mathsf{304\_z0z1z2z3z4}\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(z3 + z3\right) + \color{blue}{\left(\left(z1 - z5\right) \cdot z0\right)} \cdot \frac{z3}{z4}\right)\right), z1, z0, \left(-z1\right), z0\right)} \]
      5. associate-*l*N/A

        \[\leadsto \sqrt{\mathsf{304\_z0z1z2z3z4}\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(z3 + z3\right) + \color{blue}{\left(z1 - z5\right) \cdot \left(z0 \cdot \frac{z3}{z4}\right)}\right)\right), z1, z0, \left(-z1\right), z0\right)} \]
      6. fp-cancel-sign-sub-invN/A

        \[\leadsto \sqrt{\mathsf{304\_z0z1z2z3z4}\left(\left(z2 - \frac{z3}{z4} \cdot \color{blue}{\left(\left(z3 + z3\right) - \left(\mathsf{neg}\left(\left(z1 - z5\right)\right)\right) \cdot \left(z0 \cdot \frac{z3}{z4}\right)\right)}\right), z1, z0, \left(-z1\right), z0\right)} \]
      7. lower--.f64N/A

        \[\leadsto \sqrt{\mathsf{304\_z0z1z2z3z4}\left(\left(z2 - \frac{z3}{z4} \cdot \color{blue}{\left(\left(z3 + z3\right) - \left(\mathsf{neg}\left(\left(z1 - z5\right)\right)\right) \cdot \left(z0 \cdot \frac{z3}{z4}\right)\right)}\right), z1, z0, \left(-z1\right), z0\right)} \]
      8. lift--.f64N/A

        \[\leadsto \sqrt{\mathsf{304\_z0z1z2z3z4}\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(z3 + z3\right) - \left(\mathsf{neg}\left(\color{blue}{\left(z1 - z5\right)}\right)\right) \cdot \left(z0 \cdot \frac{z3}{z4}\right)\right)\right), z1, z0, \left(-z1\right), z0\right)} \]
      9. sub-negate-revN/A

        \[\leadsto \sqrt{\mathsf{304\_z0z1z2z3z4}\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(z3 + z3\right) - \color{blue}{\left(z5 - z1\right)} \cdot \left(z0 \cdot \frac{z3}{z4}\right)\right)\right), z1, z0, \left(-z1\right), z0\right)} \]
      10. *-commutativeN/A

        \[\leadsto \sqrt{\mathsf{304\_z0z1z2z3z4}\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(z3 + z3\right) - \left(z5 - z1\right) \cdot \color{blue}{\left(\frac{z3}{z4} \cdot z0\right)}\right)\right), z1, z0, \left(-z1\right), z0\right)} \]
      11. lower-*.f64N/A

        \[\leadsto \sqrt{\mathsf{304\_z0z1z2z3z4}\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(z3 + z3\right) - \color{blue}{\left(z5 - z1\right) \cdot \left(\frac{z3}{z4} \cdot z0\right)}\right)\right), z1, z0, \left(-z1\right), z0\right)} \]
      12. lower--.f64N/A

        \[\leadsto \sqrt{\mathsf{304\_z0z1z2z3z4}\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(z3 + z3\right) - \color{blue}{\left(z5 - z1\right)} \cdot \left(\frac{z3}{z4} \cdot z0\right)\right)\right), z1, z0, \left(-z1\right), z0\right)} \]
      13. lower-*.f6452.8%

        \[\leadsto \sqrt{\mathsf{304\_z0z1z2z3z4}\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(z3 + z3\right) - \left(z5 - z1\right) \cdot \color{blue}{\left(\frac{z3}{z4} \cdot z0\right)}\right)\right), z1, z0, \left(-z1\right), z0\right)} \]
    5. Applied rewrites52.8%

      \[\leadsto \sqrt{\mathsf{304\_z0z1z2z3z4}\left(\left(z2 - \frac{z3}{z4} \cdot \color{blue}{\left(\left(z3 + z3\right) - \left(z5 - z1\right) \cdot \left(\frac{z3}{z4} \cdot z0\right)\right)}\right), z1, z0, \left(-z1\right), z0\right)} \]

    if 1e297 < (*.f64 (*.f64 (+.f64 z0 z0) z1) (-.f64 (-.f64 z2 (*.f64 (/.f64 z3 z4) (+.f64 z3 z3))) (*.f64 (*.f64 z0 (*.f64 (/.f64 z3 z4) (/.f64 z3 z4))) (-.f64 z1 z5))))

    1. Initial program 53.4%

      \[\sqrt{\left(\left(z0 + z0\right) \cdot z1\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)} \]
    2. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \sqrt{\color{blue}{\left(\left(z0 + z0\right) \cdot z1\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)}} \]
      2. lift-*.f64N/A

        \[\leadsto \sqrt{\color{blue}{\left(\left(z0 + z0\right) \cdot z1\right)} \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)} \]
      3. associate-*l*N/A

        \[\leadsto \sqrt{\color{blue}{\left(z0 + z0\right) \cdot \left(z1 \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)\right)}} \]
      4. *-commutativeN/A

        \[\leadsto \sqrt{\left(z0 + z0\right) \cdot \color{blue}{\left(\left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right) \cdot z1\right)}} \]
      5. associate-*r*N/A

        \[\leadsto \sqrt{\color{blue}{\left(\left(z0 + z0\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)\right) \cdot z1}} \]
      6. lower-*.f64N/A

        \[\leadsto \sqrt{\color{blue}{\left(\left(z0 + z0\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)\right) \cdot z1}} \]
    3. Applied rewrites55.8%

      \[\leadsto \sqrt{\color{blue}{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4} + \left(z3 + z3\right)\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1}} \]
    4. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \color{blue}{\left(\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4} + \left(z3 + z3\right)\right)}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      2. lift-+.f64N/A

        \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4} + \color{blue}{\left(z3 + z3\right)}\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      3. associate-+r+N/A

        \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \color{blue}{\left(\left(\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4} + z3\right) + z3\right)}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      4. lower-+.f64N/A

        \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \color{blue}{\left(\left(\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4} + z3\right) + z3\right)}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      5. lower-+.f6455.8%

        \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\color{blue}{\left(\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4} + z3\right)} + z3\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      6. lift-*.f64N/A

        \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\color{blue}{\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4}} + z3\right) + z3\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      7. *-commutativeN/A

        \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\color{blue}{\frac{z3}{z4} \cdot \left(\left(z1 - z5\right) \cdot z0\right)} + z3\right) + z3\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      8. lift-*.f64N/A

        \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\frac{z3}{z4} \cdot \color{blue}{\left(\left(z1 - z5\right) \cdot z0\right)} + z3\right) + z3\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      9. *-commutativeN/A

        \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\frac{z3}{z4} \cdot \color{blue}{\left(z0 \cdot \left(z1 - z5\right)\right)} + z3\right) + z3\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      10. associate-*r*N/A

        \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\color{blue}{\left(\frac{z3}{z4} \cdot z0\right) \cdot \left(z1 - z5\right)} + z3\right) + z3\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      11. lower-*.f64N/A

        \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\color{blue}{\left(\frac{z3}{z4} \cdot z0\right) \cdot \left(z1 - z5\right)} + z3\right) + z3\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      12. lower-*.f6459.5%

        \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\color{blue}{\left(\frac{z3}{z4} \cdot z0\right)} \cdot \left(z1 - z5\right) + z3\right) + z3\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    5. Applied rewrites59.5%

      \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \color{blue}{\left(\left(\left(\frac{z3}{z4} \cdot z0\right) \cdot \left(z1 - z5\right) + z3\right) + z3\right)}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 2: 61.7% accurate, 0.3× speedup?

\[\begin{array}{l} t_0 := \sqrt{\left(\left(z0 + z0\right) \cdot z1\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)}\\ t_1 := \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\left(\frac{z3}{z4} \cdot z0\right) \cdot \left(z1 - z5\right) + z3\right) + z3\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1}\\ \mathbf{if}\;t\_0 \leq 1000000000000000:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_0 \leq 199999999999999982405111001914463627825705729939051460364922737117355163153802565541919878198424069508213948681199740222346696327168:\\ \;\;\;\;\sqrt{\left(z2 - \frac{z3}{z4} \cdot \left(\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4} + \left(z3 + z3\right)\right)\right) \cdot \left(z1 \cdot \left(z0 + z0\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
(FPCore (z0 z1 z2 z3 z4 z5)
  :precision binary64
  (let* ((t_0
        (sqrt
         (*
          (* (+ z0 z0) z1)
          (-
           (- z2 (* (/ z3 z4) (+ z3 z3)))
           (* (* z0 (* (/ z3 z4) (/ z3 z4))) (- z1 z5))))))
       (t_1
        (sqrt
         (*
          (*
           (-
            z2
            (*
             (/ z3 z4)
             (+ (+ (* (* (/ z3 z4) z0) (- z1 z5)) z3) z3)))
           (+ z0 z0))
          z1))))
  (if (<= t_0 1000000000000000)
    t_1
    (if (<=
         t_0
         199999999999999982405111001914463627825705729939051460364922737117355163153802565541919878198424069508213948681199740222346696327168)
      (sqrt
       (*
        (-
         z2
         (* (/ z3 z4) (+ (* (* (- z1 z5) z0) (/ z3 z4)) (+ z3 z3))))
        (* z1 (+ z0 z0))))
      t_1))))
double code(double z0, double z1, double z2, double z3, double z4, double z5) {
	double t_0 = sqrt((((z0 + z0) * z1) * ((z2 - ((z3 / z4) * (z3 + z3))) - ((z0 * ((z3 / z4) * (z3 / z4))) * (z1 - z5)))));
	double t_1 = sqrt((((z2 - ((z3 / z4) * (((((z3 / z4) * z0) * (z1 - z5)) + z3) + z3))) * (z0 + z0)) * z1));
	double tmp;
	if (t_0 <= 1e+15) {
		tmp = t_1;
	} else if (t_0 <= 2e+131) {
		tmp = sqrt(((z2 - ((z3 / z4) * ((((z1 - z5) * z0) * (z3 / z4)) + (z3 + z3)))) * (z1 * (z0 + z0))));
	} else {
		tmp = t_1;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(z0, z1, z2, z3, z4, z5)
use fmin_fmax_functions
    real(8), intent (in) :: z0
    real(8), intent (in) :: z1
    real(8), intent (in) :: z2
    real(8), intent (in) :: z3
    real(8), intent (in) :: z4
    real(8), intent (in) :: z5
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = sqrt((((z0 + z0) * z1) * ((z2 - ((z3 / z4) * (z3 + z3))) - ((z0 * ((z3 / z4) * (z3 / z4))) * (z1 - z5)))))
    t_1 = sqrt((((z2 - ((z3 / z4) * (((((z3 / z4) * z0) * (z1 - z5)) + z3) + z3))) * (z0 + z0)) * z1))
    if (t_0 <= 1d+15) then
        tmp = t_1
    else if (t_0 <= 2d+131) then
        tmp = sqrt(((z2 - ((z3 / z4) * ((((z1 - z5) * z0) * (z3 / z4)) + (z3 + z3)))) * (z1 * (z0 + z0))))
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double z0, double z1, double z2, double z3, double z4, double z5) {
	double t_0 = Math.sqrt((((z0 + z0) * z1) * ((z2 - ((z3 / z4) * (z3 + z3))) - ((z0 * ((z3 / z4) * (z3 / z4))) * (z1 - z5)))));
	double t_1 = Math.sqrt((((z2 - ((z3 / z4) * (((((z3 / z4) * z0) * (z1 - z5)) + z3) + z3))) * (z0 + z0)) * z1));
	double tmp;
	if (t_0 <= 1e+15) {
		tmp = t_1;
	} else if (t_0 <= 2e+131) {
		tmp = Math.sqrt(((z2 - ((z3 / z4) * ((((z1 - z5) * z0) * (z3 / z4)) + (z3 + z3)))) * (z1 * (z0 + z0))));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(z0, z1, z2, z3, z4, z5):
	t_0 = math.sqrt((((z0 + z0) * z1) * ((z2 - ((z3 / z4) * (z3 + z3))) - ((z0 * ((z3 / z4) * (z3 / z4))) * (z1 - z5)))))
	t_1 = math.sqrt((((z2 - ((z3 / z4) * (((((z3 / z4) * z0) * (z1 - z5)) + z3) + z3))) * (z0 + z0)) * z1))
	tmp = 0
	if t_0 <= 1e+15:
		tmp = t_1
	elif t_0 <= 2e+131:
		tmp = math.sqrt(((z2 - ((z3 / z4) * ((((z1 - z5) * z0) * (z3 / z4)) + (z3 + z3)))) * (z1 * (z0 + z0))))
	else:
		tmp = t_1
	return tmp
function code(z0, z1, z2, z3, z4, z5)
	t_0 = sqrt(Float64(Float64(Float64(z0 + z0) * z1) * Float64(Float64(z2 - Float64(Float64(z3 / z4) * Float64(z3 + z3))) - Float64(Float64(z0 * Float64(Float64(z3 / z4) * Float64(z3 / z4))) * Float64(z1 - z5)))))
	t_1 = sqrt(Float64(Float64(Float64(z2 - Float64(Float64(z3 / z4) * Float64(Float64(Float64(Float64(Float64(z3 / z4) * z0) * Float64(z1 - z5)) + z3) + z3))) * Float64(z0 + z0)) * z1))
	tmp = 0.0
	if (t_0 <= 1e+15)
		tmp = t_1;
	elseif (t_0 <= 2e+131)
		tmp = sqrt(Float64(Float64(z2 - Float64(Float64(z3 / z4) * Float64(Float64(Float64(Float64(z1 - z5) * z0) * Float64(z3 / z4)) + Float64(z3 + z3)))) * Float64(z1 * Float64(z0 + z0))));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(z0, z1, z2, z3, z4, z5)
	t_0 = sqrt((((z0 + z0) * z1) * ((z2 - ((z3 / z4) * (z3 + z3))) - ((z0 * ((z3 / z4) * (z3 / z4))) * (z1 - z5)))));
	t_1 = sqrt((((z2 - ((z3 / z4) * (((((z3 / z4) * z0) * (z1 - z5)) + z3) + z3))) * (z0 + z0)) * z1));
	tmp = 0.0;
	if (t_0 <= 1e+15)
		tmp = t_1;
	elseif (t_0 <= 2e+131)
		tmp = sqrt(((z2 - ((z3 / z4) * ((((z1 - z5) * z0) * (z3 / z4)) + (z3 + z3)))) * (z1 * (z0 + z0))));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[z0_, z1_, z2_, z3_, z4_, z5_] := Block[{t$95$0 = N[Sqrt[N[(N[(N[(z0 + z0), $MachinePrecision] * z1), $MachinePrecision] * N[(N[(z2 - N[(N[(z3 / z4), $MachinePrecision] * N[(z3 + z3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(z0 * N[(N[(z3 / z4), $MachinePrecision] * N[(z3 / z4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(z1 - z5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(N[(N[(z2 - N[(N[(z3 / z4), $MachinePrecision] * N[(N[(N[(N[(N[(z3 / z4), $MachinePrecision] * z0), $MachinePrecision] * N[(z1 - z5), $MachinePrecision]), $MachinePrecision] + z3), $MachinePrecision] + z3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(z0 + z0), $MachinePrecision]), $MachinePrecision] * z1), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, 1000000000000000], t$95$1, If[LessEqual[t$95$0, 199999999999999982405111001914463627825705729939051460364922737117355163153802565541919878198424069508213948681199740222346696327168], N[Sqrt[N[(N[(z2 - N[(N[(z3 / z4), $MachinePrecision] * N[(N[(N[(N[(z1 - z5), $MachinePrecision] * z0), $MachinePrecision] * N[(z3 / z4), $MachinePrecision]), $MachinePrecision] + N[(z3 + z3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(z1 * N[(z0 + z0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_0 := \sqrt{\left(\left(z0 + z0\right) \cdot z1\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)}\\
t_1 := \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\left(\frac{z3}{z4} \cdot z0\right) \cdot \left(z1 - z5\right) + z3\right) + z3\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1}\\
\mathbf{if}\;t\_0 \leq 1000000000000000:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_0 \leq 199999999999999982405111001914463627825705729939051460364922737117355163153802565541919878198424069508213948681199740222346696327168:\\
\;\;\;\;\sqrt{\left(z2 - \frac{z3}{z4} \cdot \left(\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4} + \left(z3 + z3\right)\right)\right) \cdot \left(z1 \cdot \left(z0 + z0\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (sqrt.f64 (*.f64 (*.f64 (+.f64 z0 z0) z1) (-.f64 (-.f64 z2 (*.f64 (/.f64 z3 z4) (+.f64 z3 z3))) (*.f64 (*.f64 z0 (*.f64 (/.f64 z3 z4) (/.f64 z3 z4))) (-.f64 z1 z5))))) < 1e15 or 1.9999999999999998e131 < (sqrt.f64 (*.f64 (*.f64 (+.f64 z0 z0) z1) (-.f64 (-.f64 z2 (*.f64 (/.f64 z3 z4) (+.f64 z3 z3))) (*.f64 (*.f64 z0 (*.f64 (/.f64 z3 z4) (/.f64 z3 z4))) (-.f64 z1 z5)))))

    1. Initial program 53.4%

      \[\sqrt{\left(\left(z0 + z0\right) \cdot z1\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)} \]
    2. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \sqrt{\color{blue}{\left(\left(z0 + z0\right) \cdot z1\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)}} \]
      2. lift-*.f64N/A

        \[\leadsto \sqrt{\color{blue}{\left(\left(z0 + z0\right) \cdot z1\right)} \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)} \]
      3. associate-*l*N/A

        \[\leadsto \sqrt{\color{blue}{\left(z0 + z0\right) \cdot \left(z1 \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)\right)}} \]
      4. *-commutativeN/A

        \[\leadsto \sqrt{\left(z0 + z0\right) \cdot \color{blue}{\left(\left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right) \cdot z1\right)}} \]
      5. associate-*r*N/A

        \[\leadsto \sqrt{\color{blue}{\left(\left(z0 + z0\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)\right) \cdot z1}} \]
      6. lower-*.f64N/A

        \[\leadsto \sqrt{\color{blue}{\left(\left(z0 + z0\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)\right) \cdot z1}} \]
    3. Applied rewrites55.8%

      \[\leadsto \sqrt{\color{blue}{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4} + \left(z3 + z3\right)\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1}} \]
    4. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \color{blue}{\left(\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4} + \left(z3 + z3\right)\right)}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      2. lift-+.f64N/A

        \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4} + \color{blue}{\left(z3 + z3\right)}\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      3. associate-+r+N/A

        \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \color{blue}{\left(\left(\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4} + z3\right) + z3\right)}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      4. lower-+.f64N/A

        \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \color{blue}{\left(\left(\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4} + z3\right) + z3\right)}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      5. lower-+.f6455.8%

        \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\color{blue}{\left(\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4} + z3\right)} + z3\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      6. lift-*.f64N/A

        \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\color{blue}{\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4}} + z3\right) + z3\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      7. *-commutativeN/A

        \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\color{blue}{\frac{z3}{z4} \cdot \left(\left(z1 - z5\right) \cdot z0\right)} + z3\right) + z3\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      8. lift-*.f64N/A

        \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\frac{z3}{z4} \cdot \color{blue}{\left(\left(z1 - z5\right) \cdot z0\right)} + z3\right) + z3\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      9. *-commutativeN/A

        \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\frac{z3}{z4} \cdot \color{blue}{\left(z0 \cdot \left(z1 - z5\right)\right)} + z3\right) + z3\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      10. associate-*r*N/A

        \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\color{blue}{\left(\frac{z3}{z4} \cdot z0\right) \cdot \left(z1 - z5\right)} + z3\right) + z3\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      11. lower-*.f64N/A

        \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\color{blue}{\left(\frac{z3}{z4} \cdot z0\right) \cdot \left(z1 - z5\right)} + z3\right) + z3\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      12. lower-*.f6459.5%

        \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\color{blue}{\left(\frac{z3}{z4} \cdot z0\right)} \cdot \left(z1 - z5\right) + z3\right) + z3\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    5. Applied rewrites59.5%

      \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \color{blue}{\left(\left(\left(\frac{z3}{z4} \cdot z0\right) \cdot \left(z1 - z5\right) + z3\right) + z3\right)}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]

    if 1e15 < (sqrt.f64 (*.f64 (*.f64 (+.f64 z0 z0) z1) (-.f64 (-.f64 z2 (*.f64 (/.f64 z3 z4) (+.f64 z3 z3))) (*.f64 (*.f64 z0 (*.f64 (/.f64 z3 z4) (/.f64 z3 z4))) (-.f64 z1 z5))))) < 1.9999999999999998e131

    1. Initial program 53.4%

      \[\sqrt{\left(\left(z0 + z0\right) \cdot z1\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)} \]
    2. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \sqrt{\color{blue}{\left(\left(z0 + z0\right) \cdot z1\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)}} \]
      2. *-commutativeN/A

        \[\leadsto \sqrt{\color{blue}{\left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right) \cdot \left(\left(z0 + z0\right) \cdot z1\right)}} \]
      3. lower-*.f6453.4%

        \[\leadsto \sqrt{\color{blue}{\left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right) \cdot \left(\left(z0 + z0\right) \cdot z1\right)}} \]
    3. Applied rewrites55.5%

      \[\leadsto \sqrt{\color{blue}{\left(z2 - \frac{z3}{z4} \cdot \left(\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4} + \left(z3 + z3\right)\right)\right) \cdot \left(z1 \cdot \left(z0 + z0\right)\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 3: 60.9% accurate, 0.5× speedup?

\[\begin{array}{l} \mathbf{if}\;\sqrt{\left(\left(z0 + z0\right) \cdot z1\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)} \leq 5000000000000000111755861797384299667549204650486879780239418214450132430121171797988101755921550297505076285418812476851459272474624:\\ \;\;\;\;\sqrt{\mathsf{304\_z0z1z2z3z4}\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4} + \left(z3 + z3\right)\right)\right), z1, z0, \left(-z1\right), z0\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\left(\frac{z3}{z4} \cdot z0\right) \cdot \left(z1 - z5\right) + z3\right) + z3\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1}\\ \end{array} \]
(FPCore (z0 z1 z2 z3 z4 z5)
  :precision binary64
  (if (<=
     (sqrt
      (*
       (* (+ z0 z0) z1)
       (-
        (- z2 (* (/ z3 z4) (+ z3 z3)))
        (* (* z0 (* (/ z3 z4) (/ z3 z4))) (- z1 z5)))))
     5000000000000000111755861797384299667549204650486879780239418214450132430121171797988101755921550297505076285418812476851459272474624)
  (sqrt
   (304-z0z1z2z3z4
    (- z2 (* (/ z3 z4) (+ (* (* (- z1 z5) z0) (/ z3 z4)) (+ z3 z3))))
    z1
    z0
    (- z1)
    z0))
  (sqrt
   (*
    (*
     (- z2 (* (/ z3 z4) (+ (+ (* (* (/ z3 z4) z0) (- z1 z5)) z3) z3)))
     (+ z0 z0))
    z1))))
\begin{array}{l}
\mathbf{if}\;\sqrt{\left(\left(z0 + z0\right) \cdot z1\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)} \leq 5000000000000000111755861797384299667549204650486879780239418214450132430121171797988101755921550297505076285418812476851459272474624:\\
\;\;\;\;\sqrt{\mathsf{304\_z0z1z2z3z4}\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4} + \left(z3 + z3\right)\right)\right), z1, z0, \left(-z1\right), z0\right)}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\left(\frac{z3}{z4} \cdot z0\right) \cdot \left(z1 - z5\right) + z3\right) + z3\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1}\\


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (sqrt.f64 (*.f64 (*.f64 (+.f64 z0 z0) z1) (-.f64 (-.f64 z2 (*.f64 (/.f64 z3 z4) (+.f64 z3 z3))) (*.f64 (*.f64 z0 (*.f64 (/.f64 z3 z4) (/.f64 z3 z4))) (-.f64 z1 z5))))) < 5.0000000000000001e132

    1. Initial program 53.4%

      \[\sqrt{\left(\left(z0 + z0\right) \cdot z1\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)} \]
    2. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \sqrt{\color{blue}{\left(\left(z0 + z0\right) \cdot z1\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)}} \]
      2. *-commutativeN/A

        \[\leadsto \sqrt{\color{blue}{\left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right) \cdot \left(\left(z0 + z0\right) \cdot z1\right)}} \]
      3. lift-*.f64N/A

        \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right) \cdot \color{blue}{\left(\left(z0 + z0\right) \cdot z1\right)}} \]
      4. *-commutativeN/A

        \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right) \cdot \color{blue}{\left(z1 \cdot \left(z0 + z0\right)\right)}} \]
      5. lift-+.f64N/A

        \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right) \cdot \left(z1 \cdot \color{blue}{\left(z0 + z0\right)}\right)} \]
      6. distribute-lft-inN/A

        \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right) \cdot \color{blue}{\left(z1 \cdot z0 + z1 \cdot z0\right)}} \]
      7. fp-cancel-sign-sub-invN/A

        \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right) \cdot \color{blue}{\left(z1 \cdot z0 - \left(\mathsf{neg}\left(z1\right)\right) \cdot z0\right)}} \]
      8. lower-304-z0z1z2z3z4N/A

        \[\leadsto \sqrt{\color{blue}{\mathsf{304\_z0z1z2z3z4}\left(\left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right), z1, z0, \left(\mathsf{neg}\left(z1\right)\right), z0\right)}} \]
    3. Applied rewrites48.3%

      \[\leadsto \sqrt{\color{blue}{\mathsf{304\_z0z1z2z3z4}\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4} + \left(z3 + z3\right)\right)\right), z1, z0, \left(-z1\right), z0\right)}} \]

    if 5.0000000000000001e132 < (sqrt.f64 (*.f64 (*.f64 (+.f64 z0 z0) z1) (-.f64 (-.f64 z2 (*.f64 (/.f64 z3 z4) (+.f64 z3 z3))) (*.f64 (*.f64 z0 (*.f64 (/.f64 z3 z4) (/.f64 z3 z4))) (-.f64 z1 z5)))))

    1. Initial program 53.4%

      \[\sqrt{\left(\left(z0 + z0\right) \cdot z1\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)} \]
    2. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \sqrt{\color{blue}{\left(\left(z0 + z0\right) \cdot z1\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)}} \]
      2. lift-*.f64N/A

        \[\leadsto \sqrt{\color{blue}{\left(\left(z0 + z0\right) \cdot z1\right)} \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)} \]
      3. associate-*l*N/A

        \[\leadsto \sqrt{\color{blue}{\left(z0 + z0\right) \cdot \left(z1 \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)\right)}} \]
      4. *-commutativeN/A

        \[\leadsto \sqrt{\left(z0 + z0\right) \cdot \color{blue}{\left(\left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right) \cdot z1\right)}} \]
      5. associate-*r*N/A

        \[\leadsto \sqrt{\color{blue}{\left(\left(z0 + z0\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)\right) \cdot z1}} \]
      6. lower-*.f64N/A

        \[\leadsto \sqrt{\color{blue}{\left(\left(z0 + z0\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)\right) \cdot z1}} \]
    3. Applied rewrites55.8%

      \[\leadsto \sqrt{\color{blue}{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4} + \left(z3 + z3\right)\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1}} \]
    4. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \color{blue}{\left(\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4} + \left(z3 + z3\right)\right)}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      2. lift-+.f64N/A

        \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4} + \color{blue}{\left(z3 + z3\right)}\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      3. associate-+r+N/A

        \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \color{blue}{\left(\left(\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4} + z3\right) + z3\right)}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      4. lower-+.f64N/A

        \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \color{blue}{\left(\left(\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4} + z3\right) + z3\right)}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      5. lower-+.f6455.8%

        \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\color{blue}{\left(\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4} + z3\right)} + z3\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      6. lift-*.f64N/A

        \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\color{blue}{\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4}} + z3\right) + z3\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      7. *-commutativeN/A

        \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\color{blue}{\frac{z3}{z4} \cdot \left(\left(z1 - z5\right) \cdot z0\right)} + z3\right) + z3\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      8. lift-*.f64N/A

        \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\frac{z3}{z4} \cdot \color{blue}{\left(\left(z1 - z5\right) \cdot z0\right)} + z3\right) + z3\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      9. *-commutativeN/A

        \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\frac{z3}{z4} \cdot \color{blue}{\left(z0 \cdot \left(z1 - z5\right)\right)} + z3\right) + z3\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      10. associate-*r*N/A

        \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\color{blue}{\left(\frac{z3}{z4} \cdot z0\right) \cdot \left(z1 - z5\right)} + z3\right) + z3\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      11. lower-*.f64N/A

        \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\color{blue}{\left(\frac{z3}{z4} \cdot z0\right) \cdot \left(z1 - z5\right)} + z3\right) + z3\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      12. lower-*.f6459.5%

        \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\color{blue}{\left(\frac{z3}{z4} \cdot z0\right)} \cdot \left(z1 - z5\right) + z3\right) + z3\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    5. Applied rewrites59.5%

      \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \color{blue}{\left(\left(\left(\frac{z3}{z4} \cdot z0\right) \cdot \left(z1 - z5\right) + z3\right) + z3\right)}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 4: 59.5% accurate, 1.2× speedup?

\[\sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\left(\frac{z3}{z4} \cdot z0\right) \cdot \left(z1 - z5\right) + z3\right) + z3\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
(FPCore (z0 z1 z2 z3 z4 z5)
  :precision binary64
  (sqrt
 (*
  (*
   (- z2 (* (/ z3 z4) (+ (+ (* (* (/ z3 z4) z0) (- z1 z5)) z3) z3)))
   (+ z0 z0))
  z1)))
double code(double z0, double z1, double z2, double z3, double z4, double z5) {
	return sqrt((((z2 - ((z3 / z4) * (((((z3 / z4) * z0) * (z1 - z5)) + z3) + z3))) * (z0 + z0)) * z1));
}
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(z0, z1, z2, z3, z4, z5)
use fmin_fmax_functions
    real(8), intent (in) :: z0
    real(8), intent (in) :: z1
    real(8), intent (in) :: z2
    real(8), intent (in) :: z3
    real(8), intent (in) :: z4
    real(8), intent (in) :: z5
    code = sqrt((((z2 - ((z3 / z4) * (((((z3 / z4) * z0) * (z1 - z5)) + z3) + z3))) * (z0 + z0)) * z1))
end function
public static double code(double z0, double z1, double z2, double z3, double z4, double z5) {
	return Math.sqrt((((z2 - ((z3 / z4) * (((((z3 / z4) * z0) * (z1 - z5)) + z3) + z3))) * (z0 + z0)) * z1));
}
def code(z0, z1, z2, z3, z4, z5):
	return math.sqrt((((z2 - ((z3 / z4) * (((((z3 / z4) * z0) * (z1 - z5)) + z3) + z3))) * (z0 + z0)) * z1))
function code(z0, z1, z2, z3, z4, z5)
	return sqrt(Float64(Float64(Float64(z2 - Float64(Float64(z3 / z4) * Float64(Float64(Float64(Float64(Float64(z3 / z4) * z0) * Float64(z1 - z5)) + z3) + z3))) * Float64(z0 + z0)) * z1))
end
function tmp = code(z0, z1, z2, z3, z4, z5)
	tmp = sqrt((((z2 - ((z3 / z4) * (((((z3 / z4) * z0) * (z1 - z5)) + z3) + z3))) * (z0 + z0)) * z1));
end
code[z0_, z1_, z2_, z3_, z4_, z5_] := N[Sqrt[N[(N[(N[(z2 - N[(N[(z3 / z4), $MachinePrecision] * N[(N[(N[(N[(N[(z3 / z4), $MachinePrecision] * z0), $MachinePrecision] * N[(z1 - z5), $MachinePrecision]), $MachinePrecision] + z3), $MachinePrecision] + z3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(z0 + z0), $MachinePrecision]), $MachinePrecision] * z1), $MachinePrecision]], $MachinePrecision]
\sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\left(\frac{z3}{z4} \cdot z0\right) \cdot \left(z1 - z5\right) + z3\right) + z3\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1}
Derivation
  1. Initial program 53.4%

    \[\sqrt{\left(\left(z0 + z0\right) \cdot z1\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)} \]
  2. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \sqrt{\color{blue}{\left(\left(z0 + z0\right) \cdot z1\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)}} \]
    2. lift-*.f64N/A

      \[\leadsto \sqrt{\color{blue}{\left(\left(z0 + z0\right) \cdot z1\right)} \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)} \]
    3. associate-*l*N/A

      \[\leadsto \sqrt{\color{blue}{\left(z0 + z0\right) \cdot \left(z1 \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)\right)}} \]
    4. *-commutativeN/A

      \[\leadsto \sqrt{\left(z0 + z0\right) \cdot \color{blue}{\left(\left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right) \cdot z1\right)}} \]
    5. associate-*r*N/A

      \[\leadsto \sqrt{\color{blue}{\left(\left(z0 + z0\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)\right) \cdot z1}} \]
    6. lower-*.f64N/A

      \[\leadsto \sqrt{\color{blue}{\left(\left(z0 + z0\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)\right) \cdot z1}} \]
  3. Applied rewrites55.8%

    \[\leadsto \sqrt{\color{blue}{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4} + \left(z3 + z3\right)\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1}} \]
  4. Step-by-step derivation
    1. lift-+.f64N/A

      \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \color{blue}{\left(\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4} + \left(z3 + z3\right)\right)}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    2. lift-+.f64N/A

      \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4} + \color{blue}{\left(z3 + z3\right)}\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    3. associate-+r+N/A

      \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \color{blue}{\left(\left(\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4} + z3\right) + z3\right)}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    4. lower-+.f64N/A

      \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \color{blue}{\left(\left(\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4} + z3\right) + z3\right)}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    5. lower-+.f6455.8%

      \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\color{blue}{\left(\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4} + z3\right)} + z3\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    6. lift-*.f64N/A

      \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\color{blue}{\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4}} + z3\right) + z3\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    7. *-commutativeN/A

      \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\color{blue}{\frac{z3}{z4} \cdot \left(\left(z1 - z5\right) \cdot z0\right)} + z3\right) + z3\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    8. lift-*.f64N/A

      \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\frac{z3}{z4} \cdot \color{blue}{\left(\left(z1 - z5\right) \cdot z0\right)} + z3\right) + z3\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    9. *-commutativeN/A

      \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\frac{z3}{z4} \cdot \color{blue}{\left(z0 \cdot \left(z1 - z5\right)\right)} + z3\right) + z3\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    10. associate-*r*N/A

      \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\color{blue}{\left(\frac{z3}{z4} \cdot z0\right) \cdot \left(z1 - z5\right)} + z3\right) + z3\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    11. lower-*.f64N/A

      \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\color{blue}{\left(\frac{z3}{z4} \cdot z0\right) \cdot \left(z1 - z5\right)} + z3\right) + z3\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    12. lower-*.f6459.5%

      \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\color{blue}{\left(\frac{z3}{z4} \cdot z0\right)} \cdot \left(z1 - z5\right) + z3\right) + z3\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
  5. Applied rewrites59.5%

    \[\leadsto \sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \color{blue}{\left(\left(\left(\frac{z3}{z4} \cdot z0\right) \cdot \left(z1 - z5\right) + z3\right) + z3\right)}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
  6. Add Preprocessing

Alternative 5: 55.8% accurate, 1.1× speedup?

\[\begin{array}{l} \mathbf{if}\;z0 \leq -64999999999999996793668510548615010169459801421748008099328347828280602319944494758993776569724065175462201349583033252647656195072525976144106252024887810771477419024973824:\\ \;\;\;\;\sqrt{\left(\left(z2 - z3 \cdot \frac{\left(z3 + z3\right) \cdot z4 - \left(z5 - z1\right) \cdot \left(z3 \cdot z0\right)}{z4 \cdot z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4} + \left(z3 + z3\right)\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1}\\ \end{array} \]
(FPCore (z0 z1 z2 z3 z4 z5)
  :precision binary64
  (if (<=
     z0
     -64999999999999996793668510548615010169459801421748008099328347828280602319944494758993776569724065175462201349583033252647656195072525976144106252024887810771477419024973824)
  (sqrt
   (*
    (*
     (-
      z2
      (*
       z3
       (/ (- (* (+ z3 z3) z4) (* (- z5 z1) (* z3 z0))) (* z4 z4))))
     (+ z0 z0))
    z1))
  (sqrt
   (*
    (*
     (- z2 (* (/ z3 z4) (+ (* (* (- z1 z5) z0) (/ z3 z4)) (+ z3 z3))))
     (+ z0 z0))
    z1))))
double code(double z0, double z1, double z2, double z3, double z4, double z5) {
	double tmp;
	if (z0 <= -6.5e+172) {
		tmp = sqrt((((z2 - (z3 * ((((z3 + z3) * z4) - ((z5 - z1) * (z3 * z0))) / (z4 * z4)))) * (z0 + z0)) * z1));
	} else {
		tmp = sqrt((((z2 - ((z3 / z4) * ((((z1 - z5) * z0) * (z3 / z4)) + (z3 + z3)))) * (z0 + z0)) * z1));
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(z0, z1, z2, z3, z4, z5)
use fmin_fmax_functions
    real(8), intent (in) :: z0
    real(8), intent (in) :: z1
    real(8), intent (in) :: z2
    real(8), intent (in) :: z3
    real(8), intent (in) :: z4
    real(8), intent (in) :: z5
    real(8) :: tmp
    if (z0 <= (-6.5d+172)) then
        tmp = sqrt((((z2 - (z3 * ((((z3 + z3) * z4) - ((z5 - z1) * (z3 * z0))) / (z4 * z4)))) * (z0 + z0)) * z1))
    else
        tmp = sqrt((((z2 - ((z3 / z4) * ((((z1 - z5) * z0) * (z3 / z4)) + (z3 + z3)))) * (z0 + z0)) * z1))
    end if
    code = tmp
end function
public static double code(double z0, double z1, double z2, double z3, double z4, double z5) {
	double tmp;
	if (z0 <= -6.5e+172) {
		tmp = Math.sqrt((((z2 - (z3 * ((((z3 + z3) * z4) - ((z5 - z1) * (z3 * z0))) / (z4 * z4)))) * (z0 + z0)) * z1));
	} else {
		tmp = Math.sqrt((((z2 - ((z3 / z4) * ((((z1 - z5) * z0) * (z3 / z4)) + (z3 + z3)))) * (z0 + z0)) * z1));
	}
	return tmp;
}
def code(z0, z1, z2, z3, z4, z5):
	tmp = 0
	if z0 <= -6.5e+172:
		tmp = math.sqrt((((z2 - (z3 * ((((z3 + z3) * z4) - ((z5 - z1) * (z3 * z0))) / (z4 * z4)))) * (z0 + z0)) * z1))
	else:
		tmp = math.sqrt((((z2 - ((z3 / z4) * ((((z1 - z5) * z0) * (z3 / z4)) + (z3 + z3)))) * (z0 + z0)) * z1))
	return tmp
function code(z0, z1, z2, z3, z4, z5)
	tmp = 0.0
	if (z0 <= -6.5e+172)
		tmp = sqrt(Float64(Float64(Float64(z2 - Float64(z3 * Float64(Float64(Float64(Float64(z3 + z3) * z4) - Float64(Float64(z5 - z1) * Float64(z3 * z0))) / Float64(z4 * z4)))) * Float64(z0 + z0)) * z1));
	else
		tmp = sqrt(Float64(Float64(Float64(z2 - Float64(Float64(z3 / z4) * Float64(Float64(Float64(Float64(z1 - z5) * z0) * Float64(z3 / z4)) + Float64(z3 + z3)))) * Float64(z0 + z0)) * z1));
	end
	return tmp
end
function tmp_2 = code(z0, z1, z2, z3, z4, z5)
	tmp = 0.0;
	if (z0 <= -6.5e+172)
		tmp = sqrt((((z2 - (z3 * ((((z3 + z3) * z4) - ((z5 - z1) * (z3 * z0))) / (z4 * z4)))) * (z0 + z0)) * z1));
	else
		tmp = sqrt((((z2 - ((z3 / z4) * ((((z1 - z5) * z0) * (z3 / z4)) + (z3 + z3)))) * (z0 + z0)) * z1));
	end
	tmp_2 = tmp;
end
code[z0_, z1_, z2_, z3_, z4_, z5_] := If[LessEqual[z0, -64999999999999996793668510548615010169459801421748008099328347828280602319944494758993776569724065175462201349583033252647656195072525976144106252024887810771477419024973824], N[Sqrt[N[(N[(N[(z2 - N[(z3 * N[(N[(N[(N[(z3 + z3), $MachinePrecision] * z4), $MachinePrecision] - N[(N[(z5 - z1), $MachinePrecision] * N[(z3 * z0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(z4 * z4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(z0 + z0), $MachinePrecision]), $MachinePrecision] * z1), $MachinePrecision]], $MachinePrecision], N[Sqrt[N[(N[(N[(z2 - N[(N[(z3 / z4), $MachinePrecision] * N[(N[(N[(N[(z1 - z5), $MachinePrecision] * z0), $MachinePrecision] * N[(z3 / z4), $MachinePrecision]), $MachinePrecision] + N[(z3 + z3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(z0 + z0), $MachinePrecision]), $MachinePrecision] * z1), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;z0 \leq -64999999999999996793668510548615010169459801421748008099328347828280602319944494758993776569724065175462201349583033252647656195072525976144106252024887810771477419024973824:\\
\;\;\;\;\sqrt{\left(\left(z2 - z3 \cdot \frac{\left(z3 + z3\right) \cdot z4 - \left(z5 - z1\right) \cdot \left(z3 \cdot z0\right)}{z4 \cdot z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4} + \left(z3 + z3\right)\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1}\\


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z0 < -6.4999999999999997e172

    1. Initial program 53.4%

      \[\sqrt{\left(\left(z0 + z0\right) \cdot z1\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)} \]
    2. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \sqrt{\color{blue}{\left(\left(z0 + z0\right) \cdot z1\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)}} \]
      2. lift-*.f64N/A

        \[\leadsto \sqrt{\color{blue}{\left(\left(z0 + z0\right) \cdot z1\right)} \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)} \]
      3. associate-*l*N/A

        \[\leadsto \sqrt{\color{blue}{\left(z0 + z0\right) \cdot \left(z1 \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)\right)}} \]
      4. *-commutativeN/A

        \[\leadsto \sqrt{\left(z0 + z0\right) \cdot \color{blue}{\left(\left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right) \cdot z1\right)}} \]
      5. associate-*r*N/A

        \[\leadsto \sqrt{\color{blue}{\left(\left(z0 + z0\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)\right) \cdot z1}} \]
      6. lower-*.f64N/A

        \[\leadsto \sqrt{\color{blue}{\left(\left(z0 + z0\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)\right) \cdot z1}} \]
    3. Applied rewrites55.8%

      \[\leadsto \sqrt{\color{blue}{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4} + \left(z3 + z3\right)\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1}} \]
    4. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \sqrt{\left(\left(z2 - \color{blue}{\frac{z3}{z4} \cdot \left(\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4} + \left(z3 + z3\right)\right)}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      2. *-commutativeN/A

        \[\leadsto \sqrt{\left(\left(z2 - \color{blue}{\left(\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4} + \left(z3 + z3\right)\right) \cdot \frac{z3}{z4}}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      3. lift-+.f64N/A

        \[\leadsto \sqrt{\left(\left(z2 - \color{blue}{\left(\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4} + \left(z3 + z3\right)\right)} \cdot \frac{z3}{z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      4. +-commutativeN/A

        \[\leadsto \sqrt{\left(\left(z2 - \color{blue}{\left(\left(z3 + z3\right) + \left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4}\right)} \cdot \frac{z3}{z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      5. lift-*.f64N/A

        \[\leadsto \sqrt{\left(\left(z2 - \left(\left(z3 + z3\right) + \color{blue}{\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4}}\right) \cdot \frac{z3}{z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      6. lift-/.f64N/A

        \[\leadsto \sqrt{\left(\left(z2 - \left(\left(z3 + z3\right) + \left(\left(z1 - z5\right) \cdot z0\right) \cdot \color{blue}{\frac{z3}{z4}}\right) \cdot \frac{z3}{z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      7. associate-*r/N/A

        \[\leadsto \sqrt{\left(\left(z2 - \left(\left(z3 + z3\right) + \color{blue}{\frac{\left(\left(z1 - z5\right) \cdot z0\right) \cdot z3}{z4}}\right) \cdot \frac{z3}{z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      8. add-to-fractionN/A

        \[\leadsto \sqrt{\left(\left(z2 - \color{blue}{\frac{\left(z3 + z3\right) \cdot z4 + \left(\left(z1 - z5\right) \cdot z0\right) \cdot z3}{z4}} \cdot \frac{z3}{z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      9. lift-/.f64N/A

        \[\leadsto \sqrt{\left(\left(z2 - \frac{\left(z3 + z3\right) \cdot z4 + \left(\left(z1 - z5\right) \cdot z0\right) \cdot z3}{z4} \cdot \color{blue}{\frac{z3}{z4}}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      10. frac-timesN/A

        \[\leadsto \sqrt{\left(\left(z2 - \color{blue}{\frac{\left(\left(z3 + z3\right) \cdot z4 + \left(\left(z1 - z5\right) \cdot z0\right) \cdot z3\right) \cdot z3}{z4 \cdot z4}}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      11. lift-*.f64N/A

        \[\leadsto \sqrt{\left(\left(z2 - \frac{\left(\left(z3 + z3\right) \cdot z4 + \left(\left(z1 - z5\right) \cdot z0\right) \cdot z3\right) \cdot z3}{\color{blue}{z4 \cdot z4}}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      12. lower-/.f64N/A

        \[\leadsto \sqrt{\left(\left(z2 - \color{blue}{\frac{\left(\left(z3 + z3\right) \cdot z4 + \left(\left(z1 - z5\right) \cdot z0\right) \cdot z3\right) \cdot z3}{z4 \cdot z4}}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      13. lower-*.f64N/A

        \[\leadsto \sqrt{\left(\left(z2 - \frac{\color{blue}{\left(\left(z3 + z3\right) \cdot z4 + \left(\left(z1 - z5\right) \cdot z0\right) \cdot z3\right) \cdot z3}}{z4 \cdot z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      14. lower-+.f64N/A

        \[\leadsto \sqrt{\left(\left(z2 - \frac{\color{blue}{\left(\left(z3 + z3\right) \cdot z4 + \left(\left(z1 - z5\right) \cdot z0\right) \cdot z3\right)} \cdot z3}{z4 \cdot z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      15. lower-*.f64N/A

        \[\leadsto \sqrt{\left(\left(z2 - \frac{\left(\color{blue}{\left(z3 + z3\right) \cdot z4} + \left(\left(z1 - z5\right) \cdot z0\right) \cdot z3\right) \cdot z3}{z4 \cdot z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      16. lower-*.f6441.5%

        \[\leadsto \sqrt{\left(\left(z2 - \frac{\left(\left(z3 + z3\right) \cdot z4 + \color{blue}{\left(\left(z1 - z5\right) \cdot z0\right) \cdot z3}\right) \cdot z3}{z4 \cdot z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    5. Applied rewrites41.5%

      \[\leadsto \sqrt{\left(\left(z2 - \color{blue}{\frac{\left(\left(z3 + z3\right) \cdot z4 + \left(\left(z1 - z5\right) \cdot z0\right) \cdot z3\right) \cdot z3}{z4 \cdot z4}}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    6. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \sqrt{\left(\left(z2 - \color{blue}{\frac{\left(\left(z3 + z3\right) \cdot z4 + \left(\left(z1 - z5\right) \cdot z0\right) \cdot z3\right) \cdot z3}{z4 \cdot z4}}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      2. lift-*.f64N/A

        \[\leadsto \sqrt{\left(\left(z2 - \frac{\color{blue}{\left(\left(z3 + z3\right) \cdot z4 + \left(\left(z1 - z5\right) \cdot z0\right) \cdot z3\right) \cdot z3}}{z4 \cdot z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      3. *-commutativeN/A

        \[\leadsto \sqrt{\left(\left(z2 - \frac{\color{blue}{z3 \cdot \left(\left(z3 + z3\right) \cdot z4 + \left(\left(z1 - z5\right) \cdot z0\right) \cdot z3\right)}}{z4 \cdot z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      4. associate-/l*N/A

        \[\leadsto \sqrt{\left(\left(z2 - \color{blue}{z3 \cdot \frac{\left(z3 + z3\right) \cdot z4 + \left(\left(z1 - z5\right) \cdot z0\right) \cdot z3}{z4 \cdot z4}}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      5. lower-*.f64N/A

        \[\leadsto \sqrt{\left(\left(z2 - \color{blue}{z3 \cdot \frac{\left(z3 + z3\right) \cdot z4 + \left(\left(z1 - z5\right) \cdot z0\right) \cdot z3}{z4 \cdot z4}}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      6. lower-/.f6443.7%

        \[\leadsto \sqrt{\left(\left(z2 - z3 \cdot \color{blue}{\frac{\left(z3 + z3\right) \cdot z4 + \left(\left(z1 - z5\right) \cdot z0\right) \cdot z3}{z4 \cdot z4}}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    7. Applied rewrites43.7%

      \[\leadsto \sqrt{\left(\left(z2 - \color{blue}{z3 \cdot \frac{\left(z3 + z3\right) \cdot z4 - \left(\left(z5 - z1\right) \cdot z0\right) \cdot z3}{z4 \cdot z4}}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    8. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \sqrt{\left(\left(z2 - z3 \cdot \frac{\left(z3 + z3\right) \cdot z4 - \color{blue}{\left(\left(z5 - z1\right) \cdot z0\right) \cdot z3}}{z4 \cdot z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      2. lift-*.f64N/A

        \[\leadsto \sqrt{\left(\left(z2 - z3 \cdot \frac{\left(z3 + z3\right) \cdot z4 - \color{blue}{\left(\left(z5 - z1\right) \cdot z0\right)} \cdot z3}{z4 \cdot z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      3. associate-*l*N/A

        \[\leadsto \sqrt{\left(\left(z2 - z3 \cdot \frac{\left(z3 + z3\right) \cdot z4 - \color{blue}{\left(z5 - z1\right) \cdot \left(z0 \cdot z3\right)}}{z4 \cdot z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      4. lower-*.f64N/A

        \[\leadsto \sqrt{\left(\left(z2 - z3 \cdot \frac{\left(z3 + z3\right) \cdot z4 - \color{blue}{\left(z5 - z1\right) \cdot \left(z0 \cdot z3\right)}}{z4 \cdot z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      5. *-commutativeN/A

        \[\leadsto \sqrt{\left(\left(z2 - z3 \cdot \frac{\left(z3 + z3\right) \cdot z4 - \left(z5 - z1\right) \cdot \color{blue}{\left(z3 \cdot z0\right)}}{z4 \cdot z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
      6. lower-*.f6446.0%

        \[\leadsto \sqrt{\left(\left(z2 - z3 \cdot \frac{\left(z3 + z3\right) \cdot z4 - \left(z5 - z1\right) \cdot \color{blue}{\left(z3 \cdot z0\right)}}{z4 \cdot z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    9. Applied rewrites46.0%

      \[\leadsto \sqrt{\left(\left(z2 - z3 \cdot \frac{\left(z3 + z3\right) \cdot z4 - \color{blue}{\left(z5 - z1\right) \cdot \left(z3 \cdot z0\right)}}{z4 \cdot z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]

    if -6.4999999999999997e172 < z0

    1. Initial program 53.4%

      \[\sqrt{\left(\left(z0 + z0\right) \cdot z1\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)} \]
    2. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \sqrt{\color{blue}{\left(\left(z0 + z0\right) \cdot z1\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)}} \]
      2. lift-*.f64N/A

        \[\leadsto \sqrt{\color{blue}{\left(\left(z0 + z0\right) \cdot z1\right)} \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)} \]
      3. associate-*l*N/A

        \[\leadsto \sqrt{\color{blue}{\left(z0 + z0\right) \cdot \left(z1 \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)\right)}} \]
      4. *-commutativeN/A

        \[\leadsto \sqrt{\left(z0 + z0\right) \cdot \color{blue}{\left(\left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right) \cdot z1\right)}} \]
      5. associate-*r*N/A

        \[\leadsto \sqrt{\color{blue}{\left(\left(z0 + z0\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)\right) \cdot z1}} \]
      6. lower-*.f64N/A

        \[\leadsto \sqrt{\color{blue}{\left(\left(z0 + z0\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)\right) \cdot z1}} \]
    3. Applied rewrites55.8%

      \[\leadsto \sqrt{\color{blue}{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4} + \left(z3 + z3\right)\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 6: 46.0% accurate, 1.2× speedup?

\[\sqrt{\left(\left(z2 - z3 \cdot \frac{\left(z3 + z3\right) \cdot z4 - \left(z5 - z1\right) \cdot \left(z3 \cdot z0\right)}{z4 \cdot z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
(FPCore (z0 z1 z2 z3 z4 z5)
  :precision binary64
  (sqrt
 (*
  (*
   (-
    z2
    (* z3 (/ (- (* (+ z3 z3) z4) (* (- z5 z1) (* z3 z0))) (* z4 z4))))
   (+ z0 z0))
  z1)))
double code(double z0, double z1, double z2, double z3, double z4, double z5) {
	return sqrt((((z2 - (z3 * ((((z3 + z3) * z4) - ((z5 - z1) * (z3 * z0))) / (z4 * z4)))) * (z0 + z0)) * z1));
}
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(z0, z1, z2, z3, z4, z5)
use fmin_fmax_functions
    real(8), intent (in) :: z0
    real(8), intent (in) :: z1
    real(8), intent (in) :: z2
    real(8), intent (in) :: z3
    real(8), intent (in) :: z4
    real(8), intent (in) :: z5
    code = sqrt((((z2 - (z3 * ((((z3 + z3) * z4) - ((z5 - z1) * (z3 * z0))) / (z4 * z4)))) * (z0 + z0)) * z1))
end function
public static double code(double z0, double z1, double z2, double z3, double z4, double z5) {
	return Math.sqrt((((z2 - (z3 * ((((z3 + z3) * z4) - ((z5 - z1) * (z3 * z0))) / (z4 * z4)))) * (z0 + z0)) * z1));
}
def code(z0, z1, z2, z3, z4, z5):
	return math.sqrt((((z2 - (z3 * ((((z3 + z3) * z4) - ((z5 - z1) * (z3 * z0))) / (z4 * z4)))) * (z0 + z0)) * z1))
function code(z0, z1, z2, z3, z4, z5)
	return sqrt(Float64(Float64(Float64(z2 - Float64(z3 * Float64(Float64(Float64(Float64(z3 + z3) * z4) - Float64(Float64(z5 - z1) * Float64(z3 * z0))) / Float64(z4 * z4)))) * Float64(z0 + z0)) * z1))
end
function tmp = code(z0, z1, z2, z3, z4, z5)
	tmp = sqrt((((z2 - (z3 * ((((z3 + z3) * z4) - ((z5 - z1) * (z3 * z0))) / (z4 * z4)))) * (z0 + z0)) * z1));
end
code[z0_, z1_, z2_, z3_, z4_, z5_] := N[Sqrt[N[(N[(N[(z2 - N[(z3 * N[(N[(N[(N[(z3 + z3), $MachinePrecision] * z4), $MachinePrecision] - N[(N[(z5 - z1), $MachinePrecision] * N[(z3 * z0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(z4 * z4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(z0 + z0), $MachinePrecision]), $MachinePrecision] * z1), $MachinePrecision]], $MachinePrecision]
\sqrt{\left(\left(z2 - z3 \cdot \frac{\left(z3 + z3\right) \cdot z4 - \left(z5 - z1\right) \cdot \left(z3 \cdot z0\right)}{z4 \cdot z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1}
Derivation
  1. Initial program 53.4%

    \[\sqrt{\left(\left(z0 + z0\right) \cdot z1\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)} \]
  2. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \sqrt{\color{blue}{\left(\left(z0 + z0\right) \cdot z1\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)}} \]
    2. lift-*.f64N/A

      \[\leadsto \sqrt{\color{blue}{\left(\left(z0 + z0\right) \cdot z1\right)} \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)} \]
    3. associate-*l*N/A

      \[\leadsto \sqrt{\color{blue}{\left(z0 + z0\right) \cdot \left(z1 \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)\right)}} \]
    4. *-commutativeN/A

      \[\leadsto \sqrt{\left(z0 + z0\right) \cdot \color{blue}{\left(\left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right) \cdot z1\right)}} \]
    5. associate-*r*N/A

      \[\leadsto \sqrt{\color{blue}{\left(\left(z0 + z0\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)\right) \cdot z1}} \]
    6. lower-*.f64N/A

      \[\leadsto \sqrt{\color{blue}{\left(\left(z0 + z0\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)\right) \cdot z1}} \]
  3. Applied rewrites55.8%

    \[\leadsto \sqrt{\color{blue}{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4} + \left(z3 + z3\right)\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1}} \]
  4. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \sqrt{\left(\left(z2 - \color{blue}{\frac{z3}{z4} \cdot \left(\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4} + \left(z3 + z3\right)\right)}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    2. *-commutativeN/A

      \[\leadsto \sqrt{\left(\left(z2 - \color{blue}{\left(\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4} + \left(z3 + z3\right)\right) \cdot \frac{z3}{z4}}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    3. lift-+.f64N/A

      \[\leadsto \sqrt{\left(\left(z2 - \color{blue}{\left(\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4} + \left(z3 + z3\right)\right)} \cdot \frac{z3}{z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    4. +-commutativeN/A

      \[\leadsto \sqrt{\left(\left(z2 - \color{blue}{\left(\left(z3 + z3\right) + \left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4}\right)} \cdot \frac{z3}{z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    5. lift-*.f64N/A

      \[\leadsto \sqrt{\left(\left(z2 - \left(\left(z3 + z3\right) + \color{blue}{\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4}}\right) \cdot \frac{z3}{z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    6. lift-/.f64N/A

      \[\leadsto \sqrt{\left(\left(z2 - \left(\left(z3 + z3\right) + \left(\left(z1 - z5\right) \cdot z0\right) \cdot \color{blue}{\frac{z3}{z4}}\right) \cdot \frac{z3}{z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    7. associate-*r/N/A

      \[\leadsto \sqrt{\left(\left(z2 - \left(\left(z3 + z3\right) + \color{blue}{\frac{\left(\left(z1 - z5\right) \cdot z0\right) \cdot z3}{z4}}\right) \cdot \frac{z3}{z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    8. add-to-fractionN/A

      \[\leadsto \sqrt{\left(\left(z2 - \color{blue}{\frac{\left(z3 + z3\right) \cdot z4 + \left(\left(z1 - z5\right) \cdot z0\right) \cdot z3}{z4}} \cdot \frac{z3}{z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    9. lift-/.f64N/A

      \[\leadsto \sqrt{\left(\left(z2 - \frac{\left(z3 + z3\right) \cdot z4 + \left(\left(z1 - z5\right) \cdot z0\right) \cdot z3}{z4} \cdot \color{blue}{\frac{z3}{z4}}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    10. frac-timesN/A

      \[\leadsto \sqrt{\left(\left(z2 - \color{blue}{\frac{\left(\left(z3 + z3\right) \cdot z4 + \left(\left(z1 - z5\right) \cdot z0\right) \cdot z3\right) \cdot z3}{z4 \cdot z4}}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    11. lift-*.f64N/A

      \[\leadsto \sqrt{\left(\left(z2 - \frac{\left(\left(z3 + z3\right) \cdot z4 + \left(\left(z1 - z5\right) \cdot z0\right) \cdot z3\right) \cdot z3}{\color{blue}{z4 \cdot z4}}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    12. lower-/.f64N/A

      \[\leadsto \sqrt{\left(\left(z2 - \color{blue}{\frac{\left(\left(z3 + z3\right) \cdot z4 + \left(\left(z1 - z5\right) \cdot z0\right) \cdot z3\right) \cdot z3}{z4 \cdot z4}}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    13. lower-*.f64N/A

      \[\leadsto \sqrt{\left(\left(z2 - \frac{\color{blue}{\left(\left(z3 + z3\right) \cdot z4 + \left(\left(z1 - z5\right) \cdot z0\right) \cdot z3\right) \cdot z3}}{z4 \cdot z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    14. lower-+.f64N/A

      \[\leadsto \sqrt{\left(\left(z2 - \frac{\color{blue}{\left(\left(z3 + z3\right) \cdot z4 + \left(\left(z1 - z5\right) \cdot z0\right) \cdot z3\right)} \cdot z3}{z4 \cdot z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    15. lower-*.f64N/A

      \[\leadsto \sqrt{\left(\left(z2 - \frac{\left(\color{blue}{\left(z3 + z3\right) \cdot z4} + \left(\left(z1 - z5\right) \cdot z0\right) \cdot z3\right) \cdot z3}{z4 \cdot z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    16. lower-*.f6441.5%

      \[\leadsto \sqrt{\left(\left(z2 - \frac{\left(\left(z3 + z3\right) \cdot z4 + \color{blue}{\left(\left(z1 - z5\right) \cdot z0\right) \cdot z3}\right) \cdot z3}{z4 \cdot z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
  5. Applied rewrites41.5%

    \[\leadsto \sqrt{\left(\left(z2 - \color{blue}{\frac{\left(\left(z3 + z3\right) \cdot z4 + \left(\left(z1 - z5\right) \cdot z0\right) \cdot z3\right) \cdot z3}{z4 \cdot z4}}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
  6. Step-by-step derivation
    1. lift-/.f64N/A

      \[\leadsto \sqrt{\left(\left(z2 - \color{blue}{\frac{\left(\left(z3 + z3\right) \cdot z4 + \left(\left(z1 - z5\right) \cdot z0\right) \cdot z3\right) \cdot z3}{z4 \cdot z4}}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    2. lift-*.f64N/A

      \[\leadsto \sqrt{\left(\left(z2 - \frac{\color{blue}{\left(\left(z3 + z3\right) \cdot z4 + \left(\left(z1 - z5\right) \cdot z0\right) \cdot z3\right) \cdot z3}}{z4 \cdot z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    3. *-commutativeN/A

      \[\leadsto \sqrt{\left(\left(z2 - \frac{\color{blue}{z3 \cdot \left(\left(z3 + z3\right) \cdot z4 + \left(\left(z1 - z5\right) \cdot z0\right) \cdot z3\right)}}{z4 \cdot z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    4. associate-/l*N/A

      \[\leadsto \sqrt{\left(\left(z2 - \color{blue}{z3 \cdot \frac{\left(z3 + z3\right) \cdot z4 + \left(\left(z1 - z5\right) \cdot z0\right) \cdot z3}{z4 \cdot z4}}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    5. lower-*.f64N/A

      \[\leadsto \sqrt{\left(\left(z2 - \color{blue}{z3 \cdot \frac{\left(z3 + z3\right) \cdot z4 + \left(\left(z1 - z5\right) \cdot z0\right) \cdot z3}{z4 \cdot z4}}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    6. lower-/.f6443.7%

      \[\leadsto \sqrt{\left(\left(z2 - z3 \cdot \color{blue}{\frac{\left(z3 + z3\right) \cdot z4 + \left(\left(z1 - z5\right) \cdot z0\right) \cdot z3}{z4 \cdot z4}}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
  7. Applied rewrites43.7%

    \[\leadsto \sqrt{\left(\left(z2 - \color{blue}{z3 \cdot \frac{\left(z3 + z3\right) \cdot z4 - \left(\left(z5 - z1\right) \cdot z0\right) \cdot z3}{z4 \cdot z4}}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
  8. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \sqrt{\left(\left(z2 - z3 \cdot \frac{\left(z3 + z3\right) \cdot z4 - \color{blue}{\left(\left(z5 - z1\right) \cdot z0\right) \cdot z3}}{z4 \cdot z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    2. lift-*.f64N/A

      \[\leadsto \sqrt{\left(\left(z2 - z3 \cdot \frac{\left(z3 + z3\right) \cdot z4 - \color{blue}{\left(\left(z5 - z1\right) \cdot z0\right)} \cdot z3}{z4 \cdot z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    3. associate-*l*N/A

      \[\leadsto \sqrt{\left(\left(z2 - z3 \cdot \frac{\left(z3 + z3\right) \cdot z4 - \color{blue}{\left(z5 - z1\right) \cdot \left(z0 \cdot z3\right)}}{z4 \cdot z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    4. lower-*.f64N/A

      \[\leadsto \sqrt{\left(\left(z2 - z3 \cdot \frac{\left(z3 + z3\right) \cdot z4 - \color{blue}{\left(z5 - z1\right) \cdot \left(z0 \cdot z3\right)}}{z4 \cdot z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    5. *-commutativeN/A

      \[\leadsto \sqrt{\left(\left(z2 - z3 \cdot \frac{\left(z3 + z3\right) \cdot z4 - \left(z5 - z1\right) \cdot \color{blue}{\left(z3 \cdot z0\right)}}{z4 \cdot z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    6. lower-*.f6446.0%

      \[\leadsto \sqrt{\left(\left(z2 - z3 \cdot \frac{\left(z3 + z3\right) \cdot z4 - \left(z5 - z1\right) \cdot \color{blue}{\left(z3 \cdot z0\right)}}{z4 \cdot z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
  9. Applied rewrites46.0%

    \[\leadsto \sqrt{\left(\left(z2 - z3 \cdot \frac{\left(z3 + z3\right) \cdot z4 - \color{blue}{\left(z5 - z1\right) \cdot \left(z3 \cdot z0\right)}}{z4 \cdot z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
  10. Add Preprocessing

Alternative 7: 43.7% accurate, 1.2× speedup?

\[\sqrt{\left(\left(z2 - z3 \cdot \frac{\left(z3 + z3\right) \cdot z4 - \left(\left(z5 - z1\right) \cdot z0\right) \cdot z3}{z4 \cdot z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
(FPCore (z0 z1 z2 z3 z4 z5)
  :precision binary64
  (sqrt
 (*
  (*
   (-
    z2
    (* z3 (/ (- (* (+ z3 z3) z4) (* (* (- z5 z1) z0) z3)) (* z4 z4))))
   (+ z0 z0))
  z1)))
double code(double z0, double z1, double z2, double z3, double z4, double z5) {
	return sqrt((((z2 - (z3 * ((((z3 + z3) * z4) - (((z5 - z1) * z0) * z3)) / (z4 * z4)))) * (z0 + z0)) * z1));
}
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(z0, z1, z2, z3, z4, z5)
use fmin_fmax_functions
    real(8), intent (in) :: z0
    real(8), intent (in) :: z1
    real(8), intent (in) :: z2
    real(8), intent (in) :: z3
    real(8), intent (in) :: z4
    real(8), intent (in) :: z5
    code = sqrt((((z2 - (z3 * ((((z3 + z3) * z4) - (((z5 - z1) * z0) * z3)) / (z4 * z4)))) * (z0 + z0)) * z1))
end function
public static double code(double z0, double z1, double z2, double z3, double z4, double z5) {
	return Math.sqrt((((z2 - (z3 * ((((z3 + z3) * z4) - (((z5 - z1) * z0) * z3)) / (z4 * z4)))) * (z0 + z0)) * z1));
}
def code(z0, z1, z2, z3, z4, z5):
	return math.sqrt((((z2 - (z3 * ((((z3 + z3) * z4) - (((z5 - z1) * z0) * z3)) / (z4 * z4)))) * (z0 + z0)) * z1))
function code(z0, z1, z2, z3, z4, z5)
	return sqrt(Float64(Float64(Float64(z2 - Float64(z3 * Float64(Float64(Float64(Float64(z3 + z3) * z4) - Float64(Float64(Float64(z5 - z1) * z0) * z3)) / Float64(z4 * z4)))) * Float64(z0 + z0)) * z1))
end
function tmp = code(z0, z1, z2, z3, z4, z5)
	tmp = sqrt((((z2 - (z3 * ((((z3 + z3) * z4) - (((z5 - z1) * z0) * z3)) / (z4 * z4)))) * (z0 + z0)) * z1));
end
code[z0_, z1_, z2_, z3_, z4_, z5_] := N[Sqrt[N[(N[(N[(z2 - N[(z3 * N[(N[(N[(N[(z3 + z3), $MachinePrecision] * z4), $MachinePrecision] - N[(N[(N[(z5 - z1), $MachinePrecision] * z0), $MachinePrecision] * z3), $MachinePrecision]), $MachinePrecision] / N[(z4 * z4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(z0 + z0), $MachinePrecision]), $MachinePrecision] * z1), $MachinePrecision]], $MachinePrecision]
\sqrt{\left(\left(z2 - z3 \cdot \frac{\left(z3 + z3\right) \cdot z4 - \left(\left(z5 - z1\right) \cdot z0\right) \cdot z3}{z4 \cdot z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1}
Derivation
  1. Initial program 53.4%

    \[\sqrt{\left(\left(z0 + z0\right) \cdot z1\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)} \]
  2. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \sqrt{\color{blue}{\left(\left(z0 + z0\right) \cdot z1\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)}} \]
    2. lift-*.f64N/A

      \[\leadsto \sqrt{\color{blue}{\left(\left(z0 + z0\right) \cdot z1\right)} \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)} \]
    3. associate-*l*N/A

      \[\leadsto \sqrt{\color{blue}{\left(z0 + z0\right) \cdot \left(z1 \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)\right)}} \]
    4. *-commutativeN/A

      \[\leadsto \sqrt{\left(z0 + z0\right) \cdot \color{blue}{\left(\left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right) \cdot z1\right)}} \]
    5. associate-*r*N/A

      \[\leadsto \sqrt{\color{blue}{\left(\left(z0 + z0\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)\right) \cdot z1}} \]
    6. lower-*.f64N/A

      \[\leadsto \sqrt{\color{blue}{\left(\left(z0 + z0\right) \cdot \left(\left(z2 - \frac{z3}{z4} \cdot \left(z3 + z3\right)\right) - \left(z0 \cdot \left(\frac{z3}{z4} \cdot \frac{z3}{z4}\right)\right) \cdot \left(z1 - z5\right)\right)\right) \cdot z1}} \]
  3. Applied rewrites55.8%

    \[\leadsto \sqrt{\color{blue}{\left(\left(z2 - \frac{z3}{z4} \cdot \left(\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4} + \left(z3 + z3\right)\right)\right) \cdot \left(z0 + z0\right)\right) \cdot z1}} \]
  4. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \sqrt{\left(\left(z2 - \color{blue}{\frac{z3}{z4} \cdot \left(\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4} + \left(z3 + z3\right)\right)}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    2. *-commutativeN/A

      \[\leadsto \sqrt{\left(\left(z2 - \color{blue}{\left(\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4} + \left(z3 + z3\right)\right) \cdot \frac{z3}{z4}}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    3. lift-+.f64N/A

      \[\leadsto \sqrt{\left(\left(z2 - \color{blue}{\left(\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4} + \left(z3 + z3\right)\right)} \cdot \frac{z3}{z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    4. +-commutativeN/A

      \[\leadsto \sqrt{\left(\left(z2 - \color{blue}{\left(\left(z3 + z3\right) + \left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4}\right)} \cdot \frac{z3}{z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    5. lift-*.f64N/A

      \[\leadsto \sqrt{\left(\left(z2 - \left(\left(z3 + z3\right) + \color{blue}{\left(\left(z1 - z5\right) \cdot z0\right) \cdot \frac{z3}{z4}}\right) \cdot \frac{z3}{z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    6. lift-/.f64N/A

      \[\leadsto \sqrt{\left(\left(z2 - \left(\left(z3 + z3\right) + \left(\left(z1 - z5\right) \cdot z0\right) \cdot \color{blue}{\frac{z3}{z4}}\right) \cdot \frac{z3}{z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    7. associate-*r/N/A

      \[\leadsto \sqrt{\left(\left(z2 - \left(\left(z3 + z3\right) + \color{blue}{\frac{\left(\left(z1 - z5\right) \cdot z0\right) \cdot z3}{z4}}\right) \cdot \frac{z3}{z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    8. add-to-fractionN/A

      \[\leadsto \sqrt{\left(\left(z2 - \color{blue}{\frac{\left(z3 + z3\right) \cdot z4 + \left(\left(z1 - z5\right) \cdot z0\right) \cdot z3}{z4}} \cdot \frac{z3}{z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    9. lift-/.f64N/A

      \[\leadsto \sqrt{\left(\left(z2 - \frac{\left(z3 + z3\right) \cdot z4 + \left(\left(z1 - z5\right) \cdot z0\right) \cdot z3}{z4} \cdot \color{blue}{\frac{z3}{z4}}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    10. frac-timesN/A

      \[\leadsto \sqrt{\left(\left(z2 - \color{blue}{\frac{\left(\left(z3 + z3\right) \cdot z4 + \left(\left(z1 - z5\right) \cdot z0\right) \cdot z3\right) \cdot z3}{z4 \cdot z4}}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    11. lift-*.f64N/A

      \[\leadsto \sqrt{\left(\left(z2 - \frac{\left(\left(z3 + z3\right) \cdot z4 + \left(\left(z1 - z5\right) \cdot z0\right) \cdot z3\right) \cdot z3}{\color{blue}{z4 \cdot z4}}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    12. lower-/.f64N/A

      \[\leadsto \sqrt{\left(\left(z2 - \color{blue}{\frac{\left(\left(z3 + z3\right) \cdot z4 + \left(\left(z1 - z5\right) \cdot z0\right) \cdot z3\right) \cdot z3}{z4 \cdot z4}}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    13. lower-*.f64N/A

      \[\leadsto \sqrt{\left(\left(z2 - \frac{\color{blue}{\left(\left(z3 + z3\right) \cdot z4 + \left(\left(z1 - z5\right) \cdot z0\right) \cdot z3\right) \cdot z3}}{z4 \cdot z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    14. lower-+.f64N/A

      \[\leadsto \sqrt{\left(\left(z2 - \frac{\color{blue}{\left(\left(z3 + z3\right) \cdot z4 + \left(\left(z1 - z5\right) \cdot z0\right) \cdot z3\right)} \cdot z3}{z4 \cdot z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    15. lower-*.f64N/A

      \[\leadsto \sqrt{\left(\left(z2 - \frac{\left(\color{blue}{\left(z3 + z3\right) \cdot z4} + \left(\left(z1 - z5\right) \cdot z0\right) \cdot z3\right) \cdot z3}{z4 \cdot z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    16. lower-*.f6441.5%

      \[\leadsto \sqrt{\left(\left(z2 - \frac{\left(\left(z3 + z3\right) \cdot z4 + \color{blue}{\left(\left(z1 - z5\right) \cdot z0\right) \cdot z3}\right) \cdot z3}{z4 \cdot z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
  5. Applied rewrites41.5%

    \[\leadsto \sqrt{\left(\left(z2 - \color{blue}{\frac{\left(\left(z3 + z3\right) \cdot z4 + \left(\left(z1 - z5\right) \cdot z0\right) \cdot z3\right) \cdot z3}{z4 \cdot z4}}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
  6. Step-by-step derivation
    1. lift-/.f64N/A

      \[\leadsto \sqrt{\left(\left(z2 - \color{blue}{\frac{\left(\left(z3 + z3\right) \cdot z4 + \left(\left(z1 - z5\right) \cdot z0\right) \cdot z3\right) \cdot z3}{z4 \cdot z4}}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    2. lift-*.f64N/A

      \[\leadsto \sqrt{\left(\left(z2 - \frac{\color{blue}{\left(\left(z3 + z3\right) \cdot z4 + \left(\left(z1 - z5\right) \cdot z0\right) \cdot z3\right) \cdot z3}}{z4 \cdot z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    3. *-commutativeN/A

      \[\leadsto \sqrt{\left(\left(z2 - \frac{\color{blue}{z3 \cdot \left(\left(z3 + z3\right) \cdot z4 + \left(\left(z1 - z5\right) \cdot z0\right) \cdot z3\right)}}{z4 \cdot z4}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    4. associate-/l*N/A

      \[\leadsto \sqrt{\left(\left(z2 - \color{blue}{z3 \cdot \frac{\left(z3 + z3\right) \cdot z4 + \left(\left(z1 - z5\right) \cdot z0\right) \cdot z3}{z4 \cdot z4}}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    5. lower-*.f64N/A

      \[\leadsto \sqrt{\left(\left(z2 - \color{blue}{z3 \cdot \frac{\left(z3 + z3\right) \cdot z4 + \left(\left(z1 - z5\right) \cdot z0\right) \cdot z3}{z4 \cdot z4}}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
    6. lower-/.f6443.7%

      \[\leadsto \sqrt{\left(\left(z2 - z3 \cdot \color{blue}{\frac{\left(z3 + z3\right) \cdot z4 + \left(\left(z1 - z5\right) \cdot z0\right) \cdot z3}{z4 \cdot z4}}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
  7. Applied rewrites43.7%

    \[\leadsto \sqrt{\left(\left(z2 - \color{blue}{z3 \cdot \frac{\left(z3 + z3\right) \cdot z4 - \left(\left(z5 - z1\right) \cdot z0\right) \cdot z3}{z4 \cdot z4}}\right) \cdot \left(z0 + z0\right)\right) \cdot z1} \]
  8. Add Preprocessing

Reproduce

?
herbie shell --seed 2025277 -o generate:taylor -o generate:evaluate
(FPCore (z0 z1 z2 z3 z4 z5)
  :name "(sqrt (* (* (+ z0 z0) z1) (- (- z2 (* (/ z3 z4) (+ z3 z3))) (* (* z0 (* (/ z3 z4) (/ z3 z4))) (- z1 z5)))))"
  :precision binary64
  (sqrt (* (* (+ z0 z0) z1) (- (- z2 (* (/ z3 z4) (+ z3 z3))) (* (* z0 (* (/ z3 z4) (/ z3 z4))) (- z1 z5))))))