Example from Robby

Percentage Accurate: 99.8% → 99.8%
Time: 19.4s
Alternatives: 12
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \begin{array}{l} t_1 := \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\ \left|\left(ew \cdot \sin t\right) \cdot \cos t\_1 + \left(eh \cdot \cos t\right) \cdot \sin t\_1\right| \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (atan (/ (/ eh ew) (tan t)))))
   (fabs (+ (* (* ew (sin t)) (cos t_1)) (* (* eh (cos t)) (sin t_1))))))
double code(double eh, double ew, double t) {
	double t_1 = atan(((eh / ew) / tan(t)));
	return fabs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))));
}
real(8) function code(eh, ew, t)
    real(8), intent (in) :: eh
    real(8), intent (in) :: ew
    real(8), intent (in) :: t
    real(8) :: t_1
    t_1 = atan(((eh / ew) / tan(t)))
    code = abs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))))
end function
public static double code(double eh, double ew, double t) {
	double t_1 = Math.atan(((eh / ew) / Math.tan(t)));
	return Math.abs((((ew * Math.sin(t)) * Math.cos(t_1)) + ((eh * Math.cos(t)) * Math.sin(t_1))));
}
def code(eh, ew, t):
	t_1 = math.atan(((eh / ew) / math.tan(t)))
	return math.fabs((((ew * math.sin(t)) * math.cos(t_1)) + ((eh * math.cos(t)) * math.sin(t_1))))
function code(eh, ew, t)
	t_1 = atan(Float64(Float64(eh / ew) / tan(t)))
	return abs(Float64(Float64(Float64(ew * sin(t)) * cos(t_1)) + Float64(Float64(eh * cos(t)) * sin(t_1))))
end
function tmp = code(eh, ew, t)
	t_1 = atan(((eh / ew) / tan(t)));
	tmp = abs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))));
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\
\left|\left(ew \cdot \sin t\right) \cdot \cos t\_1 + \left(eh \cdot \cos t\right) \cdot \sin t\_1\right|
\end{array}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 12 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 99.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\ \left|\left(ew \cdot \sin t\right) \cdot \cos t\_1 + \left(eh \cdot \cos t\right) \cdot \sin t\_1\right| \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (atan (/ (/ eh ew) (tan t)))))
   (fabs (+ (* (* ew (sin t)) (cos t_1)) (* (* eh (cos t)) (sin t_1))))))
double code(double eh, double ew, double t) {
	double t_1 = atan(((eh / ew) / tan(t)));
	return fabs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))));
}
real(8) function code(eh, ew, t)
    real(8), intent (in) :: eh
    real(8), intent (in) :: ew
    real(8), intent (in) :: t
    real(8) :: t_1
    t_1 = atan(((eh / ew) / tan(t)))
    code = abs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))))
end function
public static double code(double eh, double ew, double t) {
	double t_1 = Math.atan(((eh / ew) / Math.tan(t)));
	return Math.abs((((ew * Math.sin(t)) * Math.cos(t_1)) + ((eh * Math.cos(t)) * Math.sin(t_1))));
}
def code(eh, ew, t):
	t_1 = math.atan(((eh / ew) / math.tan(t)))
	return math.fabs((((ew * math.sin(t)) * math.cos(t_1)) + ((eh * math.cos(t)) * math.sin(t_1))))
function code(eh, ew, t)
	t_1 = atan(Float64(Float64(eh / ew) / tan(t)))
	return abs(Float64(Float64(Float64(ew * sin(t)) * cos(t_1)) + Float64(Float64(eh * cos(t)) * sin(t_1))))
end
function tmp = code(eh, ew, t)
	t_1 = atan(((eh / ew) / tan(t)));
	tmp = abs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))));
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\
\left|\left(ew \cdot \sin t\right) \cdot \cos t\_1 + \left(eh \cdot \cos t\right) \cdot \sin t\_1\right|
\end{array}
\end{array}

Alternative 1: 99.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left|\left(ew \cdot \sin t\right) \cdot {\left(1 + {\left(ew \cdot \frac{\tan t}{eh}\right)}^{-2}\right)}^{-0.5} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (fabs
  (+
   (* (* ew (sin t)) (pow (+ 1.0 (pow (* ew (/ (tan t) eh)) -2.0)) -0.5))
   (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))))))
double code(double eh, double ew, double t) {
	return fabs((((ew * sin(t)) * pow((1.0 + pow((ew * (tan(t) / eh)), -2.0)), -0.5)) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t)))))));
}
real(8) function code(eh, ew, t)
    real(8), intent (in) :: eh
    real(8), intent (in) :: ew
    real(8), intent (in) :: t
    code = abs((((ew * sin(t)) * ((1.0d0 + ((ew * (tan(t) / eh)) ** (-2.0d0))) ** (-0.5d0))) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t)))))))
end function
public static double code(double eh, double ew, double t) {
	return Math.abs((((ew * Math.sin(t)) * Math.pow((1.0 + Math.pow((ew * (Math.tan(t) / eh)), -2.0)), -0.5)) + ((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.pow((1.0 + math.pow((ew * (math.tan(t) / eh)), -2.0)), -0.5)) + ((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)) * (Float64(1.0 + (Float64(ew * Float64(tan(t) / eh)) ^ -2.0)) ^ -0.5)) + 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)) * ((1.0 + ((ew * (tan(t) / eh)) ^ -2.0)) ^ -0.5)) + ((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[Power[N[(1.0 + N[Power[N[(ew * N[(N[Tan[t], $MachinePrecision] / eh), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision], -0.5], $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]
\begin{array}{l}

\\
\left|\left(ew \cdot \sin t\right) \cdot {\left(1 + {\left(ew \cdot \frac{\tan t}{eh}\right)}^{-2}\right)}^{-0.5} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right|
\end{array}
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. Add Preprocessing
  3. Step-by-step derivation
    1. cos-atanN/A

      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{\frac{1}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    2. inv-powN/A

      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}\right)}^{-1}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    3. pow1/2N/A

      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot {\color{blue}{\left({\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\frac{1}{2}}\right)}}^{-1} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    4. pow-powN/A

      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\left(\frac{1}{2} \cdot -1\right)}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    5. pow-lowering-pow.f64N/A

      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\left(\frac{1}{2} \cdot -1\right)}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
  4. Applied egg-rr99.8%

    \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + {\left(ew \cdot \frac{\tan t}{eh}\right)}^{-2}\right)}^{-0.5}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
  5. Add Preprocessing

Alternative 2: 99.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\\ \left|\sin t \cdot \left(ew \cdot \cos t\_1\right) + eh \cdot \left(\cos t \cdot \sin t\_1\right)\right| \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (atan (/ eh (* ew (tan t))))))
   (fabs (+ (* (sin t) (* ew (cos t_1))) (* eh (* (cos t) (sin t_1)))))))
double code(double eh, double ew, double t) {
	double t_1 = atan((eh / (ew * tan(t))));
	return fabs(((sin(t) * (ew * cos(t_1))) + (eh * (cos(t) * sin(t_1)))));
}
real(8) function code(eh, ew, t)
    real(8), intent (in) :: eh
    real(8), intent (in) :: ew
    real(8), intent (in) :: t
    real(8) :: t_1
    t_1 = atan((eh / (ew * tan(t))))
    code = abs(((sin(t) * (ew * cos(t_1))) + (eh * (cos(t) * sin(t_1)))))
end function
public static double code(double eh, double ew, double t) {
	double t_1 = Math.atan((eh / (ew * Math.tan(t))));
	return Math.abs(((Math.sin(t) * (ew * Math.cos(t_1))) + (eh * (Math.cos(t) * Math.sin(t_1)))));
}
def code(eh, ew, t):
	t_1 = math.atan((eh / (ew * math.tan(t))))
	return math.fabs(((math.sin(t) * (ew * math.cos(t_1))) + (eh * (math.cos(t) * math.sin(t_1)))))
function code(eh, ew, t)
	t_1 = atan(Float64(eh / Float64(ew * tan(t))))
	return abs(Float64(Float64(sin(t) * Float64(ew * cos(t_1))) + Float64(eh * Float64(cos(t) * sin(t_1)))))
end
function tmp = code(eh, ew, t)
	t_1 = atan((eh / (ew * tan(t))));
	tmp = abs(((sin(t) * (ew * cos(t_1))) + (eh * (cos(t) * sin(t_1)))));
end
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[(N[Sin[t], $MachinePrecision] * N[(ew * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(eh * N[(N[Cos[t], $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\\
\left|\sin t \cdot \left(ew \cdot \cos t\_1\right) + eh \cdot \left(\cos t \cdot \sin t\_1\right)\right|
\end{array}
\end{array}
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. Add Preprocessing
  3. Step-by-step derivation
    1. cos-atanN/A

      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{\frac{1}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    2. inv-powN/A

      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}\right)}^{-1}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    3. pow1/2N/A

      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot {\color{blue}{\left({\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\frac{1}{2}}\right)}}^{-1} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    4. pow-powN/A

      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\left(\frac{1}{2} \cdot -1\right)}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    5. pow-lowering-pow.f64N/A

      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\left(\frac{1}{2} \cdot -1\right)}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
  4. Applied egg-rr99.8%

    \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + {\left(ew \cdot \frac{\tan t}{eh}\right)}^{-2}\right)}^{-0.5}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
  5. Applied egg-rr99.8%

    \[\leadsto \color{blue}{\left|\sin t \cdot \left(ew \cdot \cos \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right) + eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right)\right|} \]
  6. Add Preprocessing

Alternative 3: 99.0% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right| \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (fabs
  (+
   (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t)))))
   (* (* ew (sin t)) (cos (atan (/ eh (* ew t))))))))
