?

Average Accuracy: 99.8% → 99.8%
Time: 23.4s
Precision: binary64
Cost: 58880

?

\[\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
\[\left|\mathsf{fma}\left(ew \cdot \sin t, \frac{1}{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)}, eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right)\right)\right| \]
(FPCore (eh ew t)
 :precision binary64
 (fabs
  (+
   (* (* ew (sin t)) (cos (atan (/ (/ eh ew) (tan t)))))
   (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))))))
(FPCore (eh ew t)
 :precision binary64
 (fabs
  (fma
   (* ew (sin t))
   (/ 1.0 (hypot 1.0 (/ (/ eh ew) (tan t))))
   (* eh (* (cos t) (sin (atan (/ eh (* ew (tan t))))))))))
double code(double eh, double ew, double t) {
	return fabs((((ew * sin(t)) * cos(atan(((eh / ew) / tan(t))))) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t)))))));
}
double code(double eh, double ew, double t) {
	return fabs(fma((ew * sin(t)), (1.0 / hypot(1.0, ((eh / ew) / tan(t)))), (eh * (cos(t) * sin(atan((eh / (ew * tan(t)))))))));
}
function code(eh, ew, t)
	return abs(Float64(Float64(Float64(ew * sin(t)) * cos(atan(Float64(Float64(eh / ew) / tan(t))))) + Float64(Float64(eh * cos(t)) * sin(atan(Float64(Float64(eh / ew) / tan(t)))))))
end
function code(eh, ew, t)
	return abs(fma(Float64(ew * sin(t)), Float64(1.0 / hypot(1.0, Float64(Float64(eh / ew) / tan(t)))), Float64(eh * Float64(cos(t) * sin(atan(Float64(eh / Float64(ew * tan(t)))))))))
