
(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}
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}
Herbie found 9 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}
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}
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ eh (* (tan t) ew))))
(fabs
(+
(/ (* (sin t) ew) (sqrt (- (pow t_1 2.0) -1.0)))
(* (tanh (asinh t_1)) (* (cos t) eh))))))double code(double eh, double ew, double t) {
double t_1 = eh / (tan(t) * ew);
return fabs((((sin(t) * ew) / sqrt((pow(t_1, 2.0) - -1.0))) + (tanh(asinh(t_1)) * (cos(t) * eh))));
}
def code(eh, ew, t): t_1 = eh / (math.tan(t) * ew) return math.fabs((((math.sin(t) * ew) / math.sqrt((math.pow(t_1, 2.0) - -1.0))) + (math.tanh(math.asinh(t_1)) * (math.cos(t) * eh))))
function code(eh, ew, t) t_1 = Float64(eh / Float64(tan(t) * ew)) return abs(Float64(Float64(Float64(sin(t) * ew) / sqrt(Float64((t_1 ^ 2.0) - -1.0))) + Float64(tanh(asinh(t_1)) * Float64(cos(t) * eh)))) end
function tmp = code(eh, ew, t) t_1 = eh / (tan(t) * ew); tmp = abs((((sin(t) * ew) / sqrt(((t_1 ^ 2.0) - -1.0))) + (tanh(asinh(t_1)) * (cos(t) * eh)))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh / N[(N[Tan[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]}, N[Abs[N[(N[(N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision] / N[Sqrt[N[(N[Power[t$95$1, 2.0], $MachinePrecision] - -1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Tanh[N[ArcSinh[t$95$1], $MachinePrecision]], $MachinePrecision] * N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
t_1 := \frac{eh}{\tan t \cdot ew}\\
\left|\frac{\sin t \cdot ew}{\sqrt{{t\_1}^{2} - -1}} + \tanh \sinh^{-1} t\_1 \cdot \left(\cos t \cdot eh\right)\right|
\end{array}
Initial program 99.8%
Applied rewrites99.8%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* (/ (sin t) (sqrt (- (/ (* (/ eh (* ew t)) eh) (* ew t)) -1.0))) ew) (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))))))
double code(double eh, double ew, double t) {
return fabs((((sin(t) / sqrt(((((eh / (ew * t)) * eh) / (ew * t)) - -1.0))) * ew) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t)))))));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(eh, ew, t)
use fmin_fmax_functions
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
code = abs((((sin(t) / sqrt(((((eh / (ew * t)) * eh) / (ew * t)) - (-1.0d0)))) * ew) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t)))))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((((Math.sin(t) / Math.sqrt(((((eh / (ew * t)) * eh) / (ew * t)) - -1.0))) * ew) + ((eh * Math.cos(t)) * Math.sin(Math.atan(((eh / ew) / Math.tan(t)))))));
}
def code(eh, ew, t): return math.fabs((((math.sin(t) / math.sqrt(((((eh / (ew * t)) * eh) / (ew * t)) - -1.0))) * ew) + ((eh * math.cos(t)) * math.sin(math.atan(((eh / ew) / math.tan(t)))))))
function code(eh, ew, t) return abs(Float64(Float64(Float64(sin(t) / sqrt(Float64(Float64(Float64(Float64(eh / Float64(ew * t)) * eh) / Float64(ew * t)) - -1.0))) * ew) + Float64(Float64(eh * cos(t)) * sin(atan(Float64(Float64(eh / ew) / tan(t))))))) end
function tmp = code(eh, ew, t) tmp = abs((((sin(t) / sqrt(((((eh / (ew * t)) * eh) / (ew * t)) - -1.0))) * ew) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[(N[Sin[t], $MachinePrecision] / N[Sqrt[N[(N[(N[(N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision] * eh), $MachinePrecision] / N[(ew * t), $MachinePrecision]), $MachinePrecision] - -1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * ew), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\left|\frac{\sin t}{\sqrt{\frac{\frac{eh}{ew \cdot t} \cdot eh}{ew \cdot t} - -1}} \cdot ew + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right|
Initial program 99.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.8%
Taylor expanded in t around 0
lower-*.f6499.1%
Applied rewrites99.1%
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6499.1%
Applied rewrites99.1%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* (sin t) ew) (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))))))
double code(double eh, double ew, double t) {
return fabs(((sin(t) * ew) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t)))))));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(eh, ew, t)
use fmin_fmax_functions
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
code = abs(((sin(t) * ew) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t)))))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs(((Math.sin(t) * ew) + ((eh * Math.cos(t)) * Math.sin(Math.atan(((eh / ew) / Math.tan(t)))))));
}
def code(eh, ew, t): return math.fabs(((math.sin(t) * ew) + ((eh * math.cos(t)) * math.sin(math.atan(((eh / ew) / math.tan(t)))))))
function code(eh, ew, t) return abs(Float64(Float64(sin(t) * ew) + Float64(Float64(eh * cos(t)) * sin(atan(Float64(Float64(eh / ew) / tan(t))))))) end
function tmp = code(eh, ew, t) tmp = abs(((sin(t) * ew) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\left|\sin t \cdot ew + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right|
Initial program 99.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.8%
Taylor expanded in t around 0
lower-*.f6499.1%
Applied rewrites99.1%
Taylor expanded in eh around 0
lower-sin.f6498.6%
Applied rewrites98.6%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ eh (* ew t)))
(t_2
(fabs
(/
(+ (* t_1 (* (cos t) eh)) (* (sin t) ew))
(sqrt (- (pow t_1 2.0) -1.0))))))
(if (<= t -3e-59)
t_2
(if (<= t 1.65e-109)
(fabs (* eh (/ (* (/ eh (fabs eh)) (fabs ew)) ew)))
t_2))))double code(double eh, double ew, double t) {
double t_1 = eh / (ew * t);
double t_2 = fabs((((t_1 * (cos(t) * eh)) + (sin(t) * ew)) / sqrt((pow(t_1, 2.0) - -1.0))));
double tmp;
if (t <= -3e-59) {
tmp = t_2;
} else if (t <= 1.65e-109) {
tmp = fabs((eh * (((eh / fabs(eh)) * fabs(ew)) / ew)));
} else {
tmp = t_2;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(eh, ew, t)
use fmin_fmax_functions
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = eh / (ew * t)
t_2 = abs((((t_1 * (cos(t) * eh)) + (sin(t) * ew)) / sqrt(((t_1 ** 2.0d0) - (-1.0d0)))))
if (t <= (-3d-59)) then
tmp = t_2
else if (t <= 1.65d-109) then
tmp = abs((eh * (((eh / abs(eh)) * abs(ew)) / ew)))
else
tmp = t_2
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = eh / (ew * t);
double t_2 = Math.abs((((t_1 * (Math.cos(t) * eh)) + (Math.sin(t) * ew)) / Math.sqrt((Math.pow(t_1, 2.0) - -1.0))));
double tmp;
if (t <= -3e-59) {
tmp = t_2;
} else if (t <= 1.65e-109) {
tmp = Math.abs((eh * (((eh / Math.abs(eh)) * Math.abs(ew)) / ew)));
} else {
tmp = t_2;
}
return tmp;
}
def code(eh, ew, t): t_1 = eh / (ew * t) t_2 = math.fabs((((t_1 * (math.cos(t) * eh)) + (math.sin(t) * ew)) / math.sqrt((math.pow(t_1, 2.0) - -1.0)))) tmp = 0 if t <= -3e-59: tmp = t_2 elif t <= 1.65e-109: tmp = math.fabs((eh * (((eh / math.fabs(eh)) * math.fabs(ew)) / ew))) else: tmp = t_2 return tmp
function code(eh, ew, t) t_1 = Float64(eh / Float64(ew * t)) t_2 = abs(Float64(Float64(Float64(t_1 * Float64(cos(t) * eh)) + Float64(sin(t) * ew)) / sqrt(Float64((t_1 ^ 2.0) - -1.0)))) tmp = 0.0 if (t <= -3e-59) tmp = t_2; elseif (t <= 1.65e-109) tmp = abs(Float64(eh * Float64(Float64(Float64(eh / abs(eh)) * abs(ew)) / ew))); else tmp = t_2; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = eh / (ew * t); t_2 = abs((((t_1 * (cos(t) * eh)) + (sin(t) * ew)) / sqrt(((t_1 ^ 2.0) - -1.0)))); tmp = 0.0; if (t <= -3e-59) tmp = t_2; elseif (t <= 1.65e-109) tmp = abs((eh * (((eh / abs(eh)) * abs(ew)) / ew))); else tmp = t_2; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Abs[N[(N[(N[(t$95$1 * N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision]), $MachinePrecision] + N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(N[Power[t$95$1, 2.0], $MachinePrecision] - -1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, -3e-59], t$95$2, If[LessEqual[t, 1.65e-109], N[Abs[N[(eh * N[(N[(N[(eh / N[Abs[eh], $MachinePrecision]), $MachinePrecision] * N[Abs[ew], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$2]]]]
\begin{array}{l}
t_1 := \frac{eh}{ew \cdot t}\\
t_2 := \left|\frac{t\_1 \cdot \left(\cos t \cdot eh\right) + \sin t \cdot ew}{\sqrt{{t\_1}^{2} - -1}}\right|\\
\mathbf{if}\;t \leq -3 \cdot 10^{-59}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq 1.65 \cdot 10^{-109}:\\
\;\;\;\;\left|eh \cdot \frac{\frac{eh}{\left|eh\right|} \cdot \left|ew\right|}{ew}\right|\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
if t < -3.0000000000000001e-59 or 1.65e-109 < t Initial program 99.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-atan.f64N/A
sin-atanN/A
associate-*l/N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
Applied rewrites57.2%
Taylor expanded in t around 0
lower-*.f6448.6%
Applied rewrites48.6%
Taylor expanded in t around 0
lower-*.f6455.0%
Applied rewrites55.0%
if -3.0000000000000001e-59 < t < 1.65e-109Initial program 99.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-atan.f64N/A
sin-atanN/A
associate-*l/N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
Applied rewrites57.2%
Taylor expanded in t around 0
lower-/.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-pow.f6411.3%
Applied rewrites11.3%
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6412.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6412.3%
lift-sqrt.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
lift-pow.f64N/A
unpow2N/A
times-fracN/A
lift-/.f64N/A
lift-/.f64N/A
rem-sqrt-squareN/A
lower-fabs.f6435.1%
Applied rewrites35.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lift-fabs.f64N/A
lift-/.f64N/A
fabs-divN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-fabs.f64N/A
lower-fabs.f6442.6%
Applied rewrites42.6%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1
(fabs
(/
(+ (* (/ eh (* (tan t) ew)) (* (cos t) eh)) (* (sin t) ew))
(sqrt 1.0)))))
(if (<= t -3e-59)
t_1
(if (<= t 1.65e-109)
(fabs (* eh (/ (* (/ eh (fabs eh)) (fabs ew)) ew)))
t_1))))double code(double eh, double ew, double t) {
double t_1 = fabs(((((eh / (tan(t) * ew)) * (cos(t) * eh)) + (sin(t) * ew)) / sqrt(1.0)));
double tmp;
if (t <= -3e-59) {
tmp = t_1;
} else if (t <= 1.65e-109) {
tmp = fabs((eh * (((eh / fabs(eh)) * fabs(ew)) / 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) :: tmp
t_1 = abs(((((eh / (tan(t) * ew)) * (cos(t) * eh)) + (sin(t) * ew)) / sqrt(1.0d0)))
if (t <= (-3d-59)) then
tmp = t_1
else if (t <= 1.65d-109) then
tmp = abs((eh * (((eh / abs(eh)) * abs(ew)) / ew)))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.abs(((((eh / (Math.tan(t) * ew)) * (Math.cos(t) * eh)) + (Math.sin(t) * ew)) / Math.sqrt(1.0)));
double tmp;
if (t <= -3e-59) {
tmp = t_1;
} else if (t <= 1.65e-109) {
tmp = Math.abs((eh * (((eh / Math.abs(eh)) * Math.abs(ew)) / ew)));
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs(((((eh / (math.tan(t) * ew)) * (math.cos(t) * eh)) + (math.sin(t) * ew)) / math.sqrt(1.0))) tmp = 0 if t <= -3e-59: tmp = t_1 elif t <= 1.65e-109: tmp = math.fabs((eh * (((eh / math.fabs(eh)) * math.fabs(ew)) / ew))) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(Float64(Float64(Float64(eh / Float64(tan(t) * ew)) * Float64(cos(t) * eh)) + Float64(sin(t) * ew)) / sqrt(1.0))) tmp = 0.0 if (t <= -3e-59) tmp = t_1; elseif (t <= 1.65e-109) tmp = abs(Float64(eh * Float64(Float64(Float64(eh / abs(eh)) * abs(ew)) / ew))); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = abs(((((eh / (tan(t) * ew)) * (cos(t) * eh)) + (sin(t) * ew)) / sqrt(1.0))); tmp = 0.0; if (t <= -3e-59) tmp = t_1; elseif (t <= 1.65e-109) tmp = abs((eh * (((eh / abs(eh)) * abs(ew)) / ew))); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(N[(N[(N[(eh / N[(N[Tan[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision] * N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision]), $MachinePrecision] + N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, -3e-59], t$95$1, If[LessEqual[t, 1.65e-109], N[Abs[N[(eh * N[(N[(N[(eh / N[Abs[eh], $MachinePrecision]), $MachinePrecision] * N[Abs[ew], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \left|\frac{\frac{eh}{\tan t \cdot ew} \cdot \left(\cos t \cdot eh\right) + \sin t \cdot ew}{\sqrt{1}}\right|\\
\mathbf{if}\;t \leq -3 \cdot 10^{-59}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.65 \cdot 10^{-109}:\\
\;\;\;\;\left|eh \cdot \frac{\frac{eh}{\left|eh\right|} \cdot \left|ew\right|}{ew}\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if t < -3.0000000000000001e-59 or 1.65e-109 < t Initial program 99.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-atan.f64N/A
sin-atanN/A
associate-*l/N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
Applied rewrites57.2%
Taylor expanded in eh around 0
Applied rewrites42.6%
if -3.0000000000000001e-59 < t < 1.65e-109Initial program 99.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-atan.f64N/A
sin-atanN/A
associate-*l/N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
Applied rewrites57.2%
Taylor expanded in t around 0
lower-/.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-pow.f6411.3%
Applied rewrites11.3%
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6412.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6412.3%
lift-sqrt.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
lift-pow.f64N/A
unpow2N/A
times-fracN/A
lift-/.f64N/A
lift-/.f64N/A
rem-sqrt-squareN/A
lower-fabs.f6435.1%
Applied rewrites35.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lift-fabs.f64N/A
lift-/.f64N/A
fabs-divN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-fabs.f64N/A
lower-fabs.f6442.6%
Applied rewrites42.6%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (fabs (* eh (/ (* ew (sin t)) eh)))))
(if (<= t -3e-59)
t_1
(if (<= t 1.65e-109)
(fabs (* eh (/ (* (/ eh (fabs eh)) (fabs ew)) ew)))
t_1))))double code(double eh, double ew, double t) {
double t_1 = fabs((eh * ((ew * sin(t)) / eh)));
double tmp;
if (t <= -3e-59) {
tmp = t_1;
} else if (t <= 1.65e-109) {
tmp = fabs((eh * (((eh / fabs(eh)) * fabs(ew)) / 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) :: tmp
t_1 = abs((eh * ((ew * sin(t)) / eh)))
if (t <= (-3d-59)) then
tmp = t_1
else if (t <= 1.65d-109) then
tmp = abs((eh * (((eh / abs(eh)) * abs(ew)) / ew)))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.abs((eh * ((ew * Math.sin(t)) / eh)));
double tmp;
if (t <= -3e-59) {
tmp = t_1;
} else if (t <= 1.65e-109) {
tmp = Math.abs((eh * (((eh / Math.abs(eh)) * Math.abs(ew)) / ew)));
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs((eh * ((ew * math.sin(t)) / eh))) tmp = 0 if t <= -3e-59: tmp = t_1 elif t <= 1.65e-109: tmp = math.fabs((eh * (((eh / math.fabs(eh)) * math.fabs(ew)) / ew))) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(eh * Float64(Float64(ew * sin(t)) / eh))) tmp = 0.0 if (t <= -3e-59) tmp = t_1; elseif (t <= 1.65e-109) tmp = abs(Float64(eh * Float64(Float64(Float64(eh / abs(eh)) * abs(ew)) / ew))); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = abs((eh * ((ew * sin(t)) / eh))); tmp = 0.0; if (t <= -3e-59) tmp = t_1; elseif (t <= 1.65e-109) tmp = abs((eh * (((eh / abs(eh)) * abs(ew)) / ew))); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(eh * N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] / eh), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, -3e-59], t$95$1, If[LessEqual[t, 1.65e-109], N[Abs[N[(eh * N[(N[(N[(eh / N[Abs[eh], $MachinePrecision]), $MachinePrecision] * N[Abs[ew], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \left|eh \cdot \frac{ew \cdot \sin t}{eh}\right|\\
\mathbf{if}\;t \leq -3 \cdot 10^{-59}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.65 \cdot 10^{-109}:\\
\;\;\;\;\left|eh \cdot \frac{\frac{eh}{\left|eh\right|} \cdot \left|ew\right|}{ew}\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if t < -3.0000000000000001e-59 or 1.65e-109 < t Initial program 99.8%
Taylor expanded in eh around inf
lower-*.f64N/A
lower-+.f64N/A
Applied rewrites92.0%
Applied rewrites35.2%
Taylor expanded in eh around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6434.0%
Applied rewrites34.0%
if -3.0000000000000001e-59 < t < 1.65e-109Initial program 99.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-atan.f64N/A
sin-atanN/A
associate-*l/N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
Applied rewrites57.2%
Taylor expanded in t around 0
lower-/.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-pow.f6411.3%
Applied rewrites11.3%
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6412.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6412.3%
lift-sqrt.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
lift-pow.f64N/A
unpow2N/A
times-fracN/A
lift-/.f64N/A
lift-/.f64N/A
rem-sqrt-squareN/A
lower-fabs.f6435.1%
Applied rewrites35.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lift-fabs.f64N/A
lift-/.f64N/A
fabs-divN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-fabs.f64N/A
lower-fabs.f6442.6%
Applied rewrites42.6%
(FPCore (eh ew t) :precision binary64 (fabs (* eh (/ (* (/ eh (fabs eh)) (fabs ew)) ew))))
double code(double eh, double ew, double t) {
return fabs((eh * (((eh / fabs(eh)) * fabs(ew)) / ew)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(eh, ew, t)
use fmin_fmax_functions
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
code = abs((eh * (((eh / abs(eh)) * abs(ew)) / ew)))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((eh * (((eh / Math.abs(eh)) * Math.abs(ew)) / ew)));
}
def code(eh, ew, t): return math.fabs((eh * (((eh / math.fabs(eh)) * math.fabs(ew)) / ew)))
function code(eh, ew, t) return abs(Float64(eh * Float64(Float64(Float64(eh / abs(eh)) * abs(ew)) / ew))) end
function tmp = code(eh, ew, t) tmp = abs((eh * (((eh / abs(eh)) * abs(ew)) / ew))); end
code[eh_, ew_, t_] := N[Abs[N[(eh * N[(N[(N[(eh / N[Abs[eh], $MachinePrecision]), $MachinePrecision] * N[Abs[ew], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\left|eh \cdot \frac{\frac{eh}{\left|eh\right|} \cdot \left|ew\right|}{ew}\right|
Initial program 99.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-atan.f64N/A
sin-atanN/A
associate-*l/N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
Applied rewrites57.2%
Taylor expanded in t around 0
lower-/.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-pow.f6411.3%
Applied rewrites11.3%
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6412.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6412.3%
lift-sqrt.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
lift-pow.f64N/A
unpow2N/A
times-fracN/A
lift-/.f64N/A
lift-/.f64N/A
rem-sqrt-squareN/A
lower-fabs.f6435.1%
Applied rewrites35.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lift-fabs.f64N/A
lift-/.f64N/A
fabs-divN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-fabs.f64N/A
lower-fabs.f6442.6%
Applied rewrites42.6%
(FPCore (eh ew t) :precision binary64 (if (<= eh -2e-13) (fabs (* eh (/ eh (/ (* (fabs eh) ew) (fabs ew))))) (fabs (* eh (/ eh (* (fabs (/ eh ew)) ew))))))
double code(double eh, double ew, double t) {
double tmp;
if (eh <= -2e-13) {
tmp = fabs((eh * (eh / ((fabs(eh) * ew) / fabs(ew)))));
} else {
tmp = fabs((eh * (eh / (fabs((eh / ew)) * 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 <= (-2d-13)) then
tmp = abs((eh * (eh / ((abs(eh) * ew) / abs(ew)))))
else
tmp = abs((eh * (eh / (abs((eh / ew)) * ew))))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if (eh <= -2e-13) {
tmp = Math.abs((eh * (eh / ((Math.abs(eh) * ew) / Math.abs(ew)))));
} else {
tmp = Math.abs((eh * (eh / (Math.abs((eh / ew)) * ew))));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if eh <= -2e-13: tmp = math.fabs((eh * (eh / ((math.fabs(eh) * ew) / math.fabs(ew))))) else: tmp = math.fabs((eh * (eh / (math.fabs((eh / ew)) * ew)))) return tmp
function code(eh, ew, t) tmp = 0.0 if (eh <= -2e-13) tmp = abs(Float64(eh * Float64(eh / Float64(Float64(abs(eh) * ew) / abs(ew))))); else tmp = abs(Float64(eh * Float64(eh / Float64(abs(Float64(eh / ew)) * ew)))); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if (eh <= -2e-13) tmp = abs((eh * (eh / ((abs(eh) * ew) / abs(ew))))); else tmp = abs((eh * (eh / (abs((eh / ew)) * ew)))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[LessEqual[eh, -2e-13], N[Abs[N[(eh * N[(eh / N[(N[(N[Abs[eh], $MachinePrecision] * ew), $MachinePrecision] / N[Abs[ew], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(eh * N[(eh / N[(N[Abs[N[(eh / ew), $MachinePrecision]], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;eh \leq -2 \cdot 10^{-13}:\\
\;\;\;\;\left|eh \cdot \frac{eh}{\frac{\left|eh\right| \cdot ew}{\left|ew\right|}}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|eh \cdot \frac{eh}{\left|\frac{eh}{ew}\right| \cdot ew}\right|\\
\end{array}
if eh < -2.0000000000000001e-13Initial program 99.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-atan.f64N/A
sin-atanN/A
associate-*l/N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
Applied rewrites57.2%
Taylor expanded in t around 0
lower-/.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-pow.f6411.3%
Applied rewrites11.3%
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6412.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6412.3%
lift-sqrt.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
lift-pow.f64N/A
unpow2N/A
times-fracN/A
lift-/.f64N/A
lift-/.f64N/A
rem-sqrt-squareN/A
lower-fabs.f6435.1%
Applied rewrites35.1%
lift-*.f64N/A
lift-fabs.f64N/A
lift-/.f64N/A
fabs-divN/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-fabs.f64N/A
lower-fabs.f6431.2%
Applied rewrites31.2%
if -2.0000000000000001e-13 < eh Initial program 99.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-atan.f64N/A
sin-atanN/A
associate-*l/N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
Applied rewrites57.2%
Taylor expanded in t around 0
lower-/.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-pow.f6411.3%
Applied rewrites11.3%
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6412.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6412.3%
lift-sqrt.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
lift-pow.f64N/A
unpow2N/A
times-fracN/A
lift-/.f64N/A
lift-/.f64N/A
rem-sqrt-squareN/A
lower-fabs.f6435.1%
Applied rewrites35.1%
(FPCore (eh ew t) :precision binary64 (fabs (* eh (/ eh (* (fabs (/ eh ew)) ew)))))
double code(double eh, double ew, double t) {
return fabs((eh * (eh / (fabs((eh / ew)) * ew))));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(eh, ew, t)
use fmin_fmax_functions
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
code = abs((eh * (eh / (abs((eh / ew)) * ew))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((eh * (eh / (Math.abs((eh / ew)) * ew))));
}
def code(eh, ew, t): return math.fabs((eh * (eh / (math.fabs((eh / ew)) * ew))))
function code(eh, ew, t) return abs(Float64(eh * Float64(eh / Float64(abs(Float64(eh / ew)) * ew)))) end
function tmp = code(eh, ew, t) tmp = abs((eh * (eh / (abs((eh / ew)) * ew)))); end
code[eh_, ew_, t_] := N[Abs[N[(eh * N[(eh / N[(N[Abs[N[(eh / ew), $MachinePrecision]], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\left|eh \cdot \frac{eh}{\left|\frac{eh}{ew}\right| \cdot ew}\right|
Initial program 99.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-atan.f64N/A
sin-atanN/A
associate-*l/N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
Applied rewrites57.2%
Taylor expanded in t around 0
lower-/.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-pow.f6411.3%
Applied rewrites11.3%
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6412.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6412.3%
lift-sqrt.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
lift-pow.f64N/A
unpow2N/A
times-fracN/A
lift-/.f64N/A
lift-/.f64N/A
rem-sqrt-squareN/A
lower-fabs.f6435.1%
Applied rewrites35.1%
herbie shell --seed 2025258
(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))))))))