?

Average Error: 0.1 → 0.1
Time: 22.3s
Precision: binary64
Cost: 65088

?

\[\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| \]
\[\begin{array}{l} t_1 := \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\\ \left|\mathsf{fma}\left(ew \cdot \sin t, \cos t_1, eh \cdot \left(\cos t \cdot \sin t_1\right)\right)\right| \end{array} \]
(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
 (let* ((t_1 (atan (/ eh (* ew (tan t))))))
   (fabs (fma (* ew (sin t)) (cos t_1) (* eh (* (cos t) (sin t_1)))))))
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) {
	double t_1 = atan((eh / (ew * tan(t))));
	return fabs(fma((ew * sin(t)), cos(t_1), (eh * (cos(t) * sin(t_1)))));
}
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)
	t_1 = atan(Float64(eh / Float64(ew * tan(t))))
	return abs(fma(Float64(ew * sin(t)), cos(t_1), Float64(eh * Float64(cos(t) * sin(t_1)))))
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_] := Block[{t$95$1 = N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision] + N[(eh * N[(N[Cos[t], $MachinePrecision] * N[Sin[t$95$1], $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|
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\\
\left|\mathsf{fma}\left(ew \cdot \sin t, \cos t_1, eh \cdot \left(\cos t \cdot \sin t_1\right)\right)\right|
\end{array}

Error?

Derivation?

  1. Initial program 0.1

    \[\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. Simplified0.1

    \[\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|} \]
    Proof

    [Start]0.1

    \[ \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 [=>]0.1

    \[ \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/ [=>]0.1

    \[ \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* [=>]0.1

    \[ \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/ [=>]0.1

    \[ \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. Final simplification0.1

    \[\leadsto \left|\mathsf{fma}\left(ew \cdot \sin t, \cos \tan^{-1} \left(\frac{eh}{ew \cdot \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
Error0.1
Cost58816
\[\begin{array}{l} t_1 := \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\ \left|\cos t_1 \cdot \left(ew \cdot \sin t\right) + \left(eh \cdot \cos t\right) \cdot \sin t_1\right| \end{array} \]
Alternative 2
Error0.6
Cost52416
\[\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \cos \tan^{-1} \left(\frac{\frac{eh}{t}}{ew}\right) \cdot \left(ew \cdot \sin t\right)\right| \]
Alternative 3
Error0.9
Cost39232
\[\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + ew \cdot \sin t\right| \]
Alternative 4
Error6.4
Cost33353
\[\begin{array}{l} t_1 := eh \cdot \cos t\\ \mathbf{if}\;ew \leq -3.1 \cdot 10^{-16} \lor \neg \left(ew \leq 6 \cdot 10^{+62}\right):\\ \;\;\;\;\left|ew \cdot \sin t + t_1 \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{t}}{ew}\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|t_1 \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \frac{ew}{\frac{1}{t} + -1}\right|\\ \end{array} \]
Alternative 5
Error7.6
Cost33097
\[\begin{array}{l} t_1 := eh \cdot \cos t\\ \mathbf{if}\;ew \leq 1.2 \cdot 10^{-293} \lor \neg \left(ew \leq 6.9 \cdot 10^{-105}\right):\\ \;\;\;\;\left|ew \cdot \sin t + t_1 \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{t}}{ew}\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{ew \cdot ew}{\frac{eh}{t \cdot t} + eh \cdot -0.16666666666666666} + t_1 \cdot \sin \tan^{-1} \left(-0.3333333333333333 \cdot \frac{t \cdot eh}{ew} + \frac{eh}{ew \cdot t}\right)\right|\\ \end{array} \]
Alternative 6
Error10.7
Cost32969
\[\begin{array}{l} \mathbf{if}\;ew \leq -1.8 \cdot 10^{-20} \lor \neg \left(ew \leq 1.06 \cdot 10^{-104}\right):\\ \;\;\;\;\left|ew \cdot \sin t + eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{ew \cdot ew}{\frac{eh}{t \cdot t} + eh \cdot -0.16666666666666666} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(-0.3333333333333333 \cdot \frac{t \cdot eh}{ew} + \frac{eh}{ew \cdot t}\right)\right|\\ \end{array} \]
Alternative 7
Error26.9
Cost27849
\[\begin{array}{l} t_1 := \frac{eh}{ew \cdot t}\\ \mathbf{if}\;t \leq -3.7 \cdot 10^{-5} \lor \neg \left(t \leq 7.5 \cdot 10^{-7}\right):\\ \;\;\;\;\left|\frac{ew \cdot ew}{\frac{eh}{t \cdot t} + eh \cdot -0.16666666666666666} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(-0.3333333333333333 \cdot \frac{t \cdot eh}{ew} + t_1\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{ew \cdot t}{t_1} + eh \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right|\\ \end{array} \]
Alternative 8
Error31.2
Cost27336
\[\begin{array}{l} t_1 := \frac{eh}{ew \cdot t}\\ t_2 := eh \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\ \mathbf{if}\;ew \leq -1.35 \cdot 10^{+154}:\\ \;\;\;\;\left|\frac{ew \cdot t}{t_1} + t_2\right|\\ \mathbf{elif}\;ew \leq 1.26 \cdot 10^{+122}:\\ \;\;\;\;\left|\frac{ew \cdot ew}{\frac{eh}{t \cdot t} + eh \cdot -0.16666666666666666} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} t_1\right|\\ \mathbf{else}:\\ \;\;\;\;\left|t_2 + \frac{ew \cdot \left(ew \cdot \left(t \cdot t\right)\right)}{eh}\right|\\ \end{array} \]
Alternative 9
Error35.1
Cost27081
\[\begin{array}{l} t_1 := \frac{eh}{ew \cdot t}\\ \mathbf{if}\;ew \leq -5 \cdot 10^{+154} \lor \neg \left(ew \leq 10^{+78}\right):\\ \;\;\;\;\left|\frac{ew \cdot t}{t_1} + eh \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} t_1 + \left(ew \cdot ew\right) \cdot \frac{t \cdot t}{eh}\right|\\ \end{array} \]
Alternative 10
Error42.3
Cost26688
\[\left|eh \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(ew \cdot ew\right) \cdot \frac{t}{\frac{eh}{t}}\right| \]
Alternative 11
Error41.6
Cost26688
\[\left|eh \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \frac{t}{\frac{\frac{eh}{ew \cdot ew}}{t}}\right| \]
Alternative 12
Error40.0
Cost26688
\[\left|eh \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \frac{ew \cdot \left(ew \cdot \left(t \cdot t\right)\right)}{eh}\right| \]
Alternative 13
Error38.6
Cost26688
\[\left|\frac{ew \cdot t}{\frac{eh}{ew \cdot t}} + eh \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
Alternative 14
Error42.8
Cost20288
\[\left|\left(ew \cdot ew\right) \cdot \frac{t \cdot t}{eh} + eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right| \]

Error

Reproduce?

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