Average Error: 31.0 → 26.3
Time: 21.0s
Precision: 64
Internal Precision: 576
$\sqrt{\mathsf{fmax}\left(0, \left(\left(\mathsf{fmin}\left(\mathsf{fmax}\left(\frac{wx}{sinTheta}, -1\right), 1\right) \cdot \mathsf{fmin}\left(\mathsf{fmax}\left(\frac{wx}{sinTheta}, -1\right), 1\right)\right) \cdot alphax\right) \cdot alphax + \left(\left(\mathsf{fmin}\left(\mathsf{fmax}\left(\frac{wy}{sinTheta}, -1\right), 1\right) \cdot \mathsf{fmin}\left(\mathsf{fmax}\left(\frac{wy}{sinTheta}, -1\right), 1\right)\right) \cdot alphay\right) \cdot alphay\right)}$
$\sqrt{\mathsf{fmax}\left(0, \left(alphax \cdot \mathsf{fmin}\left(\mathsf{fmax}\left(\frac{wx}{sinTheta}, -1\right), 1\right)\right) \cdot \left(alphax \cdot \mathsf{fmin}\left(\mathsf{fmax}\left(\frac{wx}{sinTheta}, -1\right), 1\right)\right) + \left(alphay \cdot \mathsf{fmin}\left(\mathsf{fmax}\left(\frac{wy}{sinTheta}, -1\right), 1\right)\right) \cdot \left(alphay \cdot \mathsf{fmin}\left(\mathsf{fmax}\left(\frac{wy}{sinTheta}, -1\right), 1\right)\right)\right)}$

# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 31.0

$\sqrt{\mathsf{fmax}\left(0, \left(\left(\mathsf{fmin}\left(\mathsf{fmax}\left(\frac{wx}{sinTheta}, -1\right), 1\right) \cdot \mathsf{fmin}\left(\mathsf{fmax}\left(\frac{wx}{sinTheta}, -1\right), 1\right)\right) \cdot alphax\right) \cdot alphax + \left(\left(\mathsf{fmin}\left(\mathsf{fmax}\left(\frac{wy}{sinTheta}, -1\right), 1\right) \cdot \mathsf{fmin}\left(\mathsf{fmax}\left(\frac{wy}{sinTheta}, -1\right), 1\right)\right) \cdot alphay\right) \cdot alphay\right)}$
2. Initial simplification26.3

$\leadsto \sqrt{\mathsf{fmax}\left(0, \left(\mathsf{fmin}\left(\mathsf{fmax}\left(\frac{wx}{sinTheta}, -1\right), 1\right) \cdot alphax\right) \cdot \left(\mathsf{fmin}\left(\mathsf{fmax}\left(\frac{wx}{sinTheta}, -1\right), 1\right) \cdot alphax\right) + \left(alphay \cdot \mathsf{fmin}\left(\mathsf{fmax}\left(\frac{wy}{sinTheta}, -1\right), 1\right)\right) \cdot \left(alphay \cdot \mathsf{fmin}\left(\mathsf{fmax}\left(\frac{wy}{sinTheta}, -1\right), 1\right)\right)\right)}$
3. Final simplification26.3

$\leadsto \sqrt{\mathsf{fmax}\left(0, \left(alphax \cdot \mathsf{fmin}\left(\mathsf{fmax}\left(\frac{wx}{sinTheta}, -1\right), 1\right)\right) \cdot \left(alphax \cdot \mathsf{fmin}\left(\mathsf{fmax}\left(\frac{wx}{sinTheta}, -1\right), 1\right)\right) + \left(alphay \cdot \mathsf{fmin}\left(\mathsf{fmax}\left(\frac{wy}{sinTheta}, -1\right), 1\right)\right) \cdot \left(alphay \cdot \mathsf{fmin}\left(\mathsf{fmax}\left(\frac{wy}{sinTheta}, -1\right), 1\right)\right)\right)}$

# Runtime

Time bar (total: 21.0s)Debug log

herbie shell --seed '#(2775764126 3555076145 3898259844 1891440260 2599947619 1948460636)'
(FPCore (wx sinTheta alphax wy alphay)
:name "                          sqrt(fmax(0, (fmin(fmax(wx / sinTheta, -1), 1) * fmin(fmax(wx / sinTheta, -1), 1)                                         * alphax * alphax +                                         (fmin(fmax(wy / sinTheta, -1), 1)) * (fmin(fmax(wy / sinTheta, -1), 1))                                         * alphay * alphay)))"
(sqrt (fmax 0 (+ (* (* (* (fmin (fmax (/ wx sinTheta) (- 1)) 1) (fmin (fmax (/ wx sinTheta) (- 1)) 1)) alphax) alphax) (* (* (* (fmin (fmax (/ wy sinTheta) (- 1)) 1) (fmin (fmax (/ wy sinTheta) (- 1)) 1)) alphay) alphay)))))