Graphics.Rasterific.Shading:$sradialGradientWithFocusShader from Rasterific-0.6.1, B

Percentage Accurate: 90.8% → 97.7%
Time: 5.6s
Alternatives: 6
Speedup: N/A×

Specification

?
\[\begin{array}{l} \\ x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \end{array} \]
(FPCore (x y z t) :precision binary64 (- (* x x) (* (* y 4.0) (- (* z z) t))))
double code(double x, double y, double z, double t) {
	return (x * x) - ((y * 4.0) * ((z * z) - t));
}
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(x, y, z, t)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = (x * x) - ((y * 4.0d0) * ((z * z) - t))
end function
public static double code(double x, double y, double z, double t) {
	return (x * x) - ((y * 4.0) * ((z * z) - t));
}
def code(x, y, z, t):
	return (x * x) - ((y * 4.0) * ((z * z) - t))
function code(x, y, z, t)
	return Float64(Float64(x * x) - Float64(Float64(y * 4.0) * Float64(Float64(z * z) - t)))
end
function tmp = code(x, y, z, t)
	tmp = (x * x) - ((y * 4.0) * ((z * z) - t));
end
code[x_, y_, z_, t_] := N[(N[(x * x), $MachinePrecision] - N[(N[(y * 4.0), $MachinePrecision] * N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 6 alternatives:

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

Initial Program: 90.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \end{array} \]
(FPCore (x y z t) :precision binary64 (- (* x x) (* (* y 4.0) (- (* z z) t))))
double code(double x, double y, double z, double t) {
	return (x * x) - ((y * 4.0) * ((z * z) - t));
}
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(x, y, z, t)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = (x * x) - ((y * 4.0d0) * ((z * z) - t))
end function
public static double code(double x, double y, double z, double t) {
	return (x * x) - ((y * 4.0) * ((z * z) - t));
}
def code(x, y, z, t):
	return (x * x) - ((y * 4.0) * ((z * z) - t))
function code(x, y, z, t)
	return Float64(Float64(x * x) - Float64(Float64(y * 4.0) * Float64(Float64(z * z) - t)))
end
function tmp = code(x, y, z, t)
	tmp = (x * x) - ((y * 4.0) * ((z * z) - t));
end
code[x_, y_, z_, t_] := N[(N[(x * x), $MachinePrecision] - N[(N[(y * 4.0), $MachinePrecision] * N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)
\end{array}

Alternative 1: 97.7% accurate, N/A× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(-x, -x, \mathsf{fma}\left(y, t, \left(\left(-y\right) \cdot z\right) \cdot z\right) \cdot 4\right) \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (fma (- x) (- x) (* (fma y t (* (* (- y) z) z)) 4.0)))
double code(double x, double y, double z, double t) {
	return fma(-x, -x, (fma(y, t, ((-y * z) * z)) * 4.0));
}
function code(x, y, z, t)
	return fma(Float64(-x), Float64(-x), Float64(fma(y, t, Float64(Float64(Float64(-y) * z) * z)) * 4.0))
end
code[x_, y_, z_, t_] := N[((-x) * (-x) + N[(N[(y * t + N[(N[((-y) * z), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(-x, -x, \mathsf{fma}\left(y, t, \left(\left(-y\right) \cdot z\right) \cdot z\right) \cdot 4\right)
\end{array}
Derivation
  1. Initial program 92.0%

    \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift--.f64N/A

      \[\leadsto \color{blue}{x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \]
    2. lift-*.f64N/A

      \[\leadsto \color{blue}{x \cdot x} - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    3. pow2N/A

      \[\leadsto \color{blue}{{x}^{2}} - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    4. lift-*.f64N/A

      \[\leadsto {x}^{2} - \color{blue}{\left(y \cdot 4\right)} \cdot \left(z \cdot z - t\right) \]
    5. lift-*.f64N/A

      \[\leadsto {x}^{2} - \color{blue}{\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \]
    6. lift--.f64N/A

      \[\leadsto {x}^{2} - \left(y \cdot 4\right) \cdot \color{blue}{\left(z \cdot z - t\right)} \]
    7. lift-*.f64N/A

      \[\leadsto {x}^{2} - \left(y \cdot 4\right) \cdot \left(\color{blue}{z \cdot z} - t\right) \]
    8. *-commutativeN/A

      \[\leadsto {x}^{2} - \color{blue}{\left(4 \cdot y\right)} \cdot \left(z \cdot z - t\right) \]
    9. pow2N/A

      \[\leadsto {x}^{2} - \left(4 \cdot y\right) \cdot \left(\color{blue}{{z}^{2}} - t\right) \]
    10. associate-*r*N/A

      \[\leadsto {x}^{2} - \color{blue}{4 \cdot \left(y \cdot \left({z}^{2} - t\right)\right)} \]
    11. *-commutativeN/A

      \[\leadsto {x}^{2} - \color{blue}{\left(y \cdot \left({z}^{2} - t\right)\right) \cdot 4} \]
    12. fp-cancel-sub-sign-invN/A

      \[\leadsto \color{blue}{{x}^{2} + \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4} \]
    13. *-rgt-identityN/A

      \[\leadsto \color{blue}{{x}^{2} \cdot 1} + \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4 \]
    14. pow2N/A

      \[\leadsto \color{blue}{\left(x \cdot x\right)} \cdot 1 + \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4 \]
    15. sqr-neg-revN/A

      \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(x\right)\right)\right)} \cdot 1 + \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4 \]
    16. metadata-evalN/A

      \[\leadsto \left(\left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(x\right)\right)\right) \cdot \color{blue}{\left(1 \cdot 1\right)} + \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4 \]
    17. unswap-sqrN/A

      \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) \cdot 1\right) \cdot \left(\left(\mathsf{neg}\left(x\right)\right) \cdot 1\right)} + \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4 \]
    18. lower-fma.f64N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left(\mathsf{neg}\left(x\right)\right) \cdot 1, \left(\mathsf{neg}\left(x\right)\right) \cdot 1, \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4\right)} \]
  4. Applied rewrites93.9%

    \[\leadsto \color{blue}{\mathsf{fma}\left(\left(-x\right) \cdot 1, \left(-x\right) \cdot 1, \left(\left(-y\right) \cdot \mathsf{fma}\left(z, z, -t\right)\right) \cdot 4\right)} \]
  5. Step-by-step derivation
    1. lift-neg.f64N/A

      \[\leadsto \mathsf{fma}\left(\left(-x\right) \cdot 1, \left(-x\right) \cdot 1, \left(\color{blue}{\left(\mathsf{neg}\left(y\right)\right)} \cdot \mathsf{fma}\left(z, z, -t\right)\right) \cdot 4\right) \]
    2. lift-*.f64N/A

      \[\leadsto \mathsf{fma}\left(\left(-x\right) \cdot 1, \left(-x\right) \cdot 1, \color{blue}{\left(\left(\mathsf{neg}\left(y\right)\right) \cdot \mathsf{fma}\left(z, z, -t\right)\right)} \cdot 4\right) \]
    3. lift-neg.f64N/A

      \[\leadsto \mathsf{fma}\left(\left(-x\right) \cdot 1, \left(-x\right) \cdot 1, \left(\left(\mathsf{neg}\left(y\right)\right) \cdot \mathsf{fma}\left(z, z, \color{blue}{\mathsf{neg}\left(t\right)}\right)\right) \cdot 4\right) \]
    4. lift-fma.f64N/A

      \[\leadsto \mathsf{fma}\left(\left(-x\right) \cdot 1, \left(-x\right) \cdot 1, \left(\left(\mathsf{neg}\left(y\right)\right) \cdot \color{blue}{\left(z \cdot z + \left(\mathsf{neg}\left(t\right)\right)\right)}\right) \cdot 4\right) \]
    5. pow2N/A

      \[\leadsto \mathsf{fma}\left(\left(-x\right) \cdot 1, \left(-x\right) \cdot 1, \left(\left(\mathsf{neg}\left(y\right)\right) \cdot \left(\color{blue}{{z}^{2}} + \left(\mathsf{neg}\left(t\right)\right)\right)\right) \cdot 4\right) \]
    6. distribute-lft-inN/A

      \[\leadsto \mathsf{fma}\left(\left(-x\right) \cdot 1, \left(-x\right) \cdot 1, \color{blue}{\left(\left(\mathsf{neg}\left(y\right)\right) \cdot {z}^{2} + \left(\mathsf{neg}\left(y\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right)\right)} \cdot 4\right) \]
    7. mul-1-negN/A

      \[\leadsto \mathsf{fma}\left(\left(-x\right) \cdot 1, \left(-x\right) \cdot 1, \left(\color{blue}{\left(-1 \cdot y\right)} \cdot {z}^{2} + \left(\mathsf{neg}\left(y\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right)\right) \cdot 4\right) \]
    8. associate-*r*N/A

      \[\leadsto \mathsf{fma}\left(\left(-x\right) \cdot 1, \left(-x\right) \cdot 1, \left(\color{blue}{-1 \cdot \left(y \cdot {z}^{2}\right)} + \left(\mathsf{neg}\left(y\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right)\right) \cdot 4\right) \]
    9. +-commutativeN/A

      \[\leadsto \mathsf{fma}\left(\left(-x\right) \cdot 1, \left(-x\right) \cdot 1, \color{blue}{\left(\left(\mathsf{neg}\left(y\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right) + -1 \cdot \left(y \cdot {z}^{2}\right)\right)} \cdot 4\right) \]
    10. mul-1-negN/A

      \[\leadsto \mathsf{fma}\left(\left(-x\right) \cdot 1, \left(-x\right) \cdot 1, \left(\color{blue}{\left(-1 \cdot y\right)} \cdot \left(\mathsf{neg}\left(t\right)\right) + -1 \cdot \left(y \cdot {z}^{2}\right)\right) \cdot 4\right) \]
    11. mul-1-negN/A

      \[\leadsto \mathsf{fma}\left(\left(-x\right) \cdot 1, \left(-x\right) \cdot 1, \left(\left(-1 \cdot y\right) \cdot \color{blue}{\left(-1 \cdot t\right)} + -1 \cdot \left(y \cdot {z}^{2}\right)\right) \cdot 4\right) \]
    12. associate-*r*N/A

      \[\leadsto \mathsf{fma}\left(\left(-x\right) \cdot 1, \left(-x\right) \cdot 1, \left(\color{blue}{\left(\left(-1 \cdot y\right) \cdot -1\right) \cdot t} + -1 \cdot \left(y \cdot {z}^{2}\right)\right) \cdot 4\right) \]
    13. mul-1-negN/A

      \[\leadsto \mathsf{fma}\left(\left(-x\right) \cdot 1, \left(-x\right) \cdot 1, \left(\left(\color{blue}{\left(\mathsf{neg}\left(y\right)\right)} \cdot -1\right) \cdot t + -1 \cdot \left(y \cdot {z}^{2}\right)\right) \cdot 4\right) \]
    14. lower-fma.f64N/A

      \[\leadsto \mathsf{fma}\left(\left(-x\right) \cdot 1, \left(-x\right) \cdot 1, \color{blue}{\mathsf{fma}\left(\left(\mathsf{neg}\left(y\right)\right) \cdot -1, t, -1 \cdot \left(y \cdot {z}^{2}\right)\right)} \cdot 4\right) \]
    15. mul-1-negN/A

      \[\leadsto \mathsf{fma}\left(\left(-x\right) \cdot 1, \left(-x\right) \cdot 1, \mathsf{fma}\left(\color{blue}{\left(-1 \cdot y\right)} \cdot -1, t, -1 \cdot \left(y \cdot {z}^{2}\right)\right) \cdot 4\right) \]
    16. lower-*.f64N/A

      \[\leadsto \mathsf{fma}\left(\left(-x\right) \cdot 1, \left(-x\right) \cdot 1, \mathsf{fma}\left(\color{blue}{\left(-1 \cdot y\right) \cdot -1}, t, -1 \cdot \left(y \cdot {z}^{2}\right)\right) \cdot 4\right) \]
    17. mul-1-negN/A

      \[\leadsto \mathsf{fma}\left(\left(-x\right) \cdot 1, \left(-x\right) \cdot 1, \mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(y\right)\right)} \cdot -1, t, -1 \cdot \left(y \cdot {z}^{2}\right)\right) \cdot 4\right) \]
    18. lift-neg.f64N/A

      \[\leadsto \mathsf{fma}\left(\left(-x\right) \cdot 1, \left(-x\right) \cdot 1, \mathsf{fma}\left(\color{blue}{\left(-y\right)} \cdot -1, t, -1 \cdot \left(y \cdot {z}^{2}\right)\right) \cdot 4\right) \]
    19. associate-*r*N/A

      \[\leadsto \mathsf{fma}\left(\left(-x\right) \cdot 1, \left(-x\right) \cdot 1, \mathsf{fma}\left(\left(-y\right) \cdot -1, t, \color{blue}{\left(-1 \cdot y\right) \cdot {z}^{2}}\right) \cdot 4\right) \]
    20. pow2N/A

      \[\leadsto \mathsf{fma}\left(\left(-x\right) \cdot 1, \left(-x\right) \cdot 1, \mathsf{fma}\left(\left(-y\right) \cdot -1, t, \left(-1 \cdot y\right) \cdot \color{blue}{\left(z \cdot z\right)}\right) \cdot 4\right) \]
    21. associate-*r*N/A

      \[\leadsto \mathsf{fma}\left(\left(-x\right) \cdot 1, \left(-x\right) \cdot 1, \mathsf{fma}\left(\left(-y\right) \cdot -1, t, \color{blue}{\left(\left(-1 \cdot y\right) \cdot z\right) \cdot z}\right) \cdot 4\right) \]
    22. lower-*.f64N/A

      \[\leadsto \mathsf{fma}\left(\left(-x\right) \cdot 1, \left(-x\right) \cdot 1, \mathsf{fma}\left(\left(-y\right) \cdot -1, t, \color{blue}{\left(\left(-1 \cdot y\right) \cdot z\right) \cdot z}\right) \cdot 4\right) \]
  6. Applied rewrites98.8%

    \[\leadsto \mathsf{fma}\left(\left(-x\right) \cdot 1, \left(-x\right) \cdot 1, \color{blue}{\mathsf{fma}\left(\left(-y\right) \cdot -1, t, \left(\left(-y\right) \cdot z\right) \cdot z\right)} \cdot 4\right) \]
  7. Final simplification98.8%

    \[\leadsto \mathsf{fma}\left(-x, -x, \mathsf{fma}\left(y, t, \left(\left(-y\right) \cdot z\right) \cdot z\right) \cdot 4\right) \]
  8. Add Preprocessing

Alternative 2: 93.0% accurate, N/A× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(-x, -x, \left(y \cdot \mathsf{fma}\left(z, z, -t\right)\right) \cdot \left(-4\right)\right) \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (fma (- x) (- x) (* (* y (fma z z (- t))) (- 4.0))))
double code(double x, double y, double z, double t) {
	return fma(-x, -x, ((y * fma(z, z, -t)) * -4.0));
}
function code(x, y, z, t)
	return fma(Float64(-x), Float64(-x), Float64(Float64(y * fma(z, z, Float64(-t))) * Float64(-4.0)))
end
code[x_, y_, z_, t_] := N[((-x) * (-x) + N[(N[(y * N[(z * z + (-t)), $MachinePrecision]), $MachinePrecision] * (-4.0)), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(-x, -x, \left(y \cdot \mathsf{fma}\left(z, z, -t\right)\right) \cdot \left(-4\right)\right)
\end{array}
Derivation
  1. Initial program 92.0%

    \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift--.f64N/A

      \[\leadsto \color{blue}{x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \]
    2. lift-*.f64N/A

      \[\leadsto \color{blue}{x \cdot x} - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    3. pow2N/A

      \[\leadsto \color{blue}{{x}^{2}} - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    4. lift-*.f64N/A

      \[\leadsto {x}^{2} - \color{blue}{\left(y \cdot 4\right)} \cdot \left(z \cdot z - t\right) \]
    5. lift-*.f64N/A

      \[\leadsto {x}^{2} - \color{blue}{\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \]
    6. lift--.f64N/A

      \[\leadsto {x}^{2} - \left(y \cdot 4\right) \cdot \color{blue}{\left(z \cdot z - t\right)} \]
    7. lift-*.f64N/A

      \[\leadsto {x}^{2} - \left(y \cdot 4\right) \cdot \left(\color{blue}{z \cdot z} - t\right) \]
    8. *-commutativeN/A

      \[\leadsto {x}^{2} - \color{blue}{\left(4 \cdot y\right)} \cdot \left(z \cdot z - t\right) \]
    9. pow2N/A

      \[\leadsto {x}^{2} - \left(4 \cdot y\right) \cdot \left(\color{blue}{{z}^{2}} - t\right) \]
    10. associate-*r*N/A

      \[\leadsto {x}^{2} - \color{blue}{4 \cdot \left(y \cdot \left({z}^{2} - t\right)\right)} \]
    11. *-commutativeN/A

      \[\leadsto {x}^{2} - \color{blue}{\left(y \cdot \left({z}^{2} - t\right)\right) \cdot 4} \]
    12. fp-cancel-sub-sign-invN/A

      \[\leadsto \color{blue}{{x}^{2} + \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4} \]
    13. *-rgt-identityN/A

      \[\leadsto \color{blue}{{x}^{2} \cdot 1} + \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4 \]
    14. pow2N/A

      \[\leadsto \color{blue}{\left(x \cdot x\right)} \cdot 1 + \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4 \]
    15. sqr-neg-revN/A

      \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(x\right)\right)\right)} \cdot 1 + \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4 \]
    16. metadata-evalN/A

      \[\leadsto \left(\left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(x\right)\right)\right) \cdot \color{blue}{\left(1 \cdot 1\right)} + \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4 \]
    17. unswap-sqrN/A

      \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) \cdot 1\right) \cdot \left(\left(\mathsf{neg}\left(x\right)\right) \cdot 1\right)} + \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4 \]
    18. lower-fma.f64N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left(\mathsf{neg}\left(x\right)\right) \cdot 1, \left(\mathsf{neg}\left(x\right)\right) \cdot 1, \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4\right)} \]
  4. Applied rewrites93.9%

    \[\leadsto \color{blue}{\mathsf{fma}\left(\left(-x\right) \cdot 1, \left(-x\right) \cdot 1, \left(\left(-y\right) \cdot \mathsf{fma}\left(z, z, -t\right)\right) \cdot 4\right)} \]
  5. Final simplification93.9%

    \[\leadsto \mathsf{fma}\left(-x, -x, \left(y \cdot \mathsf{fma}\left(z, z, -t\right)\right) \cdot \left(-4\right)\right) \]
  6. Add Preprocessing

Alternative 3: 94.0% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\\ \mathbf{if}\;t\_1 \leq \infty:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{-4 \cdot y}{x} \cdot \mathsf{fma}\left(z, z, -t\right), 2, x \cdot 2\right)}{x \cdot 2} \cdot \left(x \cdot x\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- (* x x) (* (* y 4.0) (- (* z z) t)))))
   (if (<= t_1 INFINITY)
     t_1
     (*
      (/ (fma (* (/ (* -4.0 y) x) (fma z z (- t))) 2.0 (* x 2.0)) (* x 2.0))
      (* x x)))))