double code(double eh, double ew, double t) {
	return fabs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + ((ew * sin(t)) * cos(atan((eh / (ew * t)))))));
}
real(8) function code(eh, ew, t)
    real(8), intent (in) :: eh
    real(8), intent (in) :: ew
    real(8), intent (in) :: t
    code = abs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + ((ew * sin(t)) * cos(atan((eh / (ew * t)))))))
end function
public static double code(double eh, double ew, double t) {
	return Math.abs((((eh * Math.cos(t)) * Math.sin(Math.atan(((eh / ew) / Math.tan(t))))) + ((ew * Math.sin(t)) * Math.cos(Math.atan((eh / (ew * t)))))));
}
def code(eh, ew, t):
	return math.fabs((((eh * math.cos(t)) * math.sin(math.atan(((eh / ew) / math.tan(t))))) + ((ew * math.sin(t)) * math.cos(math.atan((eh / (ew * t)))))))
function code(eh, ew, t)
	return abs(Float64(Float64(Float64(eh * cos(t)) * sin(atan(Float64(Float64(eh / ew) / tan(t))))) + Float64(Float64(ew * sin(t)) * cos(atan(Float64(eh / Float64(ew * t)))))))
end
function tmp = code(eh, ew, t)
	tmp = abs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + ((ew * sin(t)) * cos(atan((eh / (ew * t)))))));
end
code[eh_, ew_, t_] := N[Abs[N[(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] + N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right|
\end{array}
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. Add Preprocessing
  3. Taylor expanded in t around 0

    \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \color{blue}{\left(\frac{eh}{ew \cdot t}\right)} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
  4. Step-by-step derivation
    1. /-lowering-/.f64N/A

      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \color{blue}{\left(\frac{eh}{ew \cdot t}\right)} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    2. *-commutativeN/A

      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{eh}{\color{blue}{t \cdot ew}}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    3. *-lowering-*.f6498.6

      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{eh}{\color{blue}{t \cdot ew}}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
  5. Simplified98.6%

    \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \color{blue}{\left(\frac{eh}{t \cdot ew}\right)} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
  6. Final simplification98.6%

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

Alternative 4: 98.3% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \left|ew \cdot \sin t + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right| \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (fabs
  (+ (* ew (sin t)) (* (* eh (cos t)) (sin (atan (/ eh (* ew (tan t)))))))))
double code(double eh, double ew, double t) {
	return fabs(((ew * sin(t)) + ((eh * cos(t)) * sin(atan((eh / (ew * tan(t))))))));
}
real(8) function code(eh, ew, t)
    real(8), intent (in) :: eh
    real(8), intent (in) :: ew
    real(8), intent (in) :: t
    code = abs(((ew * sin(t)) + ((eh * cos(t)) * sin(atan((eh / (ew * tan(t))))))))
end function
public static double code(double eh, double ew, double t) {
	return Math.abs(((ew * Math.sin(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)) + ((eh * math.cos(t)) * math.sin(math.atan((eh / (ew * math.tan(t))))))))
function code(eh, ew, t)
	return abs(Float64(Float64(ew * sin(t)) + Float64(Float64(eh * cos(t)) * sin(atan(Float64(eh / Float64(ew * tan(t))))))))
end
function tmp = code(eh, ew, t)
	tmp = abs(((ew * sin(t)) + ((eh * cos(t)) * sin(atan((eh / (ew * tan(t))))))));
end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\left|ew \cdot \sin t + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right|
\end{array}
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. Add Preprocessing
  3. Step-by-step derivation
    1. cos-atanN/A

      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{\frac{1}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    2. inv-powN/A

      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}\right)}^{-1}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    3. pow1/2N/A

      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot {\color{blue}{\left({\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\frac{1}{2}}\right)}}^{-1} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    4. pow-powN/A

      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\left(\frac{1}{2} \cdot -1\right)}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    5. pow-lowering-pow.f64N/A

      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\left(\frac{1}{2} \cdot -1\right)}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
  4. Applied egg-rr99.8%

    \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + {\left(ew \cdot \frac{\tan t}{eh}\right)}^{-2}\right)}^{-0.5}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
  5. Taylor expanded in eh around 0

    \[\leadsto \left|\color{blue}{eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right) + ew \cdot \sin t}\right| \]
  6. Step-by-step derivation
    1. +-lowering-+.f64N/A

      \[\leadsto \left|\color{blue}{eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right) + ew \cdot \sin t}\right| \]
    2. associate-*r*N/A

      \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)} + ew \cdot \sin t\right| \]
    3. *-lowering-*.f64N/A

      \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)} + ew \cdot \sin t\right| \]
    4. *-lowering-*.f64N/A

      \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right)} \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right) + ew \cdot \sin t\right| \]
    5. cos-lowering-cos.f64N/A

      \[\leadsto \left|\left(eh \cdot \color{blue}{\cos t}\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right) + ew \cdot \sin t\right| \]
    6. sin-lowering-sin.f64N/A

      \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \color{blue}{\sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)} + ew \cdot \sin t\right| \]
    7. atan-lowering-atan.f64N/A

      \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \color{blue}{\tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)} + ew \cdot \sin t\right| \]
    8. /-lowering-/.f64N/A

      \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \color{blue}{\left(\frac{eh}{ew \cdot \tan t}\right)} + ew \cdot \sin t\right| \]
    9. *-lowering-*.f64N/A

      \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{\color{blue}{ew \cdot \tan t}}\right) + ew \cdot \sin t\right| \]
    10. tan-lowering-tan.f64N/A

      \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \color{blue}{\tan t}}\right) + ew \cdot \sin t\right| \]
    11. *-lowering-*.f64N/A

      \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right) + \color{blue}{ew \cdot \sin t}\right| \]
    12. sin-lowering-sin.f6498.4

      \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right) + ew \cdot \color{blue}{\sin t}\right| \]
  7. Simplified98.4%

    \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right) + ew \cdot \sin t}\right| \]
  8. Final simplification98.4%

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

Alternative 5: 75.2% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left|ew \cdot \sin t\right|\\ \mathbf{if}\;ew \leq -6 \cdot 10^{+72}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;ew \leq 6 \cdot 10^{+69}:\\ \;\;\;\;\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right|\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (fabs (* ew (sin t)))))
   (if (<= ew -6e+72)
     t_1
     (if (<= ew 6e+69)
       (fabs (* (* eh (cos t)) (sin (atan (/ eh (* ew (tan t)))))))
       t_1))))
