
(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 19 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 (- (* (* eh (sin t)) (sin (atan (/ (* eh (tan t)) (- ew))))) (* (* (cos t) ew) (cos (atan (* (/ (tan t) ew) eh)))))))
double code(double eh, double ew, double t) {
return fabs((((eh * sin(t)) * sin(atan(((eh * tan(t)) / -ew)))) - ((cos(t) * ew) * cos(atan(((tan(t) / ew) * eh))))));
}
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(((eh * tan(t)) / -ew)))) - ((cos(t) * ew) * cos(atan(((tan(t) / ew) * eh))))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((((eh * Math.sin(t)) * Math.sin(Math.atan(((eh * Math.tan(t)) / -ew)))) - ((Math.cos(t) * ew) * Math.cos(Math.atan(((Math.tan(t) / ew) * eh))))));
}
def code(eh, ew, t): return math.fabs((((eh * math.sin(t)) * math.sin(math.atan(((eh * math.tan(t)) / -ew)))) - ((math.cos(t) * ew) * math.cos(math.atan(((math.tan(t) / ew) * eh))))))
function code(eh, ew, t) return abs(Float64(Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(eh * tan(t)) / Float64(-ew))))) - Float64(Float64(cos(t) * ew) * cos(atan(Float64(Float64(tan(t) / ew) * eh)))))) end
function tmp = code(eh, ew, t) tmp = abs((((eh * sin(t)) * sin(atan(((eh * tan(t)) / -ew)))) - ((cos(t) * ew) * cos(atan(((tan(t) / ew) * eh)))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision] / (-ew)), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision] * N[Cos[N[ArcTan[N[(N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{-ew}\right) - \left(\cos t \cdot ew\right) \cdot \cos \tan^{-1} \left(\frac{\tan t}{ew} \cdot eh\right)\right|
\end{array}
Initial program 99.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.8
lift-cos.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
lift-atan.f64N/A
atan-neg-revN/A
lower-atan.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-neg.f64N/A
distribute-lft-neg-outN/A
remove-double-negN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Final simplification99.8%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1
(fabs
(*
(cos
(atan
(*
(/ (sin t) (- ew))
(/
eh
(+
1.0
(*
(* t t)
(-
(*
(* t t)
(+ 0.041666666666666664 (* -0.001388888888888889 (* t t))))
0.5)))))))
ew)))
(t_2 (atan (/ (* eh (tan t)) (- ew))))
(t_3 (- (* (* ew (cos t)) (cos t_2)) (* (* eh (sin t)) (sin t_2)))))
(if (<= t_3 -2e+158)
t_1
(if (<= t_3 -2e-112)
(exp (* (log (* (* ew ew) (pow (cos t) 2.0))) 0.5))
(if (<= t_3 -5e-270) t_1 (* (cos t) ew))))))
double code(double eh, double ew, double t) {
double t_1 = fabs((cos(atan(((sin(t) / -ew) * (eh / (1.0 + ((t * t) * (((t * t) * (0.041666666666666664 + (-0.001388888888888889 * (t * t)))) - 0.5))))))) * ew));
double t_2 = atan(((eh * tan(t)) / -ew));
double t_3 = ((ew * cos(t)) * cos(t_2)) - ((eh * sin(t)) * sin(t_2));
double tmp;
if (t_3 <= -2e+158) {
tmp = t_1;
} else if (t_3 <= -2e-112) {
tmp = exp((log(((ew * ew) * pow(cos(t), 2.0))) * 0.5));
} else if (t_3 <= -5e-270) {
tmp = t_1;
} 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) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = abs((cos(atan(((sin(t) / -ew) * (eh / (1.0d0 + ((t * t) * (((t * t) * (0.041666666666666664d0 + ((-0.001388888888888889d0) * (t * t)))) - 0.5d0))))))) * ew))
t_2 = atan(((eh * tan(t)) / -ew))
t_3 = ((ew * cos(t)) * cos(t_2)) - ((eh * sin(t)) * sin(t_2))
if (t_3 <= (-2d+158)) then
tmp = t_1
else if (t_3 <= (-2d-112)) then
tmp = exp((log(((ew * ew) * (cos(t) ** 2.0d0))) * 0.5d0))
else if (t_3 <= (-5d-270)) then
tmp = t_1
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.abs((Math.cos(Math.atan(((Math.sin(t) / -ew) * (eh / (1.0 + ((t * t) * (((t * t) * (0.041666666666666664 + (-0.001388888888888889 * (t * t)))) - 0.5))))))) * ew));
double t_2 = Math.atan(((eh * Math.tan(t)) / -ew));
double t_3 = ((ew * Math.cos(t)) * Math.cos(t_2)) - ((eh * Math.sin(t)) * Math.sin(t_2));
double tmp;
if (t_3 <= -2e+158) {
tmp = t_1;
} else if (t_3 <= -2e-112) {
tmp = Math.exp((Math.log(((ew * ew) * Math.pow(Math.cos(t), 2.0))) * 0.5));
} else if (t_3 <= -5e-270) {
tmp = t_1;
} else {
tmp = Math.cos(t) * ew;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs((math.cos(math.atan(((math.sin(t) / -ew) * (eh / (1.0 + ((t * t) * (((t * t) * (0.041666666666666664 + (-0.001388888888888889 * (t * t)))) - 0.5))))))) * ew)) t_2 = math.atan(((eh * math.tan(t)) / -ew)) t_3 = ((ew * math.cos(t)) * math.cos(t_2)) - ((eh * math.sin(t)) * math.sin(t_2)) tmp = 0 if t_3 <= -2e+158: tmp = t_1 elif t_3 <= -2e-112: tmp = math.exp((math.log(((ew * ew) * math.pow(math.cos(t), 2.0))) * 0.5)) elif t_3 <= -5e-270: tmp = t_1 else: tmp = math.cos(t) * ew return tmp
function code(eh, ew, t) t_1 = abs(Float64(cos(atan(Float64(Float64(sin(t) / Float64(-ew)) * Float64(eh / Float64(1.0 + Float64(Float64(t * t) * Float64(Float64(Float64(t * t) * Float64(0.041666666666666664 + Float64(-0.001388888888888889 * Float64(t * t)))) - 0.5))))))) * ew)) t_2 = atan(Float64(Float64(eh * tan(t)) / Float64(-ew))) t_3 = Float64(Float64(Float64(ew * cos(t)) * cos(t_2)) - Float64(Float64(eh * sin(t)) * sin(t_2))) tmp = 0.0 if (t_3 <= -2e+158) tmp = t_1; elseif (t_3 <= -2e-112) tmp = exp(Float64(log(Float64(Float64(ew * ew) * (cos(t) ^ 2.0))) * 0.5)); elseif (t_3 <= -5e-270) tmp = t_1; else tmp = Float64(cos(t) * ew); end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = abs((cos(atan(((sin(t) / -ew) * (eh / (1.0 + ((t * t) * (((t * t) * (0.041666666666666664 + (-0.001388888888888889 * (t * t)))) - 0.5))))))) * ew)); t_2 = atan(((eh * tan(t)) / -ew)); t_3 = ((ew * cos(t)) * cos(t_2)) - ((eh * sin(t)) * sin(t_2)); tmp = 0.0; if (t_3 <= -2e+158) tmp = t_1; elseif (t_3 <= -2e-112) tmp = exp((log(((ew * ew) * (cos(t) ^ 2.0))) * 0.5)); elseif (t_3 <= -5e-270) tmp = t_1; else tmp = cos(t) * ew; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(N[Cos[N[ArcTan[N[(N[(N[Sin[t], $MachinePrecision] / (-ew)), $MachinePrecision] * N[(eh / N[(1.0 + N[(N[(t * t), $MachinePrecision] * N[(N[(N[(t * t), $MachinePrecision] * N[(0.041666666666666664 + N[(-0.001388888888888889 * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[ArcTan[N[(N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision] / (-ew)), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$2], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -2e+158], t$95$1, If[LessEqual[t$95$3, -2e-112], N[Exp[N[(N[Log[N[(N[(ew * ew), $MachinePrecision] * N[Power[N[Cos[t], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$3, -5e-270], t$95$1, N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\cos \tan^{-1} \left(\frac{\sin t}{-ew} \cdot \frac{eh}{1 + \left(t \cdot t\right) \cdot \left(\left(t \cdot t\right) \cdot \left(0.041666666666666664 + -0.001388888888888889 \cdot \left(t \cdot t\right)\right) - 0.5\right)}\right) \cdot ew\right|\\
t_2 := \tan^{-1} \left(\frac{eh \cdot \tan t}{-ew}\right)\\
t_3 := \left(ew \cdot \cos t\right) \cdot \cos t\_2 - \left(eh \cdot \sin t\right) \cdot \sin t\_2\\
\mathbf{if}\;t\_3 \leq -2 \cdot 10^{+158}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_3 \leq -2 \cdot 10^{-112}:\\
\;\;\;\;e^{\log \left(\left(ew \cdot ew\right) \cdot {\cos t}^{2}\right) \cdot 0.5}\\
\mathbf{elif}\;t\_3 \leq -5 \cdot 10^{-270}:\\
\;\;\;\;t\_1\\
\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))))) < -1.99999999999999991e158 or -1.9999999999999999e-112 < (-.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))))) < -4.9999999999999998e-270Initial program 99.8%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites39.4%
Taylor expanded in t around 0
Applied rewrites39.5%
if -1.99999999999999991e158 < (-.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))))) < -1.9999999999999999e-112Initial program 99.8%
Applied rewrites61.6%
Taylor expanded in eh around 0
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f6451.9
Applied rewrites51.9%
if -4.9999999999999998e-270 < (-.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.8%
Applied rewrites76.6%
Taylor expanded in t around 0
lower-+.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
distribute-rgt-outN/A
metadata-evalN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6433.0
Applied rewrites33.0%
Taylor expanded in eh around 0
*-commutativeN/A
lower-*.f64N/A
lower-cos.f6461.6
Applied rewrites61.6%
Final simplification53.7%
(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)))
-5e-270)
(fabs
(*
(cos
(atan
(*
(/ (sin t) (- ew))
(/
eh
(+
1.0
(*
(* t t)
(-
(*
(* t t)
(+ 0.041666666666666664 (* -0.001388888888888889 (* t t))))
0.5)))))))
ew))
(* (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))) <= -5e-270) {
tmp = fabs((cos(atan(((sin(t) / -ew) * (eh / (1.0 + ((t * t) * (((t * t) * (0.041666666666666664 + (-0.001388888888888889 * (t * t)))) - 0.5))))))) * ew));
} 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))) <= (-5d-270)) then
tmp = abs((cos(atan(((sin(t) / -ew) * (eh / (1.0d0 + ((t * t) * (((t * t) * (0.041666666666666664d0 + ((-0.001388888888888889d0) * (t * t)))) - 0.5d0))))))) * ew))
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))) <= -5e-270) {
tmp = Math.abs((Math.cos(Math.atan(((Math.sin(t) / -ew) * (eh / (1.0 + ((t * t) * (((t * t) * (0.041666666666666664 + (-0.001388888888888889 * (t * t)))) - 0.5))))))) * ew));
} 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))) <= -5e-270: tmp = math.fabs((math.cos(math.atan(((math.sin(t) / -ew) * (eh / (1.0 + ((t * t) * (((t * t) * (0.041666666666666664 + (-0.001388888888888889 * (t * t)))) - 0.5))))))) * ew)) 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))) <= -5e-270) tmp = abs(Float64(cos(atan(Float64(Float64(sin(t) / Float64(-ew)) * Float64(eh / Float64(1.0 + Float64(Float64(t * t) * Float64(Float64(Float64(t * t) * Float64(0.041666666666666664 + Float64(-0.001388888888888889 * Float64(t * t)))) - 0.5))))))) * ew)); 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))) <= -5e-270) tmp = abs((cos(atan(((sin(t) / -ew) * (eh / (1.0 + ((t * t) * (((t * t) * (0.041666666666666664 + (-0.001388888888888889 * (t * t)))) - 0.5))))))) * ew)); 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], -5e-270], N[Abs[N[(N[Cos[N[ArcTan[N[(N[(N[Sin[t], $MachinePrecision] / (-ew)), $MachinePrecision] * N[(eh / N[(1.0 + N[(N[(t * t), $MachinePrecision] * N[(N[(N[(t * t), $MachinePrecision] * N[(0.041666666666666664 + N[(-0.001388888888888889 * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * ew), $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 -5 \cdot 10^{-270}:\\
\;\;\;\;\left|\cos \tan^{-1} \left(\frac{\sin t}{-ew} \cdot \frac{eh}{1 + \left(t \cdot t\right) \cdot \left(\left(t \cdot t\right) \cdot \left(0.041666666666666664 + -0.001388888888888889 \cdot \left(t \cdot t\right)\right) - 0.5\right)}\right) \cdot ew\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))))) < -4.9999999999999998e-270Initial program 99.8%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites37.9%
Taylor expanded in t around 0
Applied rewrites38.0%
if -4.9999999999999998e-270 < (-.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.8%
Applied rewrites76.6%
Taylor expanded in t around 0
lower-+.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
distribute-rgt-outN/A
metadata-evalN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6433.0
Applied rewrites33.0%
Taylor expanded in eh around 0
*-commutativeN/A
lower-*.f64N/A
lower-cos.f6461.6
Applied rewrites61.6%
Final simplification49.5%
(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)))
-5e-270)
(fabs
(*
(cos
(atan
(*
(/ (sin t) (- ew))
(/
eh
(+ 1.0 (* (* t t) (- (* 0.041666666666666664 (* t t)) 0.5)))))))
ew))
(* (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))) <= -5e-270) {
tmp = fabs((cos(atan(((sin(t) / -ew) * (eh / (1.0 + ((t * t) * ((0.041666666666666664 * (t * t)) - 0.5))))))) * ew));
} 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))) <= (-5d-270)) then
tmp = abs((cos(atan(((sin(t) / -ew) * (eh / (1.0d0 + ((t * t) * ((0.041666666666666664d0 * (t * t)) - 0.5d0))))))) * ew))
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))) <= -5e-270) {
tmp = Math.abs((Math.cos(Math.atan(((Math.sin(t) / -ew) * (eh / (1.0 + ((t * t) * ((0.041666666666666664 * (t * t)) - 0.5))))))) * ew));
} 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))) <= -5e-270: tmp = math.fabs((math.cos(math.atan(((math.sin(t) / -ew) * (eh / (1.0 + ((t * t) * ((0.041666666666666664 * (t * t)) - 0.5))))))) * ew)) 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))) <= -5e-270) tmp = abs(Float64(cos(atan(Float64(Float64(sin(t) / Float64(-ew)) * Float64(eh / Float64(1.0 + Float64(Float64(t * t) * Float64(Float64(0.041666666666666664 * Float64(t * t)) - 0.5))))))) * ew)); 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))) <= -5e-270) tmp = abs((cos(atan(((sin(t) / -ew) * (eh / (1.0 + ((t * t) * ((0.041666666666666664 * (t * t)) - 0.5))))))) * ew)); 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], -5e-270], N[Abs[N[(N[Cos[N[ArcTan[N[(N[(N[Sin[t], $MachinePrecision] / (-ew)), $MachinePrecision] * N[(eh / N[(1.0 + N[(N[(t * t), $MachinePrecision] * N[(N[(0.041666666666666664 * N[(t * t), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * ew), $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 -5 \cdot 10^{-270}:\\
\;\;\;\;\left|\cos \tan^{-1} \left(\frac{\sin t}{-ew} \cdot \frac{eh}{1 + \left(t \cdot t\right) \cdot \left(0.041666666666666664 \cdot \left(t \cdot t\right) - 0.5\right)}\right) \cdot ew\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))))) < -4.9999999999999998e-270Initial program 99.8%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites37.9%
Taylor expanded in t around 0
Applied rewrites38.0%
if -4.9999999999999998e-270 < (-.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.8%
Applied rewrites76.6%
Taylor expanded in t around 0
lower-+.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
distribute-rgt-outN/A
metadata-evalN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6433.0
Applied rewrites33.0%
Taylor expanded in eh around 0
*-commutativeN/A
lower-*.f64N/A
lower-cos.f6461.6
Applied rewrites61.6%
Final simplification49.5%
(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)))
-5e-270)
(fabs
(*
(cos (atan (* (/ (sin t) (- ew)) (/ eh (+ 1.0 (* -0.5 (* t t)))))))
ew))
(* (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))) <= -5e-270) {
tmp = fabs((cos(atan(((sin(t) / -ew) * (eh / (1.0 + (-0.5 * (t * t))))))) * ew));
} 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))) <= (-5d-270)) then
tmp = abs((cos(atan(((sin(t) / -ew) * (eh / (1.0d0 + ((-0.5d0) * (t * t))))))) * ew))
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))) <= -5e-270) {
tmp = Math.abs((Math.cos(Math.atan(((Math.sin(t) / -ew) * (eh / (1.0 + (-0.5 * (t * t))))))) * ew));
} 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))) <= -5e-270: tmp = math.fabs((math.cos(math.atan(((math.sin(t) / -ew) * (eh / (1.0 + (-0.5 * (t * t))))))) * ew)) 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))) <= -5e-270) tmp = abs(Float64(cos(atan(Float64(Float64(sin(t) / Float64(-ew)) * Float64(eh / Float64(1.0 + Float64(-0.5 * Float64(t * t))))))) * ew)); 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))) <= -5e-270) tmp = abs((cos(atan(((sin(t) / -ew) * (eh / (1.0 + (-0.5 * (t * t))))))) * ew)); 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], -5e-270], N[Abs[N[(N[Cos[N[ArcTan[N[(N[(N[Sin[t], $MachinePrecision] / (-ew)), $MachinePrecision] * N[(eh / N[(1.0 + N[(-0.5 * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * ew), $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 -5 \cdot 10^{-270}:\\
\;\;\;\;\left|\cos \tan^{-1} \left(\frac{\sin t}{-ew} \cdot \frac{eh}{1 + -0.5 \cdot \left(t \cdot t\right)}\right) \cdot ew\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))))) < -4.9999999999999998e-270Initial program 99.8%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites37.9%
Taylor expanded in t around 0
Applied rewrites38.0%
if -4.9999999999999998e-270 < (-.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.8%
Applied rewrites76.6%
Taylor expanded in t around 0
lower-+.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
distribute-rgt-outN/A
metadata-evalN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6433.0
Applied rewrites33.0%
Taylor expanded in eh around 0
*-commutativeN/A
lower-*.f64N/A
lower-cos.f6461.6
Applied rewrites61.6%
Final simplification49.5%
(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)))
-5e-270)
(fabs (* (cos (atan (* (/ (sin t) (- ew)) (/ eh 1.0)))) ew))
(* (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))) <= -5e-270) {
tmp = fabs((cos(atan(((sin(t) / -ew) * (eh / 1.0)))) * ew));
} 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))) <= (-5d-270)) then
tmp = abs((cos(atan(((sin(t) / -ew) * (eh / 1.0d0)))) * ew))
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))) <= -5e-270) {
tmp = Math.abs((Math.cos(Math.atan(((Math.sin(t) / -ew) * (eh / 1.0)))) * ew));
} 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))) <= -5e-270: tmp = math.fabs((math.cos(math.atan(((math.sin(t) / -ew) * (eh / 1.0)))) * ew)) 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))) <= -5e-270) tmp = abs(Float64(cos(atan(Float64(Float64(sin(t) / Float64(-ew)) * Float64(eh / 1.0)))) * ew)); 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))) <= -5e-270) tmp = abs((cos(atan(((sin(t) / -ew) * (eh / 1.0)))) * ew)); 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], -5e-270], N[Abs[N[(N[Cos[N[ArcTan[N[(N[(N[Sin[t], $MachinePrecision] / (-ew)), $MachinePrecision] * N[(eh / 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * ew), $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 -5 \cdot 10^{-270}:\\
\;\;\;\;\left|\cos \tan^{-1} \left(\frac{\sin t}{-ew} \cdot \frac{eh}{1}\right) \cdot ew\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))))) < -4.9999999999999998e-270Initial program 99.8%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites37.9%
Taylor expanded in t around 0
Applied rewrites37.9%
if -4.9999999999999998e-270 < (-.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.8%
Applied rewrites76.6%
Taylor expanded in t around 0
lower-+.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
distribute-rgt-outN/A
metadata-evalN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6433.0
Applied rewrites33.0%
Taylor expanded in eh around 0
*-commutativeN/A
lower-*.f64N/A
lower-cos.f6461.6
Applied rewrites61.6%
Final simplification49.5%
(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)))
-5e-270)
(fabs (* (cos (atan (* eh (/ (tan t) ew)))) ew))
(* (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))) <= -5e-270) {
tmp = fabs((cos(atan((eh * (tan(t) / ew)))) * ew));
} 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))) <= (-5d-270)) then
tmp = abs((cos(atan((eh * (tan(t) / ew)))) * ew))
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))) <= -5e-270) {
tmp = Math.abs((Math.cos(Math.atan((eh * (Math.tan(t) / ew)))) * ew));
} 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))) <= -5e-270: tmp = math.fabs((math.cos(math.atan((eh * (math.tan(t) / ew)))) * ew)) 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))) <= -5e-270) tmp = abs(Float64(cos(atan(Float64(eh * Float64(tan(t) / ew)))) * ew)); 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))) <= -5e-270) tmp = abs((cos(atan((eh * (tan(t) / ew)))) * ew)); 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], -5e-270], N[Abs[N[(N[Cos[N[ArcTan[N[(eh * N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * ew), $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 -5 \cdot 10^{-270}:\\
\;\;\;\;\left|\cos \tan^{-1} \left(eh \cdot \frac{\tan t}{ew}\right) \cdot ew\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))))) < -4.9999999999999998e-270Initial program 99.8%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites37.9%
Applied rewrites37.9%
if -4.9999999999999998e-270 < (-.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.8%
Applied rewrites76.6%
Taylor expanded in t around 0
lower-+.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
distribute-rgt-outN/A
metadata-evalN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6433.0
Applied rewrites33.0%
Taylor expanded in eh around 0
*-commutativeN/A
lower-*.f64N/A
lower-cos.f6461.6
Applied rewrites61.6%
Final simplification49.5%
(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)))
-5e-270)
(fabs
(*
(cos
(atan
(* (- t) (fma (* t t) (* (/ eh ew) 0.3333333333333333) (/ eh ew)))))
ew))
(* (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))) <= -5e-270) {
tmp = fabs((cos(atan((-t * fma((t * t), ((eh / ew) * 0.3333333333333333), (eh / ew))))) * ew));
} else {
tmp = 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))) <= -5e-270) tmp = abs(Float64(cos(atan(Float64(Float64(-t) * fma(Float64(t * t), Float64(Float64(eh / ew) * 0.3333333333333333), Float64(eh / ew))))) * ew)); else tmp = Float64(cos(t) * ew); end return 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], -5e-270], N[Abs[N[(N[Cos[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] * ew), $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 -5 \cdot 10^{-270}:\\
\;\;\;\;\left|\cos \tan^{-1} \left(\left(-t\right) \cdot \mathsf{fma}\left(t \cdot t, \frac{eh}{ew} \cdot 0.3333333333333333, \frac{eh}{ew}\right)\right) \cdot ew\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))))) < -4.9999999999999998e-270Initial program 99.8%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites37.9%
Taylor expanded in t around 0
Applied rewrites34.7%
if -4.9999999999999998e-270 < (-.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.8%
Applied rewrites76.6%
Taylor expanded in t around 0
lower-+.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
distribute-rgt-outN/A
metadata-evalN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6433.0
Applied rewrites33.0%
Taylor expanded in eh around 0
*-commutativeN/A
lower-*.f64N/A
lower-cos.f6461.6
Applied rewrites61.6%
Final simplification47.9%
(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)))
-5e-270)
(exp (* (log (* ew ew)) 0.5))
(* (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))) <= -5e-270) {
tmp = exp((log((ew * ew)) * 0.5));
} 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))) <= (-5d-270)) then
tmp = exp((log((ew * ew)) * 0.5d0))
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))) <= -5e-270) {
tmp = Math.exp((Math.log((ew * ew)) * 0.5));
} 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))) <= -5e-270: tmp = math.exp((math.log((ew * ew)) * 0.5)) 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))) <= -5e-270) tmp = exp(Float64(log(Float64(ew * ew)) * 0.5)); 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))) <= -5e-270) tmp = exp((log((ew * ew)) * 0.5)); 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], -5e-270], N[Exp[N[(N[Log[N[(ew * ew), $MachinePrecision]], $MachinePrecision] * 0.5), $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 -5 \cdot 10^{-270}:\\
\;\;\;\;e^{\log \left(ew \cdot ew\right) \cdot 0.5}\\
\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))))) < -4.9999999999999998e-270Initial program 99.8%
Applied rewrites39.0%
Taylor expanded in t around 0
unpow2N/A
lower-*.f6422.9
Applied rewrites22.9%
if -4.9999999999999998e-270 < (-.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.8%
Applied rewrites76.6%
Taylor expanded in t around 0
lower-+.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
distribute-rgt-outN/A
metadata-evalN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6433.0
Applied rewrites33.0%
Taylor expanded in eh around 0
*-commutativeN/A
lower-*.f64N/A
lower-cos.f6461.6
Applied rewrites61.6%
Final simplification41.8%
(FPCore (eh ew t) :precision binary64 (fabs (- (* (* eh (sin t)) (sin (atan (/ (* (- eh) t) ew)))) (* (* (cos t) ew) (cos (atan (* (/ (tan t) ew) eh)))))))
double code(double eh, double ew, double t) {
return fabs((((eh * sin(t)) * sin(atan(((-eh * t) / ew)))) - ((cos(t) * ew) * cos(atan(((tan(t) / ew) * eh))))));
}
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(((-eh * t) / ew)))) - ((cos(t) * ew) * cos(atan(((tan(t) / ew) * eh))))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((((eh * Math.sin(t)) * Math.sin(Math.atan(((-eh * t) / ew)))) - ((Math.cos(t) * ew) * Math.cos(Math.atan(((Math.tan(t) / ew) * eh))))));
}
def code(eh, ew, t): return math.fabs((((eh * math.sin(t)) * math.sin(math.atan(((-eh * t) / ew)))) - ((math.cos(t) * ew) * math.cos(math.atan(((math.tan(t) / ew) * eh))))))
function code(eh, ew, t) return abs(Float64(Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(Float64(-eh) * t) / ew)))) - Float64(Float64(cos(t) * ew) * cos(atan(Float64(Float64(tan(t) / ew) * eh)))))) end
function tmp = code(eh, ew, t) tmp = abs((((eh * sin(t)) * sin(atan(((-eh * t) / ew)))) - ((cos(t) * ew) * cos(atan(((tan(t) / ew) * eh)))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[((-eh) * t), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision] * N[Cos[N[ArcTan[N[(N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot t}{ew}\right) - \left(\cos t \cdot ew\right) \cdot \cos \tan^{-1} \left(\frac{\tan t}{ew} \cdot eh\right)\right|
\end{array}
Initial program 99.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.8
lift-cos.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
lift-atan.f64N/A
atan-neg-revN/A
lower-atan.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-neg.f64N/A
distribute-lft-neg-outN/A
remove-double-negN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in t around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower-*.f6499.0
Applied rewrites99.0%
Final simplification99.0%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* eh (/ (tan t) ew))))
(if (or (<= eh -1.35e+69) (not (<= eh 2.2e-6)))
(fabs
(-
(* (* eh (sin t)) (sin (atan (/ (* (- eh) t) ew))))
(*
(* (cos t) ew)
(cos (atan (* (/ (fma 0.3333333333333333 (* (* t t) eh) eh) ew) t))))))
(fabs (/ (fma (* t_1 eh) (sin t) (* ew (cos t))) (cosh (asinh t_1)))))))
double code(double eh, double ew, double t) {
double t_1 = eh * (tan(t) / ew);
double tmp;
if ((eh <= -1.35e+69) || !(eh <= 2.2e-6)) {
tmp = fabs((((eh * sin(t)) * sin(atan(((-eh * t) / ew)))) - ((cos(t) * ew) * cos(atan(((fma(0.3333333333333333, ((t * t) * eh), eh) / ew) * t))))));
} else {
tmp = fabs((fma((t_1 * eh), sin(t), (ew * cos(t))) / 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.35e+69) || !(eh <= 2.2e-6)) tmp = abs(Float64(Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(Float64(-eh) * t) / ew)))) - Float64(Float64(cos(t) * ew) * cos(atan(Float64(Float64(fma(0.3333333333333333, Float64(Float64(t * t) * eh), eh) / ew) * t)))))); else tmp = abs(Float64(fma(Float64(t_1 * eh), sin(t), Float64(ew * cos(t))) / 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.35e+69], N[Not[LessEqual[eh, 2.2e-6]], $MachinePrecision]], N[Abs[N[(N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[((-eh) * t), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision] * N[Cos[N[ArcTan[N[(N[(N[(0.3333333333333333 * N[(N[(t * t), $MachinePrecision] * eh), $MachinePrecision] + eh), $MachinePrecision] / ew), $MachinePrecision] * t), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(t$95$1 * eh), $MachinePrecision] * N[Sin[t], $MachinePrecision] + N[(ew * N[Cos[t], $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.35 \cdot 10^{+69} \lor \neg \left(eh \leq 2.2 \cdot 10^{-6}\right):\\
\;\;\;\;\left|\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot t}{ew}\right) - \left(\cos t \cdot ew\right) \cdot \cos \tan^{-1} \left(\frac{\mathsf{fma}\left(0.3333333333333333, \left(t \cdot t\right) \cdot eh, eh\right)}{ew} \cdot t\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(t\_1 \cdot eh, \sin t, ew \cdot \cos t\right)}{\cosh \sinh^{-1} t\_1}\right|\\
\end{array}
\end{array}
if eh < -1.3499999999999999e69 or 2.2000000000000001e-6 < eh Initial program 99.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.8
lift-cos.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
lift-atan.f64N/A
atan-neg-revN/A
lower-atan.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-neg.f64N/A
distribute-lft-neg-outN/A
remove-double-negN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in t around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower-*.f6499.2
Applied rewrites99.2%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
associate-*r/N/A
div-add-revN/A
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6493.9
Applied rewrites93.9%
if -1.3499999999999999e69 < eh < 2.2000000000000001e-6Initial program 99.8%
Applied rewrites50.6%
Applied rewrites98.2%
Final simplification96.2%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* ew (cos t)))
(t_2 (* eh (/ (tan t) ew)))
(t_3 (* (- eh) (sin t))))
(if (or (<= eh -3.3e+82) (not (<= eh 1.45e+96)))
(fabs (* t_3 (sin (atan (/ t_3 t_1)))))
(fabs (/ (fma (* t_2 eh) (sin t) t_1) (cosh (asinh t_2)))))))
double code(double eh, double ew, double t) {
double t_1 = ew * cos(t);
double t_2 = eh * (tan(t) / ew);
double t_3 = -eh * sin(t);
double tmp;
if ((eh <= -3.3e+82) || !(eh <= 1.45e+96)) {
tmp = fabs((t_3 * sin(atan((t_3 / t_1)))));
} else {
tmp = fabs((fma((t_2 * eh), sin(t), t_1) / cosh(asinh(t_2))));
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(ew * cos(t)) t_2 = Float64(eh * Float64(tan(t) / ew)) t_3 = Float64(Float64(-eh) * sin(t)) tmp = 0.0 if ((eh <= -3.3e+82) || !(eh <= 1.45e+96)) tmp = abs(Float64(t_3 * sin(atan(Float64(t_3 / t_1))))); else tmp = abs(Float64(fma(Float64(t_2 * eh), sin(t), t_1) / cosh(asinh(t_2)))); end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(eh * N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[((-eh) * N[Sin[t], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[eh, -3.3e+82], N[Not[LessEqual[eh, 1.45e+96]], $MachinePrecision]], N[Abs[N[(t$95$3 * N[Sin[N[ArcTan[N[(t$95$3 / t$95$1), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(t$95$2 * eh), $MachinePrecision] * N[Sin[t], $MachinePrecision] + t$95$1), $MachinePrecision] / N[Cosh[N[ArcSinh[t$95$2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := ew \cdot \cos t\\
t_2 := eh \cdot \frac{\tan t}{ew}\\
t_3 := \left(-eh\right) \cdot \sin t\\
\mathbf{if}\;eh \leq -3.3 \cdot 10^{+82} \lor \neg \left(eh \leq 1.45 \cdot 10^{+96}\right):\\
\;\;\;\;\left|t\_3 \cdot \sin \tan^{-1} \left(\frac{t\_3}{t\_1}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(t\_2 \cdot eh, \sin t, t\_1\right)}{\cosh \sinh^{-1} t\_2}\right|\\
\end{array}
\end{array}
if eh < -3.2999999999999998e82 or 1.44999999999999989e96 < eh Initial program 99.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.8
lift-cos.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
lift-atan.f64N/A
atan-neg-revN/A
lower-atan.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-neg.f64N/A
distribute-lft-neg-outN/A
remove-double-negN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in eh around inf
mul-1-negN/A
lower-neg.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-cos.f6476.3
Applied rewrites76.3%
if -3.2999999999999998e82 < eh < 1.44999999999999989e96Initial program 99.8%
Applied rewrites49.8%
Applied rewrites96.2%
Final simplification88.7%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ (tan t) ew)) (t_2 (* (- eh) (sin t))))
(if (or (<= eh -3.3e+82) (not (<= eh 1.45e+96)))
(fabs (* t_2 (sin (atan (/ t_2 (* ew (cos t)))))))
(fabs
(/
(fma (sin t) (* t_1 (* eh eh)) (* (cos t) ew))
(cosh (asinh (* t_1 eh))))))))
double code(double eh, double ew, double t) {
double t_1 = tan(t) / ew;
double t_2 = -eh * sin(t);
double tmp;
if ((eh <= -3.3e+82) || !(eh <= 1.45e+96)) {
tmp = fabs((t_2 * sin(atan((t_2 / (ew * cos(t)))))));
} else {
tmp = fabs((fma(sin(t), (t_1 * (eh * eh)), (cos(t) * ew)) / cosh(asinh((t_1 * eh)))));
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(tan(t) / ew) t_2 = Float64(Float64(-eh) * sin(t)) tmp = 0.0 if ((eh <= -3.3e+82) || !(eh <= 1.45e+96)) tmp = abs(Float64(t_2 * sin(atan(Float64(t_2 / Float64(ew * cos(t))))))); else tmp = abs(Float64(fma(sin(t), Float64(t_1 * Float64(eh * eh)), Float64(cos(t) * ew)) / cosh(asinh(Float64(t_1 * eh))))); end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision]}, Block[{t$95$2 = N[((-eh) * N[Sin[t], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[eh, -3.3e+82], N[Not[LessEqual[eh, 1.45e+96]], $MachinePrecision]], N[Abs[N[(t$95$2 * N[Sin[N[ArcTan[N[(t$95$2 / N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[Sin[t], $MachinePrecision] * N[(t$95$1 * N[(eh * eh), $MachinePrecision]), $MachinePrecision] + N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision] / N[Cosh[N[ArcSinh[N[(t$95$1 * eh), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\tan t}{ew}\\
t_2 := \left(-eh\right) \cdot \sin t\\
\mathbf{if}\;eh \leq -3.3 \cdot 10^{+82} \lor \neg \left(eh \leq 1.45 \cdot 10^{+96}\right):\\
\;\;\;\;\left|t\_2 \cdot \sin \tan^{-1} \left(\frac{t\_2}{ew \cdot \cos t}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(\sin t, t\_1 \cdot \left(eh \cdot eh\right), \cos t \cdot ew\right)}{\cosh \sinh^{-1} \left(t\_1 \cdot eh\right)}\right|\\
\end{array}
\end{array}
if eh < -3.2999999999999998e82 or 1.44999999999999989e96 < eh Initial program 99.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.8
lift-cos.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
lift-atan.f64N/A
atan-neg-revN/A
lower-atan.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-neg.f64N/A
distribute-lft-neg-outN/A
remove-double-negN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in eh around inf
mul-1-negN/A
lower-neg.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-cos.f6476.3
Applied rewrites76.3%
if -3.2999999999999998e82 < eh < 1.44999999999999989e96Initial program 99.8%
Applied rewrites93.4%
Final simplification86.9%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* ew (cos t))) (t_2 (* (- eh) (sin t))))
(if (or (<= eh -2.1e+77) (not (<= eh 3.2e+18)))
(fabs (* t_2 (sin (atan (/ t_2 t_1)))))
(fabs (* t_1 (cos (atan (/ (* eh (sin t)) t_1))))))))
double code(double eh, double ew, double t) {
double t_1 = ew * cos(t);
double t_2 = -eh * sin(t);
double tmp;
if ((eh <= -2.1e+77) || !(eh <= 3.2e+18)) {
tmp = fabs((t_2 * sin(atan((t_2 / t_1)))));
} else {
tmp = fabs((t_1 * cos(atan(((eh * sin(t)) / t_1)))));
}
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 = ew * cos(t)
t_2 = -eh * sin(t)
if ((eh <= (-2.1d+77)) .or. (.not. (eh <= 3.2d+18))) then
tmp = abs((t_2 * sin(atan((t_2 / t_1)))))
else
tmp = abs((t_1 * cos(atan(((eh * sin(t)) / t_1)))))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = ew * Math.cos(t);
double t_2 = -eh * Math.sin(t);
double tmp;
if ((eh <= -2.1e+77) || !(eh <= 3.2e+18)) {
tmp = Math.abs((t_2 * Math.sin(Math.atan((t_2 / t_1)))));
} else {
tmp = Math.abs((t_1 * Math.cos(Math.atan(((eh * Math.sin(t)) / t_1)))));
}
return tmp;
}
def code(eh, ew, t): t_1 = ew * math.cos(t) t_2 = -eh * math.sin(t) tmp = 0 if (eh <= -2.1e+77) or not (eh <= 3.2e+18): tmp = math.fabs((t_2 * math.sin(math.atan((t_2 / t_1))))) else: tmp = math.fabs((t_1 * math.cos(math.atan(((eh * math.sin(t)) / t_1))))) return tmp
function code(eh, ew, t) t_1 = Float64(ew * cos(t)) t_2 = Float64(Float64(-eh) * sin(t)) tmp = 0.0 if ((eh <= -2.1e+77) || !(eh <= 3.2e+18)) tmp = abs(Float64(t_2 * sin(atan(Float64(t_2 / t_1))))); else tmp = abs(Float64(t_1 * cos(atan(Float64(Float64(eh * sin(t)) / t_1))))); end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = ew * cos(t); t_2 = -eh * sin(t); tmp = 0.0; if ((eh <= -2.1e+77) || ~((eh <= 3.2e+18))) tmp = abs((t_2 * sin(atan((t_2 / t_1))))); else tmp = abs((t_1 * cos(atan(((eh * sin(t)) / t_1))))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[((-eh) * N[Sin[t], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[eh, -2.1e+77], N[Not[LessEqual[eh, 3.2e+18]], $MachinePrecision]], N[Abs[N[(t$95$2 * N[Sin[N[ArcTan[N[(t$95$2 / t$95$1), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(t$95$1 * N[Cos[N[ArcTan[N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := ew \cdot \cos t\\
t_2 := \left(-eh\right) \cdot \sin t\\
\mathbf{if}\;eh \leq -2.1 \cdot 10^{+77} \lor \neg \left(eh \leq 3.2 \cdot 10^{+18}\right):\\
\;\;\;\;\left|t\_2 \cdot \sin \tan^{-1} \left(\frac{t\_2}{t\_1}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|t\_1 \cdot \cos \tan^{-1} \left(\frac{eh \cdot \sin t}{t\_1}\right)\right|\\
\end{array}
\end{array}
if eh < -2.0999999999999999e77 or 3.2e18 < eh Initial program 99.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.8
lift-cos.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
lift-atan.f64N/A
atan-neg-revN/A
lower-atan.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-neg.f64N/A
distribute-lft-neg-outN/A
remove-double-negN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in eh around inf
mul-1-negN/A
lower-neg.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-cos.f6474.2
Applied rewrites74.2%
if -2.0999999999999999e77 < eh < 3.2e18Initial program 99.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.8
lift-cos.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
lift-atan.f64N/A
atan-neg-revN/A
lower-atan.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-neg.f64N/A
distribute-lft-neg-outN/A
remove-double-negN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in eh around 0
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
lower-atan.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-cos.f6480.0
Applied rewrites80.0%
Final simplification77.5%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (* ew (cos t)))) (fabs (* t_1 (cos (atan (/ (* eh (sin t)) t_1)))))))
double code(double eh, double ew, double t) {
double t_1 = ew * cos(t);
return fabs((t_1 * cos(atan(((eh * sin(t)) / 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 = ew * cos(t)
code = abs((t_1 * cos(atan(((eh * sin(t)) / t_1)))))
end function
public static double code(double eh, double ew, double t) {
double t_1 = ew * Math.cos(t);
return Math.abs((t_1 * Math.cos(Math.atan(((eh * Math.sin(t)) / t_1)))));
}
def code(eh, ew, t): t_1 = ew * math.cos(t) return math.fabs((t_1 * math.cos(math.atan(((eh * math.sin(t)) / t_1)))))
function code(eh, ew, t) t_1 = Float64(ew * cos(t)) return abs(Float64(t_1 * cos(atan(Float64(Float64(eh * sin(t)) / t_1))))) end
function tmp = code(eh, ew, t) t_1 = ew * cos(t); tmp = abs((t_1 * cos(atan(((eh * sin(t)) / t_1))))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]}, N[Abs[N[(t$95$1 * N[Cos[N[ArcTan[N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := ew \cdot \cos t\\
\left|t\_1 \cdot \cos \tan^{-1} \left(\frac{eh \cdot \sin t}{t\_1}\right)\right|
\end{array}
\end{array}
Initial program 99.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.8
lift-cos.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
lift-atan.f64N/A
atan-neg-revN/A
lower-atan.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-neg.f64N/A
distribute-lft-neg-outN/A
remove-double-negN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in eh around 0
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
lower-atan.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-cos.f6458.1
Applied rewrites58.1%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (log (pow (cos t) 2.0))))
(if (<= ew -4e-310)
(exp (* (+ t_1 (* -2.0 (log (/ -1.0 ew)))) 0.5))
(exp (* (- t_1 (* -2.0 (log ew))) 0.5)))))
double code(double eh, double ew, double t) {
double t_1 = log(pow(cos(t), 2.0));
double tmp;
if (ew <= -4e-310) {
tmp = exp(((t_1 + (-2.0 * log((-1.0 / ew)))) * 0.5));
} else {
tmp = exp(((t_1 - (-2.0 * log(ew))) * 0.5));
}
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 = log((cos(t) ** 2.0d0))
if (ew <= (-4d-310)) then
tmp = exp(((t_1 + ((-2.0d0) * log(((-1.0d0) / ew)))) * 0.5d0))
else
tmp = exp(((t_1 - ((-2.0d0) * log(ew))) * 0.5d0))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.log(Math.pow(Math.cos(t), 2.0));
double tmp;
if (ew <= -4e-310) {
tmp = Math.exp(((t_1 + (-2.0 * Math.log((-1.0 / ew)))) * 0.5));
} else {
tmp = Math.exp(((t_1 - (-2.0 * Math.log(ew))) * 0.5));
}
return tmp;
}
def code(eh, ew, t): t_1 = math.log(math.pow(math.cos(t), 2.0)) tmp = 0 if ew <= -4e-310: tmp = math.exp(((t_1 + (-2.0 * math.log((-1.0 / ew)))) * 0.5)) else: tmp = math.exp(((t_1 - (-2.0 * math.log(ew))) * 0.5)) return tmp
function code(eh, ew, t) t_1 = log((cos(t) ^ 2.0)) tmp = 0.0 if (ew <= -4e-310) tmp = exp(Float64(Float64(t_1 + Float64(-2.0 * log(Float64(-1.0 / ew)))) * 0.5)); else tmp = exp(Float64(Float64(t_1 - Float64(-2.0 * log(ew))) * 0.5)); end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = log((cos(t) ^ 2.0)); tmp = 0.0; if (ew <= -4e-310) tmp = exp(((t_1 + (-2.0 * log((-1.0 / ew)))) * 0.5)); else tmp = exp(((t_1 - (-2.0 * log(ew))) * 0.5)); end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Log[N[Power[N[Cos[t], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[ew, -4e-310], N[Exp[N[(N[(t$95$1 + N[(-2.0 * N[Log[N[(-1.0 / ew), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]], $MachinePrecision], N[Exp[N[(N[(t$95$1 - N[(-2.0 * N[Log[ew], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log \left({\cos t}^{2}\right)\\
\mathbf{if}\;ew \leq -4 \cdot 10^{-310}:\\
\;\;\;\;e^{\left(t\_1 + -2 \cdot \log \left(\frac{-1}{ew}\right)\right) \cdot 0.5}\\
\mathbf{else}:\\
\;\;\;\;e^{\left(t\_1 - -2 \cdot \log ew\right) \cdot 0.5}\\
\end{array}
\end{array}
if ew < -3.999999999999988e-310Initial program 99.7%
Applied rewrites36.8%
Taylor expanded in ew around -inf
lower-+.f64N/A
lower-log.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-/.f6453.4
Applied rewrites53.4%
if -3.999999999999988e-310 < ew Initial program 99.8%
Applied rewrites40.0%
Taylor expanded in ew around inf
lower-+.f64N/A
lower-log.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
log-recN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-log.f6453.5
Applied rewrites53.5%
Final simplification53.4%
(FPCore (eh ew t) :precision binary64 (* (cos t) ew))
double code(double eh, double ew, double t) {
return cos(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 = cos(t) * ew
end function
public static double code(double eh, double ew, double t) {
return Math.cos(t) * ew;
}
def code(eh, ew, t): return math.cos(t) * ew
function code(eh, ew, t) return Float64(cos(t) * ew) end
function tmp = code(eh, ew, t) tmp = cos(t) * ew; end
code[eh_, ew_, t_] := N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision]
\begin{array}{l}
\\
\cos t \cdot ew
\end{array}
Initial program 99.8%
Applied rewrites38.1%
Taylor expanded in t around 0
lower-+.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
distribute-rgt-outN/A
metadata-evalN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6417.2
Applied rewrites17.2%
Taylor expanded in eh around 0
*-commutativeN/A
lower-*.f64N/A
lower-cos.f6431.0
Applied rewrites31.0%
(FPCore (eh ew t) :precision binary64 (fma (* (* ew t) t) -0.5 ew))
double code(double eh, double ew, double t) {
return fma(((ew * t) * t), -0.5, ew);
}
function code(eh, ew, t) return fma(Float64(Float64(ew * t) * t), -0.5, ew) end
code[eh_, ew_, t_] := N[(N[(N[(ew * t), $MachinePrecision] * t), $MachinePrecision] * -0.5 + ew), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\left(ew \cdot t\right) \cdot t, -0.5, ew\right)
\end{array}
Initial program 99.8%
Applied rewrites38.1%
Taylor expanded in t around 0
lower-+.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
distribute-rgt-outN/A
metadata-evalN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6417.2
Applied rewrites17.2%
Taylor expanded in eh around 0
Applied rewrites19.3%
Applied rewrites19.4%
(FPCore (eh ew t) :precision binary64 (* -0.5 (* ew (* t t))))
double code(double eh, double ew, double t) {
return -0.5 * (ew * (t * t));
}
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 = (-0.5d0) * (ew * (t * t))
end function
public static double code(double eh, double ew, double t) {
return -0.5 * (ew * (t * t));
}
def code(eh, ew, t): return -0.5 * (ew * (t * t))
function code(eh, ew, t) return Float64(-0.5 * Float64(ew * Float64(t * t))) end
function tmp = code(eh, ew, t) tmp = -0.5 * (ew * (t * t)); end
code[eh_, ew_, t_] := N[(-0.5 * N[(ew * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-0.5 \cdot \left(ew \cdot \left(t \cdot t\right)\right)
\end{array}
Initial program 99.8%
Applied rewrites38.1%
Taylor expanded in t around 0
lower-+.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
distribute-rgt-outN/A
metadata-evalN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6417.2
Applied rewrites17.2%
Taylor expanded in eh around 0
Applied rewrites19.3%
Taylor expanded in t around inf
Applied rewrites3.4%
herbie shell --seed 2024352
(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)))))))