?

Average Error: 0.2% → 0.2%
Time: 20.3s
Precision: binary64
Cost: 52480

?

\[\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|\frac{ew \cdot \sin t}{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\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
  (+
   (/ (* ew (sin t)) (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((((ew * sin(t)) / hypot(1.0, (eh / (ew * tan(t))))) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t)))))));
}
public static double code(double eh, double ew, double t) {
	return Math.abs((((ew * Math.sin(t)) * Math.cos(Math.atan(((eh / ew) / Math.tan(t))))) + ((eh * Math.cos(t)) * Math.sin(Math.atan(((eh / ew) / Math.tan(t)))))));
}
public static double code(double eh, double ew, double t) {
	return Math.abs((((ew * Math.sin(t)) / Math.hypot(1.0, (eh / (ew * Math.tan(t))))) + ((eh * Math.cos(t)) * Math.sin(Math.atan(((eh / ew) / Math.tan(t)))))));
}
def code(eh, ew, t):
	return math.fabs((((ew * math.sin(t)) * math.cos(math.atan(((eh / ew) / math.tan(t))))) + ((eh * math.cos(t)) * math.sin(math.atan(((eh / ew) / math.tan(t)))))))
def code(eh, ew, t):
	return math.fabs((((ew * math.sin(t)) / math.hypot(1.0, (eh / (ew * math.tan(t))))) + ((eh * math.cos(t)) * math.sin(math.atan(((eh / ew) / math.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(Float64(Float64(Float64(ew * sin(t)) / hypot(1.0, Float64(eh / Float64(ew * tan(t))))) + Float64(Float64(eh * cos(t)) * sin(atan(Float64(Float64(eh / ew) / tan(t)))))))
end
function tmp = code(eh, ew, t)
	tmp = abs((((ew * sin(t)) * cos(atan(((eh / ew) / tan(t))))) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t)))))));
end
function tmp = code(eh, ew, t)
	tmp = abs((((ew * sin(t)) / hypot(1.0, (eh / (ew * tan(t))))) + ((eh * cos(t)) * sin(atan(((eh / 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[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2], $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]
\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|\frac{ew \cdot \sin t}{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right|

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 0.2

    \[\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. Applied egg-rr0.2

    \[\leadsto \left|\color{blue}{\frac{ew \cdot \sin t}{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
  3. Final simplification0.2

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

Alternatives

Alternative 1
Error0.29%
Cost52480
\[\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \frac{ew}{\frac{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}{\sin t}}\right| \]
Alternative 2
Error0.92%
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{eh}{ew \cdot t}\right) \cdot \left(ew \cdot \sin t\right)\right| \]
Alternative 3
Error1.42%
Cost45504
\[\left|\mathsf{fma}\left(ew, \sin t, \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{\tan t}}{ew}\right)\right)\right| \]
Alternative 4
Error10.24%
Cost39636
\[\begin{array}{l} t_1 := \frac{ew}{t \cdot 0.16666666666666666 + \frac{1}{t}}\\ t_2 := \frac{eh}{ew \cdot t}\\ t_3 := eh \cdot \cos t\\ t_4 := \left|\frac{ew}{\frac{1}{\sin t}} + t_3 \cdot \sin \tan^{-1} t_2\right|\\ \mathbf{if}\;ew \leq -2 \cdot 10^{-194}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;ew \leq 7.2 \cdot 10^{-265}:\\ \;\;\;\;\left|t_3 \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + t_1\right|\\ \mathbf{elif}\;ew \leq 3.5 \cdot 10^{-66}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;ew \leq 9.5 \cdot 10^{-9}:\\ \;\;\;\;\left|t_1 + t_3 \cdot \sin \tan^{-1} \left(t_2 + -0.3333333333333333 \cdot \frac{t \cdot eh}{ew}\right)\right|\\ \mathbf{elif}\;ew \leq 1.9 \cdot 10^{+166}:\\ \;\;\;\;\left|\mathsf{fma}\left(ew, \sin t, eh \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{\tan t}}{ew}\right)\right)\right|\\ \mathbf{else}:\\ \;\;\;\;t_4\\ \end{array} \]
Alternative 5
Error1.42%
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 6
Error10.18%
Cost33620
\[\begin{array}{l} t_1 := \frac{ew}{t \cdot 0.16666666666666666 + \frac{1}{t}}\\ t_2 := \frac{eh}{ew \cdot t}\\ t_3 := \frac{ew}{\frac{1}{\sin t}}\\ t_4 := \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\ t_5 := eh \cdot \cos t\\ t_6 := \left|t_3 + t_5 \cdot \sin \tan^{-1} t_2\right|\\ \mathbf{if}\;ew \leq -9.8 \cdot 10^{-195}:\\ \;\;\;\;t_6\\ \mathbf{elif}\;ew \leq 7.2 \cdot 10^{-265}:\\ \;\;\;\;\left|t_5 \cdot t_4 + t_1\right|\\ \mathbf{elif}\;ew \leq 6.8 \cdot 10^{-67}:\\ \;\;\;\;t_6\\ \mathbf{elif}\;ew \leq 8.6 \cdot 10^{-11}:\\ \;\;\;\;\left|t_1 + t_5 \cdot \sin \tan^{-1} \left(t_2 + -0.3333333333333333 \cdot \frac{t \cdot eh}{ew}\right)\right|\\ \mathbf{elif}\;ew \leq 5.3 \cdot 10^{+110}:\\ \;\;\;\;\left|t_3 + eh \cdot t_4\right|\\ \mathbf{else}:\\ \;\;\;\;t_6\\ \end{array} \]
Alternative 7
Error17.27%
Cost33096
\[\begin{array}{l} t_1 := \frac{ew}{t \cdot 0.16666666666666666 + \frac{1}{t}}\\ t_2 := eh \cdot \cos t\\ t_3 := \frac{eh}{ew \cdot t}\\ t_4 := \left|t_2 \cdot \sin \tan^{-1} t_3 + t_1\right|\\ \mathbf{if}\;eh \leq -1.95 \cdot 10^{-32}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;eh \leq 3.6 \cdot 10^{-64}:\\ \;\;\;\;\left|\frac{ew}{\frac{1}{\sin t}} + eh \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right|\\ \mathbf{elif}\;eh \leq 4.6 \cdot 10^{+128}:\\ \;\;\;\;\left|t_1 + t_2 \cdot \sin \tan^{-1} \left(t_3 + -0.3333333333333333 \cdot \frac{t \cdot eh}{ew}\right)\right|\\ \mathbf{else}:\\ \;\;\;\;t_4\\ \end{array} \]
Alternative 8
Error10.45%
Cost32960
\[\left|\frac{ew}{\frac{1}{\sin t}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right| \]
Alternative 9
Error24.68%
Cost27081
\[\begin{array}{l} \mathbf{if}\;t \leq -1.08 \cdot 10^{+39} \lor \neg \left(t \leq 8.6 \cdot 10^{+46}\right):\\ \;\;\;\;\left|ew \cdot \sin t\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right) + \frac{ew}{t \cdot 0.16666666666666666 + \frac{1}{t}}\right|\\ \end{array} \]
Alternative 10
Error38.51%
Cost26578
\[\begin{array}{l} \mathbf{if}\;t \leq -3.2 \cdot 10^{-11} \lor \neg \left(t \leq 9.5 \cdot 10^{-89} \lor \neg \left(t \leq 1.6 \cdot 10^{-58}\right) \land t \leq 9 \cdot 10^{+14}\right):\\ \;\;\;\;\left|ew \cdot \sin t\right|\\ \mathbf{else}:\\ \;\;\;\;\left|eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right|\\ \end{array} \]
Alternative 11
Error24.97%
Cost26569
\[\begin{array}{l} \mathbf{if}\;t \leq -7.4 \cdot 10^{-8} \lor \neg \left(t \leq 9 \cdot 10^{+14}\right):\\ \;\;\;\;\left|ew \cdot \sin t\right|\\ \mathbf{else}:\\ \;\;\;\;\left|ew \cdot t + eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right|\\ \end{array} \]
Alternative 12
Error43.3%
Cost20818
\[\begin{array}{l} \mathbf{if}\;t \leq -2.6 \cdot 10^{-15} \lor \neg \left(t \leq 9.2 \cdot 10^{-89} \lor \neg \left(t \leq 1.26 \cdot 10^{-58}\right) \land t \leq 9 \cdot 10^{+14}\right):\\ \;\;\;\;\left|ew \cdot \sin t\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{t \cdot t}{eh} \cdot \left(ew \cdot ew\right) + eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right|\\ \end{array} \]
Alternative 13
Error58.48%
Cost12992
\[\left|ew \cdot \sin t\right| \]

Error

Reproduce?

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