double code(double eh, double ew, double t) {
	double t_1 = fabs((ew * sin(t)));
	double tmp;
	if (ew <= -6e+72) {
		tmp = t_1;
	} else if (ew <= 6e+69) {
		tmp = fabs(((eh * cos(t)) * sin(atan((eh / (ew * tan(t)))))));
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(eh, ew, t)
    real(8), intent (in) :: eh
    real(8), intent (in) :: ew
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = abs((ew * sin(t)))
    if (ew <= (-6d+72)) then
        tmp = t_1
    else if (ew <= 6d+69) then
        tmp = abs(((eh * cos(t)) * sin(atan((eh / (ew * tan(t)))))))
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double eh, double ew, double t) {
	double t_1 = Math.abs((ew * Math.sin(t)));
	double tmp;
	if (ew <= -6e+72) {
		tmp = t_1;
	} else if (ew <= 6e+69) {
		tmp = Math.abs(((eh * Math.cos(t)) * Math.sin(Math.atan((eh / (ew * Math.tan(t)))))));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(eh, ew, t):
	t_1 = math.fabs((ew * math.sin(t)))
	tmp = 0
	if ew <= -6e+72:
		tmp = t_1
	elif ew <= 6e+69:
		tmp = math.fabs(((eh * math.cos(t)) * math.sin(math.atan((eh / (ew * math.tan(t)))))))
	else:
		tmp = t_1
	return tmp
function code(eh, ew, t)
	t_1 = abs(Float64(ew * sin(t)))
	tmp = 0.0
	if (ew <= -6e+72)
		tmp = t_1;
	elseif (ew <= 6e+69)
		tmp = abs(Float64(Float64(eh * cos(t)) * sin(atan(Float64(eh / Float64(ew * tan(t)))))));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(eh, ew, t)
	t_1 = abs((ew * sin(t)));
	tmp = 0.0;
	if (ew <= -6e+72)
		tmp = t_1;
	elseif (ew <= 6e+69)
		tmp = abs(((eh * cos(t)) * sin(atan((eh / (ew * tan(t)))))));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[ew, -6e+72], t$95$1, If[LessEqual[ew, 6e+69], N[Abs[N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left|ew \cdot \sin t\right|\\
\mathbf{if}\;ew \leq -6 \cdot 10^{+72}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;ew \leq 6 \cdot 10^{+69}:\\
\;\;\;\;\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right|\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ew < -6.00000000000000006e72 or 5.99999999999999967e69 < ew

    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. Add Preprocessing
    3. Step-by-step derivation
      1. cos-atanN/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{\frac{1}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      2. inv-powN/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}\right)}^{-1}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      3. pow1/2N/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot {\color{blue}{\left({\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\frac{1}{2}}\right)}}^{-1} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      4. pow-powN/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\left(\frac{1}{2} \cdot -1\right)}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      5. pow-lowering-pow.f64N/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\left(\frac{1}{2} \cdot -1\right)}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    4. Applied egg-rr99.8%

      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + {\left(ew \cdot \frac{\tan t}{eh}\right)}^{-2}\right)}^{-0.5}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    5. Taylor expanded in ew around inf

      \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]
    6. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]
      2. sin-lowering-sin.f6472.0

        \[\leadsto \left|ew \cdot \color{blue}{\sin t}\right| \]
    7. Simplified72.0%

      \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]

    if -6.00000000000000006e72 < ew < 5.99999999999999967e69

    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. Add Preprocessing
    3. Taylor expanded in ew around 0

      \[\leadsto \left|\color{blue}{eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right)}\right| \]
    4. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
      2. *-commutativeN/A

        \[\leadsto \left|\color{blue}{\sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right) \cdot \left(eh \cdot \cos t\right)}\right| \]
      3. *-lowering-*.f64N/A

        \[\leadsto \left|\color{blue}{\sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right) \cdot \left(eh \cdot \cos t\right)}\right| \]
      4. sin-lowering-sin.f64N/A

        \[\leadsto \left|\color{blue}{\sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)} \cdot \left(eh \cdot \cos t\right)\right| \]
      5. atan-lowering-atan.f64N/A

        \[\leadsto \left|\sin \color{blue}{\tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)} \cdot \left(eh \cdot \cos t\right)\right| \]
      6. /-lowering-/.f64N/A

        \[\leadsto \left|\sin \tan^{-1} \color{blue}{\left(\frac{eh}{ew \cdot \tan t}\right)} \cdot \left(eh \cdot \cos t\right)\right| \]
      7. *-lowering-*.f64N/A

        \[\leadsto \left|\sin \tan^{-1} \left(\frac{eh}{\color{blue}{ew \cdot \tan t}}\right) \cdot \left(eh \cdot \cos t\right)\right| \]
      8. tan-lowering-tan.f64N/A

        \[\leadsto \left|\sin \tan^{-1} \left(\frac{eh}{ew \cdot \color{blue}{\tan t}}\right) \cdot \left(eh \cdot \cos t\right)\right| \]
      9. *-lowering-*.f64N/A

        \[\leadsto \left|\sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right) \cdot \color{blue}{\left(eh \cdot \cos t\right)}\right| \]
      10. cos-lowering-cos.f6482.8

        \[\leadsto \left|\sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right) \cdot \left(eh \cdot \color{blue}{\cos t}\right)\right| \]
    5. Simplified82.8%

      \[\leadsto \left|\color{blue}{\sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right) \cdot \left(eh \cdot \cos t\right)}\right| \]
  3. Recombined 2 regimes into one program.
  4. Final simplification79.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;ew \leq -6 \cdot 10^{+72}:\\ \;\;\;\;\left|ew \cdot \sin t\right|\\ \mathbf{elif}\;ew \leq 6 \cdot 10^{+69}:\\ \;\;\;\;\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|ew \cdot \sin t\right|\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 68.7% accurate, 2.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left|ew \cdot \sin t\right|\\ t_2 := eh \cdot \cos t\\ t_3 := \left|t\_2 \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right|\\ t_4 := \left|t\_2 \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew} + \frac{-0.3333333333333333 \cdot \left(eh \cdot \left(t \cdot t\right)\right)}{ew}}{t}\right)\right|\\ \mathbf{if}\;eh \leq -2.8 \cdot 10^{+55}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;eh \leq -1.6 \cdot 10^{+36}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;eh \leq -8.8 \cdot 10^{-118}:\\ \;\;\;\;t\_4\\ \mathbf{elif}\;eh \leq 3.6 \cdot 10^{-150}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;eh \leq 1.72 \cdot 10^{+227}:\\ \;\;\;\;t\_4\\ \mathbf{else}:\\ \;\;\;\;t\_3\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (fabs (* ew (sin t))))
        (t_2 (* eh (cos t)))
        (t_3 (fabs (* t_2 (sin (atan (/ eh (* ew t)))))))
        (t_4
         (fabs
          (*
           t_2
           (sin
            (atan
             (/
              (+ (/ eh ew) (/ (* -0.3333333333333333 (* eh (* t t))) ew))
              t)))))))
   (if (<= eh -2.8e+55)
     t_3
     (if (<= eh -1.6e+36)
       t_1
       (if (<= eh -8.8e-118)
         t_4
         (if (<= eh 3.6e-150) t_1 (if (<= eh 1.72e+227) t_4 t_3)))))))
double code(double eh, double ew, double t) {
	double t_1 = fabs((ew * sin(t)));
	double t_2 = eh * cos(t);
	double t_3 = fabs((t_2 * sin(atan((eh / (ew * t))))));
	double t_4 = fabs((t_2 * sin(atan((((eh / ew) + ((-0.3333333333333333 * (eh * (t * t))) / ew)) / t)))));
	double tmp;
	if (eh <= -2.8e+55) {
		tmp = t_3;
	} else if (eh <= -1.6e+36) {
		tmp = t_1;
	} else if (eh <= -8.8e-118) {
		tmp = t_4;
	} else if (eh <= 3.6e-150) {
		tmp = t_1;
	} else if (eh <= 1.72e+227) {
		tmp = t_4;
	} else {
		tmp = t_3;
	}
	return tmp;
}
real(8) function code(eh, ew, t)
    real(8), intent (in) :: eh
    real(8), intent (in) :: ew
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: t_4
    real(8) :: tmp
    t_1 = abs((ew * sin(t)))
    t_2 = eh * cos(t)
    t_3 = abs((t_2 * sin(atan((eh / (ew * t))))))
    t_4 = abs((t_2 * sin(atan((((eh / ew) + (((-0.3333333333333333d0) * (eh * (t * t))) / ew)) / t)))))
    if (eh <= (-2.8d+55)) then
        tmp = t_3
    else if (eh <= (-1.6d+36)) then
        tmp = t_1
    else if (eh <= (-8.8d-118)) then
        tmp = t_4
    else if (eh <= 3.6d-150) then
        tmp = t_1
    else if (eh <= 1.72d+227) then
        tmp = t_4
    else
        tmp = t_3
    end if
    code = tmp
end function
public static double code(double eh, double ew, double t) {
	double t_1 = Math.abs((ew * Math.sin(t)));
	double t_2 = eh * Math.cos(t);
	double t_3 = Math.abs((t_2 * Math.sin(Math.atan((eh / (ew * t))))));
	double t_4 = Math.abs((t_2 * Math.sin(Math.atan((((eh / ew) + ((-0.3333333333333333 * (eh * (t * t))) / ew)) / t)))));
	double tmp;
	if (eh <= -2.8e+55) {
		tmp = t_3;
	} else if (eh <= -1.6e+36) {
		tmp = t_1;
	} else if (eh <= -8.8e-118) {
		tmp = t_4;
	} else if (eh <= 3.6e-150) {
		tmp = t_1;
	} else if (eh <= 1.72e+227) {
		tmp = t_4;
	} else {
		tmp = t_3;
	}
	return tmp;
}
def code(eh, ew, t):
	t_1 = math.fabs((ew * math.sin(t)))
	t_2 = eh * math.cos(t)
	t_3 = math.fabs((t_2 * math.sin(math.atan((eh / (ew * t))))))
	t_4 = math.fabs((t_2 * math.sin(math.atan((((eh / ew) + ((-0.3333333333333333 * (eh * (t * t))) / ew)) / t)))))
	tmp = 0
	if eh <= -2.8e+55:
		tmp = t_3
	elif eh <= -1.6e+36:
		tmp = t_1
	elif eh <= -8.8e-118:
		tmp = t_4
	elif eh <= 3.6e-150:
		tmp = t_1
	elif eh <= 1.72e+227:
		tmp = t_4
	else:
		tmp = t_3
	return tmp
function code(eh, ew, t)
	t_1 = abs(Float64(ew * sin(t)))
	t_2 = Float64(eh * cos(t))
	t_3 = abs(Float64(t_2 * sin(atan(Float64(eh / Float64(ew * t))))))
	t_4 = abs(Float64(t_2 * sin(atan(Float64(Float64(Float64(eh / ew) + Float64(Float64(-0.3333333333333333 * Float64(eh * Float64(t * t))) / ew)) / t)))))
	tmp = 0.0
	if (eh <= -2.8e+55)
		tmp = t_3;
	elseif (eh <= -1.6e+36)
		tmp = t_1;
	elseif (eh <= -8.8e-118)
		tmp = t_4;
	elseif (eh <= 3.6e-150)
		tmp = t_1;
	elseif (eh <= 1.72e+227)
		tmp = t_4;
	else
		tmp = t_3;
	end
	return tmp
