
(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}
Herbie found 16 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
(let* ((t_1 (* eh (/ (tan t) ew))))
(fabs
(fma
(* (tanh (asinh t_1)) (sin t))
eh
(* (* (cos t) ew) (cos (atan t_1)))))))
double code(double eh, double ew, double t) {
double t_1 = eh * (tan(t) / ew);
return fabs(fma((tanh(asinh(t_1)) * sin(t)), eh, ((cos(t) * ew) * cos(atan(t_1)))));
}
function code(eh, ew, t) t_1 = Float64(eh * Float64(tan(t) / ew)) return abs(fma(Float64(tanh(asinh(t_1)) * sin(t)), eh, Float64(Float64(cos(t) * ew) * cos(atan(t_1))))) end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh * N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision]}, N[Abs[N[(N[(N[Tanh[N[ArcSinh[t$95$1], $MachinePrecision]], $MachinePrecision] * N[Sin[t], $MachinePrecision]), $MachinePrecision] * eh + N[(N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision] * N[Cos[N[ArcTan[t$95$1], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := eh \cdot \frac{\tan t}{ew}\\
\left|\mathsf{fma}\left(\tanh \sinh^{-1} t\_1 \cdot \sin t, eh, \left(\cos t \cdot ew\right) \cdot \cos \tan^{-1} t\_1\right)\right|
\end{array}
\end{array}
Initial program 99.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.8%
Applied rewrites99.8%
lift-fma.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
lift-tanh.f64N/A
lift-asinh.f64N/A
tanh-asinhN/A
sin-atan-revN/A
lift-atan.f64N/A
lift-sin.f64N/A
Applied rewrites99.8%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* ew (cos t)))
(t_2 (atan (/ (* (- eh) (tan t)) ew)))
(t_3 (- (* t_1 (cos t_2)) (* (* eh (sin t)) (sin t_2))))
(t_4 (/ (tan t) ew))
(t_5 (* t_4 eh)))
(if (<= t_3 -4e+23)
(fabs t_1)
(if (<= t_3 2e-199)
(fabs (/ (fma (sin t) (* t_4 (* eh eh)) ew) (cosh (asinh t_5))))
(if (<= t_3 1e+149)
(/
(fma (cos t) ew (/ (* (* (sin t) eh) (* eh (tan t))) ew))
(sqrt (+ 1.0 (pow t_5 2.0))))
t_1)))))
double code(double eh, double ew, double t) {
double t_1 = ew * cos(t);
double t_2 = atan(((-eh * tan(t)) / ew));
double t_3 = (t_1 * cos(t_2)) - ((eh * sin(t)) * sin(t_2));
double t_4 = tan(t) / ew;
double t_5 = t_4 * eh;
double tmp;
if (t_3 <= -4e+23) {
tmp = fabs(t_1);
} else if (t_3 <= 2e-199) {
tmp = fabs((fma(sin(t), (t_4 * (eh * eh)), ew) / cosh(asinh(t_5))));
} else if (t_3 <= 1e+149) {
tmp = fma(cos(t), ew, (((sin(t) * eh) * (eh * tan(t))) / ew)) / sqrt((1.0 + pow(t_5, 2.0)));
} else {
tmp = t_1;
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(ew * cos(t)) t_2 = atan(Float64(Float64(Float64(-eh) * tan(t)) / ew)) t_3 = Float64(Float64(t_1 * cos(t_2)) - Float64(Float64(eh * sin(t)) * sin(t_2))) t_4 = Float64(tan(t) / ew) t_5 = Float64(t_4 * eh) tmp = 0.0 if (t_3 <= -4e+23) tmp = abs(t_1); elseif (t_3 <= 2e-199) tmp = abs(Float64(fma(sin(t), Float64(t_4 * Float64(eh * eh)), ew) / cosh(asinh(t_5)))); elseif (t_3 <= 1e+149) tmp = Float64(fma(cos(t), ew, Float64(Float64(Float64(sin(t) * eh) * Float64(eh * tan(t))) / ew)) / sqrt(Float64(1.0 + (t_5 ^ 2.0)))); else tmp = t_1; end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(ew * N[Cos[t], $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[(t$95$1 * N[Cos[t$95$2], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision]}, Block[{t$95$5 = N[(t$95$4 * eh), $MachinePrecision]}, If[LessEqual[t$95$3, -4e+23], N[Abs[t$95$1], $MachinePrecision], If[LessEqual[t$95$3, 2e-199], N[Abs[N[(N[(N[Sin[t], $MachinePrecision] * N[(t$95$4 * N[(eh * eh), $MachinePrecision]), $MachinePrecision] + ew), $MachinePrecision] / N[Cosh[N[ArcSinh[t$95$5], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$3, 1e+149], N[(N[(N[Cos[t], $MachinePrecision] * ew + N[(N[(N[(N[Sin[t], $MachinePrecision] * eh), $MachinePrecision] * N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(1.0 + N[Power[t$95$5, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := ew \cdot \cos t\\
t_2 := \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\\
t_3 := t\_1 \cdot \cos t\_2 - \left(eh \cdot \sin t\right) \cdot \sin t\_2\\
t_4 := \frac{\tan t}{ew}\\
t_5 := t\_4 \cdot eh\\
\mathbf{if}\;t\_3 \leq -4 \cdot 10^{+23}:\\
\;\;\;\;\left|t\_1\right|\\
\mathbf{elif}\;t\_3 \leq 2 \cdot 10^{-199}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(\sin t, t\_4 \cdot \left(eh \cdot eh\right), ew\right)}{\cosh \sinh^{-1} t\_5}\right|\\
\mathbf{elif}\;t\_3 \leq 10^{+149}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\cos t, ew, \frac{\left(\sin t \cdot eh\right) \cdot \left(eh \cdot \tan t\right)}{ew}\right)}{\sqrt{1 + {t\_5}^{2}}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\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))))) < -3.9999999999999997e23Initial program 99.8%
Applied rewrites60.2%
Taylor expanded in eh around 0
lower-*.f64N/A
lift-cos.f6462.7
Applied rewrites62.7%
if -3.9999999999999997e23 < (-.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.99999999999999996e-199Initial program 99.8%
Applied rewrites83.6%
Taylor expanded in t around 0
Applied rewrites67.5%
if 1.99999999999999996e-199 < (-.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.00000000000000005e149Initial program 99.8%
Applied rewrites78.1%
Applied rewrites72.7%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6479.4
Applied rewrites79.4%
if 1.00000000000000005e149 < (-.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 rewrites53.7%
Applied rewrites68.9%
Taylor expanded in eh around 0
lower-*.f64N/A
lift-cos.f6464.2
Applied rewrites64.2%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* (cos t) ew))
(t_2 (* ew (cos t)))
(t_3 (atan (/ (* (- eh) (tan t)) ew)))
(t_4 (- (* t_2 (cos t_3)) (* (* eh (sin t)) (sin t_3))))
(t_5 (/ (tan t) ew))
(t_6 (* t_5 eh)))
(if (<= t_4 -4e+51)
(fabs t_2)
(if (<= t_4 -5e-268)
(fabs (/ (fma (sin t) (* t_5 (* eh eh)) t_1) (sqrt (fma t_6 t_6 1.0))))
(/ (fma (* (sin t) eh) (* eh t_5) t_1) (sqrt (+ 1.0 (pow t_6 2.0))))))))
double code(double eh, double ew, double t) {
double t_1 = cos(t) * ew;
double t_2 = ew * cos(t);
double t_3 = atan(((-eh * tan(t)) / ew));
double t_4 = (t_2 * cos(t_3)) - ((eh * sin(t)) * sin(t_3));
double t_5 = tan(t) / ew;
double t_6 = t_5 * eh;
double tmp;
if (t_4 <= -4e+51) {
tmp = fabs(t_2);
} else if (t_4 <= -5e-268) {
tmp = fabs((fma(sin(t), (t_5 * (eh * eh)), t_1) / sqrt(fma(t_6, t_6, 1.0))));
} else {
tmp = fma((sin(t) * eh), (eh * t_5), t_1) / sqrt((1.0 + pow(t_6, 2.0)));
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(cos(t) * ew) t_2 = Float64(ew * cos(t)) t_3 = atan(Float64(Float64(Float64(-eh) * tan(t)) / ew)) t_4 = Float64(Float64(t_2 * cos(t_3)) - Float64(Float64(eh * sin(t)) * sin(t_3))) t_5 = Float64(tan(t) / ew) t_6 = Float64(t_5 * eh) tmp = 0.0 if (t_4 <= -4e+51) tmp = abs(t_2); elseif (t_4 <= -5e-268) tmp = abs(Float64(fma(sin(t), Float64(t_5 * Float64(eh * eh)), t_1) / sqrt(fma(t_6, t_6, 1.0)))); else tmp = Float64(fma(Float64(sin(t) * eh), Float64(eh * t_5), t_1) / sqrt(Float64(1.0 + (t_6 ^ 2.0)))); end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision]}, Block[{t$95$2 = N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[ArcTan[N[(N[((-eh) * N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(N[(t$95$2 * N[Cos[t$95$3], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision]}, Block[{t$95$6 = N[(t$95$5 * eh), $MachinePrecision]}, If[LessEqual[t$95$4, -4e+51], N[Abs[t$95$2], $MachinePrecision], If[LessEqual[t$95$4, -5e-268], N[Abs[N[(N[(N[Sin[t], $MachinePrecision] * N[(t$95$5 * N[(eh * eh), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] / N[Sqrt[N[(t$95$6 * t$95$6 + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(N[(N[Sin[t], $MachinePrecision] * eh), $MachinePrecision] * N[(eh * t$95$5), $MachinePrecision] + t$95$1), $MachinePrecision] / N[Sqrt[N[(1.0 + N[Power[t$95$6, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \cos t \cdot ew\\
t_2 := ew \cdot \cos t\\
t_3 := \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\\
t_4 := t\_2 \cdot \cos t\_3 - \left(eh \cdot \sin t\right) \cdot \sin t\_3\\
t_5 := \frac{\tan t}{ew}\\
t_6 := t\_5 \cdot eh\\
\mathbf{if}\;t\_4 \leq -4 \cdot 10^{+51}:\\
\;\;\;\;\left|t\_2\right|\\
\mathbf{elif}\;t\_4 \leq -5 \cdot 10^{-268}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(\sin t, t\_5 \cdot \left(eh \cdot eh\right), t\_1\right)}{\sqrt{\mathsf{fma}\left(t\_6, t\_6, 1\right)}}\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\sin t \cdot eh, eh \cdot t\_5, t\_1\right)}{\sqrt{1 + {t\_6}^{2}}}\\
\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))))) < -4e51Initial program 99.8%
Applied rewrites59.2%
Taylor expanded in eh around 0
lower-*.f64N/A
lift-cos.f6463.0
Applied rewrites63.0%
if -4e51 < (-.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.9999999999999999e-268Initial program 99.8%
Applied rewrites82.2%
lift-cosh.f64N/A
lift-asinh.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
cosh-asinhN/A
lower-sqrt.f64N/A
lower-fma.f64N/A
lift-tan.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-tan.f64N/A
lift-/.f64N/A
lift-*.f6477.2
Applied rewrites77.2%
if -4.9999999999999999e-268 < (-.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 rewrites68.1%
Applied rewrites64.9%
lift-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
lower-fma.f6476.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6476.9
Applied rewrites76.9%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* ew (cos t)))
(t_2 (atan (/ (* (- eh) (tan t)) ew)))
(t_3 (- (* t_1 (cos t_2)) (* (* eh (sin t)) (sin t_2))))
(t_4 (/ (tan t) ew))
(t_5 (* t_4 eh)))
(if (<= t_3 -4e+23)
(fabs t_1)
(if (<= t_3 -5e-268)
(fabs (/ (fma (sin t) (* t_4 (* eh eh)) ew) (cosh (asinh t_5))))
(/
(fma (* (sin t) eh) (* eh t_4) (* (cos t) ew))
(sqrt (+ 1.0 (pow t_5 2.0))))))))
double code(double eh, double ew, double t) {
double t_1 = ew * cos(t);
double t_2 = atan(((-eh * tan(t)) / ew));
double t_3 = (t_1 * cos(t_2)) - ((eh * sin(t)) * sin(t_2));
double t_4 = tan(t) / ew;
double t_5 = t_4 * eh;
double tmp;
if (t_3 <= -4e+23) {
tmp = fabs(t_1);
} else if (t_3 <= -5e-268) {
tmp = fabs((fma(sin(t), (t_4 * (eh * eh)), ew) / cosh(asinh(t_5))));
} else {
tmp = fma((sin(t) * eh), (eh * t_4), (cos(t) * ew)) / sqrt((1.0 + pow(t_5, 2.0)));
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(ew * cos(t)) t_2 = atan(Float64(Float64(Float64(-eh) * tan(t)) / ew)) t_3 = Float64(Float64(t_1 * cos(t_2)) - Float64(Float64(eh * sin(t)) * sin(t_2))) t_4 = Float64(tan(t) / ew) t_5 = Float64(t_4 * eh) tmp = 0.0 if (t_3 <= -4e+23) tmp = abs(t_1); elseif (t_3 <= -5e-268) tmp = abs(Float64(fma(sin(t), Float64(t_4 * Float64(eh * eh)), ew) / cosh(asinh(t_5)))); else tmp = Float64(fma(Float64(sin(t) * eh), Float64(eh * t_4), Float64(cos(t) * ew)) / sqrt(Float64(1.0 + (t_5 ^ 2.0)))); end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(ew * N[Cos[t], $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[(t$95$1 * N[Cos[t$95$2], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision]}, Block[{t$95$5 = N[(t$95$4 * eh), $MachinePrecision]}, If[LessEqual[t$95$3, -4e+23], N[Abs[t$95$1], $MachinePrecision], If[LessEqual[t$95$3, -5e-268], N[Abs[N[(N[(N[Sin[t], $MachinePrecision] * N[(t$95$4 * N[(eh * eh), $MachinePrecision]), $MachinePrecision] + ew), $MachinePrecision] / N[Cosh[N[ArcSinh[t$95$5], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(N[(N[Sin[t], $MachinePrecision] * eh), $MachinePrecision] * N[(eh * t$95$4), $MachinePrecision] + N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(1.0 + N[Power[t$95$5, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := ew \cdot \cos t\\
t_2 := \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\\
t_3 := t\_1 \cdot \cos t\_2 - \left(eh \cdot \sin t\right) \cdot \sin t\_2\\
t_4 := \frac{\tan t}{ew}\\
t_5 := t\_4 \cdot eh\\
\mathbf{if}\;t\_3 \leq -4 \cdot 10^{+23}:\\
\;\;\;\;\left|t\_1\right|\\
\mathbf{elif}\;t\_3 \leq -5 \cdot 10^{-268}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(\sin t, t\_4 \cdot \left(eh \cdot eh\right), ew\right)}{\cosh \sinh^{-1} t\_5}\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\sin t \cdot eh, eh \cdot t\_4, \cos t \cdot ew\right)}{\sqrt{1 + {t\_5}^{2}}}\\
\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))))) < -3.9999999999999997e23Initial program 99.8%
Applied rewrites60.2%
Taylor expanded in eh around 0
lower-*.f64N/A
lift-cos.f6462.7
Applied rewrites62.7%
if -3.9999999999999997e23 < (-.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.9999999999999999e-268Initial program 99.8%
Applied rewrites83.8%
Taylor expanded in t around 0
Applied rewrites66.8%
if -4.9999999999999999e-268 < (-.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 rewrites68.1%
Applied rewrites64.9%
lift-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
lower-fma.f6476.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6476.9
Applied rewrites76.9%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* (/ (tan t) ew) eh))
(t_2 (atan t_1))
(t_3 (atan (/ (* (- eh) (tan t)) ew)))
(t_4 (* (cos t) ew)))
(if (<=
(- (* (* ew (cos t)) (cos t_3)) (* (* eh (sin t)) (sin t_3)))
-5e-268)
(/ (fma (/ (* eh (tan t)) ew) (* (sin t) eh) t_4) (- (cosh (asinh t_1))))
(fma (* (sin t_2) (sin t)) eh (* t_4 (cos t_2))))))
double code(double eh, double ew, double t) {
double t_1 = (tan(t) / ew) * eh;
double t_2 = atan(t_1);
double t_3 = atan(((-eh * tan(t)) / ew));
double t_4 = cos(t) * ew;
double tmp;
if ((((ew * cos(t)) * cos(t_3)) - ((eh * sin(t)) * sin(t_3))) <= -5e-268) {
tmp = fma(((eh * tan(t)) / ew), (sin(t) * eh), t_4) / -cosh(asinh(t_1));
} else {
tmp = fma((sin(t_2) * sin(t)), eh, (t_4 * cos(t_2)));
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(Float64(tan(t) / ew) * eh) t_2 = atan(t_1) t_3 = atan(Float64(Float64(Float64(-eh) * tan(t)) / ew)) t_4 = Float64(cos(t) * ew) tmp = 0.0 if (Float64(Float64(Float64(ew * cos(t)) * cos(t_3)) - Float64(Float64(eh * sin(t)) * sin(t_3))) <= -5e-268) tmp = Float64(fma(Float64(Float64(eh * tan(t)) / ew), Float64(sin(t) * eh), t_4) / Float64(-cosh(asinh(t_1)))); else tmp = fma(Float64(sin(t_2) * sin(t)), eh, Float64(t_4 * cos(t_2))); end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision] * eh), $MachinePrecision]}, Block[{t$95$2 = N[ArcTan[t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[ArcTan[N[(N[((-eh) * N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision]}, If[LessEqual[N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$3], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -5e-268], N[(N[(N[(N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision] * N[(N[Sin[t], $MachinePrecision] * eh), $MachinePrecision] + t$95$4), $MachinePrecision] / (-N[Cosh[N[ArcSinh[t$95$1], $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[(N[Sin[t$95$2], $MachinePrecision] * N[Sin[t], $MachinePrecision]), $MachinePrecision] * eh + N[(t$95$4 * N[Cos[t$95$2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\tan t}{ew} \cdot eh\\
t_2 := \tan^{-1} t\_1\\
t_3 := \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\\
t_4 := \cos t \cdot ew\\
\mathbf{if}\;\left(ew \cdot \cos t\right) \cdot \cos t\_3 - \left(eh \cdot \sin t\right) \cdot \sin t\_3 \leq -5 \cdot 10^{-268}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{eh \cdot \tan t}{ew}, \sin t \cdot eh, t\_4\right)}{-\cosh \sinh^{-1} t\_1}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\sin t\_2 \cdot \sin t, eh, t\_4 \cdot \cos t\_2\right)\\
\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.9999999999999999e-268Initial program 99.8%
Applied rewrites1.2%
lift-/.f64N/A
frac-2negN/A
lift-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-fma.f64N/A
distribute-frac-neg2N/A
distribute-neg-fracN/A
Applied rewrites82.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6482.4
Applied rewrites82.4%
if -4.9999999999999999e-268 < (-.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%
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
rem-square-sqrt98.7
lift--.f64N/A
sub-negate1N/A
Applied rewrites98.7%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* (/ (tan t) ew) eh))
(t_2 (* (sin t) eh))
(t_3 (cosh (asinh t_1)))
(t_4 (atan (/ (* (- eh) (tan t)) ew)))
(t_5 (* (cos t) ew)))
(if (<=
(- (* (* ew (cos t)) (cos t_4)) (* (* eh (sin t)) (sin t_4)))
-5e-268)
(/ (fma (/ (* eh (tan t)) ew) t_2 t_5) (- t_3))
(pow (sqrt (/ (fma t_1 t_2 t_5) t_3)) 2.0))))
double code(double eh, double ew, double t) {
double t_1 = (tan(t) / ew) * eh;
double t_2 = sin(t) * eh;
double t_3 = cosh(asinh(t_1));
double t_4 = atan(((-eh * tan(t)) / ew));
double t_5 = cos(t) * ew;
double tmp;
if ((((ew * cos(t)) * cos(t_4)) - ((eh * sin(t)) * sin(t_4))) <= -5e-268) {
tmp = fma(((eh * tan(t)) / ew), t_2, t_5) / -t_3;
} else {
tmp = pow(sqrt((fma(t_1, t_2, t_5) / t_3)), 2.0);
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(Float64(tan(t) / ew) * eh) t_2 = Float64(sin(t) * eh) t_3 = cosh(asinh(t_1)) t_4 = atan(Float64(Float64(Float64(-eh) * tan(t)) / ew)) t_5 = Float64(cos(t) * ew) tmp = 0.0 if (Float64(Float64(Float64(ew * cos(t)) * cos(t_4)) - Float64(Float64(eh * sin(t)) * sin(t_4))) <= -5e-268) tmp = Float64(fma(Float64(Float64(eh * tan(t)) / ew), t_2, t_5) / Float64(-t_3)); else tmp = sqrt(Float64(fma(t_1, t_2, t_5) / t_3)) ^ 2.0; end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision] * eh), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[t], $MachinePrecision] * eh), $MachinePrecision]}, Block[{t$95$3 = N[Cosh[N[ArcSinh[t$95$1], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[ArcTan[N[(N[((-eh) * N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision]}, If[LessEqual[N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$4], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$4], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -5e-268], N[(N[(N[(N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision] * t$95$2 + t$95$5), $MachinePrecision] / (-t$95$3)), $MachinePrecision], N[Power[N[Sqrt[N[(N[(t$95$1 * t$95$2 + t$95$5), $MachinePrecision] / t$95$3), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\tan t}{ew} \cdot eh\\
t_2 := \sin t \cdot eh\\
t_3 := \cosh \sinh^{-1} t\_1\\
t_4 := \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\\
t_5 := \cos t \cdot ew\\
\mathbf{if}\;\left(ew \cdot \cos t\right) \cdot \cos t\_4 - \left(eh \cdot \sin t\right) \cdot \sin t\_4 \leq -5 \cdot 10^{-268}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{eh \cdot \tan t}{ew}, t\_2, t\_5\right)}{-t\_3}\\
\mathbf{else}:\\
\;\;\;\;{\left(\sqrt{\frac{\mathsf{fma}\left(t\_1, t\_2, t\_5\right)}{t\_3}}\right)}^{2}\\
\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.9999999999999999e-268Initial program 99.8%
Applied rewrites1.2%
lift-/.f64N/A
frac-2negN/A
lift-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-fma.f64N/A
distribute-frac-neg2N/A
distribute-neg-fracN/A
Applied rewrites82.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6482.4
Applied rewrites82.4%
if -4.9999999999999999e-268 < (-.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 rewrites68.1%
Applied rewrites80.4%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* (sin t) eh))
(t_2 (cosh (asinh (* (/ (tan t) ew) eh))))
(t_3 (atan (/ (* (- eh) (tan t)) ew)))
(t_4 (* (cos t) ew)))
(if (<=
(- (* (* ew (cos t)) (cos t_3)) (* (* eh (sin t)) (sin t_3)))
-5e-268)
(/ (fma (/ (* eh (tan t)) ew) t_1 t_4) (- t_2))
(/ (- t_4 (* t_1 (* (/ (- eh) ew) (tan t)))) t_2))))
double code(double eh, double ew, double t) {
double t_1 = sin(t) * eh;
double t_2 = cosh(asinh(((tan(t) / ew) * eh)));
double t_3 = atan(((-eh * tan(t)) / ew));
double t_4 = cos(t) * ew;
double tmp;
if ((((ew * cos(t)) * cos(t_3)) - ((eh * sin(t)) * sin(t_3))) <= -5e-268) {
tmp = fma(((eh * tan(t)) / ew), t_1, t_4) / -t_2;
} else {
tmp = (t_4 - (t_1 * ((-eh / ew) * tan(t)))) / t_2;
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(sin(t) * eh) t_2 = cosh(asinh(Float64(Float64(tan(t) / ew) * eh))) t_3 = atan(Float64(Float64(Float64(-eh) * tan(t)) / ew)) t_4 = Float64(cos(t) * ew) tmp = 0.0 if (Float64(Float64(Float64(ew * cos(t)) * cos(t_3)) - Float64(Float64(eh * sin(t)) * sin(t_3))) <= -5e-268) tmp = Float64(fma(Float64(Float64(eh * tan(t)) / ew), t_1, t_4) / Float64(-t_2)); else tmp = Float64(Float64(t_4 - Float64(t_1 * Float64(Float64(Float64(-eh) / ew) * tan(t)))) / t_2); end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[Sin[t], $MachinePrecision] * eh), $MachinePrecision]}, Block[{t$95$2 = N[Cosh[N[ArcSinh[N[(N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[ArcTan[N[(N[((-eh) * N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision]}, If[LessEqual[N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$3], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -5e-268], N[(N[(N[(N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision] * t$95$1 + t$95$4), $MachinePrecision] / (-t$95$2)), $MachinePrecision], N[(N[(t$95$4 - N[(t$95$1 * N[(N[((-eh) / ew), $MachinePrecision] * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin t \cdot eh\\
t_2 := \cosh \sinh^{-1} \left(\frac{\tan t}{ew} \cdot eh\right)\\
t_3 := \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\\
t_4 := \cos t \cdot ew\\
\mathbf{if}\;\left(ew \cdot \cos t\right) \cdot \cos t\_3 - \left(eh \cdot \sin t\right) \cdot \sin t\_3 \leq -5 \cdot 10^{-268}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{eh \cdot \tan t}{ew}, t\_1, t\_4\right)}{-t\_2}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_4 - t\_1 \cdot \left(\frac{-eh}{ew} \cdot \tan t\right)}{t\_2}\\
\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.9999999999999999e-268Initial program 99.8%
Applied rewrites1.2%
lift-/.f64N/A
frac-2negN/A
lift-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-fma.f64N/A
distribute-frac-neg2N/A
distribute-neg-fracN/A
Applied rewrites82.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6482.4
Applied rewrites82.4%
if -4.9999999999999999e-268 < (-.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 rewrites77.9%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ (tan t) ew))
(t_2 (* t_1 eh))
(t_3 (* (sin t) eh))
(t_4 (atan (/ (* (- eh) (tan t)) ew)))
(t_5 (* (cos t) ew)))
(if (<=
(- (* (* ew (cos t)) (cos t_4)) (* (* eh (sin t)) (sin t_4)))
-5e-268)
(/ (fma (/ (* eh (tan t)) ew) t_3 t_5) (- (cosh (asinh t_2))))
(/ (fma t_3 (* eh t_1) t_5) (sqrt (+ 1.0 (pow t_2 2.0)))))))
double code(double eh, double ew, double t) {
double t_1 = tan(t) / ew;
double t_2 = t_1 * eh;
double t_3 = sin(t) * eh;
double t_4 = atan(((-eh * tan(t)) / ew));
double t_5 = cos(t) * ew;
double tmp;
if ((((ew * cos(t)) * cos(t_4)) - ((eh * sin(t)) * sin(t_4))) <= -5e-268) {
tmp = fma(((eh * tan(t)) / ew), t_3, t_5) / -cosh(asinh(t_2));
} else {
tmp = fma(t_3, (eh * t_1), t_5) / sqrt((1.0 + pow(t_2, 2.0)));
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(tan(t) / ew) t_2 = Float64(t_1 * eh) t_3 = Float64(sin(t) * eh) t_4 = atan(Float64(Float64(Float64(-eh) * tan(t)) / ew)) t_5 = Float64(cos(t) * ew) tmp = 0.0 if (Float64(Float64(Float64(ew * cos(t)) * cos(t_4)) - Float64(Float64(eh * sin(t)) * sin(t_4))) <= -5e-268) tmp = Float64(fma(Float64(Float64(eh * tan(t)) / ew), t_3, t_5) / Float64(-cosh(asinh(t_2)))); else tmp = Float64(fma(t_3, Float64(eh * t_1), t_5) / sqrt(Float64(1.0 + (t_2 ^ 2.0)))); end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * eh), $MachinePrecision]}, Block[{t$95$3 = N[(N[Sin[t], $MachinePrecision] * eh), $MachinePrecision]}, Block[{t$95$4 = N[ArcTan[N[(N[((-eh) * N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision]}, If[LessEqual[N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$4], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$4], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -5e-268], N[(N[(N[(N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision] * t$95$3 + t$95$5), $MachinePrecision] / (-N[Cosh[N[ArcSinh[t$95$2], $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[(t$95$3 * N[(eh * t$95$1), $MachinePrecision] + t$95$5), $MachinePrecision] / N[Sqrt[N[(1.0 + N[Power[t$95$2, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\tan t}{ew}\\
t_2 := t\_1 \cdot eh\\
t_3 := \sin t \cdot eh\\
t_4 := \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\\
t_5 := \cos t \cdot ew\\
\mathbf{if}\;\left(ew \cdot \cos t\right) \cdot \cos t\_4 - \left(eh \cdot \sin t\right) \cdot \sin t\_4 \leq -5 \cdot 10^{-268}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{eh \cdot \tan t}{ew}, t\_3, t\_5\right)}{-\cosh \sinh^{-1} t\_2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t\_3, eh \cdot t\_1, t\_5\right)}{\sqrt{1 + {t\_2}^{2}}}\\
\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.9999999999999999e-268Initial program 99.8%
Applied rewrites1.2%
lift-/.f64N/A
frac-2negN/A
lift-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-fma.f64N/A
distribute-frac-neg2N/A
distribute-neg-fracN/A
Applied rewrites82.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6482.4
Applied rewrites82.4%
if -4.9999999999999999e-268 < (-.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 rewrites68.1%
Applied rewrites64.9%
lift-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
lower-fma.f6476.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6476.9
Applied rewrites76.9%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ (tan t) ew))
(t_2 (* t_1 eh))
(t_3 (* (sin t) eh))
(t_4 (atan (/ (* (- eh) (tan t)) ew)))
(t_5 (* (cos t) ew)))
(if (<=
(- (* (* ew (cos t)) (cos t_4)) (* (* eh (sin t)) (sin t_4)))
-5e-268)
(/ (fma t_2 t_3 t_5) (- (cosh (asinh t_2))))
(/ (fma t_3 (* eh t_1) t_5) (sqrt (+ 1.0 (pow t_2 2.0)))))))
double code(double eh, double ew, double t) {
double t_1 = tan(t) / ew;
double t_2 = t_1 * eh;
double t_3 = sin(t) * eh;
double t_4 = atan(((-eh * tan(t)) / ew));
double t_5 = cos(t) * ew;
double tmp;
if ((((ew * cos(t)) * cos(t_4)) - ((eh * sin(t)) * sin(t_4))) <= -5e-268) {
tmp = fma(t_2, t_3, t_5) / -cosh(asinh(t_2));
} else {
tmp = fma(t_3, (eh * t_1), t_5) / sqrt((1.0 + pow(t_2, 2.0)));
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(tan(t) / ew) t_2 = Float64(t_1 * eh) t_3 = Float64(sin(t) * eh) t_4 = atan(Float64(Float64(Float64(-eh) * tan(t)) / ew)) t_5 = Float64(cos(t) * ew) tmp = 0.0 if (Float64(Float64(Float64(ew * cos(t)) * cos(t_4)) - Float64(Float64(eh * sin(t)) * sin(t_4))) <= -5e-268) tmp = Float64(fma(t_2, t_3, t_5) / Float64(-cosh(asinh(t_2)))); else tmp = Float64(fma(t_3, Float64(eh * t_1), t_5) / sqrt(Float64(1.0 + (t_2 ^ 2.0)))); end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * eh), $MachinePrecision]}, Block[{t$95$3 = N[(N[Sin[t], $MachinePrecision] * eh), $MachinePrecision]}, Block[{t$95$4 = N[ArcTan[N[(N[((-eh) * N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision]}, If[LessEqual[N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$4], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$4], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -5e-268], N[(N[(t$95$2 * t$95$3 + t$95$5), $MachinePrecision] / (-N[Cosh[N[ArcSinh[t$95$2], $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[(t$95$3 * N[(eh * t$95$1), $MachinePrecision] + t$95$5), $MachinePrecision] / N[Sqrt[N[(1.0 + N[Power[t$95$2, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\tan t}{ew}\\
t_2 := t\_1 \cdot eh\\
t_3 := \sin t \cdot eh\\
t_4 := \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\\
t_5 := \cos t \cdot ew\\
\mathbf{if}\;\left(ew \cdot \cos t\right) \cdot \cos t\_4 - \left(eh \cdot \sin t\right) \cdot \sin t\_4 \leq -5 \cdot 10^{-268}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t\_2, t\_3, t\_5\right)}{-\cosh \sinh^{-1} t\_2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t\_3, eh \cdot t\_1, t\_5\right)}{\sqrt{1 + {t\_2}^{2}}}\\
\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.9999999999999999e-268Initial program 99.8%
Applied rewrites1.2%
lift-/.f64N/A
frac-2negN/A
lift-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-fma.f64N/A
distribute-frac-neg2N/A
distribute-neg-fracN/A
Applied rewrites82.4%
if -4.9999999999999999e-268 < (-.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 rewrites68.1%
Applied rewrites64.9%
lift-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
lower-fma.f6476.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6476.9
Applied rewrites76.9%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* ew (cos t))) (t_2 (atan (/ (* (- eh) (tan t)) ew))))
(if (<= (- (* t_1 (cos t_2)) (* (* eh (sin t)) (sin t_2))) 5e-215)
(fabs ew)
t_1)))
double code(double eh, double ew, double t) {
double t_1 = ew * cos(t);
double t_2 = atan(((-eh * tan(t)) / ew));
double tmp;
if (((t_1 * cos(t_2)) - ((eh * sin(t)) * sin(t_2))) <= 5e-215) {
tmp = fabs(ew);
} else {
tmp = 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 = atan(((-eh * tan(t)) / ew))
if (((t_1 * cos(t_2)) - ((eh * sin(t)) * sin(t_2))) <= 5d-215) then
tmp = abs(ew)
else
tmp = 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 = Math.atan(((-eh * Math.tan(t)) / ew));
double tmp;
if (((t_1 * Math.cos(t_2)) - ((eh * Math.sin(t)) * Math.sin(t_2))) <= 5e-215) {
tmp = Math.abs(ew);
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = ew * math.cos(t) t_2 = math.atan(((-eh * math.tan(t)) / ew)) tmp = 0 if ((t_1 * math.cos(t_2)) - ((eh * math.sin(t)) * math.sin(t_2))) <= 5e-215: tmp = math.fabs(ew) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = Float64(ew * cos(t)) t_2 = atan(Float64(Float64(Float64(-eh) * tan(t)) / ew)) tmp = 0.0 if (Float64(Float64(t_1 * cos(t_2)) - Float64(Float64(eh * sin(t)) * sin(t_2))) <= 5e-215) tmp = abs(ew); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = ew * cos(t); t_2 = atan(((-eh * tan(t)) / ew)); tmp = 0.0; if (((t_1 * cos(t_2)) - ((eh * sin(t)) * sin(t_2))) <= 5e-215) tmp = abs(ew); else tmp = 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[ArcTan[N[(N[((-eh) * N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(t$95$1 * N[Cos[t$95$2], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e-215], N[Abs[ew], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := ew \cdot \cos t\\
t_2 := \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\\
\mathbf{if}\;t\_1 \cdot \cos t\_2 - \left(eh \cdot \sin t\right) \cdot \sin t\_2 \leq 5 \cdot 10^{-215}:\\
\;\;\;\;\left|ew\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\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.99999999999999956e-215Initial program 99.8%
Applied rewrites69.2%
Taylor expanded in t around 0
Applied rewrites43.0%
if 4.99999999999999956e-215 < (-.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 rewrites68.2%
Applied rewrites80.6%
Taylor expanded in eh around 0
lower-*.f64N/A
lift-cos.f6461.8
Applied rewrites61.8%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ (tan t) ew)) (t_2 (* eh (sin t))) (t_3 (* -1.0 t_2)))
(if (<= eh -3e+270)
t_3
(if (<= eh -1.35e+154)
t_2
(if (<= eh 3.4e+162)
(fabs
(/
(fma (sin t) (* t_1 (* eh eh)) (* (cos t) ew))
(cosh (asinh (* t_1 eh)))))
(if (<= eh 9.2e+210) t_3 t_2))))))
double code(double eh, double ew, double t) {
double t_1 = tan(t) / ew;
double t_2 = eh * sin(t);
double t_3 = -1.0 * t_2;
double tmp;
if (eh <= -3e+270) {
tmp = t_3;
} else if (eh <= -1.35e+154) {
tmp = t_2;
} else if (eh <= 3.4e+162) {
tmp = fabs((fma(sin(t), (t_1 * (eh * eh)), (cos(t) * ew)) / cosh(asinh((t_1 * eh)))));
} else if (eh <= 9.2e+210) {
tmp = t_3;
} else {
tmp = t_2;
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(tan(t) / ew) t_2 = Float64(eh * sin(t)) t_3 = Float64(-1.0 * t_2) tmp = 0.0 if (eh <= -3e+270) tmp = t_3; elseif (eh <= -1.35e+154) tmp = t_2; elseif (eh <= 3.4e+162) tmp = abs(Float64(fma(sin(t), Float64(t_1 * Float64(eh * eh)), Float64(cos(t) * ew)) / cosh(asinh(Float64(t_1 * eh))))); elseif (eh <= 9.2e+210) tmp = t_3; else tmp = t_2; 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]}, Block[{t$95$3 = N[(-1.0 * t$95$2), $MachinePrecision]}, If[LessEqual[eh, -3e+270], t$95$3, If[LessEqual[eh, -1.35e+154], t$95$2, If[LessEqual[eh, 3.4e+162], 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], If[LessEqual[eh, 9.2e+210], t$95$3, t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\tan t}{ew}\\
t_2 := eh \cdot \sin t\\
t_3 := -1 \cdot t\_2\\
\mathbf{if}\;eh \leq -3 \cdot 10^{+270}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;eh \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;eh \leq 3.4 \cdot 10^{+162}:\\
\;\;\;\;\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|\\
\mathbf{elif}\;eh \leq 9.2 \cdot 10^{+210}:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if eh < -3.00000000000000014e270 or 3.40000000000000003e162 < eh < 9.1999999999999995e210Initial program 99.8%
Applied rewrites1.9%
Applied rewrites1.2%
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
lift-*.f64N/A
unpow-prod-downN/A
pow2N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-pow.f641.2
Applied rewrites1.2%
Taylor expanded in eh around -inf
lower-*.f64N/A
lower-*.f64N/A
lift-sin.f6435.4
Applied rewrites35.4%
if -3.00000000000000014e270 < eh < -1.35000000000000003e154 or 9.1999999999999995e210 < eh Initial program 99.8%
Applied rewrites1.9%
Applied rewrites1.1%
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
lift-*.f64N/A
unpow-prod-downN/A
pow2N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-pow.f641.1
Applied rewrites1.1%
Taylor expanded in eh around inf
lower-*.f64N/A
lift-sin.f6438.6
Applied rewrites38.6%
if -1.35000000000000003e154 < eh < 3.40000000000000003e162Initial program 99.8%
Applied rewrites89.4%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ (tan t) ew)) (t_2 (fabs (* ew (cos t)))))
(if (<= ew -1.25e-124)
t_2
(if (<= ew 4.7e-129)
(fabs (/ (fma (sin t) (* t_1 (* eh eh)) ew) (cosh (asinh (* t_1 eh)))))
t_2))))
double code(double eh, double ew, double t) {
double t_1 = tan(t) / ew;
double t_2 = fabs((ew * cos(t)));
double tmp;
if (ew <= -1.25e-124) {
tmp = t_2;
} else if (ew <= 4.7e-129) {
tmp = fabs((fma(sin(t), (t_1 * (eh * eh)), ew) / cosh(asinh((t_1 * eh)))));
} else {
tmp = t_2;
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(tan(t) / ew) t_2 = abs(Float64(ew * cos(t))) tmp = 0.0 if (ew <= -1.25e-124) tmp = t_2; elseif (ew <= 4.7e-129) tmp = abs(Float64(fma(sin(t), Float64(t_1 * Float64(eh * eh)), ew) / cosh(asinh(Float64(t_1 * eh))))); else tmp = t_2; end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision]}, Block[{t$95$2 = N[Abs[N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[ew, -1.25e-124], t$95$2, If[LessEqual[ew, 4.7e-129], N[Abs[N[(N[(N[Sin[t], $MachinePrecision] * N[(t$95$1 * N[(eh * eh), $MachinePrecision]), $MachinePrecision] + ew), $MachinePrecision] / N[Cosh[N[ArcSinh[N[(t$95$1 * eh), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\tan t}{ew}\\
t_2 := \left|ew \cdot \cos t\right|\\
\mathbf{if}\;ew \leq -1.25 \cdot 10^{-124}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;ew \leq 4.7 \cdot 10^{-129}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(\sin t, t\_1 \cdot \left(eh \cdot eh\right), ew\right)}{\cosh \sinh^{-1} \left(t\_1 \cdot eh\right)}\right|\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if ew < -1.2500000000000001e-124 or 4.7000000000000002e-129 < ew Initial program 99.8%
Applied rewrites74.6%
Taylor expanded in eh around 0
lower-*.f64N/A
lift-cos.f6475.3
Applied rewrites75.3%
if -1.2500000000000001e-124 < ew < 4.7000000000000002e-129Initial program 99.8%
Applied rewrites54.7%
Taylor expanded in t around 0
Applied rewrites48.1%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (fabs (* ew (cos t))))) (if (<= ew -1.9e-142) t_1 (if (<= ew 8e-223) (* eh (sin t)) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((ew * cos(t)));
double tmp;
if (ew <= -1.9e-142) {
tmp = t_1;
} else if (ew <= 8e-223) {
tmp = eh * sin(t);
} else {
tmp = 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) :: tmp
t_1 = abs((ew * cos(t)))
if (ew <= (-1.9d-142)) then
tmp = t_1
else if (ew <= 8d-223) then
tmp = eh * sin(t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.abs((ew * Math.cos(t)));
double tmp;
if (ew <= -1.9e-142) {
tmp = t_1;
} else if (ew <= 8e-223) {
tmp = eh * Math.sin(t);
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs((ew * math.cos(t))) tmp = 0 if ew <= -1.9e-142: tmp = t_1 elif ew <= 8e-223: tmp = eh * math.sin(t) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(ew * cos(t))) tmp = 0.0 if (ew <= -1.9e-142) tmp = t_1; elseif (ew <= 8e-223) tmp = Float64(eh * sin(t)); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = abs((ew * cos(t))); tmp = 0.0; if (ew <= -1.9e-142) tmp = t_1; elseif (ew <= 8e-223) tmp = eh * sin(t); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[ew, -1.9e-142], t$95$1, If[LessEqual[ew, 8e-223], N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|ew \cdot \cos t\right|\\
\mathbf{if}\;ew \leq -1.9 \cdot 10^{-142}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;ew \leq 8 \cdot 10^{-223}:\\
\;\;\;\;eh \cdot \sin t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if ew < -1.89999999999999986e-142 or 7.9999999999999998e-223 < ew Initial program 99.8%
Applied rewrites73.2%
Taylor expanded in eh around 0
lower-*.f64N/A
lift-cos.f6471.0
Applied rewrites71.0%
if -1.89999999999999986e-142 < ew < 7.9999999999999998e-223Initial program 99.8%
Applied rewrites21.6%
Applied rewrites16.5%
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
lift-*.f64N/A
unpow-prod-downN/A
pow2N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-pow.f6410.5
Applied rewrites10.5%
Taylor expanded in eh around inf
lower-*.f64N/A
lift-sin.f6440.0
Applied rewrites40.0%
(FPCore (eh ew t) :precision binary64 (if (<= ew -1.9e-142) (fabs ew) (if (<= ew 1.05e-214) (* eh (sin t)) ew)))
double code(double eh, double ew, double t) {
double tmp;
if (ew <= -1.9e-142) {
tmp = fabs(ew);
} else if (ew <= 1.05e-214) {
tmp = eh * sin(t);
} else {
tmp = 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 (ew <= (-1.9d-142)) then
tmp = abs(ew)
else if (ew <= 1.05d-214) then
tmp = eh * sin(t)
else
tmp = ew
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if (ew <= -1.9e-142) {
tmp = Math.abs(ew);
} else if (ew <= 1.05e-214) {
tmp = eh * Math.sin(t);
} else {
tmp = ew;
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if ew <= -1.9e-142: tmp = math.fabs(ew) elif ew <= 1.05e-214: tmp = eh * math.sin(t) else: tmp = ew return tmp
function code(eh, ew, t) tmp = 0.0 if (ew <= -1.9e-142) tmp = abs(ew); elseif (ew <= 1.05e-214) tmp = Float64(eh * sin(t)); else tmp = ew; end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if (ew <= -1.9e-142) tmp = abs(ew); elseif (ew <= 1.05e-214) tmp = eh * sin(t); else tmp = ew; end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[LessEqual[ew, -1.9e-142], N[Abs[ew], $MachinePrecision], If[LessEqual[ew, 1.05e-214], N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision], ew]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -1.9 \cdot 10^{-142}:\\
\;\;\;\;\left|ew\right|\\
\mathbf{elif}\;ew \leq 1.05 \cdot 10^{-214}:\\
\;\;\;\;eh \cdot \sin t\\
\mathbf{else}:\\
\;\;\;\;ew\\
\end{array}
\end{array}
if ew < -1.89999999999999986e-142Initial program 99.8%
Applied rewrites73.9%
Taylor expanded in t around 0
Applied rewrites48.7%
if -1.89999999999999986e-142 < ew < 1.04999999999999996e-214Initial program 99.8%
Applied rewrites22.2%
Applied rewrites17.1%
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
lift-*.f64N/A
unpow-prod-downN/A
pow2N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-pow.f6411.0
Applied rewrites11.0%
Taylor expanded in eh around inf
lower-*.f64N/A
lift-sin.f6439.9
Applied rewrites39.9%
if 1.04999999999999996e-214 < ew Initial program 99.8%
Applied rewrites54.9%
Applied rewrites65.2%
Taylor expanded in t around 0
Applied rewrites46.4%
(FPCore (eh ew t) :precision binary64 (fabs ew))
double code(double eh, double ew, double t) {
return fabs(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(ew)
end function
public static double code(double eh, double ew, double t) {
return Math.abs(ew);
}
def code(eh, ew, t): return math.fabs(ew)
function code(eh, ew, t) return abs(ew) end
function tmp = code(eh, ew, t) tmp = abs(ew); end
code[eh_, ew_, t_] := N[Abs[ew], $MachinePrecision]
\begin{array}{l}
\\
\left|ew\right|
\end{array}
Initial program 99.8%
Applied rewrites68.7%
Taylor expanded in t around 0
Applied rewrites42.4%
(FPCore (eh ew t) :precision binary64 ew)
double code(double eh, double ew, double t) {
return 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 = ew
end function
public static double code(double eh, double ew, double t) {
return ew;
}
def code(eh, ew, t): return ew
function code(eh, ew, t) return ew end
function tmp = code(eh, ew, t) tmp = ew; end
code[eh_, ew_, t_] := ew
\begin{array}{l}
\\
ew
\end{array}
Initial program 99.8%
Applied rewrites35.3%
Applied rewrites40.9%
Taylor expanded in t around 0
Applied rewrites22.3%
herbie shell --seed 2025107
(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)))))))