?

Average Error: 0.1 → 0.1
Time: 20.6s
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|ew \cdot \frac{\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(ew * Float64(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[(ew * N[(N[Sin[t], $MachinePrecision] / N[Sqrt[1.0 ^ 2 + N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2], $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]
\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|ew \cdot \frac{\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.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. Applied egg-rr18.7

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

    \[\leadsto \left|\color{blue}{ew \cdot \frac{\sin t}{\mathsf{hypot}\left(1, \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| \]
    Proof

    [Start]18.7

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

    expm1-def [=>]11.5

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

    expm1-log1p [=>]0.1

    \[ \left|\color{blue}{ew \cdot \frac{\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| \]

    *-commutative [=>]0.1

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

    \[\leadsto \left|ew \cdot \frac{\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.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{eh}{ew \cdot t}\right) \cdot \left(ew \cdot \sin t\right)\right| \]
Alternative 2
Error1.0
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 3
Error8.3
Cost34384
\[\begin{array}{l} t_1 := eh \cdot \cos t\\ t_2 := \frac{eh}{ew \cdot t}\\ t_3 := ew \cdot \sin t\\ t_4 := \left|t_3 + eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right|\\ t_5 := \frac{\frac{eh}{t \cdot t} + eh \cdot -0.16666666666666666}{ew}\\ \mathbf{if}\;ew \leq -2.4 \cdot 10^{-29}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;ew \leq -4.4 \cdot 10^{-85}:\\ \;\;\;\;\left|\frac{ew}{t_5} + t_1 \cdot \sin \tan^{-1} \left(t_2 + -0.3333333333333333 \cdot \frac{t \cdot eh}{ew}\right)\right|\\ \mathbf{elif}\;ew \leq -2.8 \cdot 10^{-214}:\\ \;\;\;\;\left|t_3 + t_1 \cdot \sin \tan^{-1} t_2\right|\\ \mathbf{elif}\;ew \leq 6.5 \cdot 10^{-51}:\\ \;\;\;\;\left|t_1 \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \frac{ew}{\frac{0.5}{\frac{eh}{ew}} + t_5}\right|\\ \mathbf{else}:\\ \;\;\;\;t_4\\ \end{array} \]
Alternative 4
Error8.4
Cost34000
\[\begin{array}{l} t_1 := eh \cdot \cos t\\ t_2 := \frac{eh}{ew \cdot t}\\ t_3 := \frac{ew}{\frac{\frac{eh}{t \cdot t} + eh \cdot -0.16666666666666666}{ew}}\\ t_4 := ew \cdot \sin t\\ t_5 := \left|t_4 + eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right|\\ \mathbf{if}\;ew \leq -2.1 \cdot 10^{-28}:\\ \;\;\;\;t_5\\ \mathbf{elif}\;ew \leq -4.5 \cdot 10^{-85}:\\ \;\;\;\;\left|t_3 + t_1 \cdot \sin \tan^{-1} \left(t_2 + -0.3333333333333333 \cdot \frac{t \cdot eh}{ew}\right)\right|\\ \mathbf{elif}\;ew \leq -2.3 \cdot 10^{-214}:\\ \;\;\;\;\left|t_4 + t_1 \cdot \sin \tan^{-1} t_2\right|\\ \mathbf{elif}\;ew \leq 1.4 \cdot 10^{-51}:\\ \;\;\;\;\left|t_1 \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + t_3\right|\\ \mathbf{else}:\\ \;\;\;\;t_5\\ \end{array} \]
Alternative 5
Error11.0
Cost33496
\[\begin{array}{l} t_1 := eh \cdot \cos t\\ t_2 := \frac{eh}{ew \cdot t}\\ t_3 := \left|\frac{ew}{\frac{\frac{eh}{t \cdot t} + eh \cdot -0.16666666666666666}{ew}} + t_1 \cdot \sin \tan^{-1} \left(t_2 + -0.3333333333333333 \cdot \frac{t \cdot eh}{ew}\right)\right|\\ t_4 := \left|ew \cdot \sin t + eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right|\\ \mathbf{if}\;ew \leq -5.5 \cdot 10^{-31}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;ew \leq -5.5 \cdot 10^{-85}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;ew \leq -1.02 \cdot 10^{-158}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;ew \leq -2.9 \cdot 10^{-241}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;ew \leq 1.38 \cdot 10^{-201}:\\ \;\;\;\;\left|t_1 \cdot \sin \tan^{-1} t_2 + ew \cdot \left(t \cdot \left(t \cdot \frac{ew}{eh}\right)\right)\right|\\ \mathbf{elif}\;ew \leq 7.5 \cdot 10^{-52}:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;t_4\\ \end{array} \]
Alternative 6
Error10.1
Cost33496
\[\begin{array}{l} t_1 := \frac{eh}{ew \cdot t}\\ t_2 := ew \cdot \sin t\\ t_3 := \left|t_2 + eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right|\\ t_4 := eh \cdot \cos t\\ t_5 := \left|\frac{ew}{\frac{\frac{eh}{t \cdot t} + eh \cdot -0.16666666666666666}{ew}} + t_4 \cdot \sin \tan^{-1} \left(t_1 + -0.3333333333333333 \cdot \frac{t \cdot eh}{ew}\right)\right|\\ t_6 := t_4 \cdot \sin \tan^{-1} t_1\\ \mathbf{if}\;ew \leq -9.8 \cdot 10^{-26}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;ew \leq -4.8 \cdot 10^{-85}:\\ \;\;\;\;t_5\\ \mathbf{elif}\;ew \leq -2.6 \cdot 10^{-214}:\\ \;\;\;\;\left|t_2 + t_6\right|\\ \mathbf{elif}\;ew \leq -2.05 \cdot 10^{-241}:\\ \;\;\;\;t_5\\ \mathbf{elif}\;ew \leq 5.5 \cdot 10^{-205}:\\ \;\;\;\;\left|t_6 + ew \cdot \left(t \cdot \left(t \cdot \frac{ew}{eh}\right)\right)\right|\\ \mathbf{elif}\;ew \leq 1.2 \cdot 10^{-51}:\\ \;\;\;\;t_5\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \]
Alternative 7
Error27.1
Cost27849
\[\begin{array}{l} t_1 := eh \cdot \cos t\\ t_2 := \frac{eh}{ew \cdot t}\\ \mathbf{if}\;ew \leq -1.3 \cdot 10^{-241} \lor \neg \left(ew \leq 6.8 \cdot 10^{-205}\right):\\ \;\;\;\;\left|\frac{ew}{\frac{\frac{eh}{t \cdot t} + eh \cdot -0.16666666666666666}{ew}} + t_1 \cdot \sin \tan^{-1} \left(t_2 + -0.3333333333333333 \cdot \frac{t \cdot eh}{ew}\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|t_1 \cdot \sin \tan^{-1} t_2 + ew \cdot \left(t \cdot \left(t \cdot \frac{ew}{eh}\right)\right)\right|\\ \end{array} \]
Alternative 8
Error31.2
Cost27072
\[\left|\frac{ew}{\frac{\frac{eh}{t \cdot t} + eh \cdot -0.16666666666666666}{ew}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right| \]
Alternative 9
Error31.9
Cost26944
\[\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right) + \frac{ew}{\frac{eh}{t} \cdot \frac{1}{ew \cdot t}}\right| \]
Alternative 10
Error32.0
Cost26816
\[\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right) + ew \cdot \left(t \cdot \left(t \cdot \frac{ew}{eh}\right)\right)\right| \]
Alternative 11
Error31.9
Cost26816
\[\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right) + t \cdot \left(\frac{ew}{eh} \cdot \left(ew \cdot t\right)\right)\right| \]
Alternative 12
Error31.9
Cost26816
\[\begin{array}{l} t_1 := \frac{eh}{ew \cdot t}\\ \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} t_1 + t \cdot \frac{ew}{t_1}\right| \end{array} \]

Error

Reproduce?

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