end
function tmp_2 = code(eh, ew, t)
	t_1 = abs((ew * sin(t)));
	t_2 = eh * cos(t);
	t_3 = abs((t_2 * sin(atan((eh / (ew * t))))));
	t_4 = abs((t_2 * sin(atan((((eh / ew) + ((-0.3333333333333333 * (eh * (t * t))) / ew)) / t)))));
	tmp = 0.0;
	if (eh <= -2.8e+55)
		tmp = t_3;
	elseif (eh <= -1.6e+36)
		tmp = t_1;
	elseif (eh <= -8.8e-118)
		tmp = t_4;
	elseif (eh <= 3.6e-150)
		tmp = t_1;
	elseif (eh <= 1.72e+227)
		tmp = t_4;
	else
		tmp = t_3;
	end
	tmp_2 = tmp;
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Abs[N[(t$95$2 * N[Sin[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[Abs[N[(t$95$2 * N[Sin[N[ArcTan[N[(N[(N[(eh / ew), $MachinePrecision] + N[(N[(-0.3333333333333333 * N[(eh * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -2.8e+55], t$95$3, If[LessEqual[eh, -1.6e+36], t$95$1, If[LessEqual[eh, -8.8e-118], t$95$4, If[LessEqual[eh, 3.6e-150], t$95$1, If[LessEqual[eh, 1.72e+227], t$95$4, t$95$3]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left|ew \cdot \sin t\right|\\
t_2 := eh \cdot \cos t\\
t_3 := \left|t\_2 \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right|\\
t_4 := \left|t\_2 \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew} + \frac{-0.3333333333333333 \cdot \left(eh \cdot \left(t \cdot t\right)\right)}{ew}}{t}\right)\right|\\
\mathbf{if}\;eh \leq -2.8 \cdot 10^{+55}:\\
\;\;\;\;t\_3\\

\mathbf{elif}\;eh \leq -1.6 \cdot 10^{+36}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;eh \leq -8.8 \cdot 10^{-118}:\\
\;\;\;\;t\_4\\

\mathbf{elif}\;eh \leq 3.6 \cdot 10^{-150}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;eh \leq 1.72 \cdot 10^{+227}:\\
\;\;\;\;t\_4\\

\mathbf{else}:\\
\;\;\;\;t\_3\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if eh < -2.8000000000000001e55 or 1.71999999999999995e227 < eh

    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. Add Preprocessing
    3. Step-by-step derivation
      1. cos-atanN/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{\frac{1}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      2. inv-powN/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}\right)}^{-1}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      3. pow1/2N/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot {\color{blue}{\left({\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\frac{1}{2}}\right)}}^{-1} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      4. pow-powN/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\left(\frac{1}{2} \cdot -1\right)}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      5. pow-lowering-pow.f64N/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\left(\frac{1}{2} \cdot -1\right)}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    4. Applied egg-rr99.8%

      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + {\left(ew \cdot \frac{\tan t}{eh}\right)}^{-2}\right)}^{-0.5}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    5. Taylor expanded in ew around 0

      \[\leadsto \left|\color{blue}{eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right)}\right| \]
    6. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
      2. *-lowering-*.f64N/A

        \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
      3. *-lowering-*.f64N/A

        \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right)} \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right| \]
      4. cos-lowering-cos.f64N/A

        \[\leadsto \left|\left(eh \cdot \color{blue}{\cos t}\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right| \]
      5. sin-lowering-sin.f64N/A

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \color{blue}{\sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
      6. atan-lowering-atan.f64N/A

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \color{blue}{\tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
      7. /-lowering-/.f64N/A

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \color{blue}{\left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
      8. *-lowering-*.f64N/A

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{\color{blue}{ew \cdot \tan t}}\right)\right| \]
      9. tan-lowering-tan.f6492.7

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \color{blue}{\tan t}}\right)\right| \]
    7. Simplified92.7%

      \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
    8. Taylor expanded in t around 0

      \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \color{blue}{\left(\frac{eh}{ew \cdot t}\right)}\right| \]
    9. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \color{blue}{\left(\frac{eh}{ew \cdot t}\right)}\right| \]
      2. *-commutativeN/A

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{\color{blue}{t \cdot ew}}\right)\right| \]
      3. *-lowering-*.f6485.8

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{\color{blue}{t \cdot ew}}\right)\right| \]
    10. Simplified85.8%

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

    if -2.8000000000000001e55 < eh < -1.5999999999999999e36 or -8.79999999999999934e-118 < eh < 3.6000000000000002e-150

    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. Add Preprocessing
    3. Step-by-step derivation
      1. cos-atanN/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{\frac{1}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      2. inv-powN/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}\right)}^{-1}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      3. pow1/2N/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot {\color{blue}{\left({\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\frac{1}{2}}\right)}}^{-1} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      4. pow-powN/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\left(\frac{1}{2} \cdot -1\right)}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      5. pow-lowering-pow.f64N/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\left(\frac{1}{2} \cdot -1\right)}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    4. Applied egg-rr99.8%

      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + {\left(ew \cdot \frac{\tan t}{eh}\right)}^{-2}\right)}^{-0.5}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    5. Taylor expanded in ew around inf

      \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]
    6. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]
      2. sin-lowering-sin.f6478.3

        \[\leadsto \left|ew \cdot \color{blue}{\sin t}\right| \]
    7. Simplified78.3%

      \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]

    if -1.5999999999999999e36 < eh < -8.79999999999999934e-118 or 3.6000000000000002e-150 < eh < 1.71999999999999995e227

    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. Add Preprocessing
    3. Step-by-step derivation
      1. cos-atanN/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{\frac{1}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      2. inv-powN/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}\right)}^{-1}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      3. pow1/2N/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot {\color{blue}{\left({\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\frac{1}{2}}\right)}}^{-1} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      4. pow-powN/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\left(\frac{1}{2} \cdot -1\right)}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      5. pow-lowering-pow.f64N/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\left(\frac{1}{2} \cdot -1\right)}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    4. Applied egg-rr99.8%

      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + {\left(ew \cdot \frac{\tan t}{eh}\right)}^{-2}\right)}^{-0.5}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    5. Taylor expanded in ew around 0

      \[\leadsto \left|\color{blue}{eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right)}\right| \]
    6. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
      2. *-lowering-*.f64N/A

        \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
      3. *-lowering-*.f64N/A

        \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right)} \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right| \]
      4. cos-lowering-cos.f64N/A

        \[\leadsto \left|\left(eh \cdot \color{blue}{\cos t}\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right| \]
      5. sin-lowering-sin.f64N/A

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \color{blue}{\sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
      6. atan-lowering-atan.f64N/A

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \color{blue}{\tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
      7. /-lowering-/.f64N/A

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \color{blue}{\left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
      8. *-lowering-*.f64N/A

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{\color{blue}{ew \cdot \tan t}}\right)\right| \]
      9. tan-lowering-tan.f6475.0

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \color{blue}{\tan t}}\right)\right| \]
    7. Simplified75.0%

      \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
    8. Taylor expanded in t around 0

      \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \color{blue}{\left(\frac{\frac{-1}{3} \cdot \frac{eh \cdot {t}^{2}}{ew} + \frac{eh}{ew}}{t}\right)}\right| \]
    9. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \color{blue}{\left(\frac{\frac{-1}{3} \cdot \frac{eh \cdot {t}^{2}}{ew} + \frac{eh}{ew}}{t}\right)}\right| \]
      2. +-lowering-+.f64N/A

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\color{blue}{\frac{-1}{3} \cdot \frac{eh \cdot {t}^{2}}{ew} + \frac{eh}{ew}}}{t}\right)\right| \]
      3. associate-*r/N/A

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\color{blue}{\frac{\frac{-1}{3} \cdot \left(eh \cdot {t}^{2}\right)}{ew}} + \frac{eh}{ew}}{t}\right)\right| \]
      4. /-lowering-/.f64N/A

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\color{blue}{\frac{\frac{-1}{3} \cdot \left(eh \cdot {t}^{2}\right)}{ew}} + \frac{eh}{ew}}{t}\right)\right| \]
      5. *-lowering-*.f64N/A

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{\color{blue}{\frac{-1}{3} \cdot \left(eh \cdot {t}^{2}\right)}}{ew} + \frac{eh}{ew}}{t}\right)\right| \]
      6. *-lowering-*.f64N/A

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{\frac{-1}{3} \cdot \color{blue}{\left(eh \cdot {t}^{2}\right)}}{ew} + \frac{eh}{ew}}{t}\right)\right| \]
      7. unpow2N/A

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{\frac{-1}{3} \cdot \left(eh \cdot \color{blue}{\left(t \cdot t\right)}\right)}{ew} + \frac{eh}{ew}}{t}\right)\right| \]
      8. *-lowering-*.f64N/A

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{\frac{-1}{3} \cdot \left(eh \cdot \color{blue}{\left(t \cdot t\right)}\right)}{ew} + \frac{eh}{ew}}{t}\right)\right| \]
      9. /-lowering-/.f6471.8

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{-0.3333333333333333 \cdot \left(eh \cdot \left(t \cdot t\right)\right)}{ew} + \color{blue}{\frac{eh}{ew}}}{t}\right)\right| \]
    10. Simplified71.8%

      \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \color{blue}{\left(\frac{\frac{-0.3333333333333333 \cdot \left(eh \cdot \left(t \cdot t\right)\right)}{ew} + \frac{eh}{ew}}{t}\right)}\right| \]
  3. Recombined 3 regimes into one program.
  4. Final simplification77.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;eh \leq -2.8 \cdot 10^{+55}:\\ \;\;\;\;\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right|\\ \mathbf{elif}\;eh \leq -1.6 \cdot 10^{+36}:\\ \;\;\;\;\left|ew \cdot \sin t\right|\\ \mathbf{elif}\;eh \leq -8.8 \cdot 10^{-118}:\\ \;\;\;\;\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew} + \frac{-0.3333333333333333 \cdot \left(eh \cdot \left(t \cdot t\right)\right)}{ew}}{t}\right)\right|\\ \mathbf{elif}\;eh \leq 3.6 \cdot 10^{-150}:\\ \;\;\;\;\left|ew \cdot \sin t\right|\\ \mathbf{elif}\;eh \leq 1.72 \cdot 10^{+227}:\\ \;\;\;\;\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew} + \frac{-0.3333333333333333 \cdot \left(eh \cdot \left(t \cdot t\right)\right)}{ew}}{t}\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right|\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 73.8% accurate, 2.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left|ew \cdot \sin t\right|\\ \mathbf{if}\;t \leq -3 \cdot 10^{+134}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq -0.000112:\\ \;\;\;\;\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right|\\ \mathbf{elif}\;t \leq 40000:\\ \;\;\;\;\left|ew \cdot t + eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right|\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (fabs (* ew (sin t)))))
   (if (<= t -3e+134)
     t_1
     (if (<= t -0.000112)
       (fabs (* (* eh (cos t)) (sin (atan (/ eh (* ew t))))))
       (if (<= t 40000.0)
         (fabs (+ (* ew t) (* eh (sin (atan (/ eh (* ew (tan t))))))))
         t_1)))))
