
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (atan (/ (* (- eh) (tan t)) ew)))) (fabs (- (* (* ew (cos t)) (cos t_1)) (* (* eh (sin t)) (sin t_1))))))
double code(double eh, double ew, double t) {
double t_1 = atan(((-eh * tan(t)) / ew));
return fabs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1))));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(eh, ew, t)
use fmin_fmax_functions
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
real(8) :: t_1
t_1 = atan(((-eh * tan(t)) / ew))
code = abs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1))))
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.atan(((-eh * Math.tan(t)) / ew));
return Math.abs((((ew * Math.cos(t)) * Math.cos(t_1)) - ((eh * Math.sin(t)) * Math.sin(t_1))));
}
def code(eh, ew, t): t_1 = math.atan(((-eh * math.tan(t)) / ew)) return math.fabs((((ew * math.cos(t)) * math.cos(t_1)) - ((eh * math.sin(t)) * math.sin(t_1))))
function code(eh, ew, t) t_1 = atan(Float64(Float64(Float64(-eh) * tan(t)) / ew)) return abs(Float64(Float64(Float64(ew * cos(t)) * cos(t_1)) - Float64(Float64(eh * sin(t)) * sin(t_1)))) end
function tmp = code(eh, ew, t) t_1 = atan(((-eh * tan(t)) / ew)); tmp = abs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1)))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[((-eh) * N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\\
\left|\left(ew \cdot \cos t\right) \cdot \cos t\_1 - \left(eh \cdot \sin t\right) \cdot \sin t\_1\right|
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (atan (/ (* (- eh) (tan t)) ew)))) (fabs (- (* (* ew (cos t)) (cos t_1)) (* (* eh (sin t)) (sin t_1))))))
double code(double eh, double ew, double t) {
double t_1 = atan(((-eh * tan(t)) / ew));
return fabs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1))));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(eh, ew, t)
use fmin_fmax_functions
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
real(8) :: t_1
t_1 = atan(((-eh * tan(t)) / ew))
code = abs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1))))
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.atan(((-eh * Math.tan(t)) / ew));
return Math.abs((((ew * Math.cos(t)) * Math.cos(t_1)) - ((eh * Math.sin(t)) * Math.sin(t_1))));
}
def code(eh, ew, t): t_1 = math.atan(((-eh * math.tan(t)) / ew)) return math.fabs((((ew * math.cos(t)) * math.cos(t_1)) - ((eh * math.sin(t)) * math.sin(t_1))))
function code(eh, ew, t) t_1 = atan(Float64(Float64(Float64(-eh) * tan(t)) / ew)) return abs(Float64(Float64(Float64(ew * cos(t)) * cos(t_1)) - Float64(Float64(eh * sin(t)) * sin(t_1)))) end
function tmp = code(eh, ew, t) t_1 = atan(((-eh * tan(t)) / ew)); tmp = abs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1)))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[((-eh) * N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\\
\left|\left(ew \cdot \cos t\right) \cdot \cos t\_1 - \left(eh \cdot \sin t\right) \cdot \sin t\_1\right|
\end{array}
\end{array}
(FPCore (eh ew t) :precision binary64 (fabs (fma (* (sin t) (tanh (asinh (* (tan t) (/ (- eh) ew))))) eh (* (* (cos (atan (* (/ eh ew) (tan t)))) (- (cos t))) ew))))
double code(double eh, double ew, double t) {
return fabs(fma((sin(t) * tanh(asinh((tan(t) * (-eh / ew))))), eh, ((cos(atan(((eh / ew) * tan(t)))) * -cos(t)) * ew)));
}
function code(eh, ew, t) return abs(fma(Float64(sin(t) * tanh(asinh(Float64(tan(t) * Float64(Float64(-eh) / ew))))), eh, Float64(Float64(cos(atan(Float64(Float64(eh / ew) * tan(t)))) * Float64(-cos(t))) * ew))) end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[Sin[t], $MachinePrecision] * N[Tanh[N[ArcSinh[N[(N[Tan[t], $MachinePrecision] * N[((-eh) / ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * eh + N[(N[(N[Cos[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] * N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * (-N[Cos[t], $MachinePrecision])), $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\mathsf{fma}\left(\sin t \cdot \tanh \sinh^{-1} \left(\tan t \cdot \frac{-eh}{ew}\right), eh, \left(\cos \tan^{-1} \left(\frac{eh}{ew} \cdot \tan t\right) \cdot \left(-\cos t\right)\right) \cdot ew\right)\right|
\end{array}
Initial program 99.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.8%
Taylor expanded in eh around 0
fabs-subN/A
lower-fabs.f64N/A
associate-*r*N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
Applied rewrites99.8%
Applied rewrites99.8%
Final simplification99.8%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (atan (/ (* eh (tan t)) (- ew)))))
(if (<=
(- (* (* ew (cos t)) (cos t_1)) (* (* eh (sin t)) (sin t_1)))
-2e-296)
(fabs (/ ew 1.0))
(* (cos t) ew))))
double code(double eh, double ew, double t) {
double t_1 = atan(((eh * tan(t)) / -ew));
double tmp;
if ((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1))) <= -2e-296) {
tmp = fabs((ew / 1.0));
} else {
tmp = cos(t) * ew;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(eh, ew, t)
use fmin_fmax_functions
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = atan(((eh * tan(t)) / -ew))
if ((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1))) <= (-2d-296)) then
tmp = abs((ew / 1.0d0))
else
tmp = cos(t) * ew
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.atan(((eh * Math.tan(t)) / -ew));
double tmp;
if ((((ew * Math.cos(t)) * Math.cos(t_1)) - ((eh * Math.sin(t)) * Math.sin(t_1))) <= -2e-296) {
tmp = Math.abs((ew / 1.0));
} else {
tmp = Math.cos(t) * ew;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.atan(((eh * math.tan(t)) / -ew)) tmp = 0 if (((ew * math.cos(t)) * math.cos(t_1)) - ((eh * math.sin(t)) * math.sin(t_1))) <= -2e-296: tmp = math.fabs((ew / 1.0)) else: tmp = math.cos(t) * ew return tmp
function code(eh, ew, t) t_1 = atan(Float64(Float64(eh * tan(t)) / Float64(-ew))) tmp = 0.0 if (Float64(Float64(Float64(ew * cos(t)) * cos(t_1)) - Float64(Float64(eh * sin(t)) * sin(t_1))) <= -2e-296) tmp = abs(Float64(ew / 1.0)); else tmp = Float64(cos(t) * ew); end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = atan(((eh * tan(t)) / -ew)); tmp = 0.0; if ((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1))) <= -2e-296) tmp = abs((ew / 1.0)); else tmp = cos(t) * ew; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision] / (-ew)), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -2e-296], N[Abs[N[(ew / 1.0), $MachinePrecision]], $MachinePrecision], N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{eh \cdot \tan t}{-ew}\right)\\
\mathbf{if}\;\left(ew \cdot \cos t\right) \cdot \cos t\_1 - \left(eh \cdot \sin t\right) \cdot \sin t\_1 \leq -2 \cdot 10^{-296}:\\
\;\;\;\;\left|\frac{ew}{1}\right|\\
\mathbf{else}:\\
\;\;\;\;\cos t \cdot ew\\
\end{array}
\end{array}
if (-.f64 (*.f64 (*.f64 ew (cos.f64 t)) (cos.f64 (atan.f64 (/.f64 (*.f64 (neg.f64 eh) (tan.f64 t)) ew)))) (*.f64 (*.f64 eh (sin.f64 t)) (sin.f64 (atan.f64 (/.f64 (*.f64 (neg.f64 eh) (tan.f64 t)) ew))))) < -2e-296Initial program 99.8%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites41.1%
Applied rewrites40.8%
Taylor expanded in eh around 0
Applied rewrites41.3%
if -2e-296 < (-.f64 (*.f64 (*.f64 ew (cos.f64 t)) (cos.f64 (atan.f64 (/.f64 (*.f64 (neg.f64 eh) (tan.f64 t)) ew)))) (*.f64 (*.f64 eh (sin.f64 t)) (sin.f64 (atan.f64 (/.f64 (*.f64 (neg.f64 eh) (tan.f64 t)) ew))))) Initial program 99.7%
Applied rewrites68.8%
Taylor expanded in eh around 0
*-commutativeN/A
lower-*.f64N/A
lower-cos.f6461.7
Applied rewrites61.7%
Final simplification52.7%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* eh (/ (tan t) ew))))
(if (or (<= eh -1.1e-44) (not (<= eh 8.2e+60)))
(fabs
(fma
(* (sin t) (tanh (asinh (* (tan t) (/ (- eh) ew)))))
eh
(* (* (cos (atan (/ (* eh t) ew))) (- (cos t))) ew)))
(fabs (/ (+ (* (cos t) ew) (* t_1 (* (sin t) eh))) (cosh (asinh t_1)))))))
double code(double eh, double ew, double t) {
double t_1 = eh * (tan(t) / ew);
double tmp;
if ((eh <= -1.1e-44) || !(eh <= 8.2e+60)) {
tmp = fabs(fma((sin(t) * tanh(asinh((tan(t) * (-eh / ew))))), eh, ((cos(atan(((eh * t) / ew))) * -cos(t)) * ew)));
} else {
tmp = fabs((((cos(t) * ew) + (t_1 * (sin(t) * eh))) / cosh(asinh(t_1))));
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(eh * Float64(tan(t) / ew)) tmp = 0.0 if ((eh <= -1.1e-44) || !(eh <= 8.2e+60)) tmp = abs(fma(Float64(sin(t) * tanh(asinh(Float64(tan(t) * Float64(Float64(-eh) / ew))))), eh, Float64(Float64(cos(atan(Float64(Float64(eh * t) / ew))) * Float64(-cos(t))) * ew))); else tmp = abs(Float64(Float64(Float64(cos(t) * ew) + Float64(t_1 * Float64(sin(t) * eh))) / cosh(asinh(t_1)))); end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh * N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[eh, -1.1e-44], N[Not[LessEqual[eh, 8.2e+60]], $MachinePrecision]], N[Abs[N[(N[(N[Sin[t], $MachinePrecision] * N[Tanh[N[ArcSinh[N[(N[Tan[t], $MachinePrecision] * N[((-eh) / ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * eh + N[(N[(N[Cos[N[ArcTan[N[(N[(eh * t), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * (-N[Cos[t], $MachinePrecision])), $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision] + N[(t$95$1 * N[(N[Sin[t], $MachinePrecision] * eh), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Cosh[N[ArcSinh[t$95$1], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := eh \cdot \frac{\tan t}{ew}\\
\mathbf{if}\;eh \leq -1.1 \cdot 10^{-44} \lor \neg \left(eh \leq 8.2 \cdot 10^{+60}\right):\\
\;\;\;\;\left|\mathsf{fma}\left(\sin t \cdot \tanh \sinh^{-1} \left(\tan t \cdot \frac{-eh}{ew}\right), eh, \left(\cos \tan^{-1} \left(\frac{eh \cdot t}{ew}\right) \cdot \left(-\cos t\right)\right) \cdot ew\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\cos t \cdot ew + t\_1 \cdot \left(\sin t \cdot eh\right)}{\cosh \sinh^{-1} t\_1}\right|\\
\end{array}
\end{array}
if eh < -1.10000000000000006e-44 or 8.2e60 < eh Initial program 99.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.8%
Taylor expanded in eh around 0
fabs-subN/A
lower-fabs.f64N/A
associate-*r*N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
Applied rewrites99.8%
Applied rewrites99.8%
Taylor expanded in t around 0
Applied rewrites96.6%
if -1.10000000000000006e-44 < eh < 8.2e60Initial program 99.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.8%
Applied rewrites98.2%
Final simplification97.5%
(FPCore (eh ew t) :precision binary64 (fabs (- (* (* eh (sin t)) (sin (atan (* (/ (- t) ew) eh)))) (* (* ew (cos t)) (cos (atan (/ (* eh (tan t)) (- ew))))))))
double code(double eh, double ew, double t) {
return fabs((((eh * sin(t)) * sin(atan(((-t / ew) * eh)))) - ((ew * cos(t)) * cos(atan(((eh * tan(t)) / -ew))))));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(eh, ew, t)
use fmin_fmax_functions
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
code = abs((((eh * sin(t)) * sin(atan(((-t / ew) * eh)))) - ((ew * cos(t)) * cos(atan(((eh * tan(t)) / -ew))))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((((eh * Math.sin(t)) * Math.sin(Math.atan(((-t / ew) * eh)))) - ((ew * Math.cos(t)) * Math.cos(Math.atan(((eh * Math.tan(t)) / -ew))))));
}
def code(eh, ew, t): return math.fabs((((eh * math.sin(t)) * math.sin(math.atan(((-t / ew) * eh)))) - ((ew * math.cos(t)) * math.cos(math.atan(((eh * math.tan(t)) / -ew))))))
function code(eh, ew, t) return abs(Float64(Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(Float64(-t) / ew) * eh)))) - Float64(Float64(ew * cos(t)) * cos(atan(Float64(Float64(eh * tan(t)) / Float64(-ew))))))) end
function tmp = code(eh, ew, t) tmp = abs((((eh * sin(t)) * sin(atan(((-t / ew) * eh)))) - ((ew * cos(t)) * cos(atan(((eh * tan(t)) / -ew)))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[((-t) / ew), $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Cos[N[ArcTan[N[(N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision] / (-ew)), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{-t}{ew} \cdot eh\right) - \left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{eh \cdot \tan t}{-ew}\right)\right|
\end{array}
Initial program 99.8%
Taylor expanded in t around 0
mul-1-negN/A
distribute-neg-fracN/A
*-commutativeN/A
distribute-lft-neg-inN/A
associate-/l*N/A
distribute-lft-neg-inN/A
associate-/l*N/A
associate-*l/N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
lower-neg.f6498.6
Applied rewrites98.6%
Final simplification98.6%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* (cos t) ew)) (t_2 (* eh (/ (tan t) ew))) (t_3 (* (sin t) eh)))
(if (or (<= eh -2.6e+171) (not (<= eh 3.2e+108)))
(fabs (* t_3 (sin (atan (/ (* (sin t) (- eh)) t_1)))))
(fabs (/ (+ t_1 (* t_2 t_3)) (cosh (asinh t_2)))))))
double code(double eh, double ew, double t) {
double t_1 = cos(t) * ew;
double t_2 = eh * (tan(t) / ew);
double t_3 = sin(t) * eh;
double tmp;
if ((eh <= -2.6e+171) || !(eh <= 3.2e+108)) {
tmp = fabs((t_3 * sin(atan(((sin(t) * -eh) / t_1)))));
} else {
tmp = fabs(((t_1 + (t_2 * t_3)) / cosh(asinh(t_2))));
}
return tmp;
}
def code(eh, ew, t): t_1 = math.cos(t) * ew t_2 = eh * (math.tan(t) / ew) t_3 = math.sin(t) * eh tmp = 0 if (eh <= -2.6e+171) or not (eh <= 3.2e+108): tmp = math.fabs((t_3 * math.sin(math.atan(((math.sin(t) * -eh) / t_1))))) else: tmp = math.fabs(((t_1 + (t_2 * t_3)) / math.cosh(math.asinh(t_2)))) return tmp
function code(eh, ew, t) t_1 = Float64(cos(t) * ew) t_2 = Float64(eh * Float64(tan(t) / ew)) t_3 = Float64(sin(t) * eh) tmp = 0.0 if ((eh <= -2.6e+171) || !(eh <= 3.2e+108)) tmp = abs(Float64(t_3 * sin(atan(Float64(Float64(sin(t) * Float64(-eh)) / t_1))))); else tmp = abs(Float64(Float64(t_1 + Float64(t_2 * t_3)) / cosh(asinh(t_2)))); end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = cos(t) * ew; t_2 = eh * (tan(t) / ew); t_3 = sin(t) * eh; tmp = 0.0; if ((eh <= -2.6e+171) || ~((eh <= 3.2e+108))) tmp = abs((t_3 * sin(atan(((sin(t) * -eh) / t_1))))); else tmp = abs(((t_1 + (t_2 * t_3)) / cosh(asinh(t_2)))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision]}, Block[{t$95$2 = N[(eh * N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Sin[t], $MachinePrecision] * eh), $MachinePrecision]}, If[Or[LessEqual[eh, -2.6e+171], N[Not[LessEqual[eh, 3.2e+108]], $MachinePrecision]], N[Abs[N[(t$95$3 * N[Sin[N[ArcTan[N[(N[(N[Sin[t], $MachinePrecision] * (-eh)), $MachinePrecision] / t$95$1), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(t$95$1 + N[(t$95$2 * t$95$3), $MachinePrecision]), $MachinePrecision] / N[Cosh[N[ArcSinh[t$95$2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \cos t \cdot ew\\
t_2 := eh \cdot \frac{\tan t}{ew}\\
t_3 := \sin t \cdot eh\\
\mathbf{if}\;eh \leq -2.6 \cdot 10^{+171} \lor \neg \left(eh \leq 3.2 \cdot 10^{+108}\right):\\
\;\;\;\;\left|t\_3 \cdot \sin \tan^{-1} \left(\frac{\sin t \cdot \left(-eh\right)}{t\_1}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{t\_1 + t\_2 \cdot t\_3}{\cosh \sinh^{-1} t\_2}\right|\\
\end{array}
\end{array}
if eh < -2.6e171 or 3.1999999999999999e108 < eh Initial program 99.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.8%
Taylor expanded in eh around 0
fabs-subN/A
lower-fabs.f64N/A
associate-*r*N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
Applied rewrites99.8%
Taylor expanded in eh around inf
Applied rewrites79.9%
if -2.6e171 < eh < 3.1999999999999999e108Initial program 99.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.8%
Applied rewrites95.3%
Final simplification91.2%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* (cos t) ew)) (t_2 (/ (tan t) ew)))
(if (or (<= eh -2.1e+151) (not (<= eh 3.2e+108)))
(fabs (* (* (sin t) eh) (sin (atan (/ (* (sin t) (- eh)) t_1)))))
(fabs
(/ (fma (sin t) (* t_2 (* eh eh)) t_1) (cosh (asinh (* t_2 eh))))))))
double code(double eh, double ew, double t) {
double t_1 = cos(t) * ew;
double t_2 = tan(t) / ew;
double tmp;
if ((eh <= -2.1e+151) || !(eh <= 3.2e+108)) {
tmp = fabs(((sin(t) * eh) * sin(atan(((sin(t) * -eh) / t_1)))));
} else {
tmp = fabs((fma(sin(t), (t_2 * (eh * eh)), t_1) / cosh(asinh((t_2 * eh)))));
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(cos(t) * ew) t_2 = Float64(tan(t) / ew) tmp = 0.0 if ((eh <= -2.1e+151) || !(eh <= 3.2e+108)) tmp = abs(Float64(Float64(sin(t) * eh) * sin(atan(Float64(Float64(sin(t) * Float64(-eh)) / t_1))))); else tmp = abs(Float64(fma(sin(t), Float64(t_2 * Float64(eh * eh)), t_1) / cosh(asinh(Float64(t_2 * eh))))); end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision]}, Block[{t$95$2 = N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision]}, If[Or[LessEqual[eh, -2.1e+151], N[Not[LessEqual[eh, 3.2e+108]], $MachinePrecision]], N[Abs[N[(N[(N[Sin[t], $MachinePrecision] * eh), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(N[Sin[t], $MachinePrecision] * (-eh)), $MachinePrecision] / t$95$1), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[Sin[t], $MachinePrecision] * N[(t$95$2 * N[(eh * eh), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] / N[Cosh[N[ArcSinh[N[(t$95$2 * eh), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \cos t \cdot ew\\
t_2 := \frac{\tan t}{ew}\\
\mathbf{if}\;eh \leq -2.1 \cdot 10^{+151} \lor \neg \left(eh \leq 3.2 \cdot 10^{+108}\right):\\
\;\;\;\;\left|\left(\sin t \cdot eh\right) \cdot \sin \tan^{-1} \left(\frac{\sin t \cdot \left(-eh\right)}{t\_1}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(\sin t, t\_2 \cdot \left(eh \cdot eh\right), t\_1\right)}{\cosh \sinh^{-1} \left(t\_2 \cdot eh\right)}\right|\\
\end{array}
\end{array}
if eh < -2.1000000000000001e151 or 3.1999999999999999e108 < eh Initial program 99.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.7%
Taylor expanded in eh around 0
fabs-subN/A
lower-fabs.f64N/A
associate-*r*N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
Applied rewrites99.8%
Taylor expanded in eh around inf
Applied rewrites78.4%
if -2.1000000000000001e151 < eh < 3.1999999999999999e108Initial program 99.8%
Applied rewrites91.9%
Final simplification88.1%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1
(fabs
(*
(* (sin t) eh)
(sin
(atan
(*
(- t)
(fma (* t t) (* (/ eh ew) 0.3333333333333333) (/ eh ew))))))))
(t_2 (* (cos t) ew)))
(if (<= t -4.3e+123)
t_1
(if (<= t 3.1e+45)
(fabs
(-
(* (* ew (cos t)) (cos (atan (/ (* eh (tan t)) (- ew)))))
(* (* eh t) (sin (atan (* (/ (- t) ew) eh))))))
(if (<= t 1.22e+148)
t_1
(fabs (* t_2 (cos (atan (/ (* (sin t) (- eh)) t_2))))))))))
double code(double eh, double ew, double t) {
double t_1 = fabs(((sin(t) * eh) * sin(atan((-t * fma((t * t), ((eh / ew) * 0.3333333333333333), (eh / ew)))))));
double t_2 = cos(t) * ew;
double tmp;
if (t <= -4.3e+123) {
tmp = t_1;
} else if (t <= 3.1e+45) {
tmp = fabs((((ew * cos(t)) * cos(atan(((eh * tan(t)) / -ew)))) - ((eh * t) * sin(atan(((-t / ew) * eh))))));
} else if (t <= 1.22e+148) {
tmp = t_1;
} else {
tmp = fabs((t_2 * cos(atan(((sin(t) * -eh) / t_2)))));
}
return tmp;
}
function code(eh, ew, t) t_1 = abs(Float64(Float64(sin(t) * eh) * sin(atan(Float64(Float64(-t) * fma(Float64(t * t), Float64(Float64(eh / ew) * 0.3333333333333333), Float64(eh / ew))))))) t_2 = Float64(cos(t) * ew) tmp = 0.0 if (t <= -4.3e+123) tmp = t_1; elseif (t <= 3.1e+45) tmp = abs(Float64(Float64(Float64(ew * cos(t)) * cos(atan(Float64(Float64(eh * tan(t)) / Float64(-ew))))) - Float64(Float64(eh * t) * sin(atan(Float64(Float64(Float64(-t) / ew) * eh)))))); elseif (t <= 1.22e+148) tmp = t_1; else tmp = abs(Float64(t_2 * cos(atan(Float64(Float64(sin(t) * Float64(-eh)) / t_2))))); end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(N[(N[Sin[t], $MachinePrecision] * eh), $MachinePrecision] * N[Sin[N[ArcTan[N[((-t) * N[(N[(t * t), $MachinePrecision] * N[(N[(eh / ew), $MachinePrecision] * 0.3333333333333333), $MachinePrecision] + N[(eh / ew), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision]}, If[LessEqual[t, -4.3e+123], t$95$1, If[LessEqual[t, 3.1e+45], N[Abs[N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Cos[N[ArcTan[N[(N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision] / (-ew)), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * t), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[((-t) / ew), $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[t, 1.22e+148], t$95$1, N[Abs[N[(t$95$2 * N[Cos[N[ArcTan[N[(N[(N[Sin[t], $MachinePrecision] * (-eh)), $MachinePrecision] / t$95$2), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\left(\sin t \cdot eh\right) \cdot \sin \tan^{-1} \left(\left(-t\right) \cdot \mathsf{fma}\left(t \cdot t, \frac{eh}{ew} \cdot 0.3333333333333333, \frac{eh}{ew}\right)\right)\right|\\
t_2 := \cos t \cdot ew\\
\mathbf{if}\;t \leq -4.3 \cdot 10^{+123}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 3.1 \cdot 10^{+45}:\\
\;\;\;\;\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{eh \cdot \tan t}{-ew}\right) - \left(eh \cdot t\right) \cdot \sin \tan^{-1} \left(\frac{-t}{ew} \cdot eh\right)\right|\\
\mathbf{elif}\;t \leq 1.22 \cdot 10^{+148}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\left|t\_2 \cdot \cos \tan^{-1} \left(\frac{\sin t \cdot \left(-eh\right)}{t\_2}\right)\right|\\
\end{array}
\end{array}
if t < -4.29999999999999986e123 or 3.09999999999999988e45 < t < 1.22000000000000007e148Initial program 99.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.6%
Taylor expanded in eh around 0
fabs-subN/A
lower-fabs.f64N/A
associate-*r*N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
Applied rewrites99.7%
Taylor expanded in eh around inf
Applied rewrites68.5%
Taylor expanded in t around 0
Applied rewrites68.8%
if -4.29999999999999986e123 < t < 3.09999999999999988e45Initial program 99.9%
Taylor expanded in t around 0
mul-1-negN/A
distribute-neg-fracN/A
*-commutativeN/A
distribute-lft-neg-inN/A
associate-/l*N/A
distribute-lft-neg-inN/A
associate-/l*N/A
associate-*l/N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
lower-neg.f6499.5
Applied rewrites99.5%
Taylor expanded in t around 0
lower-*.f6490.7
Applied rewrites90.7%
if 1.22000000000000007e148 < t Initial program 99.4%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites14.8%
Applied rewrites14.5%
Taylor expanded in eh around 0
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
lower-atan.f64N/A
mul-1-negN/A
distribute-neg-fracN/A
lower-/.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f6463.3
Applied rewrites63.3%
Final simplification81.8%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* (cos t) ew)))
(if (<= t -7.5e+128)
(fabs
(*
(* (sin t) eh)
(sin
(atan
(* (- t) (fma (* t t) (* (/ eh ew) 0.3333333333333333) (/ eh ew)))))))
(if (or (<= t -2.6e+15) (not (<= t 1.35e-17)))
(fabs (* t_1 (cos (atan (/ (* (sin t) (- eh)) t_1)))))
(fabs
(-
(*
(fma
(fma 0.041666666666666664 (* (* t t) ew) (* -0.5 ew))
(* t t)
ew)
(cos (atan (/ (* eh (tan t)) (- ew)))))
(* (* eh t) (sin (atan (* (/ (- t) ew) eh))))))))))
double code(double eh, double ew, double t) {
double t_1 = cos(t) * ew;
double tmp;
if (t <= -7.5e+128) {
tmp = fabs(((sin(t) * eh) * sin(atan((-t * fma((t * t), ((eh / ew) * 0.3333333333333333), (eh / ew)))))));
} else if ((t <= -2.6e+15) || !(t <= 1.35e-17)) {
tmp = fabs((t_1 * cos(atan(((sin(t) * -eh) / t_1)))));
} else {
tmp = fabs(((fma(fma(0.041666666666666664, ((t * t) * ew), (-0.5 * ew)), (t * t), ew) * cos(atan(((eh * tan(t)) / -ew)))) - ((eh * t) * sin(atan(((-t / ew) * eh))))));
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(cos(t) * ew) tmp = 0.0 if (t <= -7.5e+128) tmp = abs(Float64(Float64(sin(t) * eh) * sin(atan(Float64(Float64(-t) * fma(Float64(t * t), Float64(Float64(eh / ew) * 0.3333333333333333), Float64(eh / ew))))))); elseif ((t <= -2.6e+15) || !(t <= 1.35e-17)) tmp = abs(Float64(t_1 * cos(atan(Float64(Float64(sin(t) * Float64(-eh)) / t_1))))); else tmp = abs(Float64(Float64(fma(fma(0.041666666666666664, Float64(Float64(t * t) * ew), Float64(-0.5 * ew)), Float64(t * t), ew) * cos(atan(Float64(Float64(eh * tan(t)) / Float64(-ew))))) - Float64(Float64(eh * t) * sin(atan(Float64(Float64(Float64(-t) / ew) * eh)))))); end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision]}, If[LessEqual[t, -7.5e+128], N[Abs[N[(N[(N[Sin[t], $MachinePrecision] * eh), $MachinePrecision] * N[Sin[N[ArcTan[N[((-t) * N[(N[(t * t), $MachinePrecision] * N[(N[(eh / ew), $MachinePrecision] * 0.3333333333333333), $MachinePrecision] + N[(eh / ew), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[t, -2.6e+15], N[Not[LessEqual[t, 1.35e-17]], $MachinePrecision]], N[Abs[N[(t$95$1 * N[Cos[N[ArcTan[N[(N[(N[Sin[t], $MachinePrecision] * (-eh)), $MachinePrecision] / t$95$1), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(N[(0.041666666666666664 * N[(N[(t * t), $MachinePrecision] * ew), $MachinePrecision] + N[(-0.5 * ew), $MachinePrecision]), $MachinePrecision] * N[(t * t), $MachinePrecision] + ew), $MachinePrecision] * N[Cos[N[ArcTan[N[(N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision] / (-ew)), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * t), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[((-t) / ew), $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \cos t \cdot ew\\
\mathbf{if}\;t \leq -7.5 \cdot 10^{+128}:\\
\;\;\;\;\left|\left(\sin t \cdot eh\right) \cdot \sin \tan^{-1} \left(\left(-t\right) \cdot \mathsf{fma}\left(t \cdot t, \frac{eh}{ew} \cdot 0.3333333333333333, \frac{eh}{ew}\right)\right)\right|\\
\mathbf{elif}\;t \leq -2.6 \cdot 10^{+15} \lor \neg \left(t \leq 1.35 \cdot 10^{-17}\right):\\
\;\;\;\;\left|t\_1 \cdot \cos \tan^{-1} \left(\frac{\sin t \cdot \left(-eh\right)}{t\_1}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664, \left(t \cdot t\right) \cdot ew, -0.5 \cdot ew\right), t \cdot t, ew\right) \cdot \cos \tan^{-1} \left(\frac{eh \cdot \tan t}{-ew}\right) - \left(eh \cdot t\right) \cdot \sin \tan^{-1} \left(\frac{-t}{ew} \cdot eh\right)\right|\\
\end{array}
\end{array}
if t < -7.50000000000000076e128Initial program 99.5%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.5%
Taylor expanded in eh around 0
fabs-subN/A
lower-fabs.f64N/A
associate-*r*N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
Applied rewrites99.6%
Taylor expanded in eh around inf
Applied rewrites74.1%
Taylor expanded in t around 0
Applied rewrites74.3%
if -7.50000000000000076e128 < t < -2.6e15 or 1.3500000000000001e-17 < t Initial program 99.6%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites16.2%
Applied rewrites15.9%
Taylor expanded in eh around 0
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
lower-atan.f64N/A
mul-1-negN/A
distribute-neg-fracN/A
lower-/.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f6460.2
Applied rewrites60.2%
if -2.6e15 < t < 1.3500000000000001e-17Initial program 100.0%
Taylor expanded in t around 0
mul-1-negN/A
distribute-neg-fracN/A
*-commutativeN/A
distribute-lft-neg-inN/A
associate-/l*N/A
distribute-lft-neg-inN/A
associate-/l*N/A
associate-*l/N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
lower-neg.f64100.0
Applied rewrites100.0%
Taylor expanded in t around 0
lower-*.f6497.8
Applied rewrites97.8%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6497.8
Applied rewrites97.8%
Final simplification80.7%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* (cos t) ew)) (t_2 (atan (/ (* (sin t) (- eh)) t_1))))
(if (or (<= eh -9.5e+57) (not (<= eh 5e+90)))
(fabs (* (* (sin t) eh) (sin t_2)))
(fabs (* t_1 (cos t_2))))))
double code(double eh, double ew, double t) {
double t_1 = cos(t) * ew;
double t_2 = atan(((sin(t) * -eh) / t_1));
double tmp;
if ((eh <= -9.5e+57) || !(eh <= 5e+90)) {
tmp = fabs(((sin(t) * eh) * sin(t_2)));
} else {
tmp = fabs((t_1 * cos(t_2)));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(eh, ew, t)
use fmin_fmax_functions
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) :: tmp
t_1 = cos(t) * ew
t_2 = atan(((sin(t) * -eh) / t_1))
if ((eh <= (-9.5d+57)) .or. (.not. (eh <= 5d+90))) then
tmp = abs(((sin(t) * eh) * sin(t_2)))
else
tmp = abs((t_1 * cos(t_2)))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.cos(t) * ew;
double t_2 = Math.atan(((Math.sin(t) * -eh) / t_1));
double tmp;
if ((eh <= -9.5e+57) || !(eh <= 5e+90)) {
tmp = Math.abs(((Math.sin(t) * eh) * Math.sin(t_2)));
} else {
tmp = Math.abs((t_1 * Math.cos(t_2)));
}
return tmp;
}
def code(eh, ew, t): t_1 = math.cos(t) * ew t_2 = math.atan(((math.sin(t) * -eh) / t_1)) tmp = 0 if (eh <= -9.5e+57) or not (eh <= 5e+90): tmp = math.fabs(((math.sin(t) * eh) * math.sin(t_2))) else: tmp = math.fabs((t_1 * math.cos(t_2))) return tmp
function code(eh, ew, t) t_1 = Float64(cos(t) * ew) t_2 = atan(Float64(Float64(sin(t) * Float64(-eh)) / t_1)) tmp = 0.0 if ((eh <= -9.5e+57) || !(eh <= 5e+90)) tmp = abs(Float64(Float64(sin(t) * eh) * sin(t_2))); else tmp = abs(Float64(t_1 * cos(t_2))); end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = cos(t) * ew; t_2 = atan(((sin(t) * -eh) / t_1)); tmp = 0.0; if ((eh <= -9.5e+57) || ~((eh <= 5e+90))) tmp = abs(((sin(t) * eh) * sin(t_2))); else tmp = abs((t_1 * cos(t_2))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision]}, Block[{t$95$2 = N[ArcTan[N[(N[(N[Sin[t], $MachinePrecision] * (-eh)), $MachinePrecision] / t$95$1), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[eh, -9.5e+57], N[Not[LessEqual[eh, 5e+90]], $MachinePrecision]], N[Abs[N[(N[(N[Sin[t], $MachinePrecision] * eh), $MachinePrecision] * N[Sin[t$95$2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(t$95$1 * N[Cos[t$95$2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \cos t \cdot ew\\
t_2 := \tan^{-1} \left(\frac{\sin t \cdot \left(-eh\right)}{t\_1}\right)\\
\mathbf{if}\;eh \leq -9.5 \cdot 10^{+57} \lor \neg \left(eh \leq 5 \cdot 10^{+90}\right):\\
\;\;\;\;\left|\left(\sin t \cdot eh\right) \cdot \sin t\_2\right|\\
\mathbf{else}:\\
\;\;\;\;\left|t\_1 \cdot \cos t\_2\right|\\
\end{array}
\end{array}
if eh < -9.4999999999999997e57 or 5.0000000000000004e90 < eh Initial program 99.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.7%
Taylor expanded in eh around 0
fabs-subN/A
lower-fabs.f64N/A
associate-*r*N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
Applied rewrites99.8%
Taylor expanded in eh around inf
Applied rewrites73.5%
if -9.4999999999999997e57 < eh < 5.0000000000000004e90Initial program 99.8%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites51.2%
Applied rewrites51.1%
Taylor expanded in eh around 0
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
lower-atan.f64N/A
mul-1-negN/A
distribute-neg-fracN/A
lower-/.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f6478.6
Applied rewrites78.6%
Final simplification76.7%
(FPCore (eh ew t)
:precision binary64
(if (or (<= ew -2.6e-28) (not (<= ew 3.6e-25)))
(fabs
(fma
(* (- eh) (/ (* t t) ew))
eh
(* (* (cos (atan (* (/ eh ew) (tan t)))) (- (cos t))) ew)))
(fabs (* (* (tanh (asinh (* (/ (tan t) ew) (- eh)))) eh) (sin t)))))
double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -2.6e-28) || !(ew <= 3.6e-25)) {
tmp = fabs(fma((-eh * ((t * t) / ew)), eh, ((cos(atan(((eh / ew) * tan(t)))) * -cos(t)) * ew)));
} else {
tmp = fabs(((tanh(asinh(((tan(t) / ew) * -eh))) * eh) * sin(t)));
}
return tmp;
}
function code(eh, ew, t) tmp = 0.0 if ((ew <= -2.6e-28) || !(ew <= 3.6e-25)) tmp = abs(fma(Float64(Float64(-eh) * Float64(Float64(t * t) / ew)), eh, Float64(Float64(cos(atan(Float64(Float64(eh / ew) * tan(t)))) * Float64(-cos(t))) * ew))); else tmp = abs(Float64(Float64(tanh(asinh(Float64(Float64(tan(t) / ew) * Float64(-eh)))) * eh) * sin(t))); end return tmp end
code[eh_, ew_, t_] := If[Or[LessEqual[ew, -2.6e-28], N[Not[LessEqual[ew, 3.6e-25]], $MachinePrecision]], N[Abs[N[(N[((-eh) * N[(N[(t * t), $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision] * eh + N[(N[(N[Cos[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] * N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * (-N[Cos[t], $MachinePrecision])), $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[Tanh[N[ArcSinh[N[(N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision] * (-eh)), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * eh), $MachinePrecision] * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -2.6 \cdot 10^{-28} \lor \neg \left(ew \leq 3.6 \cdot 10^{-25}\right):\\
\;\;\;\;\left|\mathsf{fma}\left(\left(-eh\right) \cdot \frac{t \cdot t}{ew}, eh, \left(\cos \tan^{-1} \left(\frac{eh}{ew} \cdot \tan t\right) \cdot \left(-\cos t\right)\right) \cdot ew\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\left(\tanh \sinh^{-1} \left(\frac{\tan t}{ew} \cdot \left(-eh\right)\right) \cdot eh\right) \cdot \sin t\right|\\
\end{array}
\end{array}
if ew < -2.6e-28 or 3.5999999999999999e-25 < ew Initial program 99.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.8%
Taylor expanded in eh around 0
fabs-subN/A
lower-fabs.f64N/A
associate-*r*N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
Applied rewrites99.8%
Applied rewrites99.8%
Taylor expanded in t around 0
Applied rewrites65.8%
if -2.6e-28 < ew < 3.5999999999999999e-25Initial program 99.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.8%
Taylor expanded in eh around 0
fabs-subN/A
lower-fabs.f64N/A
associate-*r*N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
Applied rewrites99.8%
Taylor expanded in eh around inf
Applied rewrites67.0%
Applied rewrites67.0%
Final simplification66.4%
(FPCore (eh ew t)
:precision binary64
(if (or (<= t -4.3e-40) (not (<= t 245000.0)))
(fabs
(*
(* (sin t) eh)
(sin
(atan
(* (- t) (fma (* t t) (* (/ eh ew) 0.3333333333333333) (/ eh ew)))))))
(fabs (/ ew 1.0))))
double code(double eh, double ew, double t) {
double tmp;
if ((t <= -4.3e-40) || !(t <= 245000.0)) {
tmp = fabs(((sin(t) * eh) * sin(atan((-t * fma((t * t), ((eh / ew) * 0.3333333333333333), (eh / ew)))))));
} else {
tmp = fabs((ew / 1.0));
}
return tmp;
}
function code(eh, ew, t) tmp = 0.0 if ((t <= -4.3e-40) || !(t <= 245000.0)) tmp = abs(Float64(Float64(sin(t) * eh) * sin(atan(Float64(Float64(-t) * fma(Float64(t * t), Float64(Float64(eh / ew) * 0.3333333333333333), Float64(eh / ew))))))); else tmp = abs(Float64(ew / 1.0)); end return tmp end
code[eh_, ew_, t_] := If[Or[LessEqual[t, -4.3e-40], N[Not[LessEqual[t, 245000.0]], $MachinePrecision]], N[Abs[N[(N[(N[Sin[t], $MachinePrecision] * eh), $MachinePrecision] * N[Sin[N[ArcTan[N[((-t) * N[(N[(t * t), $MachinePrecision] * N[(N[(eh / ew), $MachinePrecision] * 0.3333333333333333), $MachinePrecision] + N[(eh / ew), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(ew / 1.0), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.3 \cdot 10^{-40} \lor \neg \left(t \leq 245000\right):\\
\;\;\;\;\left|\left(\sin t \cdot eh\right) \cdot \sin \tan^{-1} \left(\left(-t\right) \cdot \mathsf{fma}\left(t \cdot t, \frac{eh}{ew} \cdot 0.3333333333333333, \frac{eh}{ew}\right)\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{ew}{1}\right|\\
\end{array}
\end{array}
if t < -4.3000000000000003e-40 or 245000 < t Initial program 99.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.6%
Taylor expanded in eh around 0
fabs-subN/A
lower-fabs.f64N/A
associate-*r*N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
Applied rewrites99.6%
Taylor expanded in eh around inf
Applied rewrites54.7%
Taylor expanded in t around 0
Applied rewrites55.1%
if -4.3000000000000003e-40 < t < 245000Initial program 100.0%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites73.7%
Applied rewrites73.6%
Taylor expanded in eh around 0
Applied rewrites73.9%
Final simplification63.9%
(FPCore (eh ew t) :precision binary64 (fma (* (* -0.5 ew) t) t ew))
double code(double eh, double ew, double t) {
return fma(((-0.5 * ew) * t), t, ew);
}
function code(eh, ew, t) return fma(Float64(Float64(-0.5 * ew) * t), t, ew) end
code[eh_, ew_, t_] := N[(N[(N[(-0.5 * ew), $MachinePrecision] * t), $MachinePrecision] * t + ew), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\left(-0.5 \cdot ew\right) \cdot t, t, ew\right)
\end{array}
Initial program 99.8%
Applied rewrites39.0%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6418.2
Applied rewrites18.2%
Taylor expanded in eh around 0
Applied rewrites21.6%
Applied rewrites21.7%
(FPCore (eh ew t) :precision binary64 (fma (* -0.5 ew) (* t t) ew))
double code(double eh, double ew, double t) {
return fma((-0.5 * ew), (t * t), ew);
}
function code(eh, ew, t) return fma(Float64(-0.5 * ew), Float64(t * t), ew) end
code[eh_, ew_, t_] := N[(N[(-0.5 * ew), $MachinePrecision] * N[(t * t), $MachinePrecision] + ew), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(-0.5 \cdot ew, t \cdot t, ew\right)
\end{array}
Initial program 99.8%
Applied rewrites39.0%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6418.2
Applied rewrites18.2%
Taylor expanded in eh around 0
Applied rewrites21.6%
(FPCore (eh ew t) :precision binary64 (fabs (/ ew 1.0)))
double code(double eh, double ew, double t) {
return fabs((ew / 1.0));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(eh, ew, t)
use fmin_fmax_functions
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
code = abs((ew / 1.0d0))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((ew / 1.0));
}
def code(eh, ew, t): return math.fabs((ew / 1.0))
function code(eh, ew, t) return abs(Float64(ew / 1.0)) end
function tmp = code(eh, ew, t) tmp = abs((ew / 1.0)); end
code[eh_, ew_, t_] := N[Abs[N[(ew / 1.0), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{ew}{1}\right|
\end{array}
Initial program 99.8%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites41.3%
Applied rewrites41.0%
Taylor expanded in eh around 0
Applied rewrites41.5%
Final simplification41.5%
herbie shell --seed 2024346
(FPCore (eh ew t)
:name "Example 2 from Robby"
:precision binary64
(fabs (- (* (* ew (cos t)) (cos (atan (/ (* (- eh) (tan t)) ew)))) (* (* eh (sin t)) (sin (atan (/ (* (- eh) (tan t)) ew)))))))