double code(double x, double y, double z, double t) {
	double t_1 = (x * x) - ((y * 4.0) * ((z * z) - t));
	double tmp;
	if (t_1 <= ((double) INFINITY)) {
		tmp = t_1;
	} else {
		tmp = (fma((((-4.0 * y) / x) * fma(z, z, -t)), 2.0, (x * 2.0)) / (x * 2.0)) * (x * x);
	}
	return tmp;
}
function code(x, y, z, t)
	t_1 = Float64(Float64(x * x) - Float64(Float64(y * 4.0) * Float64(Float64(z * z) - t)))
	tmp = 0.0
	if (t_1 <= Inf)
		tmp = t_1;
	else
		tmp = Float64(Float64(fma(Float64(Float64(Float64(-4.0 * y) / x) * fma(z, z, Float64(-t))), 2.0, Float64(x * 2.0)) / Float64(x * 2.0)) * Float64(x * x));
	end
	return tmp
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * x), $MachinePrecision] - N[(N[(y * 4.0), $MachinePrecision] * N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(N[(N[(N[(N[(N[(-4.0 * y), $MachinePrecision] / x), $MachinePrecision] * N[(z * z + (-t)), $MachinePrecision]), $MachinePrecision] * 2.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision] / N[(x * 2.0), $MachinePrecision]), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{-4 \cdot y}{x} \cdot \mathsf{fma}\left(z, z, -t\right), 2, x \cdot 2\right)}{x \cdot 2} \cdot \left(x \cdot x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (*.f64 x x) (*.f64 (*.f64 y #s(literal 4 binary64)) (-.f64 (*.f64 z z) t))) < +inf.0

    1. Initial program 95.3%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. Add Preprocessing

    if +inf.0 < (-.f64 (*.f64 x x) (*.f64 (*.f64 y #s(literal 4 binary64)) (-.f64 (*.f64 z z) t)))

    1. Initial program 0.0%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \color{blue}{x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \]
      2. lift-*.f64N/A

        \[\leadsto \color{blue}{x \cdot x} - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
      3. pow2N/A

        \[\leadsto \color{blue}{{x}^{2}} - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
      4. lift-*.f64N/A

        \[\leadsto {x}^{2} - \color{blue}{\left(y \cdot 4\right)} \cdot \left(z \cdot z - t\right) \]
      5. lift-*.f64N/A

        \[\leadsto {x}^{2} - \color{blue}{\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \]
      6. lift--.f64N/A

        \[\leadsto {x}^{2} - \left(y \cdot 4\right) \cdot \color{blue}{\left(z \cdot z - t\right)} \]
      7. lift-*.f64N/A

        \[\leadsto {x}^{2} - \left(y \cdot 4\right) \cdot \left(\color{blue}{z \cdot z} - t\right) \]
      8. *-commutativeN/A

        \[\leadsto {x}^{2} - \color{blue}{\left(4 \cdot y\right)} \cdot \left(z \cdot z - t\right) \]
      9. pow2N/A

        \[\leadsto {x}^{2} - \left(4 \cdot y\right) \cdot \left(\color{blue}{{z}^{2}} - t\right) \]
      10. associate-*r*N/A

        \[\leadsto {x}^{2} - \color{blue}{4 \cdot \left(y \cdot \left({z}^{2} - t\right)\right)} \]
      11. *-commutativeN/A

        \[\leadsto {x}^{2} - \color{blue}{\left(y \cdot \left({z}^{2} - t\right)\right) \cdot 4} \]
      12. fp-cancel-sub-sign-invN/A

        \[\leadsto \color{blue}{{x}^{2} + \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4} \]
      13. *-rgt-identityN/A

        \[\leadsto \color{blue}{{x}^{2} \cdot 1} + \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4 \]
      14. pow2N/A

        \[\leadsto \color{blue}{\left(x \cdot x\right)} \cdot 1 + \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4 \]
      15. sqr-neg-revN/A

        \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(x\right)\right)\right)} \cdot 1 + \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4 \]
      16. metadata-evalN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(x\right)\right)\right) \cdot \color{blue}{\left(1 \cdot 1\right)} + \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4 \]
      17. unswap-sqrN/A

        \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) \cdot 1\right) \cdot \left(\left(\mathsf{neg}\left(x\right)\right) \cdot 1\right)} + \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4 \]
      18. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left(\mathsf{neg}\left(x\right)\right) \cdot 1, \left(\mathsf{neg}\left(x\right)\right) \cdot 1, \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4\right)} \]
    4. Applied rewrites55.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left(-x\right) \cdot 1, \left(-x\right) \cdot 1, \left(\left(-y\right) \cdot \mathsf{fma}\left(z, z, -t\right)\right) \cdot 4\right)} \]
    5. Taylor expanded in x around inf

      \[\leadsto \color{blue}{{x}^{2} \cdot \left(1 + -4 \cdot \frac{y \cdot \left({z}^{2} - t\right)}{{x}^{2}}\right)} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(1 + -4 \cdot \frac{y \cdot \left({z}^{2} - t\right)}{{x}^{2}}\right) \cdot \color{blue}{{x}^{2}} \]
      2. lower-*.f64N/A

        \[\leadsto \left(1 + -4 \cdot \frac{y \cdot \left({z}^{2} - t\right)}{{x}^{2}}\right) \cdot \color{blue}{{x}^{2}} \]
    7. Applied rewrites77.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-4 \cdot y}{x}, \frac{\mathsf{fma}\left(z, z, -t\right)}{x}, 1\right) \cdot \left(x \cdot x\right)} \]
    8. Step-by-step derivation
      1. lift-fma.f64N/A

        \[\leadsto \left(\frac{-4 \cdot y}{x} \cdot \frac{\mathsf{fma}\left(z, z, -t\right)}{x} + 1\right) \cdot \left(\color{blue}{x} \cdot x\right) \]
      2. lift-*.f64N/A

        \[\leadsto \left(\frac{-4 \cdot y}{x} \cdot \frac{\mathsf{fma}\left(z, z, -t\right)}{x} + 1\right) \cdot \left(x \cdot x\right) \]
      3. lift-/.f64N/A

        \[\leadsto \left(\frac{-4 \cdot y}{x} \cdot \frac{\mathsf{fma}\left(z, z, -t\right)}{x} + 1\right) \cdot \left(x \cdot x\right) \]
      4. lift-/.f64N/A

        \[\leadsto \left(\frac{-4 \cdot y}{x} \cdot \frac{\mathsf{fma}\left(z, z, -t\right)}{x} + 1\right) \cdot \left(x \cdot x\right) \]
      5. lift-neg.f64N/A

        \[\leadsto \left(\frac{-4 \cdot y}{x} \cdot \frac{\mathsf{fma}\left(z, z, \mathsf{neg}\left(t\right)\right)}{x} + 1\right) \cdot \left(x \cdot x\right) \]
      6. lift-fma.f64N/A

        \[\leadsto \left(\frac{-4 \cdot y}{x} \cdot \frac{z \cdot z + \left(\mathsf{neg}\left(t\right)\right)}{x} + 1\right) \cdot \left(x \cdot x\right) \]
      7. associate-*r/N/A

        \[\leadsto \left(\frac{\frac{-4 \cdot y}{x} \cdot \left(z \cdot z + \left(\mathsf{neg}\left(t\right)\right)\right)}{x} + 1\right) \cdot \left(x \cdot x\right) \]
      8. metadata-evalN/A

        \[\leadsto \left(\frac{\frac{-4 \cdot y}{x} \cdot \left(z \cdot z + \left(\mathsf{neg}\left(t\right)\right)\right)}{x} + \frac{2}{2}\right) \cdot \left(x \cdot x\right) \]
      9. frac-addN/A

        \[\leadsto \frac{\left(\frac{-4 \cdot y}{x} \cdot \left(z \cdot z + \left(\mathsf{neg}\left(t\right)\right)\right)\right) \cdot 2 + x \cdot 2}{x \cdot 2} \cdot \left(\color{blue}{x} \cdot x\right) \]
      10. lower-/.f64N/A

        \[\leadsto \frac{\left(\frac{-4 \cdot y}{x} \cdot \left(z \cdot z + \left(\mathsf{neg}\left(t\right)\right)\right)\right) \cdot 2 + x \cdot 2}{x \cdot 2} \cdot \left(\color{blue}{x} \cdot x\right) \]
    9. Applied rewrites77.8%

      \[\leadsto \frac{\mathsf{fma}\left(\frac{-4 \cdot y}{x} \cdot \mathsf{fma}\left(z, z, -t\right), 2, x \cdot 2\right)}{x \cdot 2} \cdot \left(\color{blue}{x} \cdot x\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 4: 78.6% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \cdot x \leq 5 \cdot 10^{-306}:\\ \;\;\;\;x \cdot x - \left(y \cdot 4\right) \cdot \left(-t\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{-4 \cdot y}{x} \cdot \mathsf{fma}\left(z, z, -t\right), 2, x \cdot 2\right)}{x \cdot 2} \cdot \left(x \cdot x\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= (* x x) 5e-306)
   (- (* x x) (* (* y 4.0) (- t)))
   (*
    (/ (fma (* (/ (* -4.0 y) x) (fma z z (- t))) 2.0 (* x 2.0)) (* x 2.0))
    (* x x))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((x * x) <= 5e-306) {
		tmp = (x * x) - ((y * 4.0) * -t);
	} else {
		tmp = (fma((((-4.0 * y) / x) * fma(z, z, -t)), 2.0, (x * 2.0)) / (x * 2.0)) * (x * x);
	}
	return tmp;
}
function code(x, y, z, t)
	tmp = 0.0
	if (Float64(x * x) <= 5e-306)
		tmp = Float64(Float64(x * x) - Float64(Float64(y * 4.0) * Float64(-t)));
	else
		tmp = Float64(Float64(fma(Float64(Float64(Float64(-4.0 * y) / x) * fma(z, z, Float64(-t))), 2.0, Float64(x * 2.0)) / Float64(x * 2.0)) * Float64(x * x));
	end
	return tmp