double code(double eh, double ew, double t) {
	double t_1 = fabs((ew * sin(t)));
	double tmp;
	if (t <= -3e+134) {
		tmp = t_1;
	} else if (t <= -0.000112) {
		tmp = fabs(((eh * cos(t)) * sin(atan((eh / (ew * t))))));
	} else if (t <= 40000.0) {
		tmp = fabs(((ew * t) + (eh * sin(atan((eh / (ew * tan(t))))))));
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(eh, ew, t)
    real(8), intent (in) :: eh
    real(8), intent (in) :: ew
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = abs((ew * sin(t)))
    if (t <= (-3d+134)) then
        tmp = t_1
    else if (t <= (-0.000112d0)) then
        tmp = abs(((eh * cos(t)) * sin(atan((eh / (ew * t))))))
    else if (t <= 40000.0d0) then
        tmp = abs(((ew * t) + (eh * sin(atan((eh / (ew * tan(t))))))))
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double eh, double ew, double t) {
	double t_1 = Math.abs((ew * Math.sin(t)));
	double tmp;
	if (t <= -3e+134) {
		tmp = t_1;
	} else if (t <= -0.000112) {
		tmp = Math.abs(((eh * Math.cos(t)) * Math.sin(Math.atan((eh / (ew * t))))));
	} else if (t <= 40000.0) {
		tmp = Math.abs(((ew * t) + (eh * Math.sin(Math.atan((eh / (ew * Math.tan(t))))))));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(eh, ew, t):
	t_1 = math.fabs((ew * math.sin(t)))
	tmp = 0
	if t <= -3e+134:
		tmp = t_1
	elif t <= -0.000112:
		tmp = math.fabs(((eh * math.cos(t)) * math.sin(math.atan((eh / (ew * t))))))
	elif t <= 40000.0:
		tmp = math.fabs(((ew * t) + (eh * math.sin(math.atan((eh / (ew * math.tan(t))))))))
	else:
		tmp = t_1
	return tmp
function code(eh, ew, t)
	t_1 = abs(Float64(ew * sin(t)))
	tmp = 0.0
	if (t <= -3e+134)
		tmp = t_1;
	elseif (t <= -0.000112)
		tmp = abs(Float64(Float64(eh * cos(t)) * sin(atan(Float64(eh / Float64(ew * t))))));
	elseif (t <= 40000.0)
		tmp = abs(Float64(Float64(ew * t) + Float64(eh * sin(atan(Float64(eh / Float64(ew * tan(t))))))));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(eh, ew, t)
	t_1 = abs((ew * sin(t)));
	tmp = 0.0;
	if (t <= -3e+134)
		tmp = t_1;
	elseif (t <= -0.000112)
		tmp = abs(((eh * cos(t)) * sin(atan((eh / (ew * t))))));
	elseif (t <= 40000.0)
		tmp = abs(((ew * t) + (eh * sin(atan((eh / (ew * tan(t))))))));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, -3e+134], t$95$1, If[LessEqual[t, -0.000112], N[Abs[N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[t, 40000.0], N[Abs[N[(N[(ew * t), $MachinePrecision] + N[(eh * N[Sin[N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left|ew \cdot \sin t\right|\\
\mathbf{if}\;t \leq -3 \cdot 10^{+134}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t \leq -0.000112:\\
\;\;\;\;\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right|\\

\mathbf{elif}\;t \leq 40000:\\
\;\;\;\;\left|ew \cdot t + eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right|\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -2.99999999999999997e134 or 4e4 < t

    1. Initial program 99.7%

      \[\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. Add Preprocessing
    3. Step-by-step derivation
      1. cos-atanN/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{\frac{1}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      2. inv-powN/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}\right)}^{-1}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      3. pow1/2N/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot {\color{blue}{\left({\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\frac{1}{2}}\right)}}^{-1} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      4. pow-powN/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\left(\frac{1}{2} \cdot -1\right)}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      5. pow-lowering-pow.f64N/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\left(\frac{1}{2} \cdot -1\right)}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    4. Applied egg-rr99.7%

      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + {\left(ew \cdot \frac{\tan t}{eh}\right)}^{-2}\right)}^{-0.5}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    5. Taylor expanded in ew around inf

      \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]
    6. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]
      2. sin-lowering-sin.f6446.4

        \[\leadsto \left|ew \cdot \color{blue}{\sin t}\right| \]
    7. Simplified46.4%

      \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]

    if -2.99999999999999997e134 < t < -1.11999999999999998e-4

    1. Initial program 99.7%

      \[\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. Add Preprocessing
    3. Step-by-step derivation
      1. cos-atanN/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{\frac{1}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      2. inv-powN/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}\right)}^{-1}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      3. pow1/2N/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot {\color{blue}{\left({\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\frac{1}{2}}\right)}}^{-1} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      4. pow-powN/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\left(\frac{1}{2} \cdot -1\right)}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      5. pow-lowering-pow.f64N/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\left(\frac{1}{2} \cdot -1\right)}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    4. Applied egg-rr99.7%

      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + {\left(ew \cdot \frac{\tan t}{eh}\right)}^{-2}\right)}^{-0.5}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    5. Taylor expanded in ew around 0

      \[\leadsto \left|\color{blue}{eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right)}\right| \]
    6. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
      2. *-lowering-*.f64N/A

        \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
      3. *-lowering-*.f64N/A

        \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right)} \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right| \]
      4. cos-lowering-cos.f64N/A

        \[\leadsto \left|\left(eh \cdot \color{blue}{\cos t}\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right| \]
      5. sin-lowering-sin.f64N/A

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \color{blue}{\sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
      6. atan-lowering-atan.f64N/A

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \color{blue}{\tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
      7. /-lowering-/.f64N/A

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \color{blue}{\left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
      8. *-lowering-*.f64N/A

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{\color{blue}{ew \cdot \tan t}}\right)\right| \]
      9. tan-lowering-tan.f6463.7

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \color{blue}{\tan t}}\right)\right| \]
    7. Simplified63.7%

      \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
    8. Taylor expanded in t around 0

      \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \color{blue}{\left(\frac{eh}{ew \cdot t}\right)}\right| \]
    9. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \color{blue}{\left(\frac{eh}{ew \cdot t}\right)}\right| \]
      2. *-commutativeN/A

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{\color{blue}{t \cdot ew}}\right)\right| \]
      3. *-lowering-*.f6456.6

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{\color{blue}{t \cdot ew}}\right)\right| \]
    10. Simplified56.6%

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

    if -1.11999999999999998e-4 < t < 4e4

    1. Initial program 100.0%

      \[\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. Add Preprocessing
    3. Step-by-step derivation
      1. cos-atanN/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{\frac{1}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      2. inv-powN/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}\right)}^{-1}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      3. pow1/2N/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot {\color{blue}{\left({\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\frac{1}{2}}\right)}}^{-1} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      4. pow-powN/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\left(\frac{1}{2} \cdot -1\right)}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      5. pow-lowering-pow.f64N/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\left(\frac{1}{2} \cdot -1\right)}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    4. Applied egg-rr100.0%

      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + {\left(ew \cdot \frac{\tan t}{eh}\right)}^{-2}\right)}^{-0.5}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    5. Taylor expanded in eh around 0

      \[\leadsto \left|\color{blue}{eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right) + ew \cdot \sin t}\right| \]
    6. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \left|\color{blue}{eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right) + ew \cdot \sin t}\right| \]
      2. associate-*r*N/A

        \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)} + ew \cdot \sin t\right| \]
      3. *-lowering-*.f64N/A

        \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)} + ew \cdot \sin t\right| \]
      4. *-lowering-*.f64N/A

        \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right)} \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right) + ew \cdot \sin t\right| \]
      5. cos-lowering-cos.f64N/A

        \[\leadsto \left|\left(eh \cdot \color{blue}{\cos t}\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right) + ew \cdot \sin t\right| \]
      6. sin-lowering-sin.f64N/A

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \color{blue}{\sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)} + ew \cdot \sin t\right| \]
      7. atan-lowering-atan.f64N/A

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \color{blue}{\tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)} + ew \cdot \sin t\right| \]
      8. /-lowering-/.f64N/A

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \color{blue}{\left(\frac{eh}{ew \cdot \tan t}\right)} + ew \cdot \sin t\right| \]
      9. *-lowering-*.f64N/A

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{\color{blue}{ew \cdot \tan t}}\right) + ew \cdot \sin t\right| \]
      10. tan-lowering-tan.f64N/A

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \color{blue}{\tan t}}\right) + ew \cdot \sin t\right| \]
      11. *-lowering-*.f64N/A

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right) + \color{blue}{ew \cdot \sin t}\right| \]
      12. sin-lowering-sin.f6499.4

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right) + ew \cdot \color{blue}{\sin t}\right| \]
    7. Simplified99.4%

      \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right) + ew \cdot \sin t}\right| \]
    8. Taylor expanded in t around 0

      \[\leadsto \left|\color{blue}{eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right) + ew \cdot t}\right| \]
    9. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \left|\color{blue}{eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right) + ew \cdot t}\right| \]
      2. *-lowering-*.f64N/A

        \[\leadsto \left|\color{blue}{eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)} + ew \cdot t\right| \]
      3. sin-lowering-sin.f64N/A

        \[\leadsto \left|eh \cdot \color{blue}{\sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)} + ew \cdot t\right| \]
      4. atan-lowering-atan.f64N/A

        \[\leadsto \left|eh \cdot \sin \color{blue}{\tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)} + ew \cdot t\right| \]
      5. /-lowering-/.f64N/A

        \[\leadsto \left|eh \cdot \sin \tan^{-1} \color{blue}{\left(\frac{eh}{ew \cdot \tan t}\right)} + ew \cdot t\right| \]
      6. *-lowering-*.f64N/A

        \[\leadsto \left|eh \cdot \sin \tan^{-1} \left(\frac{eh}{\color{blue}{ew \cdot \tan t}}\right) + ew \cdot t\right| \]
      7. tan-lowering-tan.f64N/A

        \[\leadsto \left|eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \color{blue}{\tan t}}\right) + ew \cdot t\right| \]
      8. *-commutativeN/A

        \[\leadsto \left|eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right) + \color{blue}{t \cdot ew}\right| \]
      9. *-lowering-*.f6498.7

        \[\leadsto \left|eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right) + \color{blue}{t \cdot ew}\right| \]
    10. Simplified98.7%

      \[\leadsto \left|\color{blue}{eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right) + t \cdot ew}\right| \]
  3. Recombined 3 regimes into one program.
  4. Final simplification71.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -3 \cdot 10^{+134}:\\ \;\;\;\;\left|ew \cdot \sin t\right|\\ \mathbf{elif}\;t \leq -0.000112:\\ \;\;\;\;\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right|\\ \mathbf{elif}\;t \leq 40000:\\ \;\;\;\;\left|ew \cdot t + eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|ew \cdot \sin t\right|\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 66.4% accurate, 2.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right|\\ \mathbf{if}\;eh \leq -3 \cdot 10^{+55}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;eh \leq 4 \cdot 10^{-52}:\\ \;\;\;\;\left|ew \cdot \sin t\right|\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (fabs (* (* eh (cos t)) (sin (atan (/ eh (* ew t))))))))
   (if (<= eh -3e+55) t_1 (if (<= eh 4e-52) (fabs (* ew (sin t))) t_1))))
