Average Error: 32.4 → 16.2
Time: 34.7s
Precision: 64
Internal Precision: 576
\[\sqrt{\left(\left(x \cdot x\right) \cdot \cos t\right) \cdot \cos t + \left(\left(y \cdot y\right) \cdot \sin t\right) \cdot \sin t}\]
\[\begin{array}{l} \mathbf{if}\;\cos t \cdot \left(-x\right) \le -2.334906730441395 \cdot 10^{-137}:\\ \;\;\;\;\cos t \cdot x\\ \mathbf{if}\;\cos t \cdot \left(-x\right) \le 6.073623898151345 \cdot 10^{-108}:\\ \;\;\;\;\left|\sin t \cdot y\right| + \frac{1}{2} \cdot \frac{{x}^{2}}{\left|\sin t \cdot y\right|}\\ \mathbf{else}:\\ \;\;\;\;\cos t \cdot \left(-x\right)\\ \end{array}\]

Error

Bits error versus x

Bits error versus t

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 3 regimes
  2. if (* (cos t) (- x)) < -2.334906730441395e-137

    1. Initial program 31.3

      \[\sqrt{\left(\left(x \cdot x\right) \cdot \cos t\right) \cdot \cos t + \left(\left(y \cdot y\right) \cdot \sin t\right) \cdot \sin t}\]
    2. Taylor expanded around inf 16.3

      \[\leadsto \color{blue}{\cos t \cdot x}\]

    if -2.334906730441395e-137 < (* (cos t) (- x)) < 6.073623898151345e-108

    1. Initial program 34.2

      \[\sqrt{\left(\left(x \cdot x\right) \cdot \cos t\right) \cdot \cos t + \left(\left(y \cdot y\right) \cdot \sin t\right) \cdot \sin t}\]
    2. Using strategy rm
    3. Applied add-sqr-sqrt34.2

      \[\leadsto \sqrt{\left(\left(x \cdot x\right) \cdot \cos t\right) \cdot \cos t + \color{blue}{\sqrt{\left(\left(y \cdot y\right) \cdot \sin t\right) \cdot \sin t} \cdot \sqrt{\left(\left(y \cdot y\right) \cdot \sin t\right) \cdot \sin t}}}\]
    4. Applied simplify34.2

      \[\leadsto \sqrt{\left(\left(x \cdot x\right) \cdot \cos t\right) \cdot \cos t + \color{blue}{\left|\sin t \cdot y\right|} \cdot \sqrt{\left(\left(y \cdot y\right) \cdot \sin t\right) \cdot \sin t}}\]
    5. Applied simplify28.1

      \[\leadsto \sqrt{\left(\left(x \cdot x\right) \cdot \cos t\right) \cdot \cos t + \left|\sin t \cdot y\right| \cdot \color{blue}{\left|\sin t \cdot y\right|}}\]
    6. Taylor expanded around 0 17.1

      \[\leadsto \color{blue}{\left|\sin t \cdot y\right| + \frac{1}{2} \cdot \frac{{x}^{2}}{\left|\sin t \cdot y\right|}}\]

    if 6.073623898151345e-108 < (* (cos t) (- x))

    1. Initial program 31.9

      \[\sqrt{\left(\left(x \cdot x\right) \cdot \cos t\right) \cdot \cos t + \left(\left(y \cdot y\right) \cdot \sin t\right) \cdot \sin t}\]
    2. Taylor expanded around -inf 15.2

      \[\leadsto \color{blue}{-1 \cdot \left(\cos t \cdot x\right)}\]
    3. Applied simplify15.2

      \[\leadsto \color{blue}{\cos t \cdot \left(-x\right)}\]
  3. Recombined 3 regimes into one program.

Runtime

Time bar (total: 34.7s)Debug log

herbie shell --seed '#(2775764126 3555076145 3898259844 1891440260 2599947619 1948460636)' 
(FPCore (x t y)
  :name "sqrt(x*x*cos(t)*cos(t)+y*y*sin(t)*sin(t))"
  (sqrt (+ (* (* (* x x) (cos t)) (cos t)) (* (* (* y y) (sin t)) (sin t)))))