end
code[x_, y_, z_, t_] := If[LessEqual[N[(x * x), $MachinePrecision], 5e-306], N[(N[(x * x), $MachinePrecision] - N[(N[(y * 4.0), $MachinePrecision] * (-t)), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(N[(-4.0 * y), $MachinePrecision] / x), $MachinePrecision] * N[(z * z + (-t)), $MachinePrecision]), $MachinePrecision] * 2.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision] / N[(x * 2.0), $MachinePrecision]), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 5 \cdot 10^{-306}:\\
\;\;\;\;x \cdot x - \left(y \cdot 4\right) \cdot \left(-t\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{-4 \cdot y}{x} \cdot \mathsf{fma}\left(z, z, -t\right), 2, x \cdot 2\right)}{x \cdot 2} \cdot \left(x \cdot x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x x) < 4.99999999999999998e-306

    1. Initial program 95.2%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0

      \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \color{blue}{\left(-1 \cdot t\right)} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \left(\mathsf{neg}\left(t\right)\right) \]
      2. lower-neg.f6463.3

        \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \left(-t\right) \]
    5. Applied rewrites63.3%

      \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \color{blue}{\left(-t\right)} \]

    if 4.99999999999999998e-306 < (*.f64 x x)

    1. Initial program 91.0%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \color{blue}{x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \]
      2. lift-*.f64N/A

        \[\leadsto \color{blue}{x \cdot x} - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
      3. pow2N/A

        \[\leadsto \color{blue}{{x}^{2}} - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
      4. lift-*.f64N/A

        \[\leadsto {x}^{2} - \color{blue}{\left(y \cdot 4\right)} \cdot \left(z \cdot z - t\right) \]
      5. lift-*.f64N/A

        \[\leadsto {x}^{2} - \color{blue}{\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \]
      6. lift--.f64N/A

        \[\leadsto {x}^{2} - \left(y \cdot 4\right) \cdot \color{blue}{\left(z \cdot z - t\right)} \]
      7. lift-*.f64N/A

        \[\leadsto {x}^{2} - \left(y \cdot 4\right) \cdot \left(\color{blue}{z \cdot z} - t\right) \]
      8. *-commutativeN/A

        \[\leadsto {x}^{2} - \color{blue}{\left(4 \cdot y\right)} \cdot \left(z \cdot z - t\right) \]
      9. pow2N/A

        \[\leadsto {x}^{2} - \left(4 \cdot y\right) \cdot \left(\color{blue}{{z}^{2}} - t\right) \]
      10. associate-*r*N/A

        \[\leadsto {x}^{2} - \color{blue}{4 \cdot \left(y \cdot \left({z}^{2} - t\right)\right)} \]
      11. *-commutativeN/A

        \[\leadsto {x}^{2} - \color{blue}{\left(y \cdot \left({z}^{2} - t\right)\right) \cdot 4} \]
      12. fp-cancel-sub-sign-invN/A

        \[\leadsto \color{blue}{{x}^{2} + \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4} \]
      13. *-rgt-identityN/A

        \[\leadsto \color{blue}{{x}^{2} \cdot 1} + \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4 \]
      14. pow2N/A

        \[\leadsto \color{blue}{\left(x \cdot x\right)} \cdot 1 + \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4 \]
      15. sqr-neg-revN/A

        \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(x\right)\right)\right)} \cdot 1 + \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4 \]
      16. metadata-evalN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(x\right)\right)\right) \cdot \color{blue}{\left(1 \cdot 1\right)} + \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4 \]
      17. unswap-sqrN/A

        \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) \cdot 1\right) \cdot \left(\left(\mathsf{neg}\left(x\right)\right) \cdot 1\right)} + \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4 \]
      18. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left(\mathsf{neg}\left(x\right)\right) \cdot 1, \left(\mathsf{neg}\left(x\right)\right) \cdot 1, \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4\right)} \]
    4. Applied rewrites93.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left(-x\right) \cdot 1, \left(-x\right) \cdot 1, \left(\left(-y\right) \cdot \mathsf{fma}\left(z, z, -t\right)\right) \cdot 4\right)} \]
    5. Taylor expanded in x around inf

      \[\leadsto \color{blue}{{x}^{2} \cdot \left(1 + -4 \cdot \frac{y \cdot \left({z}^{2} - t\right)}{{x}^{2}}\right)} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(1 + -4 \cdot \frac{y \cdot \left({z}^{2} - t\right)}{{x}^{2}}\right) \cdot \color{blue}{{x}^{2}} \]
      2. lower-*.f64N/A

        \[\leadsto \left(1 + -4 \cdot \frac{y \cdot \left({z}^{2} - t\right)}{{x}^{2}}\right) \cdot \color{blue}{{x}^{2}} \]
    7. Applied rewrites87.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-4 \cdot y}{x}, \frac{\mathsf{fma}\left(z, z, -t\right)}{x}, 1\right) \cdot \left(x \cdot x\right)} \]
    8. Step-by-step derivation
      1. lift-fma.f64N/A

        \[\leadsto \left(\frac{-4 \cdot y}{x} \cdot \frac{\mathsf{fma}\left(z, z, -t\right)}{x} + 1\right) \cdot \left(\color{blue}{x} \cdot x\right) \]
      2. lift-*.f64N/A

        \[\leadsto \left(\frac{-4 \cdot y}{x} \cdot \frac{\mathsf{fma}\left(z, z, -t\right)}{x} + 1\right) \cdot \left(x \cdot x\right) \]
      3. lift-/.f64N/A

        \[\leadsto \left(\frac{-4 \cdot y}{x} \cdot \frac{\mathsf{fma}\left(z, z, -t\right)}{x} + 1\right) \cdot \left(x \cdot x\right) \]
      4. lift-/.f64N/A

        \[\leadsto \left(\frac{-4 \cdot y}{x} \cdot \frac{\mathsf{fma}\left(z, z, -t\right)}{x} + 1\right) \cdot \left(x \cdot x\right) \]
      5. lift-neg.f64N/A

        \[\leadsto \left(\frac{-4 \cdot y}{x} \cdot \frac{\mathsf{fma}\left(z, z, \mathsf{neg}\left(t\right)\right)}{x} + 1\right) \cdot \left(x \cdot x\right) \]
      6. lift-fma.f64N/A

        \[\leadsto \left(\frac{-4 \cdot y}{x} \cdot \frac{z \cdot z + \left(\mathsf{neg}\left(t\right)\right)}{x} + 1\right) \cdot \left(x \cdot x\right) \]
      7. associate-*r/N/A

        \[\leadsto \left(\frac{\frac{-4 \cdot y}{x} \cdot \left(z \cdot z + \left(\mathsf{neg}\left(t\right)\right)\right)}{x} + 1\right) \cdot \left(x \cdot x\right) \]
      8. metadata-evalN/A

        \[\leadsto \left(\frac{\frac{-4 \cdot y}{x} \cdot \left(z \cdot z + \left(\mathsf{neg}\left(t\right)\right)\right)}{x} + \frac{2}{2}\right) \cdot \left(x \cdot x\right) \]
      9. frac-addN/A

        \[\leadsto \frac{\left(\frac{-4 \cdot y}{x} \cdot \left(z \cdot z + \left(\mathsf{neg}\left(t\right)\right)\right)\right) \cdot 2 + x \cdot 2}{x \cdot 2} \cdot \left(\color{blue}{x} \cdot x\right) \]
      10. lower-/.f64N/A

        \[\leadsto \frac{\left(\frac{-4 \cdot y}{x} \cdot \left(z \cdot z + \left(\mathsf{neg}\left(t\right)\right)\right)\right) \cdot 2 + x \cdot 2}{x \cdot 2} \cdot \left(\color{blue}{x} \cdot x\right) \]
    9. Applied rewrites88.2%

      \[\leadsto \frac{\mathsf{fma}\left(\frac{-4 \cdot y}{x} \cdot \mathsf{fma}\left(z, z, -t\right), 2, x \cdot 2\right)}{x \cdot 2} \cdot \left(\color{blue}{x} \cdot x\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 5: 72.2% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{-4 \cdot y}{x}\\ \mathbf{if}\;x \cdot x \leq 5 \cdot 10^{-306}:\\ \;\;\;\;\mathsf{fma}\left(\left(-x\right) \cdot x, \frac{\mathsf{fma}\left(t\_1, \frac{z \cdot z}{x}, 1\right)}{t}, -4 \cdot y\right) \cdot \left(-t\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(t\_1 \cdot \mathsf{fma}\left(z, z, -t\right), 2, x \cdot 2\right)}{x \cdot 2} \cdot \left(x \cdot x\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (/ (* -4.0 y) x)))
   (if (<= (* x x) 5e-306)
     (* (fma (* (- x) x) (/ (fma t_1 (/ (* z z) x) 1.0) t) (* -4.0 y)) (- t))
     (* (/ (fma (* t_1 (fma z z (- t))) 2.0 (* x 2.0)) (* x 2.0)) (* x x)))))