double code(double eh, double ew, double t) {
	double t_1 = fabs(((eh * cos(t)) * sin(atan((eh / (ew * t))))));
	double tmp;
	if (eh <= -3e+55) {
		tmp = t_1;
	} else if (eh <= 4e-52) {
		tmp = fabs((ew * sin(t)));
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(eh, ew, t)
    real(8), intent (in) :: eh
    real(8), intent (in) :: ew
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = abs(((eh * cos(t)) * sin(atan((eh / (ew * t))))))
    if (eh <= (-3d+55)) then
        tmp = t_1
    else if (eh <= 4d-52) then
        tmp = abs((ew * sin(t)))
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double eh, double ew, double t) {
	double t_1 = Math.abs(((eh * Math.cos(t)) * Math.sin(Math.atan((eh / (ew * t))))));
	double tmp;
	if (eh <= -3e+55) {
		tmp = t_1;
	} else if (eh <= 4e-52) {
		tmp = Math.abs((ew * Math.sin(t)));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(eh, ew, t):
	t_1 = math.fabs(((eh * math.cos(t)) * math.sin(math.atan((eh / (ew * t))))))
	tmp = 0
	if eh <= -3e+55:
		tmp = t_1
	elif eh <= 4e-52:
		tmp = math.fabs((ew * math.sin(t)))
	else:
		tmp = t_1
	return tmp
function code(eh, ew, t)
	t_1 = abs(Float64(Float64(eh * cos(t)) * sin(atan(Float64(eh / Float64(ew * t))))))
	tmp = 0.0
	if (eh <= -3e+55)
		tmp = t_1;
	elseif (eh <= 4e-52)
		tmp = abs(Float64(ew * sin(t)));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(eh, ew, t)
	t_1 = abs(((eh * cos(t)) * sin(atan((eh / (ew * t))))));
	tmp = 0.0;
	if (eh <= -3e+55)
		tmp = t_1;
	elseif (eh <= 4e-52)
		tmp = abs((ew * sin(t)));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -3e+55], t$95$1, If[LessEqual[eh, 4e-52], N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right|\\
\mathbf{if}\;eh \leq -3 \cdot 10^{+55}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;eh \leq 4 \cdot 10^{-52}:\\
\;\;\;\;\left|ew \cdot \sin t\right|\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if eh < -3.00000000000000017e55 or 4e-52 < eh

    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. Add Preprocessing
    3. Step-by-step derivation
      1. cos-atanN/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{\frac{1}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      2. inv-powN/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}\right)}^{-1}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      3. pow1/2N/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot {\color{blue}{\left({\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\frac{1}{2}}\right)}}^{-1} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      4. pow-powN/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\left(\frac{1}{2} \cdot -1\right)}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      5. pow-lowering-pow.f64N/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\left(\frac{1}{2} \cdot -1\right)}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    4. Applied egg-rr99.8%

      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + {\left(ew \cdot \frac{\tan t}{eh}\right)}^{-2}\right)}^{-0.5}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    5. Taylor expanded in ew around 0

      \[\leadsto \left|\color{blue}{eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right)}\right| \]
    6. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
      2. *-lowering-*.f64N/A

        \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
      3. *-lowering-*.f64N/A

        \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right)} \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right| \]
      4. cos-lowering-cos.f64N/A

        \[\leadsto \left|\left(eh \cdot \color{blue}{\cos t}\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right| \]
      5. sin-lowering-sin.f64N/A

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \color{blue}{\sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
      6. atan-lowering-atan.f64N/A

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \color{blue}{\tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
      7. /-lowering-/.f64N/A

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \color{blue}{\left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
      8. *-lowering-*.f64N/A

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{\color{blue}{ew \cdot \tan t}}\right)\right| \]
      9. tan-lowering-tan.f6487.9

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \color{blue}{\tan t}}\right)\right| \]
    7. Simplified87.9%

      \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
    8. Taylor expanded in t around 0

      \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \color{blue}{\left(\frac{eh}{ew \cdot t}\right)}\right| \]
    9. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \color{blue}{\left(\frac{eh}{ew \cdot t}\right)}\right| \]
      2. *-commutativeN/A

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{\color{blue}{t \cdot ew}}\right)\right| \]
      3. *-lowering-*.f6475.1

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{\color{blue}{t \cdot ew}}\right)\right| \]
    10. Simplified75.1%

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

    if -3.00000000000000017e55 < eh < 4e-52

    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. Add Preprocessing
    3. Step-by-step derivation
      1. cos-atanN/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{\frac{1}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      2. inv-powN/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}\right)}^{-1}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      3. pow1/2N/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot {\color{blue}{\left({\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\frac{1}{2}}\right)}}^{-1} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      4. pow-powN/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\left(\frac{1}{2} \cdot -1\right)}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      5. pow-lowering-pow.f64N/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\left(\frac{1}{2} \cdot -1\right)}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    4. Applied egg-rr99.8%

      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + {\left(ew \cdot \frac{\tan t}{eh}\right)}^{-2}\right)}^{-0.5}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    5. Taylor expanded in ew around inf

      \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]
    6. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]
      2. sin-lowering-sin.f6463.8

        \[\leadsto \left|ew \cdot \color{blue}{\sin t}\right| \]
    7. Simplified63.8%

      \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]
  3. Recombined 2 regimes into one program.
  4. Final simplification69.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;eh \leq -3 \cdot 10^{+55}:\\ \;\;\;\;\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right|\\ \mathbf{elif}\;eh \leq 4 \cdot 10^{-52}:\\ \;\;\;\;\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)\right|\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 60.2% accurate, 2.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left|ew \cdot \sin t\right|\\ \mathbf{if}\;t \leq -3.2 \cdot 10^{-97}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq 1.55 \cdot 10^{-21}:\\ \;\;\;\;\left|eh \cdot \sin \tan^{-1} \left(\frac{eh}{t \cdot \left(ew + \left(ew \cdot \left(t \cdot t\right)\right) \cdot 0.3333333333333333\right)}\right)\right|\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (fabs (* ew (sin t)))))
   (if (<= t -3.2e-97)
     t_1
     (if (<= t 1.55e-21)
       (fabs
        (*
         eh
         (sin
          (atan (/ eh (* t (+ ew (* (* ew (* t t)) 0.3333333333333333))))))))
       t_1))))