end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
code[eh_, ew_, t_] := N[Abs[N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[1.0 ^ 2 + N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] + N[(eh * N[(N[Cos[t], $MachinePrecision] * N[Sin[N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right|
\left|\mathsf{fma}\left(ew \cdot \sin t, \frac{1}{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)}, eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right)\right)\right|

Error?

Derivation?

  1. Initial program 99.8%

    \[\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
  2. Simplified99.8%

    \[\leadsto \color{blue}{\left|\mathsf{fma}\left(ew \cdot \sin t, \cos \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right), eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)\right)\right)\right|} \]
    Step-by-step derivation

    [Start]99.8

    \[ \left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]

    fma-def [=>]99.8

    \[ \left|\color{blue}{\mathsf{fma}\left(ew \cdot \sin t, \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right), \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right)}\right| \]

    associate-/l/ [=>]99.8

    \[ \left|\mathsf{fma}\left(ew \cdot \sin t, \cos \tan^{-1} \color{blue}{\left(\frac{eh}{\tan t \cdot ew}\right)}, \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right)\right| \]

    associate-*l* [=>]99.8

    \[ \left|\mathsf{fma}\left(ew \cdot \sin t, \cos \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right), \color{blue}{eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right)}\right)\right| \]

    associate-/l/ [=>]99.8

    \[ \left|\mathsf{fma}\left(ew \cdot \sin t, \cos \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right), eh \cdot \left(\cos t \cdot \sin \tan^{-1} \color{blue}{\left(\frac{eh}{\tan t \cdot ew}\right)}\right)\right)\right| \]
  3. Applied egg-rr99.8%

    \[\leadsto \left|\mathsf{fma}\left(ew \cdot \sin t, \color{blue}{{\left(\mathsf{hypot}\left(1, \frac{eh}{\tan t \cdot ew}\right)\right)}^{-0.5} \cdot {\left(\mathsf{hypot}\left(1, \frac{eh}{\tan t \cdot ew}\right)\right)}^{-0.5}}, eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)\right)\right)\right| \]
    Step-by-step derivation

    [Start]99.8

    \[ \left|\mathsf{fma}\left(ew \cdot \sin t, \cos \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right), eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)\right)\right)\right| \]

    add-sqr-sqrt [=>]99.8

    \[ \left|\mathsf{fma}\left(ew \cdot \sin t, \color{blue}{\sqrt{\cos \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)} \cdot \sqrt{\cos \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)}}, eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)\right)\right)\right| \]

    pow1/2 [=>]99.8

    \[ \left|\mathsf{fma}\left(ew \cdot \sin t, \color{blue}{{\cos \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)}^{0.5}} \cdot \sqrt{\cos \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)}, eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)\right)\right)\right| \]

    cos-atan [=>]99.8

    \[ \left|\mathsf{fma}\left(ew \cdot \sin t, {\color{blue}{\left(\frac{1}{\sqrt{1 + \frac{eh}{\tan t \cdot ew} \cdot \frac{eh}{\tan t \cdot ew}}}\right)}}^{0.5} \cdot \sqrt{\cos \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)}, eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)\right)\right)\right| \]

    inv-pow [=>]99.8

    \[ \left|\mathsf{fma}\left(ew \cdot \sin t, {\color{blue}{\left({\left(\sqrt{1 + \frac{eh}{\tan t \cdot ew} \cdot \frac{eh}{\tan t \cdot ew}}\right)}^{-1}\right)}}^{0.5} \cdot \sqrt{\cos \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)}, eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)\right)\right)\right| \]

    pow-pow [=>]99.8

    \[ \left|\mathsf{fma}\left(ew \cdot \sin t, \color{blue}{{\left(\sqrt{1 + \frac{eh}{\tan t \cdot ew} \cdot \frac{eh}{\tan t \cdot ew}}\right)}^{\left(-1 \cdot 0.5\right)}} \cdot \sqrt{\cos \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)}, eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)\right)\right)\right| \]

    hypot-1-def [=>]99.8

    \[ \left|\mathsf{fma}\left(ew \cdot \sin t, {\color{blue}{\left(\mathsf{hypot}\left(1, \frac{eh}{\tan t \cdot ew}\right)\right)}}^{\left(-1 \cdot 0.5\right)} \cdot \sqrt{\cos \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)}, eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)\right)\right)\right| \]

    metadata-eval [=>]99.8

    \[ \left|\mathsf{fma}\left(ew \cdot \sin t, {\left(\mathsf{hypot}\left(1, \frac{eh}{\tan t \cdot ew}\right)\right)}^{\color{blue}{-0.5}} \cdot \sqrt{\cos \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)}, eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)\right)\right)\right| \]

    pow1/2 [=>]99.8

    \[ \left|\mathsf{fma}\left(ew \cdot \sin t, {\left(\mathsf{hypot}\left(1, \frac{eh}{\tan t \cdot ew}\right)\right)}^{-0.5} \cdot \color{blue}{{\cos \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)}^{0.5}}, eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)\right)\right)\right| \]

    cos-atan [=>]99.8

    \[ \left|\mathsf{fma}\left(ew \cdot \sin t, {\left(\mathsf{hypot}\left(1, \frac{eh}{\tan t \cdot ew}\right)\right)}^{-0.5} \cdot {\color{blue}{\left(\frac{1}{\sqrt{1 + \frac{eh}{\tan t \cdot ew} \cdot \frac{eh}{\tan t \cdot ew}}}\right)}}^{0.5}, eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)\right)\right)\right| \]

    inv-pow [=>]99.8

    \[ \left|\mathsf{fma}\left(ew \cdot \sin t, {\left(\mathsf{hypot}\left(1, \frac{eh}{\tan t \cdot ew}\right)\right)}^{-0.5} \cdot {\color{blue}{\left({\left(\sqrt{1 + \frac{eh}{\tan t \cdot ew} \cdot \frac{eh}{\tan t \cdot ew}}\right)}^{-1}\right)}}^{0.5}, eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)\right)\right)\right| \]

    pow-pow [=>]99.8

    \[ \left|\mathsf{fma}\left(ew \cdot \sin t, {\left(\mathsf{hypot}\left(1, \frac{eh}{\tan t \cdot ew}\right)\right)}^{-0.5} \cdot \color{blue}{{\left(\sqrt{1 + \frac{eh}{\tan t \cdot ew} \cdot \frac{eh}{\tan t \cdot ew}}\right)}^{\left(-1 \cdot 0.5\right)}}, eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)\right)\right)\right| \]

    hypot-1-def [=>]99.8

    \[ \left|\mathsf{fma}\left(ew \cdot \sin t, {\left(\mathsf{hypot}\left(1, \frac{eh}{\tan t \cdot ew}\right)\right)}^{-0.5} \cdot {\color{blue}{\left(\mathsf{hypot}\left(1, \frac{eh}{\tan t \cdot ew}\right)\right)}}^{\left(-1 \cdot 0.5\right)}, eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)\right)\right)\right| \]

    metadata-eval [=>]99.8

    \[ \left|\mathsf{fma}\left(ew \cdot \sin t, {\left(\mathsf{hypot}\left(1, \frac{eh}{\tan t \cdot ew}\right)\right)}^{-0.5} \cdot {\left(\mathsf{hypot}\left(1, \frac{eh}{\tan t \cdot ew}\right)\right)}^{\color{blue}{-0.5}}, eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)\right)\right)\right| \]
  4. Simplified99.8%

    \[\leadsto \left|\mathsf{fma}\left(ew \cdot \sin t, \color{blue}{\frac{1}{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)}}, eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)\right)\right)\right| \]
    Step-by-step derivation

    [Start]99.8

    \[ \left|\mathsf{fma}\left(ew \cdot \sin t, {\left(\mathsf{hypot}\left(1, \frac{eh}{\tan t \cdot ew}\right)\right)}^{-0.5} \cdot {\left(\mathsf{hypot}\left(1, \frac{eh}{\tan t \cdot ew}\right)\right)}^{-0.5}, eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)\right)\right)\right| \]

    pow-sqr [=>]99.8

    \[ \left|\mathsf{fma}\left(ew \cdot \sin t, \color{blue}{{\left(\mathsf{hypot}\left(1, \frac{eh}{\tan t \cdot ew}\right)\right)}^{\left(2 \cdot -0.5\right)}}, eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)\right)\right)\right| \]

    metadata-eval [=>]99.8

    \[ \left|\mathsf{fma}\left(ew \cdot \sin t, {\left(\mathsf{hypot}\left(1, \frac{eh}{\tan t \cdot ew}\right)\right)}^{\color{blue}{-1}}, eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)\right)\right)\right| \]

    unpow-1 [=>]99.8

    \[ \left|\mathsf{fma}\left(ew \cdot \sin t, \color{blue}{\frac{1}{\mathsf{hypot}\left(1, \frac{eh}{\tan t \cdot ew}\right)}}, eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)\right)\right)\right| \]

    *-commutative [=>]99.8

    \[ \left|\mathsf{fma}\left(ew \cdot \sin t, \frac{1}{\mathsf{hypot}\left(1, \frac{eh}{\color{blue}{ew \cdot \tan t}}\right)}, eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)\right)\right)\right| \]

    associate-/r* [=>]99.8

    \[ \left|\mathsf{fma}\left(ew \cdot \sin t, \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\frac{\frac{eh}{ew}}{\tan t}}\right)}, eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)\right)\right)\right| \]
  5. Final simplification99.8%

    \[\leadsto \left|\mathsf{fma}\left(ew \cdot \sin t, \frac{1}{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)}, eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right)\right)\right| \]