double code(double x, double y, double z, double t) {
	double t_1 = (-4.0 * y) / x;
	double tmp;
	if ((x * x) <= 5e-306) {
		tmp = fma((-x * x), (fma(t_1, ((z * z) / x), 1.0) / t), (-4.0 * y)) * -t;
	} else {
		tmp = (fma((t_1 * fma(z, z, -t)), 2.0, (x * 2.0)) / (x * 2.0)) * (x * x);
	}
	return tmp;
}
function code(x, y, z, t)
	t_1 = Float64(Float64(-4.0 * y) / x)
	tmp = 0.0
	if (Float64(x * x) <= 5e-306)
		tmp = Float64(fma(Float64(Float64(-x) * x), Float64(fma(t_1, Float64(Float64(z * z) / x), 1.0) / t), Float64(-4.0 * y)) * Float64(-t));
	else
		tmp = Float64(Float64(fma(Float64(t_1 * fma(z, z, Float64(-t))), 2.0, Float64(x * 2.0)) / Float64(x * 2.0)) * Float64(x * x));
	end
	return tmp
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(-4.0 * y), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[N[(x * x), $MachinePrecision], 5e-306], N[(N[(N[((-x) * x), $MachinePrecision] * N[(N[(t$95$1 * N[(N[(z * z), $MachinePrecision] / x), $MachinePrecision] + 1.0), $MachinePrecision] / t), $MachinePrecision] + N[(-4.0 * y), $MachinePrecision]), $MachinePrecision] * (-t)), $MachinePrecision], N[(N[(N[(N[(t$95$1 * N[(z * z + (-t)), $MachinePrecision]), $MachinePrecision] * 2.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision] / N[(x * 2.0), $MachinePrecision]), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{-4 \cdot y}{x}\\
\mathbf{if}\;x \cdot x \leq 5 \cdot 10^{-306}:\\
\;\;\;\;\mathsf{fma}\left(\left(-x\right) \cdot x, \frac{\mathsf{fma}\left(t\_1, \frac{z \cdot z}{x}, 1\right)}{t}, -4 \cdot y\right) \cdot \left(-t\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t\_1 \cdot \mathsf{fma}\left(z, z, -t\right), 2, x \cdot 2\right)}{x \cdot 2} \cdot \left(x \cdot x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x x) < 4.99999999999999998e-306

    1. Initial program 95.2%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \color{blue}{x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \]
      2. lift-*.f64N/A

        \[\leadsto \color{blue}{x \cdot x} - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
      3. pow2N/A

        \[\leadsto \color{blue}{{x}^{2}} - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
      4. lift-*.f64N/A

        \[\leadsto {x}^{2} - \color{blue}{\left(y \cdot 4\right)} \cdot \left(z \cdot z - t\right) \]
      5. lift-*.f64N/A

        \[\leadsto {x}^{2} - \color{blue}{\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \]
      6. lift--.f64N/A

        \[\leadsto {x}^{2} - \left(y \cdot 4\right) \cdot \color{blue}{\left(z \cdot z - t\right)} \]
      7. lift-*.f64N/A

        \[\leadsto {x}^{2} - \left(y \cdot 4\right) \cdot \left(\color{blue}{z \cdot z} - t\right) \]
      8. *-commutativeN/A

        \[\leadsto {x}^{2} - \color{blue}{\left(4 \cdot y\right)} \cdot \left(z \cdot z - t\right) \]
      9. pow2N/A

        \[\leadsto {x}^{2} - \left(4 \cdot y\right) \cdot \left(\color{blue}{{z}^{2}} - t\right) \]
      10. associate-*r*N/A

        \[\leadsto {x}^{2} - \color{blue}{4 \cdot \left(y \cdot \left({z}^{2} - t\right)\right)} \]
      11. *-commutativeN/A

        \[\leadsto {x}^{2} - \color{blue}{\left(y \cdot \left({z}^{2} - t\right)\right) \cdot 4} \]
      12. fp-cancel-sub-sign-invN/A

        \[\leadsto \color{blue}{{x}^{2} + \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4} \]
      13. *-rgt-identityN/A

        \[\leadsto \color{blue}{{x}^{2} \cdot 1} + \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4 \]
      14. pow2N/A

        \[\leadsto \color{blue}{\left(x \cdot x\right)} \cdot 1 + \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4 \]
      15. sqr-neg-revN/A

        \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(x\right)\right)\right)} \cdot 1 + \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4 \]
      16. metadata-evalN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(x\right)\right)\right) \cdot \color{blue}{\left(1 \cdot 1\right)} + \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4 \]
      17. unswap-sqrN/A

        \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) \cdot 1\right) \cdot \left(\left(\mathsf{neg}\left(x\right)\right) \cdot 1\right)} + \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4 \]
      18. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left(\mathsf{neg}\left(x\right)\right) \cdot 1, \left(\mathsf{neg}\left(x\right)\right) \cdot 1, \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4\right)} \]
    4. Applied rewrites95.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left(-x\right) \cdot 1, \left(-x\right) \cdot 1, \left(\left(-y\right) \cdot \mathsf{fma}\left(z, z, -t\right)\right) \cdot 4\right)} \]
    5. Taylor expanded in x around inf

      \[\leadsto \color{blue}{{x}^{2} \cdot \left(1 + -4 \cdot \frac{y \cdot \left({z}^{2} - t\right)}{{x}^{2}}\right)} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(1 + -4 \cdot \frac{y \cdot \left({z}^{2} - t\right)}{{x}^{2}}\right) \cdot \color{blue}{{x}^{2}} \]
      2. lower-*.f64N/A

        \[\leadsto \left(1 + -4 \cdot \frac{y \cdot \left({z}^{2} - t\right)}{{x}^{2}}\right) \cdot \color{blue}{{x}^{2}} \]
    7. Applied rewrites4.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-4 \cdot y}{x}, \frac{\mathsf{fma}\left(z, z, -t\right)}{x}, 1\right) \cdot \left(x \cdot x\right)} \]
    8. Taylor expanded in t around -inf

      \[\leadsto -1 \cdot \color{blue}{\left(t \cdot \left(-4 \cdot y + -1 \cdot \frac{{x}^{2} \cdot \left(1 + -4 \cdot \frac{y \cdot {z}^{2}}{{x}^{2}}\right)}{t}\right)\right)} \]
    9. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(t \cdot \left(-4 \cdot y + -1 \cdot \frac{{x}^{2} \cdot \left(1 + -4 \cdot \frac{y \cdot {z}^{2}}{{x}^{2}}\right)}{t}\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{neg}\left(\left(-4 \cdot y + -1 \cdot \frac{{x}^{2} \cdot \left(1 + -4 \cdot \frac{y \cdot {z}^{2}}{{x}^{2}}\right)}{t}\right) \cdot t\right) \]
      3. distribute-rgt-neg-inN/A

        \[\leadsto \left(-4 \cdot y + -1 \cdot \frac{{x}^{2} \cdot \left(1 + -4 \cdot \frac{y \cdot {z}^{2}}{{x}^{2}}\right)}{t}\right) \cdot \left(\mathsf{neg}\left(t\right)\right) \]
      4. lower-*.f64N/A

        \[\leadsto \left(-4 \cdot y + -1 \cdot \frac{{x}^{2} \cdot \left(1 + -4 \cdot \frac{y \cdot {z}^{2}}{{x}^{2}}\right)}{t}\right) \cdot \left(\mathsf{neg}\left(t\right)\right) \]
    10. Applied rewrites23.0%

      \[\leadsto \mathsf{fma}\left(\left(-x\right) \cdot x, \frac{\mathsf{fma}\left(\frac{-4 \cdot y}{x}, \frac{z \cdot z}{x}, 1\right)}{t}, -4 \cdot y\right) \cdot \color{blue}{\left(-t\right)} \]

    if 4.99999999999999998e-306 < (*.f64 x x)

    1. Initial program 91.0%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \color{blue}{x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \]
      2. lift-*.f64N/A

        \[\leadsto \color{blue}{x \cdot x} - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
      3. pow2N/A

        \[\leadsto \color{blue}{{x}^{2}} - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
      4. lift-*.f64N/A

        \[\leadsto {x}^{2} - \color{blue}{\left(y \cdot 4\right)} \cdot \left(z \cdot z - t\right) \]
      5. lift-*.f64N/A

        \[\leadsto {x}^{2} - \color{blue}{\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \]
      6. lift--.f64N/A

        \[\leadsto {x}^{2} - \left(y \cdot 4\right) \cdot \color{blue}{\left(z \cdot z - t\right)} \]
      7. lift-*.f64N/A

        \[\leadsto {x}^{2} - \left(y \cdot 4\right) \cdot \left(\color{blue}{z \cdot z} - t\right) \]
      8. *-commutativeN/A

        \[\leadsto {x}^{2} - \color{blue}{\left(4 \cdot y\right)} \cdot \left(z \cdot z - t\right) \]
      9. pow2N/A

        \[\leadsto {x}^{2} - \left(4 \cdot y\right) \cdot \left(\color{blue}{{z}^{2}} - t\right) \]
      10. associate-*r*N/A

        \[\leadsto {x}^{2} - \color{blue}{4 \cdot \left(y \cdot \left({z}^{2} - t\right)\right)} \]
      11. *-commutativeN/A

        \[\leadsto {x}^{2} - \color{blue}{\left(y \cdot \left({z}^{2} - t\right)\right) \cdot 4} \]
      12. fp-cancel-sub-sign-invN/A

        \[\leadsto \color{blue}{{x}^{2} + \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4} \]
      13. *-rgt-identityN/A

        \[\leadsto \color{blue}{{x}^{2} \cdot 1} + \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4 \]
      14. pow2N/A

        \[\leadsto \color{blue}{\left(x \cdot x\right)} \cdot 1 + \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4 \]
      15. sqr-neg-revN/A

        \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(x\right)\right)\right)} \cdot 1 + \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4 \]
      16. metadata-evalN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(x\right)\right)\right) \cdot \color{blue}{\left(1 \cdot 1\right)} + \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4 \]
      17. unswap-sqrN/A

        \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) \cdot 1\right) \cdot \left(\left(\mathsf{neg}\left(x\right)\right) \cdot 1\right)} + \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4 \]
      18. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left(\mathsf{neg}\left(x\right)\right) \cdot 1, \left(\mathsf{neg}\left(x\right)\right) \cdot 1, \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4\right)} \]
    4. Applied rewrites93.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left(-x\right) \cdot 1, \left(-x\right) \cdot 1, \left(\left(-y\right) \cdot \mathsf{fma}\left(z, z, -t\right)\right) \cdot 4\right)} \]
    5. Taylor expanded in x around inf

      \[\leadsto \color{blue}{{x}^{2} \cdot \left(1 + -4 \cdot \frac{y \cdot \left({z}^{2} - t\right)}{{x}^{2}}\right)} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(1 + -4 \cdot \frac{y \cdot \left({z}^{2} - t\right)}{{x}^{2}}\right) \cdot \color{blue}{{x}^{2}} \]
      2. lower-*.f64N/A

        \[\leadsto \left(1 + -4 \cdot \frac{y \cdot \left({z}^{2} - t\right)}{{x}^{2}}\right) \cdot \color{blue}{{x}^{2}} \]
    7. Applied rewrites87.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-4 \cdot y}{x}, \frac{\mathsf{fma}\left(z, z, -t\right)}{x}, 1\right) \cdot \left(x \cdot x\right)} \]
    8. Step-by-step derivation
      1. lift-fma.f64N/A

        \[\leadsto \left(\frac{-4 \cdot y}{x} \cdot \frac{\mathsf{fma}\left(z, z, -t\right)}{x} + 1\right) \cdot \left(\color{blue}{x} \cdot x\right) \]
      2. lift-*.f64N/A

        \[\leadsto \left(\frac{-4 \cdot y}{x} \cdot \frac{\mathsf{fma}\left(z, z, -t\right)}{x} + 1\right) \cdot \left(x \cdot x\right) \]
      3. lift-/.f64N/A

        \[\leadsto \left(\frac{-4 \cdot y}{x} \cdot \frac{\mathsf{fma}\left(z, z, -t\right)}{x} + 1\right) \cdot \left(x \cdot x\right) \]
      4. lift-/.f64N/A

        \[\leadsto \left(\frac{-4 \cdot y}{x} \cdot \frac{\mathsf{fma}\left(z, z, -t\right)}{x} + 1\right) \cdot \left(x \cdot x\right) \]
      5. lift-neg.f64N/A

        \[\leadsto \left(\frac{-4 \cdot y}{x} \cdot \frac{\mathsf{fma}\left(z, z, \mathsf{neg}\left(t\right)\right)}{x} + 1\right) \cdot \left(x \cdot x\right) \]
      6. lift-fma.f64N/A

        \[\leadsto \left(\frac{-4 \cdot y}{x} \cdot \frac{z \cdot z + \left(\mathsf{neg}\left(t\right)\right)}{x} + 1\right) \cdot \left(x \cdot x\right) \]
      7. associate-*r/N/A

        \[\leadsto \left(\frac{\frac{-4 \cdot y}{x} \cdot \left(z \cdot z + \left(\mathsf{neg}\left(t\right)\right)\right)}{x} + 1\right) \cdot \left(x \cdot x\right) \]
      8. metadata-evalN/A

        \[\leadsto \left(\frac{\frac{-4 \cdot y}{x} \cdot \left(z \cdot z + \left(\mathsf{neg}\left(t\right)\right)\right)}{x} + \frac{2}{2}\right) \cdot \left(x \cdot x\right) \]
      9. frac-addN/A

        \[\leadsto \frac{\left(\frac{-4 \cdot y}{x} \cdot \left(z \cdot z + \left(\mathsf{neg}\left(t\right)\right)\right)\right) \cdot 2 + x \cdot 2}{x \cdot 2} \cdot \left(\color{blue}{x} \cdot x\right) \]
      10. lower-/.f64N/A

        \[\leadsto \frac{\left(\frac{-4 \cdot y}{x} \cdot \left(z \cdot z + \left(\mathsf{neg}\left(t\right)\right)\right)\right) \cdot 2 + x \cdot 2}{x \cdot 2} \cdot \left(\color{blue}{x} \cdot x\right) \]
    9. Applied rewrites88.2%

      \[\leadsto \frac{\mathsf{fma}\left(\frac{-4 \cdot y}{x} \cdot \mathsf{fma}\left(z, z, -t\right), 2, x \cdot 2\right)}{x \cdot 2} \cdot \left(\color{blue}{x} \cdot x\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 6: 66.9% accurate, N/A× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(\left(-x\right) \cdot x, \frac{\mathsf{fma}\left(\frac{-4 \cdot y}{x}, \frac{z \cdot z}{x}, 1\right)}{t}, -4 \cdot y\right) \cdot \left(-t\right) \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (*
  (fma (* (- x) x) (/ (fma (/ (* -4.0 y) x) (/ (* z z) x) 1.0) t) (* -4.0 y))
  (- t)))
double code(double x, double y, double z, double t) {
	return fma((-x * x), (fma(((-4.0 * y) / x), ((z * z) / x), 1.0) / t), (-4.0 * y)) * -t;
}
function code(x, y, z, t)
	return Float64(fma(Float64(Float64(-x) * x), Float64(fma(Float64(Float64(-4.0 * y) / x), Float64(Float64(z * z) / x), 1.0) / t), Float64(-4.0 * y)) * Float64(-t))
end
code[x_, y_, z_, t_] := N[(N[(N[((-x) * x), $MachinePrecision] * N[(N[(N[(N[(-4.0 * y), $MachinePrecision] / x), $MachinePrecision] * N[(N[(z * z), $MachinePrecision] / x), $MachinePrecision] + 1.0), $MachinePrecision] / t), $MachinePrecision] + N[(-4.0 * y), $MachinePrecision]), $MachinePrecision] * (-t)), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(\left(-x\right) \cdot x, \frac{\mathsf{fma}\left(\frac{-4 \cdot y}{x}, \frac{z \cdot z}{x}, 1\right)}{t}, -4 \cdot y\right) \cdot \left(-t\right)
\end{array}
Derivation
  1. Initial program 92.0%

    \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift--.f64N/A

      \[\leadsto \color{blue}{x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \]
    2. lift-*.f64N/A

      \[\leadsto \color{blue}{x \cdot x} - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    3. pow2N/A

      \[\leadsto \color{blue}{{x}^{2}} - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    4. lift-*.f64N/A

      \[\leadsto {x}^{2} - \color{blue}{\left(y \cdot 4\right)} \cdot \left(z \cdot z - t\right) \]
    5. lift-*.f64N/A

      \[\leadsto {x}^{2} - \color{blue}{\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \]
    6. lift--.f64N/A

      \[\leadsto {x}^{2} - \left(y \cdot 4\right) \cdot \color{blue}{\left(z \cdot z - t\right)} \]
    7. lift-*.f64N/A

      \[\leadsto {x}^{2} - \left(y \cdot 4\right) \cdot \left(\color{blue}{z \cdot z} - t\right) \]
    8. *-commutativeN/A

      \[\leadsto {x}^{2} - \color{blue}{\left(4 \cdot y\right)} \cdot \left(z \cdot z - t\right) \]
    9. pow2N/A

      \[\leadsto {x}^{2} - \left(4 \cdot y\right) \cdot \left(\color{blue}{{z}^{2}} - t\right) \]
    10. associate-*r*N/A

      \[\leadsto {x}^{2} - \color{blue}{4 \cdot \left(y \cdot \left({z}^{2} - t\right)\right)} \]
    11. *-commutativeN/A

      \[\leadsto {x}^{2} - \color{blue}{\left(y \cdot \left({z}^{2} - t\right)\right) \cdot 4} \]
    12. fp-cancel-sub-sign-invN/A

      \[\leadsto \color{blue}{{x}^{2} + \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4} \]
    13. *-rgt-identityN/A

      \[\leadsto \color{blue}{{x}^{2} \cdot 1} + \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4 \]
    14. pow2N/A

      \[\leadsto \color{blue}{\left(x \cdot x\right)} \cdot 1 + \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4 \]
    15. sqr-neg-revN/A

      \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(x\right)\right)\right)} \cdot 1 + \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4 \]
    16. metadata-evalN/A

      \[\leadsto \left(\left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(x\right)\right)\right) \cdot \color{blue}{\left(1 \cdot 1\right)} + \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4 \]
    17. unswap-sqrN/A

      \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) \cdot 1\right) \cdot \left(\left(\mathsf{neg}\left(x\right)\right) \cdot 1\right)} + \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4 \]
    18. lower-fma.f64N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left(\mathsf{neg}\left(x\right)\right) \cdot 1, \left(\mathsf{neg}\left(x\right)\right) \cdot 1, \left(\mathsf{neg}\left(y \cdot \left({z}^{2} - t\right)\right)\right) \cdot 4\right)} \]
  4. Applied rewrites93.9%

    \[\leadsto \color{blue}{\mathsf{fma}\left(\left(-x\right) \cdot 1, \left(-x\right) \cdot 1, \left(\left(-y\right) \cdot \mathsf{fma}\left(z, z, -t\right)\right) \cdot 4\right)} \]
  5. Taylor expanded in x around inf

    \[\leadsto \color{blue}{{x}^{2} \cdot \left(1 + -4 \cdot \frac{y \cdot \left({z}^{2} - t\right)}{{x}^{2}}\right)} \]
  6. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto \left(1 + -4 \cdot \frac{y \cdot \left({z}^{2} - t\right)}{{x}^{2}}\right) \cdot \color{blue}{{x}^{2}} \]
    2. lower-*.f64N/A

      \[\leadsto \left(1 + -4 \cdot \frac{y \cdot \left({z}^{2} - t\right)}{{x}^{2}}\right) \cdot \color{blue}{{x}^{2}} \]
  7. Applied rewrites67.8%

    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-4 \cdot y}{x}, \frac{\mathsf{fma}\left(z, z, -t\right)}{x}, 1\right) \cdot \left(x \cdot x\right)} \]
  8. Taylor expanded in t around -inf

    \[\leadsto -1 \cdot \color{blue}{\left(t \cdot \left(-4 \cdot y + -1 \cdot \frac{{x}^{2} \cdot \left(1 + -4 \cdot \frac{y \cdot {z}^{2}}{{x}^{2}}\right)}{t}\right)\right)} \]
  9. Step-by-step derivation
    1. mul-1-negN/A

      \[\leadsto \mathsf{neg}\left(t \cdot \left(-4 \cdot y + -1 \cdot \frac{{x}^{2} \cdot \left(1 + -4 \cdot \frac{y \cdot {z}^{2}}{{x}^{2}}\right)}{t}\right)\right) \]
    2. *-commutativeN/A

      \[\leadsto \mathsf{neg}\left(\left(-4 \cdot y + -1 \cdot \frac{{x}^{2} \cdot \left(1 + -4 \cdot \frac{y \cdot {z}^{2}}{{x}^{2}}\right)}{t}\right) \cdot t\right) \]
    3. distribute-rgt-neg-inN/A

      \[\leadsto \left(-4 \cdot y + -1 \cdot \frac{{x}^{2} \cdot \left(1 + -4 \cdot \frac{y \cdot {z}^{2}}{{x}^{2}}\right)}{t}\right) \cdot \left(\mathsf{neg}\left(t\right)\right) \]
    4. lower-*.f64N/A

      \[\leadsto \left(-4 \cdot y + -1 \cdot \frac{{x}^{2} \cdot \left(1 + -4 \cdot \frac{y \cdot {z}^{2}}{{x}^{2}}\right)}{t}\right) \cdot \left(\mathsf{neg}\left(t\right)\right) \]
  10. Applied rewrites64.8%

    \[\leadsto \mathsf{fma}\left(\left(-x\right) \cdot x, \frac{\mathsf{fma}\left(\frac{-4 \cdot y}{x}, \frac{z \cdot z}{x}, 1\right)}{t}, -4 \cdot y\right) \cdot \color{blue}{\left(-t\right)} \]
  11. Add Preprocessing

Reproduce

?
herbie shell --seed 2025059 
(FPCore (x y z t)
  :name "Graphics.Rasterific.Shading:$sradialGradientWithFocusShader from Rasterific-0.6.1, B"
  :precision binary64

  :alt
  (! :herbie-platform default (- (* x x) (* 4 (* y (- (* z z) t)))))

  (- (* x x) (* (* y 4.0) (- (* z z) t))))