Average Error: 33.6 → 1.4
Time: 4.9s
Precision: binary64
\[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t}\]
\[\begin{array}{l} \mathbf{if}\;\frac{x \cdot x}{y \cdot y} \leq 2.276682948737203 \cdot 10^{+305}:\\ \;\;\;\;\frac{1}{\sqrt[3]{y} \cdot \sqrt[3]{y}} \cdot \left(\frac{x}{y} \cdot \frac{x}{\sqrt[3]{y}}\right) + \frac{z}{t} \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{x}{y} + \left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right) \cdot \left(\frac{z}{t} \cdot \frac{\sqrt[3]{z}}{t}\right)\\ \end{array}\]
\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t}
\begin{array}{l}
\mathbf{if}\;\frac{x \cdot x}{y \cdot y} \leq 2.276682948737203 \cdot 10^{+305}:\\
\;\;\;\;\frac{1}{\sqrt[3]{y} \cdot \sqrt[3]{y}} \cdot \left(\frac{x}{y} \cdot \frac{x}{\sqrt[3]{y}}\right) + \frac{z}{t} \cdot \frac{z}{t}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{x}{y} + \left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right) \cdot \left(\frac{z}{t} \cdot \frac{\sqrt[3]{z}}{t}\right)\\

\end{array}
(FPCore (x y z t)
 :precision binary64
 (+ (/ (* x x) (* y y)) (/ (* z z) (* t t))))
(FPCore (x y z t)
 :precision binary64
 (if (<= (/ (* x x) (* y y)) 2.276682948737203e+305)
   (+
    (* (/ 1.0 (* (cbrt y) (cbrt y))) (* (/ x y) (/ x (cbrt y))))
    (* (/ z t) (/ z t)))
   (+
    (* (/ x y) (/ x y))
    (* (* (cbrt z) (cbrt z)) (* (/ z t) (/ (cbrt z) t))))))
double code(double x, double y, double z, double t) {
	return ((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)) <= 2.276682948737203e+305) {
		tmp = ((1.0 / (cbrt(y) * cbrt(y))) * ((x / y) * (x / cbrt(y)))) + ((z / t) * (z / t));
	} else {
		tmp = ((x / y) * (x / y)) + ((cbrt(z) * cbrt(z)) * ((z / t) * (cbrt(z) / t)));
	}
	return tmp;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original33.6
Target0.4
Herbie1.4
\[{\left(\frac{x}{y}\right)}^{2} + {\left(\frac{z}{t}\right)}^{2}\]

Derivation

  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 x x) (*.f64 y y)) < 2.27668294873720283e305

    1. Initial program 23.4

      \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t}\]
    2. Using strategy rm
    3. Applied times-frac_binary64_105304.1

      \[\leadsto \frac{x \cdot x}{y \cdot y} + \color{blue}{\frac{z}{t} \cdot \frac{z}{t}}\]
    4. Using strategy rm
    5. Applied times-frac_binary64_105300.4

      \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{x}{y}} + \frac{z}{t} \cdot \frac{z}{t}\]
    6. Using strategy rm
    7. Applied add-cube-cbrt_binary64_105560.7

      \[\leadsto \frac{x}{\color{blue}{\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \sqrt[3]{y}}} \cdot \frac{x}{y} + \frac{z}{t} \cdot \frac{z}{t}\]
    8. Applied *-un-lft-identity_binary64_105240.7

      \[\leadsto \frac{\color{blue}{1 \cdot x}}{\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \sqrt[3]{y}} \cdot \frac{x}{y} + \frac{z}{t} \cdot \frac{z}{t}\]
    9. Applied times-frac_binary64_105300.7

      \[\leadsto \color{blue}{\left(\frac{1}{\sqrt[3]{y} \cdot \sqrt[3]{y}} \cdot \frac{x}{\sqrt[3]{y}}\right)} \cdot \frac{x}{y} + \frac{z}{t} \cdot \frac{z}{t}\]
    10. Applied associate-*l*_binary64_104671.1

      \[\leadsto \color{blue}{\frac{1}{\sqrt[3]{y} \cdot \sqrt[3]{y}} \cdot \left(\frac{x}{\sqrt[3]{y}} \cdot \frac{x}{y}\right)} + \frac{z}{t} \cdot \frac{z}{t}\]
    11. Simplified1.1

      \[\leadsto \frac{1}{\sqrt[3]{y} \cdot \sqrt[3]{y}} \cdot \color{blue}{\left(\frac{x}{y} \cdot \frac{x}{\sqrt[3]{y}}\right)} + \frac{z}{t} \cdot \frac{z}{t}\]

    if 2.27668294873720283e305 < (/.f64 (*.f64 x x) (*.f64 y y))

    1. Initial program 63.8

      \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t}\]
    2. Using strategy rm
    3. Applied times-frac_binary64_1053063.7

      \[\leadsto \frac{x \cdot x}{y \cdot y} + \color{blue}{\frac{z}{t} \cdot \frac{z}{t}}\]
    4. Using strategy rm
    5. Applied times-frac_binary64_105300.5

      \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{x}{y}} + \frac{z}{t} \cdot \frac{z}{t}\]
    6. Using strategy rm
    7. Applied *-un-lft-identity_binary64_105240.5

      \[\leadsto \frac{x}{y} \cdot \frac{x}{y} + \frac{z}{\color{blue}{1 \cdot t}} \cdot \frac{z}{t}\]
    8. Applied add-cube-cbrt_binary64_105560.7

      \[\leadsto \frac{x}{y} \cdot \frac{x}{y} + \frac{\color{blue}{\left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right) \cdot \sqrt[3]{z}}}{1 \cdot t} \cdot \frac{z}{t}\]
    9. Applied times-frac_binary64_105300.7

      \[\leadsto \frac{x}{y} \cdot \frac{x}{y} + \color{blue}{\left(\frac{\sqrt[3]{z} \cdot \sqrt[3]{z}}{1} \cdot \frac{\sqrt[3]{z}}{t}\right)} \cdot \frac{z}{t}\]
    10. Applied associate-*l*_binary64_104672.1

      \[\leadsto \frac{x}{y} \cdot \frac{x}{y} + \color{blue}{\frac{\sqrt[3]{z} \cdot \sqrt[3]{z}}{1} \cdot \left(\frac{\sqrt[3]{z}}{t} \cdot \frac{z}{t}\right)}\]
    11. Simplified2.1

      \[\leadsto \frac{x}{y} \cdot \frac{x}{y} + \frac{\sqrt[3]{z} \cdot \sqrt[3]{z}}{1} \cdot \color{blue}{\left(\frac{z}{t} \cdot \frac{\sqrt[3]{z}}{t}\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification1.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x \cdot x}{y \cdot y} \leq 2.276682948737203 \cdot 10^{+305}:\\ \;\;\;\;\frac{1}{\sqrt[3]{y} \cdot \sqrt[3]{y}} \cdot \left(\frac{x}{y} \cdot \frac{x}{\sqrt[3]{y}}\right) + \frac{z}{t} \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{x}{y} + \left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right) \cdot \left(\frac{z}{t} \cdot \frac{\sqrt[3]{z}}{t}\right)\\ \end{array}\]

Reproduce

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

  :herbie-target
  (+ (pow (/ x y) 2.0) (pow (/ z t) 2.0))

  (+ (/ (* x x) (* y y)) (/ (* z z) (* t t))))