Average Error: 34.4 → 2.0
Time: 5.6s
Precision: binary64
\[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t}\]
\[\begin{array}{l} \mathbf{if}\;x \leq -8.615083971814368 \cdot 10^{+45}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{x}{y} + z \cdot \frac{\frac{z}{t}}{t}\\ \mathbf{elif}\;x \leq -7.167240071025731 \cdot 10^{-222} \lor \neg \left(x \leq 1.8116009526472228 \cdot 10^{-272}\right) \land x \leq 1.1255167977815244 \cdot 10^{+199}:\\ \;\;\;\;\frac{1}{y} \cdot \left(x \cdot \frac{x}{y}\right) + \frac{z}{t} \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{x}{y} + \frac{1}{t} \cdot \left(z \cdot \frac{z}{t}\right)\\ \end{array}\]
\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t}
\begin{array}{l}
\mathbf{if}\;x \leq -8.615083971814368 \cdot 10^{+45}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{x}{y} + z \cdot \frac{\frac{z}{t}}{t}\\

\mathbf{elif}\;x \leq -7.167240071025731 \cdot 10^{-222} \lor \neg \left(x \leq 1.8116009526472228 \cdot 10^{-272}\right) \land x \leq 1.1255167977815244 \cdot 10^{+199}:\\
\;\;\;\;\frac{1}{y} \cdot \left(x \cdot \frac{x}{y}\right) + \frac{z}{t} \cdot \frac{z}{t}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{x}{y} + \frac{1}{t} \cdot \left(z \cdot \frac{z}{t}\right)\\

\end{array}
double code(double x, double y, double z, double t) {
	return ((double) ((((double) (x * x)) / ((double) (y * y))) + (((double) (z * z)) / ((double) (t * t)))));
}
double code(double x, double y, double z, double t) {
	double VAR;
	if ((x <= -8.615083971814368e+45)) {
		VAR = ((double) (((double) ((x / y) * (x / y))) + ((double) (z * ((z / t) / t)))));
	} else {
		double VAR_1;
		if (((x <= -7.167240071025731e-222) || (!(x <= 1.8116009526472228e-272) && (x <= 1.1255167977815244e+199)))) {
			VAR_1 = ((double) (((double) ((1.0 / y) * ((double) (x * (x / y))))) + ((double) ((z / t) * (z / t)))));
		} else {
			VAR_1 = ((double) (((double) ((x / y) * (x / y))) + ((double) ((1.0 / t) * ((double) (z * (z / t)))))));
		}
		VAR = VAR_1;
	}
	return VAR;
}

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

Original34.4
Target0.4
Herbie2.0
\[{\left(\frac{x}{y}\right)}^{2} + {\left(\frac{z}{t}\right)}^{2}\]

