Graphics.Rasterific.Svg.PathConverter:arcToSegments from rasterific-svg-0.2.3.1

Percentage Accurate: 66.6% → 99.7%
Time: 5.9s
Alternatives: 8
Speedup: 1.0×

Specification

?
\[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
(FPCore (x y z t)
  :precision binary64
  :pre TRUE
  (+ (/ (* x x) (* y y)) (/ (* z z) (* t t))))
double code(double x, double y, double z, double t) {
	return ((x * x) / (y * y)) + ((z * z) / (t * t));
}
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 * y)) + ((z * z) / (t * t))
end function
public static double code(double x, double y, double z, double t) {
	return ((x * x) / (y * y)) + ((z * z) / (t * t));
}
def code(x, y, z, t):
	return ((x * x) / (y * y)) + ((z * z) / (t * t))
function code(x, y, z, t)
	return Float64(Float64(Float64(x * x) / Float64(y * y)) + Float64(Float64(z * z) / Float64(t * t)))
end
function tmp = code(x, y, z, t)
	tmp = ((x * x) / (y * y)) + ((z * z) / (t * t));
end
code[x_, y_, z_, t_] := N[(N[(N[(x * x), $MachinePrecision] / N[(y * y), $MachinePrecision]), $MachinePrecision] + N[(N[(z * z), $MachinePrecision] / N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
f(x, y, z, t):
	x in [-inf, +inf],
	y in [-inf, +inf],
	z in [-inf, +inf],
	t in [-inf, +inf]
code: THEORY
BEGIN
f(x, y, z, t: real): real =
	((x * x) / (y * y)) + ((z * z) / (t * t))
END code
\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t}

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

\[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
(FPCore (x y z t)
  :precision binary64
  :pre TRUE
  (+ (/ (* x x) (* y y)) (/ (* z z) (* t t))))
double code(double x, double y, double z, double t) {
	return ((x * x) / (y * y)) + ((z * z) / (t * t));
}
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 * y)) + ((z * z) / (t * t))
end function
public static double code(double x, double y, double z, double t) {
	return ((x * x) / (y * y)) + ((z * z) / (t * t));
}
def code(x, y, z, t):
	return ((x * x) / (y * y)) + ((z * z) / (t * t))
function code(x, y, z, t)
	return Float64(Float64(Float64(x * x) / Float64(y * y)) + Float64(Float64(z * z) / Float64(t * t)))
end
function tmp = code(x, y, z, t)
	tmp = ((x * x) / (y * y)) + ((z * z) / (t * t));
end
code[x_, y_, z_, t_] := N[(N[(N[(x * x), $MachinePrecision] / N[(y * y), $MachinePrecision]), $MachinePrecision] + N[(N[(z * z), $MachinePrecision] / N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
f(x, y, z, t):
	x in [-inf, +inf],
	y in [-inf, +inf],
	z in [-inf, +inf],
	t in [-inf, +inf]
code: THEORY
BEGIN
f(x, y, z, t: real): real =
	((x * x) / (y * y)) + ((z * z) / (t * t))
END code
\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t}

Alternative 1: 99.7% accurate, 1.0× speedup?

\[\mathsf{fma}\left(\frac{z}{t}, \frac{z}{t}, \frac{x}{y} \cdot \frac{x}{y}\right) \]
(FPCore (x y z t)
  :precision binary64
  :pre TRUE
  (fma (/ z t) (/ z t) (* (/ x y) (/ x y))))
double code(double x, double y, double z, double t) {
	return fma((z / t), (z / t), ((x / y) * (x / y)));
}
function code(x, y, z, t)
	return fma(Float64(z / t), Float64(z / t), Float64(Float64(x / y) * Float64(x / y)))
end
code[x_, y_, z_, t_] := N[(N[(z / t), $MachinePrecision] * N[(z / t), $MachinePrecision] + N[(N[(x / y), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
f(x, y, z, t):
	x in [-inf, +inf],
	y in [-inf, +inf],
	z in [-inf, +inf],
	t in [-inf, +inf]
code: THEORY
BEGIN
f(x, y, z, t: real): real =
	((z / t) * (z / t)) + ((x / y) * (x / y))
END code
\mathsf{fma}\left(\frac{z}{t}, \frac{z}{t}, \frac{x}{y} \cdot \frac{x}{y}\right)
Derivation
  1. Initial program 66.6%

    \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
  2. Step-by-step derivation
    1. Applied rewrites81.2%

      \[\leadsto \mathsf{fma}\left(\frac{z}{t}, \frac{z}{t}, \frac{x \cdot x}{y \cdot y}\right) \]
    2. Step-by-step derivation
      1. Applied rewrites99.7%

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

      Alternative 2: 97.0% accurate, 1.0× speedup?

      \[\mathsf{fma}\left(\frac{x}{y}, \frac{x}{y}, z \cdot \frac{\frac{z}{t}}{t}\right) \]
      (FPCore (x y z t)
        :precision binary64
        :pre TRUE
        (fma (/ x y) (/ x y) (* z (/ (/ z t) t))))
      double code(double x, double y, double z, double t) {
      	return fma((x / y), (x / y), (z * ((z / t) / t)));
      }
      
      function code(x, y, z, t)
      	return fma(Float64(x / y), Float64(x / y), Float64(z * Float64(Float64(z / t) / t)))
      end
      
      code[x_, y_, z_, t_] := N[(N[(x / y), $MachinePrecision] * N[(x / y), $MachinePrecision] + N[(z * N[(N[(z / t), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
      
      f(x, y, z, t):
      	x in [-inf, +inf],
      	y in [-inf, +inf],
      	z in [-inf, +inf],
      	t in [-inf, +inf]
      code: THEORY
      BEGIN
      f(x, y, z, t: real): real =
      	((x / y) * (x / y)) + (z * ((z / t) / t))
      END code
      \mathsf{fma}\left(\frac{x}{y}, \frac{x}{y}, z \cdot \frac{\frac{z}{t}}{t}\right)
      
      Derivation
      1. Initial program 66.6%

        \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
      2. Step-by-step derivation
        1. Applied rewrites90.1%

          \[\leadsto \mathsf{fma}\left(\frac{x}{y}, \frac{x}{y}, \left(-\left(-z\right)\right) \cdot \frac{z}{t \cdot t}\right) \]
        2. Step-by-step derivation
          1. Applied rewrites90.1%

            \[\leadsto \mathsf{fma}\left(\frac{x}{y}, \frac{x}{y}, z \cdot \frac{z}{t \cdot t}\right) \]
          2. Step-by-step derivation
            1. Applied rewrites97.0%

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

            Alternative 3: 96.5% accurate, 0.6× speedup?

            \[\begin{array}{l} \mathbf{if}\;\frac{z \cdot z}{t \cdot t} \leq 5 \cdot 10^{+302}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{y}, \frac{x}{y}, z \cdot \frac{z}{t \cdot t}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{z}{t}, \frac{z}{t}, x \cdot \frac{x}{y \cdot y}\right)\\ \end{array} \]
            (FPCore (x y z t)
              :precision binary64
              :pre TRUE
              (if (<= (/ (* z z) (* t t)) 5e+302)
              (fma (/ x y) (/ x y) (* z (/ z (* t t))))
              (fma (/ z t) (/ z t) (* x (/ x (* y y))))))
            double code(double x, double y, double z, double t) {
            	double tmp;
            	if (((z * z) / (t * t)) <= 5e+302) {
            		tmp = fma((x / y), (x / y), (z * (z / (t * t))));
            	} else {
            		tmp = fma((z / t), (z / t), (x * (x / (y * y))));
            	}
            	return tmp;
            }
            
            function code(x, y, z, t)
            	tmp = 0.0
            	if (Float64(Float64(z * z) / Float64(t * t)) <= 5e+302)
            		tmp = fma(Float64(x / y), Float64(x / y), Float64(z * Float64(z / Float64(t * t))));
            	else
            		tmp = fma(Float64(z / t), Float64(z / t), Float64(x * Float64(x / Float64(y * y))));
            	end
            	return tmp
            end
            
            code[x_, y_, z_, t_] := If[LessEqual[N[(N[(z * z), $MachinePrecision] / N[(t * t), $MachinePrecision]), $MachinePrecision], 5e+302], N[(N[(x / y), $MachinePrecision] * N[(x / y), $MachinePrecision] + N[(z * N[(z / N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z / t), $MachinePrecision] * N[(z / t), $MachinePrecision] + N[(x * N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
            
            f(x, y, z, t):
            	x in [-inf, +inf],
            	y in [-inf, +inf],
            	z in [-inf, +inf],
            	t in [-inf, +inf]
            code: THEORY
            BEGIN
            f(x, y, z, t: real): real =
            	LET tmp = IF (((z * z) / (t * t)) <= (500000000000000000080882538393228219106334323115829719147747508550558749612869373932630121517106957626889886784090168708013722910283889599821695770803013034305575373061142488088628325022100263638403663533845231056330713750098525613244949130339381695724688044273646160407063978743165327734459561131638784)) THEN (((x / y) * (x / y)) + (z * (z / (t * t)))) ELSE (((z / t) * (z / t)) + (x * (x / (y * y)))) ENDIF IN
            	tmp
            END code
            \begin{array}{l}
            \mathbf{if}\;\frac{z \cdot z}{t \cdot t} \leq 5 \cdot 10^{+302}:\\
            \;\;\;\;\mathsf{fma}\left(\frac{x}{y}, \frac{x}{y}, z \cdot \frac{z}{t \cdot t}\right)\\
            
            \mathbf{else}:\\
            \;\;\;\;\mathsf{fma}\left(\frac{z}{t}, \frac{z}{t}, x \cdot \frac{x}{y \cdot y}\right)\\
            
            
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if (/.f64 (*.f64 z z) (*.f64 t t)) < 5e302

              1. Initial program 66.6%

                \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
              2. Step-by-step derivation
                1. Applied rewrites90.1%

                  \[\leadsto \mathsf{fma}\left(\frac{x}{y}, \frac{x}{y}, \left(-\left(-z\right)\right) \cdot \frac{z}{t \cdot t}\right) \]
                2. Step-by-step derivation
                  1. Applied rewrites90.1%

                    \[\leadsto \mathsf{fma}\left(\frac{x}{y}, \frac{x}{y}, z \cdot \frac{z}{t \cdot t}\right) \]

                  if 5e302 < (/.f64 (*.f64 z z) (*.f64 t t))

                  1. Initial program 66.6%

                    \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
                  2. Step-by-step derivation
                    1. Applied rewrites81.2%

                      \[\leadsto \mathsf{fma}\left(\frac{z}{t}, \frac{z}{t}, \frac{x \cdot x}{y \cdot y}\right) \]
                    2. Step-by-step derivation
                      1. Applied rewrites89.3%

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

                    Alternative 4: 93.5% accurate, 0.6× speedup?

                    \[\begin{array}{l} \mathbf{if}\;\frac{z \cdot z}{t \cdot t} \leq \infty:\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{y}, \frac{x}{y}, z \cdot \frac{z}{t \cdot t}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(z, \frac{\frac{z}{t}}{t}, \frac{x \cdot x}{y \cdot y}\right)\\ \end{array} \]
                    (FPCore (x y z t)
                      :precision binary64
                      :pre TRUE
                      (if (<= (/ (* z z) (* t t)) INFINITY)
                      (fma (/ x y) (/ x y) (* z (/ z (* t t))))
                      (fma z (/ (/ z t) t) (/ (* x x) (* y y)))))
                    double code(double x, double y, double z, double t) {
                    	double tmp;
                    	if (((z * z) / (t * t)) <= ((double) INFINITY)) {
                    		tmp = fma((x / y), (x / y), (z * (z / (t * t))));
                    	} else {
                    		tmp = fma(z, ((z / t) / t), ((x * x) / (y * y)));
                    	}
                    	return tmp;
                    }
                    
                    function code(x, y, z, t)
                    	tmp = 0.0
                    	if (Float64(Float64(z * z) / Float64(t * t)) <= Inf)
                    		tmp = fma(Float64(x / y), Float64(x / y), Float64(z * Float64(z / Float64(t * t))));
                    	else
                    		tmp = fma(z, Float64(Float64(z / t) / t), Float64(Float64(x * x) / Float64(y * y)));
                    	end
                    	return tmp
                    end
                    
                    code[x_, y_, z_, t_] := If[LessEqual[N[(N[(z * z), $MachinePrecision] / N[(t * t), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(x / y), $MachinePrecision] * N[(x / y), $MachinePrecision] + N[(z * N[(z / N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(N[(z / t), $MachinePrecision] / t), $MachinePrecision] + N[(N[(x * x), $MachinePrecision] / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                    
                    \begin{array}{l}
                    \mathbf{if}\;\frac{z \cdot z}{t \cdot t} \leq \infty:\\
                    \;\;\;\;\mathsf{fma}\left(\frac{x}{y}, \frac{x}{y}, z \cdot \frac{z}{t \cdot t}\right)\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;\mathsf{fma}\left(z, \frac{\frac{z}{t}}{t}, \frac{x \cdot x}{y \cdot y}\right)\\
                    
                    
                    \end{array}
                    
                    Derivation
                    1. Split input into 2 regimes
                    2. if (/.f64 (*.f64 z z) (*.f64 t t)) < +inf.0

                      1. Initial program 66.6%

                        \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
                      2. Step-by-step derivation
                        1. Applied rewrites90.1%

                          \[\leadsto \mathsf{fma}\left(\frac{x}{y}, \frac{x}{y}, \left(-\left(-z\right)\right) \cdot \frac{z}{t \cdot t}\right) \]
                        2. Step-by-step derivation
                          1. Applied rewrites90.1%

                            \[\leadsto \mathsf{fma}\left(\frac{x}{y}, \frac{x}{y}, z \cdot \frac{z}{t \cdot t}\right) \]

                          if +inf.0 < (/.f64 (*.f64 z z) (*.f64 t t))

                          1. Initial program 66.6%

                            \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
                          2. Step-by-step derivation
                            1. Applied rewrites73.4%

                              \[\leadsto \mathsf{fma}\left(z, \frac{z}{t \cdot t}, \frac{x \cdot x}{y \cdot y}\right) \]
                            2. Step-by-step derivation
                              1. Applied rewrites79.0%

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

                            Alternative 5: 87.4% accurate, 0.6× speedup?

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

                              1. Initial program 66.6%

                                \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
                              2. Step-by-step derivation
                                1. Applied rewrites73.4%

                                  \[\leadsto \mathsf{fma}\left(z, \frac{z}{t \cdot t}, \frac{x \cdot x}{y \cdot y}\right) \]
                                2. Step-by-step derivation
                                  1. Applied rewrites79.0%

                                    \[\leadsto \mathsf{fma}\left(z, \frac{\frac{z}{t}}{t}, \frac{x \cdot x}{y \cdot y}\right) \]

                                  if +inf.0 < (/.f64 (*.f64 x x) (*.f64 y y))

                                  1. Initial program 66.6%

                                    \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
                                  2. Step-by-step derivation
                                    1. Applied rewrites73.6%

                                      \[\leadsto \mathsf{fma}\left(x, \frac{x}{y \cdot y}, \frac{z \cdot z}{t \cdot t}\right) \]
                                    2. Step-by-step derivation
                                      1. Applied rewrites79.4%

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

                                    Alternative 6: 84.9% accurate, 0.6× speedup?

                                    \[\begin{array}{l} \mathbf{if}\;\frac{x \cdot x}{y \cdot y} \leq \infty:\\ \;\;\;\;\mathsf{fma}\left(z, \frac{z}{t \cdot t}, x \cdot \frac{x}{y \cdot y}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(x, \frac{\frac{x}{y}}{y}, \frac{z \cdot z}{t \cdot t}\right)\\ \end{array} \]
                                    (FPCore (x y z t)
                                      :precision binary64
                                      :pre TRUE
                                      (if (<= (/ (* x x) (* y y)) INFINITY)
                                      (fma z (/ z (* t t)) (* x (/ x (* y y))))
                                      (fma x (/ (/ x y) y) (/ (* z z) (* t t)))))
                                    double code(double x, double y, double z, double t) {
                                    	double tmp;
                                    	if (((x * x) / (y * y)) <= ((double) INFINITY)) {
                                    		tmp = fma(z, (z / (t * t)), (x * (x / (y * y))));
                                    	} else {
                                    		tmp = fma(x, ((x / y) / y), ((z * z) / (t * t)));
                                    	}
                                    	return tmp;
                                    }
                                    
                                    function code(x, y, z, t)
                                    	tmp = 0.0
                                    	if (Float64(Float64(x * x) / Float64(y * y)) <= Inf)
                                    		tmp = fma(z, Float64(z / Float64(t * t)), Float64(x * Float64(x / Float64(y * y))));
                                    	else
                                    		tmp = fma(x, Float64(Float64(x / y) / y), Float64(Float64(z * z) / Float64(t * t)));
                                    	end
                                    	return tmp
                                    end
                                    
                                    code[x_, y_, z_, t_] := If[LessEqual[N[(N[(x * x), $MachinePrecision] / N[(y * y), $MachinePrecision]), $MachinePrecision], Infinity], N[(z * N[(z / N[(t * t), $MachinePrecision]), $MachinePrecision] + N[(x * N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision] + N[(N[(z * z), $MachinePrecision] / N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                                    
                                    \begin{array}{l}
                                    \mathbf{if}\;\frac{x \cdot x}{y \cdot y} \leq \infty:\\
                                    \;\;\;\;\mathsf{fma}\left(z, \frac{z}{t \cdot t}, x \cdot \frac{x}{y \cdot y}\right)\\
                                    
                                    \mathbf{else}:\\
                                    \;\;\;\;\mathsf{fma}\left(x, \frac{\frac{x}{y}}{y}, \frac{z \cdot z}{t \cdot t}\right)\\
                                    
                                    
                                    \end{array}
                                    
                                    Derivation
                                    1. Split input into 2 regimes
                                    2. if (/.f64 (*.f64 x x) (*.f64 y y)) < +inf.0

                                      1. Initial program 66.6%

                                        \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
                                      2. Step-by-step derivation
                                        1. Applied rewrites73.4%

                                          \[\leadsto \mathsf{fma}\left(z, \frac{z}{t \cdot t}, \frac{x \cdot x}{y \cdot y}\right) \]
                                        2. Step-by-step derivation
                                          1. Applied rewrites80.9%

                                            \[\leadsto \mathsf{fma}\left(z, \frac{z}{t \cdot t}, x \cdot \frac{x}{y \cdot y}\right) \]

                                          if +inf.0 < (/.f64 (*.f64 x x) (*.f64 y y))

                                          1. Initial program 66.6%

                                            \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
                                          2. Step-by-step derivation
                                            1. Applied rewrites73.6%

                                              \[\leadsto \mathsf{fma}\left(x, \frac{x}{y \cdot y}, \frac{z \cdot z}{t \cdot t}\right) \]
                                            2. Step-by-step derivation
                                              1. Applied rewrites79.4%

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

                                            Alternative 7: 80.9% accurate, 1.0× speedup?

                                            \[\mathsf{fma}\left(z, \frac{z}{t \cdot t}, x \cdot \frac{x}{y \cdot y}\right) \]
                                            (FPCore (x y z t)
                                              :precision binary64
                                              :pre TRUE
                                              (fma z (/ z (* t t)) (* x (/ x (* y y)))))
                                            double code(double x, double y, double z, double t) {
                                            	return fma(z, (z / (t * t)), (x * (x / (y * y))));
                                            }
                                            
                                            function code(x, y, z, t)
                                            	return fma(z, Float64(z / Float64(t * t)), Float64(x * Float64(x / Float64(y * y))))
                                            end
                                            
                                            code[x_, y_, z_, t_] := N[(z * N[(z / N[(t * t), $MachinePrecision]), $MachinePrecision] + N[(x * N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
                                            
                                            f(x, y, z, t):
                                            	x in [-inf, +inf],
                                            	y in [-inf, +inf],
                                            	z in [-inf, +inf],
                                            	t in [-inf, +inf]
                                            code: THEORY
                                            BEGIN
                                            f(x, y, z, t: real): real =
                                            	(z * (z / (t * t))) + (x * (x / (y * y)))
                                            END code
                                            \mathsf{fma}\left(z, \frac{z}{t \cdot t}, x \cdot \frac{x}{y \cdot y}\right)
                                            
                                            Derivation
                                            1. Initial program 66.6%

                                              \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
                                            2. Step-by-step derivation
                                              1. Applied rewrites73.4%

                                                \[\leadsto \mathsf{fma}\left(z, \frac{z}{t \cdot t}, \frac{x \cdot x}{y \cdot y}\right) \]
                                              2. Step-by-step derivation
                                                1. Applied rewrites80.9%

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

                                                Alternative 8: 73.6% accurate, 1.0× speedup?

                                                \[\mathsf{fma}\left(x, \frac{x}{y \cdot y}, \frac{z \cdot z}{t \cdot t}\right) \]
                                                (FPCore (x y z t)
                                                  :precision binary64
                                                  :pre TRUE
                                                  (fma x (/ x (* y y)) (/ (* z z) (* t t))))
                                                double code(double x, double y, double z, double t) {
                                                	return fma(x, (x / (y * y)), ((z * z) / (t * t)));
                                                }
                                                
                                                function code(x, y, z, t)
                                                	return fma(x, Float64(x / Float64(y * y)), Float64(Float64(z * z) / Float64(t * t)))
                                                end
                                                
                                                code[x_, y_, z_, t_] := N[(x * N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision] + N[(N[(z * z), $MachinePrecision] / N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
                                                
                                                f(x, y, z, t):
                                                	x in [-inf, +inf],
                                                	y in [-inf, +inf],
                                                	z in [-inf, +inf],
                                                	t in [-inf, +inf]
                                                code: THEORY
                                                BEGIN
                                                f(x, y, z, t: real): real =
                                                	(x * (x / (y * y))) + ((z * z) / (t * t))
                                                END code
                                                \mathsf{fma}\left(x, \frac{x}{y \cdot y}, \frac{z \cdot z}{t \cdot t}\right)
                                                
                                                Derivation
                                                1. Initial program 66.6%

                                                  \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
                                                2. Step-by-step derivation
                                                  1. Applied rewrites73.6%

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

                                                  Reproduce

                                                  ?
                                                  herbie shell --seed 2026092 
                                                  (FPCore (x y z t)
                                                    :name "Graphics.Rasterific.Svg.PathConverter:arcToSegments from rasterific-svg-0.2.3.1"
                                                    :precision binary64
                                                    (+ (/ (* x x) (* y y)) (/ (* z z) (* t t))))