double code(double eh, double ew, double t) {
	double t_1 = fabs((ew * sin(t)));
	double tmp;
	if (t <= -3.2e-97) {
		tmp = t_1;
	} else if (t <= 1.55e-21) {
		tmp = fabs((eh * sin(atan((eh / (t * (ew + ((ew * (t * t)) * 0.3333333333333333))))))));
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(eh, ew, t)
    real(8), intent (in) :: eh
    real(8), intent (in) :: ew
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = abs((ew * sin(t)))
    if (t <= (-3.2d-97)) then
        tmp = t_1
    else if (t <= 1.55d-21) then
        tmp = abs((eh * sin(atan((eh / (t * (ew + ((ew * (t * t)) * 0.3333333333333333d0))))))))
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double eh, double ew, double t) {
	double t_1 = Math.abs((ew * Math.sin(t)));
	double tmp;
	if (t <= -3.2e-97) {
		tmp = t_1;
	} else if (t <= 1.55e-21) {
		tmp = Math.abs((eh * Math.sin(Math.atan((eh / (t * (ew + ((ew * (t * t)) * 0.3333333333333333))))))));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(eh, ew, t):
	t_1 = math.fabs((ew * math.sin(t)))
	tmp = 0
	if t <= -3.2e-97:
		tmp = t_1
	elif t <= 1.55e-21:
		tmp = math.fabs((eh * math.sin(math.atan((eh / (t * (ew + ((ew * (t * t)) * 0.3333333333333333))))))))
	else:
		tmp = t_1
	return tmp
function code(eh, ew, t)
	t_1 = abs(Float64(ew * sin(t)))
	tmp = 0.0
	if (t <= -3.2e-97)
		tmp = t_1;
	elseif (t <= 1.55e-21)
		tmp = abs(Float64(eh * sin(atan(Float64(eh / Float64(t * Float64(ew + Float64(Float64(ew * Float64(t * t)) * 0.3333333333333333))))))));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(eh, ew, t)
	t_1 = abs((ew * sin(t)));
	tmp = 0.0;
	if (t <= -3.2e-97)
		tmp = t_1;
	elseif (t <= 1.55e-21)
		tmp = abs((eh * sin(atan((eh / (t * (ew + ((ew * (t * t)) * 0.3333333333333333))))))));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, -3.2e-97], t$95$1, If[LessEqual[t, 1.55e-21], N[Abs[N[(eh * N[Sin[N[ArcTan[N[(eh / N[(t * N[(ew + N[(N[(ew * N[(t * t), $MachinePrecision]), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left|ew \cdot \sin t\right|\\
\mathbf{if}\;t \leq -3.2 \cdot 10^{-97}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t \leq 1.55 \cdot 10^{-21}:\\
\;\;\;\;\left|eh \cdot \sin \tan^{-1} \left(\frac{eh}{t \cdot \left(ew + \left(ew \cdot \left(t \cdot t\right)\right) \cdot 0.3333333333333333\right)}\right)\right|\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -3.1999999999999998e-97 or 1.5499999999999999e-21 < t

    1. Initial program 99.7%

      \[\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. Add Preprocessing
    3. Step-by-step derivation
      1. cos-atanN/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{\frac{1}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      2. inv-powN/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}\right)}^{-1}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      3. pow1/2N/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot {\color{blue}{\left({\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\frac{1}{2}}\right)}}^{-1} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      4. pow-powN/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\left(\frac{1}{2} \cdot -1\right)}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      5. pow-lowering-pow.f64N/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\left(\frac{1}{2} \cdot -1\right)}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    4. Applied egg-rr99.7%

      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + {\left(ew \cdot \frac{\tan t}{eh}\right)}^{-2}\right)}^{-0.5}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    5. Taylor expanded in ew around inf

      \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]
    6. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]
      2. sin-lowering-sin.f6447.0

        \[\leadsto \left|ew \cdot \color{blue}{\sin t}\right| \]
    7. Simplified47.0%

      \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]

    if -3.1999999999999998e-97 < t < 1.5499999999999999e-21

    1. Initial program 100.0%

      \[\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. Add Preprocessing
    3. Taylor expanded in t around 0

      \[\leadsto \left|\color{blue}{eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \left|\color{blue}{eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
      2. sin-lowering-sin.f64N/A

        \[\leadsto \left|eh \cdot \color{blue}{\sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
      3. atan-lowering-atan.f64N/A

        \[\leadsto \left|eh \cdot \sin \color{blue}{\tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
      4. /-lowering-/.f64N/A

        \[\leadsto \left|eh \cdot \sin \tan^{-1} \color{blue}{\left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
      5. *-lowering-*.f64N/A

        \[\leadsto \left|eh \cdot \sin \tan^{-1} \left(\frac{eh}{\color{blue}{ew \cdot \tan t}}\right)\right| \]
      6. tan-lowering-tan.f6479.4

        \[\leadsto \left|eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \color{blue}{\tan t}}\right)\right| \]
    5. Simplified79.4%

      \[\leadsto \left|\color{blue}{eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
    6. Taylor expanded in t around 0

      \[\leadsto \left|eh \cdot \sin \tan^{-1} \left(\frac{eh}{\color{blue}{t \cdot \left(ew + \frac{1}{3} \cdot \left(ew \cdot {t}^{2}\right)\right)}}\right)\right| \]
    7. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \left|eh \cdot \sin \tan^{-1} \left(\frac{eh}{\color{blue}{t \cdot \left(ew + \frac{1}{3} \cdot \left(ew \cdot {t}^{2}\right)\right)}}\right)\right| \]
      2. +-lowering-+.f64N/A

        \[\leadsto \left|eh \cdot \sin \tan^{-1} \left(\frac{eh}{t \cdot \color{blue}{\left(ew + \frac{1}{3} \cdot \left(ew \cdot {t}^{2}\right)\right)}}\right)\right| \]
      3. *-commutativeN/A

        \[\leadsto \left|eh \cdot \sin \tan^{-1} \left(\frac{eh}{t \cdot \left(ew + \color{blue}{\left(ew \cdot {t}^{2}\right) \cdot \frac{1}{3}}\right)}\right)\right| \]
      4. *-lowering-*.f64N/A

        \[\leadsto \left|eh \cdot \sin \tan^{-1} \left(\frac{eh}{t \cdot \left(ew + \color{blue}{\left(ew \cdot {t}^{2}\right) \cdot \frac{1}{3}}\right)}\right)\right| \]
      5. *-lowering-*.f64N/A

        \[\leadsto \left|eh \cdot \sin \tan^{-1} \left(\frac{eh}{t \cdot \left(ew + \color{blue}{\left(ew \cdot {t}^{2}\right)} \cdot \frac{1}{3}\right)}\right)\right| \]
      6. unpow2N/A

        \[\leadsto \left|eh \cdot \sin \tan^{-1} \left(\frac{eh}{t \cdot \left(ew + \left(ew \cdot \color{blue}{\left(t \cdot t\right)}\right) \cdot \frac{1}{3}\right)}\right)\right| \]
      7. *-lowering-*.f6479.4

        \[\leadsto \left|eh \cdot \sin \tan^{-1} \left(\frac{eh}{t \cdot \left(ew + \left(ew \cdot \color{blue}{\left(t \cdot t\right)}\right) \cdot 0.3333333333333333\right)}\right)\right| \]
    8. Simplified79.4%

      \[\leadsto \left|eh \cdot \sin \tan^{-1} \left(\frac{eh}{\color{blue}{t \cdot \left(ew + \left(ew \cdot \left(t \cdot t\right)\right) \cdot 0.3333333333333333\right)}}\right)\right| \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 10: 60.2% accurate, 2.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left|ew \cdot \sin t\right|\\ \mathbf{if}\;t \leq -3.4 \cdot 10^{-97}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq 2.8 \cdot 10^{-17}:\\ \;\;\;\;\left|eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right|\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (fabs (* ew (sin t)))))
   (if (<= t -3.4e-97)
     t_1
     (if (<= t 2.8e-17) (fabs (* eh (sin (atan (/ eh (* ew t)))))) t_1))))
double code(double eh, double ew, double t) {
	double t_1 = fabs((ew * sin(t)));
	double tmp;
	if (t <= -3.4e-97) {
		tmp = t_1;
	} else if (t <= 2.8e-17) {
		tmp = fabs((eh * sin(atan((eh / (ew * t))))));
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(eh, ew, t)
    real(8), intent (in) :: eh
    real(8), intent (in) :: ew
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = abs((ew * sin(t)))
    if (t <= (-3.4d-97)) then
        tmp = t_1
    else if (t <= 2.8d-17) then
        tmp = abs((eh * sin(atan((eh / (ew * t))))))
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double eh, double ew, double t) {
	double t_1 = Math.abs((ew * Math.sin(t)));
	double tmp;
	if (t <= -3.4e-97) {
		tmp = t_1;
	} else if (t <= 2.8e-17) {
		tmp = Math.abs((eh * Math.sin(Math.atan((eh / (ew * t))))));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(eh, ew, t):
	t_1 = math.fabs((ew * math.sin(t)))
	tmp = 0
	if t <= -3.4e-97:
		tmp = t_1
	elif t <= 2.8e-17:
		tmp = math.fabs((eh * math.sin(math.atan((eh / (ew * t))))))
	else:
		tmp = t_1
	return tmp
function code(eh, ew, t)
	t_1 = abs(Float64(ew * sin(t)))
	tmp = 0.0
	if (t <= -3.4e-97)
		tmp = t_1;
	elseif (t <= 2.8e-17)
		tmp = abs(Float64(eh * sin(atan(Float64(eh / Float64(ew * t))))));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(eh, ew, t)
	t_1 = abs((ew * sin(t)));
	tmp = 0.0;
	if (t <= -3.4e-97)
		tmp = t_1;
	elseif (t <= 2.8e-17)
		tmp = abs((eh * sin(atan((eh / (ew * t))))));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, -3.4e-97], t$95$1, If[LessEqual[t, 2.8e-17], N[Abs[N[(eh * N[Sin[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left|ew \cdot \sin t\right|\\
\mathbf{if}\;t \leq -3.4 \cdot 10^{-97}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t \leq 2.8 \cdot 10^{-17}:\\
\;\;\;\;\left|eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right|\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -3.3999999999999999e-97 or 2.7999999999999999e-17 < t

    1. Initial program 99.7%

      \[\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. Add Preprocessing
    3. Step-by-step derivation
      1. cos-atanN/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{\frac{1}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      2. inv-powN/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}\right)}^{-1}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      3. pow1/2N/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot {\color{blue}{\left({\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\frac{1}{2}}\right)}}^{-1} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      4. pow-powN/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\left(\frac{1}{2} \cdot -1\right)}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      5. pow-lowering-pow.f64N/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\left(\frac{1}{2} \cdot -1\right)}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    4. Applied egg-rr99.7%

      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + {\left(ew \cdot \frac{\tan t}{eh}\right)}^{-2}\right)}^{-0.5}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    5. Taylor expanded in ew around inf

      \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]
    6. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]
      2. sin-lowering-sin.f6447.0

        \[\leadsto \left|ew \cdot \color{blue}{\sin t}\right| \]
    7. Simplified47.0%

      \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]

    if -3.3999999999999999e-97 < t < 2.7999999999999999e-17

    1. Initial program 100.0%

      \[\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. Add Preprocessing
    3. Taylor expanded in t around 0

      \[\leadsto \left|\color{blue}{eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \left|\color{blue}{eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
      2. sin-lowering-sin.f64N/A

        \[\leadsto \left|eh \cdot \color{blue}{\sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
      3. atan-lowering-atan.f64N/A

        \[\leadsto \left|eh \cdot \sin \color{blue}{\tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
      4. /-lowering-/.f64N/A

        \[\leadsto \left|eh \cdot \sin \tan^{-1} \color{blue}{\left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
      5. *-lowering-*.f64N/A

        \[\leadsto \left|eh \cdot \sin \tan^{-1} \left(\frac{eh}{\color{blue}{ew \cdot \tan t}}\right)\right| \]
      6. tan-lowering-tan.f6479.4

        \[\leadsto \left|eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \color{blue}{\tan t}}\right)\right| \]
    5. Simplified79.4%

      \[\leadsto \left|\color{blue}{eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
    6. Taylor expanded in t around 0

      \[\leadsto \left|eh \cdot \sin \tan^{-1} \color{blue}{\left(\frac{eh}{ew \cdot t}\right)}\right| \]
    7. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \left|eh \cdot \sin \tan^{-1} \color{blue}{\left(\frac{eh}{ew \cdot t}\right)}\right| \]
      2. *-commutativeN/A

        \[\leadsto \left|eh \cdot \sin \tan^{-1} \left(\frac{eh}{\color{blue}{t \cdot ew}}\right)\right| \]
      3. *-lowering-*.f6479.4

        \[\leadsto \left|eh \cdot \sin \tan^{-1} \left(\frac{eh}{\color{blue}{t \cdot ew}}\right)\right| \]
    8. Simplified79.4%

      \[\leadsto \left|eh \cdot \sin \tan^{-1} \color{blue}{\left(\frac{eh}{t \cdot ew}\right)}\right| \]
  3. Recombined 2 regimes into one program.
  4. Final simplification59.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -3.4 \cdot 10^{-97}:\\ \;\;\;\;\left|ew \cdot \sin t\right|\\ \mathbf{elif}\;t \leq 2.8 \cdot 10^{-17}:\\ \;\;\;\;\left|eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|ew \cdot \sin t\right|\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 41.9% accurate, 4.5× speedup?

\[\begin{array}{l} \\ \left|ew \cdot \sin t\right| \end{array} \]
(FPCore (eh ew t) :precision binary64 (fabs (* ew (sin t))))
double code(double eh, double ew, double t) {
	return fabs((ew * sin(t)));
}
real(8) function code(eh, ew, t)
    real(8), intent (in) :: eh
    real(8), intent (in) :: ew
    real(8), intent (in) :: t
    code = abs((ew * sin(t)))
end function
public static double code(double eh, double ew, double t) {
	return Math.abs((ew * Math.sin(t)));
}
def code(eh, ew, t):
	return math.fabs((ew * math.sin(t)))
function code(eh, ew, t)
	return abs(Float64(ew * sin(t)))
end
function tmp = code(eh, ew, t)
	tmp = abs((ew * sin(t)));
end
code[eh_, ew_, t_] := N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\left|ew \cdot \sin t\right|
\end{array}
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. Add Preprocessing
  3. Step-by-step derivation
    1. cos-atanN/A

      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{\frac{1}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    2. inv-powN/A

      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}\right)}^{-1}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    3. pow1/2N/A

      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot {\color{blue}{\left({\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\frac{1}{2}}\right)}}^{-1} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    4. pow-powN/A

      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\left(\frac{1}{2} \cdot -1\right)}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    5. pow-lowering-pow.f64N/A

      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\left(\frac{1}{2} \cdot -1\right)}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
  4. Applied egg-rr99.8%

    \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + {\left(ew \cdot \frac{\tan t}{eh}\right)}^{-2}\right)}^{-0.5}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
  5. Taylor expanded in ew around inf

    \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]
  6. Step-by-step derivation
    1. *-lowering-*.f64N/A

      \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]
    2. sin-lowering-sin.f6438.6

      \[\leadsto \left|ew \cdot \color{blue}{\sin t}\right| \]
  7. Simplified38.6%

    \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]
  8. Add Preprocessing

Alternative 12: 18.9% accurate, 8.9× speedup?

\[\begin{array}{l} \\ \left|ew \cdot t\right| \end{array} \]
(FPCore (eh ew t) :precision binary64 (fabs (* ew t)))
double code(double eh, double ew, double t) {
	return fabs((ew * t));
}
real(8) function code(eh, ew, t)
    real(8), intent (in) :: eh
    real(8), intent (in) :: ew
    real(8), intent (in) :: t
    code = abs((ew * t))
end function
public static double code(double eh, double ew, double t) {
	return Math.abs((ew * t));
}
def code(eh, ew, t):
	return math.fabs((ew * t))
function code(eh, ew, t)
	return abs(Float64(ew * t))
end
function tmp = code(eh, ew, t)
	tmp = abs((ew * t));
end
code[eh_, ew_, t_] := N[Abs[N[(ew * t), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\left|ew \cdot t\right|
\end{array}
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. Add Preprocessing
  3. Step-by-step derivation
    1. cos-atanN/A

      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{\frac{1}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    2. inv-powN/A

      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}\right)}^{-1}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    3. pow1/2N/A

      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot {\color{blue}{\left({\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\frac{1}{2}}\right)}}^{-1} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    4. pow-powN/A

      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\left(\frac{1}{2} \cdot -1\right)}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    5. pow-lowering-pow.f64N/A

      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}\right)}^{\left(\frac{1}{2} \cdot -1\right)}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
  4. Applied egg-rr99.8%

    \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{{\left(1 + {\left(ew \cdot \frac{\tan t}{eh}\right)}^{-2}\right)}^{-0.5}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
  5. Taylor expanded in ew around inf

    \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]
  6. Step-by-step derivation
    1. *-lowering-*.f64N/A

      \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]
    2. sin-lowering-sin.f6438.6

      \[\leadsto \left|ew \cdot \color{blue}{\sin t}\right| \]
  7. Simplified38.6%

    \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]
  8. Taylor expanded in t around 0

    \[\leadsto \left|\color{blue}{ew \cdot t}\right| \]
  9. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto \left|\color{blue}{t \cdot ew}\right| \]
    2. *-lowering-*.f6417.7

      \[\leadsto \left|\color{blue}{t \cdot ew}\right| \]
  10. Simplified17.7%

    \[\leadsto \left|\color{blue}{t \cdot ew}\right| \]
  11. Final simplification17.7%

    \[\leadsto \left|ew \cdot t\right| \]
  12. Add Preprocessing

Reproduce

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