
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (atan (/ (/ eh ew) (tan t))))) (fabs (+ (* (* ew (sin t)) (cos t_1)) (* (* eh (cos t)) (sin t_1))))))
double code(double eh, double ew, double t) {
double t_1 = atan(((eh / ew) / tan(t)));
return fabs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))));
}
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 / ew) / tan(t)))
code = abs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))))
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.atan(((eh / ew) / Math.tan(t)));
return Math.abs((((ew * Math.sin(t)) * Math.cos(t_1)) + ((eh * Math.cos(t)) * Math.sin(t_1))));
}
def code(eh, ew, t): t_1 = math.atan(((eh / ew) / math.tan(t))) return math.fabs((((ew * math.sin(t)) * math.cos(t_1)) + ((eh * math.cos(t)) * math.sin(t_1))))
function code(eh, ew, t) t_1 = atan(Float64(Float64(eh / ew) / tan(t))) return abs(Float64(Float64(Float64(ew * sin(t)) * cos(t_1)) + Float64(Float64(eh * cos(t)) * sin(t_1)))) end
function tmp = code(eh, ew, t) t_1 = atan(((eh / ew) / tan(t))); tmp = abs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1)))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\
\left|\left(ew \cdot \sin t\right) \cdot \cos t\_1 + \left(eh \cdot \cos t\right) \cdot \sin t\_1\right|
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (atan (/ (/ eh ew) (tan t))))) (fabs (+ (* (* ew (sin t)) (cos t_1)) (* (* eh (cos t)) (sin t_1))))))
double code(double eh, double ew, double t) {
double t_1 = atan(((eh / ew) / tan(t)));
return fabs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))));
}
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 / ew) / tan(t)))
code = abs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))))
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.atan(((eh / ew) / Math.tan(t)));
return Math.abs((((ew * Math.sin(t)) * Math.cos(t_1)) + ((eh * Math.cos(t)) * Math.sin(t_1))));
}
def code(eh, ew, t): t_1 = math.atan(((eh / ew) / math.tan(t))) return math.fabs((((ew * math.sin(t)) * math.cos(t_1)) + ((eh * math.cos(t)) * math.sin(t_1))))
function code(eh, ew, t) t_1 = atan(Float64(Float64(eh / ew) / tan(t))) return abs(Float64(Float64(Float64(ew * sin(t)) * cos(t_1)) + Float64(Float64(eh * cos(t)) * sin(t_1)))) end
function tmp = code(eh, ew, t) t_1 = atan(((eh / ew) / tan(t))); tmp = abs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1)))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\
\left|\left(ew \cdot \sin t\right) \cdot \cos t\_1 + \left(eh \cdot \cos t\right) \cdot \sin t\_1\right|
\end{array}
\end{array}
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (atan (/ (/ eh ew) (tan t))))) (fabs (+ (* (* eh (cos t)) (sin t_1)) (* (* ew (sin t)) (cos t_1))))))
double code(double eh, double ew, double t) {
double t_1 = atan(((eh / ew) / tan(t)));
return fabs((((eh * cos(t)) * sin(t_1)) + ((ew * sin(t)) * cos(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 / ew) / tan(t)))
code = abs((((eh * cos(t)) * sin(t_1)) + ((ew * sin(t)) * cos(t_1))))
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.atan(((eh / ew) / Math.tan(t)));
return Math.abs((((eh * Math.cos(t)) * Math.sin(t_1)) + ((ew * Math.sin(t)) * Math.cos(t_1))));
}
def code(eh, ew, t): t_1 = math.atan(((eh / ew) / math.tan(t))) return math.fabs((((eh * math.cos(t)) * math.sin(t_1)) + ((ew * math.sin(t)) * math.cos(t_1))))
function code(eh, ew, t) t_1 = atan(Float64(Float64(eh / ew) / tan(t))) return abs(Float64(Float64(Float64(eh * cos(t)) * sin(t_1)) + Float64(Float64(ew * sin(t)) * cos(t_1)))) end
function tmp = code(eh, ew, t) t_1 = atan(((eh / ew) / tan(t))); tmp = abs((((eh * cos(t)) * sin(t_1)) + ((ew * sin(t)) * cos(t_1)))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision] + N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\
\left|\left(eh \cdot \cos t\right) \cdot \sin t\_1 + \left(ew \cdot \sin t\right) \cdot \cos t\_1\right|
\end{array}
\end{array}
Initial program 99.8%
Final simplification99.8%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ (/ eh (tan t)) ew)) (t_2 (asinh t_1)))
(if (or (<= eh -1.2e-80) (not (<= eh 7.8e-108)))
(fabs
(*
(*
(fma
(tanh t_2)
(/ (cos t) ew)
(* (/ (sin t) eh) (cos (atan (/ (/ eh ew) t)))))
ew)
eh))
(fabs (/ (+ (* (sin t) ew) (* eh (* (cos t) t_1))) (cosh t_2))))))
double code(double eh, double ew, double t) {
double t_1 = (eh / tan(t)) / ew;
double t_2 = asinh(t_1);
double tmp;
if ((eh <= -1.2e-80) || !(eh <= 7.8e-108)) {
tmp = fabs(((fma(tanh(t_2), (cos(t) / ew), ((sin(t) / eh) * cos(atan(((eh / ew) / t))))) * ew) * eh));
} else {
tmp = fabs((((sin(t) * ew) + (eh * (cos(t) * t_1))) / cosh(t_2)));
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(Float64(eh / tan(t)) / ew) t_2 = asinh(t_1) tmp = 0.0 if ((eh <= -1.2e-80) || !(eh <= 7.8e-108)) tmp = abs(Float64(Float64(fma(tanh(t_2), Float64(cos(t) / ew), Float64(Float64(sin(t) / eh) * cos(atan(Float64(Float64(eh / ew) / t))))) * ew) * eh)); else tmp = abs(Float64(Float64(Float64(sin(t) * ew) + Float64(eh * Float64(cos(t) * t_1))) / cosh(t_2))); end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[(eh / N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]}, Block[{t$95$2 = N[ArcSinh[t$95$1], $MachinePrecision]}, If[Or[LessEqual[eh, -1.2e-80], N[Not[LessEqual[eh, 7.8e-108]], $MachinePrecision]], N[Abs[N[(N[(N[(N[Tanh[t$95$2], $MachinePrecision] * N[(N[Cos[t], $MachinePrecision] / ew), $MachinePrecision] + N[(N[(N[Sin[t], $MachinePrecision] / eh), $MachinePrecision] * N[Cos[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * ew), $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision] + N[(eh * N[(N[Cos[t], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Cosh[t$95$2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{eh}{\tan t}}{ew}\\
t_2 := \sinh^{-1} t\_1\\
\mathbf{if}\;eh \leq -1.2 \cdot 10^{-80} \lor \neg \left(eh \leq 7.8 \cdot 10^{-108}\right):\\
\;\;\;\;\left|\left(\mathsf{fma}\left(\tanh t\_2, \frac{\cos t}{ew}, \frac{\sin t}{eh} \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{t}\right)\right) \cdot ew\right) \cdot eh\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\sin t \cdot ew + eh \cdot \left(\cos t \cdot t\_1\right)}{\cosh t\_2}\right|\\
\end{array}
\end{array}
if eh < -1.2e-80 or 7.79999999999999989e-108 < eh Initial program 99.8%
Taylor expanded in eh around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.7%
Taylor expanded in ew around inf
Applied rewrites99.0%
Applied rewrites99.6%
Taylor expanded in t around 0
Applied rewrites99.4%
if -1.2e-80 < eh < 7.79999999999999989e-108Initial program 99.8%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lift-*.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
associate-*l/N/A
lift-sin.f64N/A
Applied rewrites97.5%
Final simplification98.8%
(FPCore (eh ew t)
:precision binary64
(if (or (<= ew -5.05e-57) (not (<= ew 1.5e-199)))
(fabs
(+
(* (* eh (cos t)) (sin (atan (/ (/ eh ew) t))))
(* (* ew (sin t)) (cos (atan (/ (/ eh ew) (tan t)))))))
(fabs (* (sin (atan (* (/ (cos t) ew) (/ eh (sin t))))) (* (cos t) eh)))))
double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -5.05e-57) || !(ew <= 1.5e-199)) {
tmp = fabs((((eh * cos(t)) * sin(atan(((eh / ew) / t)))) + ((ew * sin(t)) * cos(atan(((eh / ew) / tan(t)))))));
} else {
tmp = fabs((sin(atan(((cos(t) / ew) * (eh / sin(t))))) * (cos(t) * eh)));
}
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) :: tmp
if ((ew <= (-5.05d-57)) .or. (.not. (ew <= 1.5d-199))) then
tmp = abs((((eh * cos(t)) * sin(atan(((eh / ew) / t)))) + ((ew * sin(t)) * cos(atan(((eh / ew) / tan(t)))))))
else
tmp = abs((sin(atan(((cos(t) / ew) * (eh / sin(t))))) * (cos(t) * eh)))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -5.05e-57) || !(ew <= 1.5e-199)) {
tmp = Math.abs((((eh * Math.cos(t)) * Math.sin(Math.atan(((eh / ew) / t)))) + ((ew * Math.sin(t)) * Math.cos(Math.atan(((eh / ew) / Math.tan(t)))))));
} else {
tmp = Math.abs((Math.sin(Math.atan(((Math.cos(t) / ew) * (eh / Math.sin(t))))) * (Math.cos(t) * eh)));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (ew <= -5.05e-57) or not (ew <= 1.5e-199): tmp = math.fabs((((eh * math.cos(t)) * math.sin(math.atan(((eh / ew) / t)))) + ((ew * math.sin(t)) * math.cos(math.atan(((eh / ew) / math.tan(t))))))) else: tmp = math.fabs((math.sin(math.atan(((math.cos(t) / ew) * (eh / math.sin(t))))) * (math.cos(t) * eh))) return tmp
function code(eh, ew, t) tmp = 0.0 if ((ew <= -5.05e-57) || !(ew <= 1.5e-199)) tmp = abs(Float64(Float64(Float64(eh * cos(t)) * sin(atan(Float64(Float64(eh / ew) / t)))) + Float64(Float64(ew * sin(t)) * cos(atan(Float64(Float64(eh / ew) / tan(t))))))); else tmp = abs(Float64(sin(atan(Float64(Float64(cos(t) / ew) * Float64(eh / sin(t))))) * Float64(cos(t) * eh))); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((ew <= -5.05e-57) || ~((ew <= 1.5e-199))) tmp = abs((((eh * cos(t)) * sin(atan(((eh / ew) / t)))) + ((ew * sin(t)) * cos(atan(((eh / ew) / tan(t))))))); else tmp = abs((sin(atan(((cos(t) / ew) * (eh / sin(t))))) * (cos(t) * eh))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[ew, -5.05e-57], N[Not[LessEqual[ew, 1.5e-199]], $MachinePrecision]], N[Abs[N[(N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[Sin[N[ArcTan[N[(N[(N[Cos[t], $MachinePrecision] / ew), $MachinePrecision] * N[(eh / N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -5.05 \cdot 10^{-57} \lor \neg \left(ew \leq 1.5 \cdot 10^{-199}\right):\\
\;\;\;\;\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{t}\right) + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\sin \tan^{-1} \left(\frac{\cos t}{ew} \cdot \frac{eh}{\sin t}\right) \cdot \left(\cos t \cdot eh\right)\right|\\
\end{array}
\end{array}
if ew < -5.05000000000000008e-57 or 1.49999999999999992e-199 < ew Initial program 99.8%
Taylor expanded in t around 0
associate-/r*N/A
lower-/.f64N/A
lower-/.f6490.9
Applied rewrites90.9%
if -5.05000000000000008e-57 < ew < 1.49999999999999992e-199Initial program 99.8%
Taylor expanded in eh around inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f6495.1
Applied rewrites95.1%
Final simplification92.2%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ (/ eh (tan t)) ew)))
(if (or (<= eh -7.8e-29) (not (<= eh 0.000108)))
(fabs (* (sin (atan (* (/ (cos t) ew) (/ eh (sin t))))) (* (cos t) eh)))
(fabs (/ (+ (* (sin t) ew) (* eh (* (cos t) t_1))) (cosh (asinh t_1)))))))
double code(double eh, double ew, double t) {
double t_1 = (eh / tan(t)) / ew;
double tmp;
if ((eh <= -7.8e-29) || !(eh <= 0.000108)) {
tmp = fabs((sin(atan(((cos(t) / ew) * (eh / sin(t))))) * (cos(t) * eh)));
} else {
tmp = fabs((((sin(t) * ew) + (eh * (cos(t) * t_1))) / cosh(asinh(t_1))));
}
return tmp;
}
def code(eh, ew, t): t_1 = (eh / math.tan(t)) / ew tmp = 0 if (eh <= -7.8e-29) or not (eh <= 0.000108): tmp = math.fabs((math.sin(math.atan(((math.cos(t) / ew) * (eh / math.sin(t))))) * (math.cos(t) * eh))) else: tmp = math.fabs((((math.sin(t) * ew) + (eh * (math.cos(t) * t_1))) / math.cosh(math.asinh(t_1)))) return tmp
function code(eh, ew, t) t_1 = Float64(Float64(eh / tan(t)) / ew) tmp = 0.0 if ((eh <= -7.8e-29) || !(eh <= 0.000108)) tmp = abs(Float64(sin(atan(Float64(Float64(cos(t) / ew) * Float64(eh / sin(t))))) * Float64(cos(t) * eh))); else tmp = abs(Float64(Float64(Float64(sin(t) * ew) + Float64(eh * Float64(cos(t) * t_1))) / cosh(asinh(t_1)))); end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = (eh / tan(t)) / ew; tmp = 0.0; if ((eh <= -7.8e-29) || ~((eh <= 0.000108))) tmp = abs((sin(atan(((cos(t) / ew) * (eh / sin(t))))) * (cos(t) * eh))); else tmp = abs((((sin(t) * ew) + (eh * (cos(t) * t_1))) / cosh(asinh(t_1)))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[(eh / N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]}, If[Or[LessEqual[eh, -7.8e-29], N[Not[LessEqual[eh, 0.000108]], $MachinePrecision]], N[Abs[N[(N[Sin[N[ArcTan[N[(N[(N[Cos[t], $MachinePrecision] / ew), $MachinePrecision] * N[(eh / N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision] + N[(eh * N[(N[Cos[t], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Cosh[N[ArcSinh[t$95$1], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{eh}{\tan t}}{ew}\\
\mathbf{if}\;eh \leq -7.8 \cdot 10^{-29} \lor \neg \left(eh \leq 0.000108\right):\\
\;\;\;\;\left|\sin \tan^{-1} \left(\frac{\cos t}{ew} \cdot \frac{eh}{\sin t}\right) \cdot \left(\cos t \cdot eh\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\sin t \cdot ew + eh \cdot \left(\cos t \cdot t\_1\right)}{\cosh \sinh^{-1} t\_1}\right|\\
\end{array}
\end{array}
if eh < -7.7999999999999995e-29 or 1.08e-4 < eh Initial program 99.7%
Taylor expanded in eh around inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f6487.4
Applied rewrites87.4%
if -7.7999999999999995e-29 < eh < 1.08e-4Initial program 99.8%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lift-*.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
associate-*l/N/A
lift-sin.f64N/A
Applied rewrites95.2%
Final simplification90.6%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ (/ eh (tan t)) ew)))
(if (or (<= eh -7.8e-29) (not (<= eh 0.000108)))
(fabs (* (sin (atan (* (/ (cos t) ew) (/ eh (sin t))))) (* (cos t) eh)))
(fabs (/ (fma (* (cos t) t_1) eh (* (sin t) ew)) (cosh (asinh t_1)))))))
double code(double eh, double ew, double t) {
double t_1 = (eh / tan(t)) / ew;
double tmp;
if ((eh <= -7.8e-29) || !(eh <= 0.000108)) {
tmp = fabs((sin(atan(((cos(t) / ew) * (eh / sin(t))))) * (cos(t) * eh)));
} else {
tmp = fabs((fma((cos(t) * t_1), eh, (sin(t) * ew)) / cosh(asinh(t_1))));
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(Float64(eh / tan(t)) / ew) tmp = 0.0 if ((eh <= -7.8e-29) || !(eh <= 0.000108)) tmp = abs(Float64(sin(atan(Float64(Float64(cos(t) / ew) * Float64(eh / sin(t))))) * Float64(cos(t) * eh))); else tmp = abs(Float64(fma(Float64(cos(t) * t_1), eh, Float64(sin(t) * ew)) / cosh(asinh(t_1)))); end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[(eh / N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]}, If[Or[LessEqual[eh, -7.8e-29], N[Not[LessEqual[eh, 0.000108]], $MachinePrecision]], N[Abs[N[(N[Sin[N[ArcTan[N[(N[(N[Cos[t], $MachinePrecision] / ew), $MachinePrecision] * N[(eh / N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(N[Cos[t], $MachinePrecision] * t$95$1), $MachinePrecision] * eh + N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision] / N[Cosh[N[ArcSinh[t$95$1], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{eh}{\tan t}}{ew}\\
\mathbf{if}\;eh \leq -7.8 \cdot 10^{-29} \lor \neg \left(eh \leq 0.000108\right):\\
\;\;\;\;\left|\sin \tan^{-1} \left(\frac{\cos t}{ew} \cdot \frac{eh}{\sin t}\right) \cdot \left(\cos t \cdot eh\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(\cos t \cdot t\_1, eh, \sin t \cdot ew\right)}{\cosh \sinh^{-1} t\_1}\right|\\
\end{array}
\end{array}
if eh < -7.7999999999999995e-29 or 1.08e-4 < eh Initial program 99.7%
Taylor expanded in eh around inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f6487.4
Applied rewrites87.4%
if -7.7999999999999995e-29 < eh < 1.08e-4Initial program 99.8%
Applied rewrites95.2%
Final simplification90.6%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ (/ eh (tan t)) ew)))
(if (or (<= eh -4.7e-55) (not (<= eh 4.2e+22)))
(fabs (* (sin (atan (* (/ (cos t) ew) (/ eh (sin t))))) (* (cos t) eh)))
(fabs
(/
(+ (* eh (* (cos t) t_1)) (* (sin t) ew))
(sqrt (+ 1.0 (pow t_1 2.0))))))))
double code(double eh, double ew, double t) {
double t_1 = (eh / tan(t)) / ew;
double tmp;
if ((eh <= -4.7e-55) || !(eh <= 4.2e+22)) {
tmp = fabs((sin(atan(((cos(t) / ew) * (eh / sin(t))))) * (cos(t) * eh)));
} else {
tmp = fabs((((eh * (cos(t) * t_1)) + (sin(t) * ew)) / sqrt((1.0 + pow(t_1, 2.0)))));
}
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 = (eh / tan(t)) / ew
if ((eh <= (-4.7d-55)) .or. (.not. (eh <= 4.2d+22))) then
tmp = abs((sin(atan(((cos(t) / ew) * (eh / sin(t))))) * (cos(t) * eh)))
else
tmp = abs((((eh * (cos(t) * t_1)) + (sin(t) * ew)) / sqrt((1.0d0 + (t_1 ** 2.0d0)))))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = (eh / Math.tan(t)) / ew;
double tmp;
if ((eh <= -4.7e-55) || !(eh <= 4.2e+22)) {
tmp = Math.abs((Math.sin(Math.atan(((Math.cos(t) / ew) * (eh / Math.sin(t))))) * (Math.cos(t) * eh)));
} else {
tmp = Math.abs((((eh * (Math.cos(t) * t_1)) + (Math.sin(t) * ew)) / Math.sqrt((1.0 + Math.pow(t_1, 2.0)))));
}
return tmp;
}
def code(eh, ew, t): t_1 = (eh / math.tan(t)) / ew tmp = 0 if (eh <= -4.7e-55) or not (eh <= 4.2e+22): tmp = math.fabs((math.sin(math.atan(((math.cos(t) / ew) * (eh / math.sin(t))))) * (math.cos(t) * eh))) else: tmp = math.fabs((((eh * (math.cos(t) * t_1)) + (math.sin(t) * ew)) / math.sqrt((1.0 + math.pow(t_1, 2.0))))) return tmp
function code(eh, ew, t) t_1 = Float64(Float64(eh / tan(t)) / ew) tmp = 0.0 if ((eh <= -4.7e-55) || !(eh <= 4.2e+22)) tmp = abs(Float64(sin(atan(Float64(Float64(cos(t) / ew) * Float64(eh / sin(t))))) * Float64(cos(t) * eh))); else tmp = abs(Float64(Float64(Float64(eh * Float64(cos(t) * t_1)) + Float64(sin(t) * ew)) / sqrt(Float64(1.0 + (t_1 ^ 2.0))))); end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = (eh / tan(t)) / ew; tmp = 0.0; if ((eh <= -4.7e-55) || ~((eh <= 4.2e+22))) tmp = abs((sin(atan(((cos(t) / ew) * (eh / sin(t))))) * (cos(t) * eh))); else tmp = abs((((eh * (cos(t) * t_1)) + (sin(t) * ew)) / sqrt((1.0 + (t_1 ^ 2.0))))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[(eh / N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]}, If[Or[LessEqual[eh, -4.7e-55], N[Not[LessEqual[eh, 4.2e+22]], $MachinePrecision]], N[Abs[N[(N[Sin[N[ArcTan[N[(N[(N[Cos[t], $MachinePrecision] / ew), $MachinePrecision] * N[(eh / N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(eh * N[(N[Cos[t], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] + N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(1.0 + N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{eh}{\tan t}}{ew}\\
\mathbf{if}\;eh \leq -4.7 \cdot 10^{-55} \lor \neg \left(eh \leq 4.2 \cdot 10^{+22}\right):\\
\;\;\;\;\left|\sin \tan^{-1} \left(\frac{\cos t}{ew} \cdot \frac{eh}{\sin t}\right) \cdot \left(\cos t \cdot eh\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{eh \cdot \left(\cos t \cdot t\_1\right) + \sin t \cdot ew}{\sqrt{1 + {t\_1}^{2}}}\right|\\
\end{array}
\end{array}
if eh < -4.7e-55 or 4.1999999999999996e22 < eh Initial program 99.8%
Taylor expanded in eh around inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f6487.5
Applied rewrites87.5%
if -4.7e-55 < eh < 4.1999999999999996e22Initial program 99.8%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lift-*.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
associate-*l/N/A
lift-sin.f64N/A
Applied rewrites94.2%
rem-square-sqrtN/A
sqrt-prodN/A
lower-sqrt.f64N/A
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
rem-square-sqrtN/A
+-commutativeN/A
lower-+.f64N/A
pow2N/A
lower-pow.f6489.7
Applied rewrites89.7%
Final simplification88.4%
(FPCore (eh ew t) :precision binary64 (if (or (<= eh -1.45e-55) (not (<= eh 4.5e-18))) (fabs (* (sin (atan (* (/ (cos t) ew) (/ eh (sin t))))) (* (cos t) eh))) (fabs (* (sin t) ew))))
double code(double eh, double ew, double t) {
double tmp;
if ((eh <= -1.45e-55) || !(eh <= 4.5e-18)) {
tmp = fabs((sin(atan(((cos(t) / ew) * (eh / sin(t))))) * (cos(t) * eh)));
} else {
tmp = fabs((sin(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) :: tmp
if ((eh <= (-1.45d-55)) .or. (.not. (eh <= 4.5d-18))) then
tmp = abs((sin(atan(((cos(t) / ew) * (eh / sin(t))))) * (cos(t) * eh)))
else
tmp = abs((sin(t) * ew))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((eh <= -1.45e-55) || !(eh <= 4.5e-18)) {
tmp = Math.abs((Math.sin(Math.atan(((Math.cos(t) / ew) * (eh / Math.sin(t))))) * (Math.cos(t) * eh)));
} else {
tmp = Math.abs((Math.sin(t) * ew));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (eh <= -1.45e-55) or not (eh <= 4.5e-18): tmp = math.fabs((math.sin(math.atan(((math.cos(t) / ew) * (eh / math.sin(t))))) * (math.cos(t) * eh))) else: tmp = math.fabs((math.sin(t) * ew)) return tmp
function code(eh, ew, t) tmp = 0.0 if ((eh <= -1.45e-55) || !(eh <= 4.5e-18)) tmp = abs(Float64(sin(atan(Float64(Float64(cos(t) / ew) * Float64(eh / sin(t))))) * Float64(cos(t) * eh))); else tmp = abs(Float64(sin(t) * ew)); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((eh <= -1.45e-55) || ~((eh <= 4.5e-18))) tmp = abs((sin(atan(((cos(t) / ew) * (eh / sin(t))))) * (cos(t) * eh))); else tmp = abs((sin(t) * ew)); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[eh, -1.45e-55], N[Not[LessEqual[eh, 4.5e-18]], $MachinePrecision]], N[Abs[N[(N[Sin[N[ArcTan[N[(N[(N[Cos[t], $MachinePrecision] / ew), $MachinePrecision] * N[(eh / N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;eh \leq -1.45 \cdot 10^{-55} \lor \neg \left(eh \leq 4.5 \cdot 10^{-18}\right):\\
\;\;\;\;\left|\sin \tan^{-1} \left(\frac{\cos t}{ew} \cdot \frac{eh}{\sin t}\right) \cdot \left(\cos t \cdot eh\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\sin t \cdot ew\right|\\
\end{array}
\end{array}
if eh < -1.45e-55 or 4.49999999999999994e-18 < eh Initial program 99.8%
Taylor expanded in eh around inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f6487.2
Applied rewrites87.2%
if -1.45e-55 < eh < 4.49999999999999994e-18Initial program 99.8%
Applied rewrites53.8%
Taylor expanded in eh around 0
lower-sqrt.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6440.8
Applied rewrites40.8%
Taylor expanded in eh around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6470.1
Applied rewrites70.1%
Final simplification80.6%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* (cos t) eh)) (t_2 (fabs (* (sin (atan (/ (/ eh ew) t))) t_1))))
(if (<= eh -4.7e-55)
t_2
(if (<= eh 4.5e-18)
(fabs (* (sin t) ew))
(if (<= eh 4.8e+182)
(fabs
(*
(sin
(atan
(/ (fma (* (/ eh ew) -0.3333333333333333) (* t t) (/ eh ew)) t)))
t_1))
t_2)))))
double code(double eh, double ew, double t) {
double t_1 = cos(t) * eh;
double t_2 = fabs((sin(atan(((eh / ew) / t))) * t_1));
double tmp;
if (eh <= -4.7e-55) {
tmp = t_2;
} else if (eh <= 4.5e-18) {
tmp = fabs((sin(t) * ew));
} else if (eh <= 4.8e+182) {
tmp = fabs((sin(atan((fma(((eh / ew) * -0.3333333333333333), (t * t), (eh / ew)) / t))) * t_1));
} else {
tmp = t_2;
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(cos(t) * eh) t_2 = abs(Float64(sin(atan(Float64(Float64(eh / ew) / t))) * t_1)) tmp = 0.0 if (eh <= -4.7e-55) tmp = t_2; elseif (eh <= 4.5e-18) tmp = abs(Float64(sin(t) * ew)); elseif (eh <= 4.8e+182) tmp = abs(Float64(sin(atan(Float64(fma(Float64(Float64(eh / ew) * -0.3333333333333333), Float64(t * t), Float64(eh / ew)) / t))) * t_1)); else tmp = t_2; end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision]}, Block[{t$95$2 = N[Abs[N[(N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -4.7e-55], t$95$2, If[LessEqual[eh, 4.5e-18], N[Abs[N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision], If[LessEqual[eh, 4.8e+182], N[Abs[N[(N[Sin[N[ArcTan[N[(N[(N[(N[(eh / ew), $MachinePrecision] * -0.3333333333333333), $MachinePrecision] * N[(t * t), $MachinePrecision] + N[(eh / ew), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision]], $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \cos t \cdot eh\\
t_2 := \left|\sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{t}\right) \cdot t\_1\right|\\
\mathbf{if}\;eh \leq -4.7 \cdot 10^{-55}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;eh \leq 4.5 \cdot 10^{-18}:\\
\;\;\;\;\left|\sin t \cdot ew\right|\\
\mathbf{elif}\;eh \leq 4.8 \cdot 10^{+182}:\\
\;\;\;\;\left|\sin \tan^{-1} \left(\frac{\mathsf{fma}\left(\frac{eh}{ew} \cdot -0.3333333333333333, t \cdot t, \frac{eh}{ew}\right)}{t}\right) \cdot t\_1\right|\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if eh < -4.7e-55 or 4.80000000000000019e182 < eh Initial program 99.7%
Taylor expanded in eh around inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f6491.9
Applied rewrites91.9%
Taylor expanded in t around 0
Applied rewrites80.8%
if -4.7e-55 < eh < 4.49999999999999994e-18Initial program 99.8%
Applied rewrites53.8%
Taylor expanded in eh around 0
lower-sqrt.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6440.8
Applied rewrites40.8%
Taylor expanded in eh around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6470.1
Applied rewrites70.1%
if 4.49999999999999994e-18 < eh < 4.80000000000000019e182Initial program 99.8%
Taylor expanded in eh around inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f6476.5
Applied rewrites76.5%
Taylor expanded in t around 0
Applied rewrites74.6%
(FPCore (eh ew t) :precision binary64 (if (or (<= eh -4.7e-55) (not (<= eh 1e-14))) (fabs (* (sin (atan (/ (/ eh ew) t))) (* (cos t) eh))) (fabs (* (sin t) ew))))
double code(double eh, double ew, double t) {
double tmp;
if ((eh <= -4.7e-55) || !(eh <= 1e-14)) {
tmp = fabs((sin(atan(((eh / ew) / t))) * (cos(t) * eh)));
} else {
tmp = fabs((sin(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) :: tmp
if ((eh <= (-4.7d-55)) .or. (.not. (eh <= 1d-14))) then
tmp = abs((sin(atan(((eh / ew) / t))) * (cos(t) * eh)))
else
tmp = abs((sin(t) * ew))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((eh <= -4.7e-55) || !(eh <= 1e-14)) {
tmp = Math.abs((Math.sin(Math.atan(((eh / ew) / t))) * (Math.cos(t) * eh)));
} else {
tmp = Math.abs((Math.sin(t) * ew));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (eh <= -4.7e-55) or not (eh <= 1e-14): tmp = math.fabs((math.sin(math.atan(((eh / ew) / t))) * (math.cos(t) * eh))) else: tmp = math.fabs((math.sin(t) * ew)) return tmp
function code(eh, ew, t) tmp = 0.0 if ((eh <= -4.7e-55) || !(eh <= 1e-14)) tmp = abs(Float64(sin(atan(Float64(Float64(eh / ew) / t))) * Float64(cos(t) * eh))); else tmp = abs(Float64(sin(t) * ew)); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((eh <= -4.7e-55) || ~((eh <= 1e-14))) tmp = abs((sin(atan(((eh / ew) / t))) * (cos(t) * eh))); else tmp = abs((sin(t) * ew)); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[eh, -4.7e-55], N[Not[LessEqual[eh, 1e-14]], $MachinePrecision]], N[Abs[N[(N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;eh \leq -4.7 \cdot 10^{-55} \lor \neg \left(eh \leq 10^{-14}\right):\\
\;\;\;\;\left|\sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{t}\right) \cdot \left(\cos t \cdot eh\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\sin t \cdot ew\right|\\
\end{array}
\end{array}
if eh < -4.7e-55 or 9.99999999999999999e-15 < eh Initial program 99.8%
Taylor expanded in eh around inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f6487.2
Applied rewrites87.2%
Taylor expanded in t around 0
Applied rewrites74.0%
if -4.7e-55 < eh < 9.99999999999999999e-15Initial program 99.8%
Applied rewrites53.8%
Taylor expanded in eh around 0
lower-sqrt.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6440.8
Applied rewrites40.8%
Taylor expanded in eh around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6470.1
Applied rewrites70.1%
Final simplification72.5%
(FPCore (eh ew t)
:precision binary64
(if (or (<= t -7.5e-48) (not (<= t 8e-6)))
(fabs (* (sin t) ew))
(fabs
(*
(sin
(atan
(*
(/ (fma -0.5 (* t t) 1.0) ew)
(/
eh
(*
(fma
(-
(*
(fma -0.0001984126984126984 (* t t) 0.008333333333333333)
(* t t))
0.16666666666666666)
(* t t)
1.0)
t)))))
eh))))
double code(double eh, double ew, double t) {
double tmp;
if ((t <= -7.5e-48) || !(t <= 8e-6)) {
tmp = fabs((sin(t) * ew));
} else {
tmp = fabs((sin(atan(((fma(-0.5, (t * t), 1.0) / ew) * (eh / (fma(((fma(-0.0001984126984126984, (t * t), 0.008333333333333333) * (t * t)) - 0.16666666666666666), (t * t), 1.0) * t))))) * eh));
}
return tmp;
}
function code(eh, ew, t) tmp = 0.0 if ((t <= -7.5e-48) || !(t <= 8e-6)) tmp = abs(Float64(sin(t) * ew)); else tmp = abs(Float64(sin(atan(Float64(Float64(fma(-0.5, Float64(t * t), 1.0) / ew) * Float64(eh / Float64(fma(Float64(Float64(fma(-0.0001984126984126984, Float64(t * t), 0.008333333333333333) * Float64(t * t)) - 0.16666666666666666), Float64(t * t), 1.0) * t))))) * eh)); end return tmp end
code[eh_, ew_, t_] := If[Or[LessEqual[t, -7.5e-48], N[Not[LessEqual[t, 8e-6]], $MachinePrecision]], N[Abs[N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[Sin[N[ArcTan[N[(N[(N[(-0.5 * N[(t * t), $MachinePrecision] + 1.0), $MachinePrecision] / ew), $MachinePrecision] * N[(eh / N[(N[(N[(N[(N[(-0.0001984126984126984 * N[(t * t), $MachinePrecision] + 0.008333333333333333), $MachinePrecision] * N[(t * t), $MachinePrecision]), $MachinePrecision] - 0.16666666666666666), $MachinePrecision] * N[(t * t), $MachinePrecision] + 1.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.5 \cdot 10^{-48} \lor \neg \left(t \leq 8 \cdot 10^{-6}\right):\\
\;\;\;\;\left|\sin t \cdot ew\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\sin \tan^{-1} \left(\frac{\mathsf{fma}\left(-0.5, t \cdot t, 1\right)}{ew} \cdot \frac{eh}{\mathsf{fma}\left(\mathsf{fma}\left(-0.0001984126984126984, t \cdot t, 0.008333333333333333\right) \cdot \left(t \cdot t\right) - 0.16666666666666666, t \cdot t, 1\right) \cdot t}\right) \cdot eh\right|\\
\end{array}
\end{array}
if t < -7.50000000000000042e-48 or 7.99999999999999964e-6 < t Initial program 99.6%
Applied rewrites31.9%
Taylor expanded in eh around 0
lower-sqrt.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6422.9
Applied rewrites22.9%
Taylor expanded in eh around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6445.9
Applied rewrites45.9%
if -7.50000000000000042e-48 < t < 7.99999999999999964e-6Initial program 100.0%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-sin.f6477.5
Applied rewrites77.5%
Taylor expanded in t around 0
Applied rewrites77.5%
Taylor expanded in t around 0
Applied rewrites77.5%
Final simplification59.7%
(FPCore (eh ew t) :precision binary64 (if (or (<= t -7.5e-48) (not (<= t 8e-6))) (fabs (* (sin t) ew)) (fabs (* (sin (atan (/ (/ eh ew) t))) eh))))
double code(double eh, double ew, double t) {
double tmp;
if ((t <= -7.5e-48) || !(t <= 8e-6)) {
tmp = fabs((sin(t) * ew));
} else {
tmp = fabs((sin(atan(((eh / ew) / t))) * eh));
}
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) :: tmp
if ((t <= (-7.5d-48)) .or. (.not. (t <= 8d-6))) then
tmp = abs((sin(t) * ew))
else
tmp = abs((sin(atan(((eh / ew) / t))) * eh))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((t <= -7.5e-48) || !(t <= 8e-6)) {
tmp = Math.abs((Math.sin(t) * ew));
} else {
tmp = Math.abs((Math.sin(Math.atan(((eh / ew) / t))) * eh));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (t <= -7.5e-48) or not (t <= 8e-6): tmp = math.fabs((math.sin(t) * ew)) else: tmp = math.fabs((math.sin(math.atan(((eh / ew) / t))) * eh)) return tmp
function code(eh, ew, t) tmp = 0.0 if ((t <= -7.5e-48) || !(t <= 8e-6)) tmp = abs(Float64(sin(t) * ew)); else tmp = abs(Float64(sin(atan(Float64(Float64(eh / ew) / t))) * eh)); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((t <= -7.5e-48) || ~((t <= 8e-6))) tmp = abs((sin(t) * ew)); else tmp = abs((sin(atan(((eh / ew) / t))) * eh)); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[t, -7.5e-48], N[Not[LessEqual[t, 8e-6]], $MachinePrecision]], N[Abs[N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.5 \cdot 10^{-48} \lor \neg \left(t \leq 8 \cdot 10^{-6}\right):\\
\;\;\;\;\left|\sin t \cdot ew\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{t}\right) \cdot eh\right|\\
\end{array}
\end{array}
if t < -7.50000000000000042e-48 or 7.99999999999999964e-6 < t Initial program 99.6%
Applied rewrites31.9%
Taylor expanded in eh around 0
lower-sqrt.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6422.9
Applied rewrites22.9%
Taylor expanded in eh around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6445.9
Applied rewrites45.9%
if -7.50000000000000042e-48 < t < 7.99999999999999964e-6Initial program 100.0%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-sin.f6477.5
Applied rewrites77.5%
Taylor expanded in t around 0
Applied rewrites77.5%
Final simplification59.7%
(FPCore (eh ew t) :precision binary64 (fabs (* (sin t) ew)))
double code(double eh, double ew, double t) {
return fabs((sin(t) * ew));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(eh, ew, t)
use fmin_fmax_functions
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
code = abs((sin(t) * ew))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((Math.sin(t) * ew));
}
def code(eh, ew, t): return math.fabs((math.sin(t) * ew))
function code(eh, ew, t) return abs(Float64(sin(t) * ew)) end
function tmp = code(eh, ew, t) tmp = abs((sin(t) * ew)); end
code[eh_, ew_, t_] := N[Abs[N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\sin t \cdot ew\right|
\end{array}
Initial program 99.8%
Applied rewrites31.0%
Taylor expanded in eh around 0
lower-sqrt.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6420.4
Applied rewrites20.4%
Taylor expanded in eh around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6437.0
Applied rewrites37.0%
(FPCore (eh ew t) :precision binary64 (fabs (* t ew)))
double code(double eh, double ew, double t) {
return fabs((t * ew));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(eh, ew, t)
use fmin_fmax_functions
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
code = abs((t * ew))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((t * ew));
}
def code(eh, ew, t): return math.fabs((t * ew))
function code(eh, ew, t) return abs(Float64(t * ew)) end
function tmp = code(eh, ew, t) tmp = abs((t * ew)); end
code[eh_, ew_, t_] := N[Abs[N[(t * ew), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|t \cdot ew\right|
\end{array}
Initial program 99.8%
Applied rewrites31.0%
Taylor expanded in eh around 0
lower-sqrt.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6420.4
Applied rewrites20.4%
Taylor expanded in eh around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6437.0
Applied rewrites37.0%
Taylor expanded in t around 0
Applied rewrites17.2%
herbie shell --seed 2024350
(FPCore (eh ew t)
:name "Example from Robby"
:precision binary64
(fabs (+ (* (* ew (sin t)) (cos (atan (/ (/ eh ew) (tan t))))) (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))))))