Derivation

  1. Split input into 3 regimes
  2. if x < -8.615083971814368e45

    1. Initial program Error: 44.6 bits

      \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t}\]
    2. SimplifiedError: 29.3 bits

      \[\leadsto \color{blue}{x \cdot \frac{x}{y \cdot y} + z \cdot \frac{z}{t \cdot t}}\]
    3. Using strategy rm
    4. Applied add-sqr-sqrtError: 64.0 bits

      \[\leadsto x \cdot \frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{y \cdot y} + z \cdot \frac{z}{t \cdot t}\]
    5. Applied times-fracError: 64.0 bits

      \[\leadsto x \cdot \color{blue}{\left(\frac{\sqrt{x}}{y} \cdot \frac{\sqrt{x}}{y}\right)} + z \cdot \frac{z}{t \cdot t}\]
    6. Applied add-sqr-sqrtError: 64.0 bits

      \[\leadsto \color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)} \cdot \left(\frac{\sqrt{x}}{y} \cdot \frac{\sqrt{x}}{y}\right) + z \cdot \frac{z}{t \cdot t}\]
    7. Applied unswap-sqrError: 64.0 bits

      \[\leadsto \color{blue}{\left(\sqrt{x} \cdot \frac{\sqrt{x}}{y}\right) \cdot \left(\sqrt{x} \cdot \frac{\sqrt{x}}{y}\right)} + z \cdot \frac{z}{t \cdot t}\]
    8. SimplifiedError: 64.0 bits

      \[\leadsto \color{blue}{\frac{x}{y}} \cdot \left(\sqrt{x} \cdot \frac{\sqrt{x}}{y}\right) + z \cdot \frac{z}{t \cdot t}\]
    9. SimplifiedError: 11.2 bits

      \[\leadsto \frac{x}{y} \cdot \color{blue}{\frac{x}{y}} + z \cdot \frac{z}{t \cdot t}\]
    10. Using strategy rm
    11. Applied associate-/r*Error: 3.7 bits

      \[\leadsto \frac{x}{y} \cdot \frac{x}{y} + z \cdot \color{blue}{\frac{\frac{z}{t}}{t}}\]

    if -8.615083971814368e45 < x < -7.167240071025731e-222 or 1.8116009526472228e-272 < x < 1.1255167977815244e199

    1. Initial program Error: 30.8 bits

      \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t}\]
    2. SimplifiedError: 23.7 bits

      \[\leadsto \color{blue}{x \cdot \frac{x}{y \cdot y} + z \cdot \frac{z}{t \cdot t}}\]
    3. Using strategy rm
    4. Applied add-sqr-sqrtError: 39.4 bits

      \[\leadsto x \cdot \frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{y \cdot y} + z \cdot \frac{z}{t \cdot t}\]
    5. Applied times-fracError: 35.9 bits

      \[\leadsto x \cdot \color{blue}{\left(\frac{\sqrt{x}}{y} \cdot \frac{\sqrt{x}}{y}\right)} + z \cdot \frac{z}{t \cdot t}\]
    6. Applied add-sqr-sqrtError: 36.0 bits

      \[\leadsto \color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)} \cdot \left(\frac{\sqrt{x}}{y} \cdot \frac{\sqrt{x}}{y}\right) + z \cdot \frac{z}{t \cdot t}\]
    7. Applied unswap-sqrError: 33.3 bits

      \[\leadsto \color{blue}{\left(\sqrt{x} \cdot \frac{\sqrt{x}}{y}\right) \cdot \left(\sqrt{x} \cdot \frac{\sqrt{x}}{y}\right)} + z \cdot \frac{z}{t \cdot t}\]
    8. SimplifiedError: 33.2 bits

      \[\leadsto \color{blue}{\frac{x}{y}} \cdot \left(\sqrt{x} \cdot \frac{\sqrt{x}}{y}\right) + z \cdot \frac{z}{t \cdot t}\]
    9. SimplifiedError: 14.2 bits

      \[\leadsto \frac{x}{y} \cdot \color{blue}{\frac{x}{y}} + z \cdot \frac{z}{t \cdot t}\]
    10. Using strategy rm
    11. Applied add-sqr-sqrtError: 39.2 bits

      \[\leadsto \frac{x}{y} \cdot \frac{x}{y} + z \cdot \frac{\color{blue}{\sqrt{z} \cdot \sqrt{z}}}{t \cdot t}\]
    12. Applied times-fracError: 34.5 bits

      \[\leadsto \frac{x}{y} \cdot \frac{x}{y} + z \cdot \color{blue}{\left(\frac{\sqrt{z}}{t} \cdot \frac{\sqrt{z}}{t}\right)}\]
    13. Applied add-sqr-sqrtError: 34.6 bits

      \[\leadsto \frac{x}{y} \cdot \frac{x}{y} + \color{blue}{\left(\sqrt{z} \cdot \sqrt{z}\right)} \cdot \left(\frac{\sqrt{z}}{t} \cdot \frac{\sqrt{z}}{t}\right)\]
    14. Applied unswap-sqrError: 32.3 bits

      \[\leadsto \frac{x}{y} \cdot \frac{x}{y} + \color{blue}{\left(\sqrt{z} \cdot \frac{\sqrt{z}}{t}\right) \cdot \left(\sqrt{z} \cdot \frac{\sqrt{z}}{t}\right)}\]
    15. SimplifiedError: 32.3 bits

      \[\leadsto \frac{x}{y} \cdot \frac{x}{y} + \color{blue}{\frac{z}{t}} \cdot \left(\sqrt{z} \cdot \frac{\sqrt{z}}{t}\right)\]
    16. SimplifiedError: 0.4 bits

      \[\leadsto \frac{x}{y} \cdot \frac{x}{y} + \frac{z}{t} \cdot \color{blue}{\frac{z}{t}}\]
    17. Using strategy rm
    18. Applied add-sqr-sqrtError: 31.8 bits

      \[\leadsto \frac{x}{y} \cdot \frac{x}{\color{blue}{\sqrt{y} \cdot \sqrt{y}}} + \frac{z}{t} \cdot \frac{z}{t}\]
    19. Applied *-un-lft-identityError: 31.8 bits

      \[\leadsto \frac{x}{y} \cdot \frac{\color{blue}{1 \cdot x}}{\sqrt{y} \cdot \sqrt{y}} + \frac{z}{t} \cdot \frac{z}{t}\]
    20. Applied times-fracError: 31.8 bits

      \[\leadsto \frac{x}{y} \cdot \color{blue}{\left(\frac{1}{\sqrt{y}} \cdot \frac{x}{\sqrt{y}}\right)} + \frac{z}{t} \cdot \frac{z}{t}\]
    21. Applied add-sqr-sqrtError: 31.9 bits

      \[\leadsto \frac{x}{\color{blue}{\sqrt{y} \cdot \sqrt{y}}} \cdot \left(\frac{1}{\sqrt{y}} \cdot \frac{x}{\sqrt{y}}\right) + \frac{z}{t} \cdot \frac{z}{t}\]
    22. Applied *-un-lft-identityError: 31.9 bits

      \[\leadsto \frac{\color{blue}{1 \cdot x}}{\sqrt{y} \cdot \sqrt{y}} \cdot \left(\frac{1}{\sqrt{y}} \cdot \frac{x}{\sqrt{y}}\right) + \frac{z}{t} \cdot \frac{z}{t}\]
    23. Applied times-fracError: 31.9 bits

      \[\leadsto \color{blue}{\left(\frac{1}{\sqrt{y}} \cdot \frac{x}{\sqrt{y}}\right)} \cdot \left(\frac{1}{\sqrt{y}} \cdot \frac{x}{\sqrt{y}}\right) + \frac{z}{t} \cdot \frac{z}{t}\]
    24. Applied swap-sqrError: 32.3 bits

      \[\leadsto \color{blue}{\left(\frac{1}{\sqrt{y}} \cdot \frac{1}{\sqrt{y}}\right) \cdot \left(\frac{x}{\sqrt{y}} \cdot \frac{x}{\sqrt{y}}\right)} + \frac{z}{t} \cdot \frac{z}{t}\]
    25. SimplifiedError: 32.2 bits

      \[\leadsto \color{blue}{\frac{1}{y}} \cdot \left(\frac{x}{\sqrt{y}} \cdot \frac{x}{\sqrt{y}}\right) + \frac{z}{t} \cdot \frac{z}{t}\]
    26. SimplifiedError: 1.2 bits

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

    if -7.167240071025731e-222 < x < 1.8116009526472228e-272 or 1.1255167977815244e199 < x

    1. Initial program Error: 40.2 bits

      \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t}\]
    2. SimplifiedError: 30.4 bits

      \[\leadsto \color{blue}{x \cdot \frac{x}{y \cdot y} + z \cdot \frac{z}{t \cdot t}}\]
    3. Using strategy rm
    4. Applied add-sqr-sqrtError: 50.1 bits

      \[\leadsto x \cdot \frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{y \cdot y} + z \cdot \frac{z}{t \cdot t}\]
    5. Applied times-fracError: 40.4 bits

      \[\leadsto x \cdot \color{blue}{\left(\frac{\sqrt{x}}{y} \cdot \frac{\sqrt{x}}{y}\right)} + z \cdot \frac{z}{t \cdot t}\]
    6. Applied add-sqr-sqrtError: 40.5 bits

      \[\leadsto \color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)} \cdot \left(\frac{\sqrt{x}}{y} \cdot \frac{\sqrt{x}}{y}\right) + z \cdot \frac{z}{t \cdot t}\]
    7. Applied unswap-sqrError: 39.4 bits

      \[\leadsto \color{blue}{\left(\sqrt{x} \cdot \frac{\sqrt{x}}{y}\right) \cdot \left(\sqrt{x} \cdot \frac{\sqrt{x}}{y}\right)} + z \cdot \frac{z}{t \cdot t}\]
    8. SimplifiedError: 39.4 bits

      \[\leadsto \color{blue}{\frac{x}{y}} \cdot \left(\sqrt{x} \cdot \frac{\sqrt{x}}{y}\right) + z \cdot \frac{z}{t \cdot t}\]
    9. SimplifiedError: 13.4 bits

      \[\leadsto \frac{x}{y} \cdot \color{blue}{\frac{x}{y}} + z \cdot \frac{z}{t \cdot t}\]
    10. Using strategy rm
    11. Applied add-sqr-sqrtError: 38.4 bits

      \[\leadsto \frac{x}{y} \cdot \frac{x}{y} + z \cdot \frac{\color{blue}{\sqrt{z} \cdot \sqrt{z}}}{t \cdot t}\]
    12. Applied times-fracError: 34.7 bits

      \[\leadsto \frac{x}{y} \cdot \frac{x}{y} + z \cdot \color{blue}{\left(\frac{\sqrt{z}}{t} \cdot \frac{\sqrt{z}}{t}\right)}\]
    13. Applied add-sqr-sqrtError: 34.7 bits

      \[\leadsto \frac{x}{y} \cdot \frac{x}{y} + \color{blue}{\left(\sqrt{z} \cdot \sqrt{z}\right)} \cdot \left(\frac{\sqrt{z}}{t} \cdot \frac{\sqrt{z}}{t}\right)\]
    14. Applied unswap-sqrError: 32.3 bits

      \[\leadsto \frac{x}{y} \cdot \frac{x}{y} + \color{blue}{\left(\sqrt{z} \cdot \frac{\sqrt{z}}{t}\right) \cdot \left(\sqrt{z} \cdot \frac{\sqrt{z}}{t}\right)}\]
    15. SimplifiedError: 32.2 bits

      \[\leadsto \frac{x}{y} \cdot \frac{x}{y} + \color{blue}{\frac{z}{t}} \cdot \left(\sqrt{z} \cdot \frac{\sqrt{z}}{t}\right)\]
    16. SimplifiedError: 0.4 bits

      \[\leadsto \frac{x}{y} \cdot \frac{x}{y} + \frac{z}{t} \cdot \color{blue}{\frac{z}{t}}\]
    17. Using strategy rm
    18. Applied add-sqr-sqrtError: 32.1 bits

      \[\leadsto \frac{x}{y} \cdot \frac{x}{y} + \frac{z}{t} \cdot \frac{z}{\color{blue}{\sqrt{t} \cdot \sqrt{t}}}\]
    19. Applied *-un-lft-identityError: 32.1 bits

      \[\leadsto \frac{x}{y} \cdot \frac{x}{y} + \frac{z}{t} \cdot \frac{\color{blue}{1 \cdot z}}{\sqrt{t} \cdot \sqrt{t}}\]
    20. Applied times-fracError: 32.0 bits

      \[\leadsto \frac{x}{y} \cdot \frac{x}{y} + \frac{z}{t} \cdot \color{blue}{\left(\frac{1}{\sqrt{t}} \cdot \frac{z}{\sqrt{t}}\right)}\]
    21. Applied add-sqr-sqrtError: 32.1 bits

      \[\leadsto \frac{x}{y} \cdot \frac{x}{y} + \frac{z}{\color{blue}{\sqrt{t} \cdot \sqrt{t}}} \cdot \left(\frac{1}{\sqrt{t}} \cdot \frac{z}{\sqrt{t}}\right)\]
    22. Applied *-un-lft-identityError: 32.1 bits

      \[\leadsto \frac{x}{y} \cdot \frac{x}{y} + \frac{\color{blue}{1 \cdot z}}{\sqrt{t} \cdot \sqrt{t}} \cdot \left(\frac{1}{\sqrt{t}} \cdot \frac{z}{\sqrt{t}}\right)\]
    23. Applied times-fracError: 32.1 bits

      \[\leadsto \frac{x}{y} \cdot \frac{x}{y} + \color{blue}{\left(\frac{1}{\sqrt{t}} \cdot \frac{z}{\sqrt{t}}\right)} \cdot \left(\frac{1}{\sqrt{t}} \cdot \frac{z}{\sqrt{t}}\right)\]
    24. Applied swap-sqrError: 34.1 bits

      \[\leadsto \frac{x}{y} \cdot \frac{x}{y} + \color{blue}{\left(\frac{1}{\sqrt{t}} \cdot \frac{1}{\sqrt{t}}\right) \cdot \left(\frac{z}{\sqrt{t}} \cdot \frac{z}{\sqrt{t}}\right)}\]
    25. SimplifiedError: 34.0 bits

      \[\leadsto \frac{x}{y} \cdot \frac{x}{y} + \color{blue}{\frac{1}{t}} \cdot \left(\frac{z}{\sqrt{t}} \cdot \frac{z}{\sqrt{t}}\right)\]
    26. SimplifiedError: 3.8 bits

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -8.615083971814368 \cdot 10^{+45}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{x}{y} + z \cdot \frac{\frac{z}{t}}{t}\\ \mathbf{elif}\;x \leq -7.167240071025731 \cdot 10^{-222} \lor \neg \left(x \leq 1.8116009526472228 \cdot 10^{-272}\right) \land x \leq 1.1255167977815244 \cdot 10^{+199}:\\ \;\;\;\;\frac{1}{y} \cdot \left(x \cdot \frac{x}{y}\right) + \frac{z}{t} \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{x}{y} + \frac{1}{t} \cdot \left(z \cdot \frac{z}{t}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020200 
(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))))