Alternatives

Alternative 1
Accuracy99.8%
Cost52608
\[\begin{array}{l} t_1 := \frac{\frac{eh}{ew}}{\tan t}\\ \left|\frac{1}{\mathsf{hypot}\left(1, t_1\right)} \cdot \left(ew \cdot \sin t\right) + \sin \tan^{-1} t_1 \cdot \left(eh \cdot \cos t\right)\right| \end{array} \]
Alternative 2
Accuracy99.0%
Cost52416
\[\left|\sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) \cdot \left(eh \cdot \cos t\right) + \cos \tan^{-1} \left(\frac{eh}{ew \cdot t}\right) \cdot \left(ew \cdot \sin t\right)\right| \]
Alternative 3
Accuracy98.4%
Cost39232
\[\left|\sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) \cdot \left(eh \cdot \cos t\right) + ew \cdot \sin t\right| \]
Alternative 4
Accuracy97.9%
Cost19648
\[\left|ew \cdot \sin t + eh \cdot \cos t\right| \]
Alternative 5
Accuracy97.9%
Cost19648
\[\left|ew \cdot \sin t - eh \cdot \cos t\right| \]
Alternative 6
Accuracy78.5%
Cost13120
\[\left|eh + ew \cdot \sin t\right| \]
Alternative 7
Accuracy42.3%
Cost12992
\[\left|ew \cdot \sin t\right| \]

Error

Reproduce?

herbie shell --seed 2023157 
(FPCore (eh ew t)
  :name "Example from Robby"
  :precision binary64
  (fabs (+ (* (* ew (sin t)) (cos (atan (/ (/ eh ew) (tan t))))) (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))))))