
(FPCore (r a b) :precision binary64 (/ (* r (sin b)) (cos (+ a b))))
double code(double r, double a, double b) {
return (r * sin(b)) / cos((a + b));
}
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(r, a, b)
use fmin_fmax_functions
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
code = (r * sin(b)) / cos((a + b))
end function
public static double code(double r, double a, double b) {
return (r * Math.sin(b)) / Math.cos((a + b));
}
def code(r, a, b): return (r * math.sin(b)) / math.cos((a + b))
function code(r, a, b) return Float64(Float64(r * sin(b)) / cos(Float64(a + b))) end
function tmp = code(r, a, b) tmp = (r * sin(b)) / cos((a + b)); end
code[r_, a_, b_] := N[(N[(r * N[Sin[b], $MachinePrecision]), $MachinePrecision] / N[Cos[N[(a + b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{r \cdot \sin b}{\cos \left(a + b\right)}
\end{array}
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (r a b) :precision binary64 (/ (* r (sin b)) (cos (+ a b))))
double code(double r, double a, double b) {
return (r * sin(b)) / cos((a + b));
}
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(r, a, b)
use fmin_fmax_functions
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
code = (r * sin(b)) / cos((a + b))
end function
public static double code(double r, double a, double b) {
return (r * Math.sin(b)) / Math.cos((a + b));
}
def code(r, a, b): return (r * math.sin(b)) / math.cos((a + b))
function code(r, a, b) return Float64(Float64(r * sin(b)) / cos(Float64(a + b))) end
function tmp = code(r, a, b) tmp = (r * sin(b)) / cos((a + b)); end
code[r_, a_, b_] := N[(N[(r * N[Sin[b], $MachinePrecision]), $MachinePrecision] / N[Cos[N[(a + b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{r \cdot \sin b}{\cos \left(a + b\right)}
\end{array}
(FPCore (r a b) :precision binary64 (* (/ (tan b) (cos a)) (/ r (- 1.0 (* (tan a) (tan b))))))
double code(double r, double a, double b) {
return (tan(b) / cos(a)) * (r / (1.0 - (tan(a) * tan(b))));
}
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(r, a, b)
use fmin_fmax_functions
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
code = (tan(b) / cos(a)) * (r / (1.0d0 - (tan(a) * tan(b))))
end function
public static double code(double r, double a, double b) {
return (Math.tan(b) / Math.cos(a)) * (r / (1.0 - (Math.tan(a) * Math.tan(b))));
}
def code(r, a, b): return (math.tan(b) / math.cos(a)) * (r / (1.0 - (math.tan(a) * math.tan(b))))
function code(r, a, b) return Float64(Float64(tan(b) / cos(a)) * Float64(r / Float64(1.0 - Float64(tan(a) * tan(b))))) end
function tmp = code(r, a, b) tmp = (tan(b) / cos(a)) * (r / (1.0 - (tan(a) * tan(b)))); end
code[r_, a_, b_] := N[(N[(N[Tan[b], $MachinePrecision] / N[Cos[a], $MachinePrecision]), $MachinePrecision] * N[(r / N[(1.0 - N[(N[Tan[a], $MachinePrecision] * N[Tan[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\tan b}{\cos a} \cdot \frac{r}{1 - \tan a \cdot \tan b}
\end{array}
Initial program 76.6%
lift-cos.f64N/A
lift-+.f64N/A
cos-sumN/A
sub-to-multN/A
lower-*.f64N/A
lower--.f64N/A
lift-sin.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-cos.f6499.5
Applied rewrites99.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.5%
(FPCore (r a b) :precision binary64 (/ (/ (* (tan b) r) (- 1.0 (* (tan a) (tan b)))) (cos a)))
double code(double r, double a, double b) {
return ((tan(b) * r) / (1.0 - (tan(a) * tan(b)))) / cos(a);
}
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(r, a, b)
use fmin_fmax_functions
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((tan(b) * r) / (1.0d0 - (tan(a) * tan(b)))) / cos(a)
end function
public static double code(double r, double a, double b) {
return ((Math.tan(b) * r) / (1.0 - (Math.tan(a) * Math.tan(b)))) / Math.cos(a);
}
def code(r, a, b): return ((math.tan(b) * r) / (1.0 - (math.tan(a) * math.tan(b)))) / math.cos(a)
function code(r, a, b) return Float64(Float64(Float64(tan(b) * r) / Float64(1.0 - Float64(tan(a) * tan(b)))) / cos(a)) end
function tmp = code(r, a, b) tmp = ((tan(b) * r) / (1.0 - (tan(a) * tan(b)))) / cos(a); end
code[r_, a_, b_] := N[(N[(N[(N[Tan[b], $MachinePrecision] * r), $MachinePrecision] / N[(1.0 - N[(N[Tan[a], $MachinePrecision] * N[Tan[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Cos[a], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{\tan b \cdot r}{1 - \tan a \cdot \tan b}}{\cos a}
\end{array}
Initial program 76.6%
lift-cos.f64N/A
lift-+.f64N/A
cos-sumN/A
sub-to-multN/A
lower-*.f64N/A
lower--.f64N/A
lift-sin.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-cos.f6499.5
Applied rewrites99.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.5%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6499.5
Applied rewrites99.5%
(FPCore (r a b) :precision binary64 (/ (* (tan b) (- r)) (* (cos a) (fma (tan a) (tan b) -1.0))))
double code(double r, double a, double b) {
return (tan(b) * -r) / (cos(a) * fma(tan(a), tan(b), -1.0));
}
function code(r, a, b) return Float64(Float64(tan(b) * Float64(-r)) / Float64(cos(a) * fma(tan(a), tan(b), -1.0))) end
code[r_, a_, b_] := N[(N[(N[Tan[b], $MachinePrecision] * (-r)), $MachinePrecision] / N[(N[Cos[a], $MachinePrecision] * N[(N[Tan[a], $MachinePrecision] * N[Tan[b], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\tan b \cdot \left(-r\right)}{\cos a \cdot \mathsf{fma}\left(\tan a, \tan b, -1\right)}
\end{array}
Initial program 76.6%
lift-cos.f64N/A
lift-+.f64N/A
cos-sumN/A
sub-to-multN/A
lower-*.f64N/A
lower--.f64N/A
lift-sin.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-cos.f6499.5
Applied rewrites99.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.5%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-2negN/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
sub-flipN/A
lift-*.f64N/A
metadata-evalN/A
lower-fma.f6499.5
Applied rewrites99.5%
(FPCore (r a b) :precision binary64 (/ (* r (tan b)) (* (- 1.0 (* (tan a) (tan b))) (cos a))))
double code(double r, double a, double b) {
return (r * tan(b)) / ((1.0 - (tan(a) * tan(b))) * cos(a));
}
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(r, a, b)
use fmin_fmax_functions
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
code = (r * tan(b)) / ((1.0d0 - (tan(a) * tan(b))) * cos(a))
end function
public static double code(double r, double a, double b) {
return (r * Math.tan(b)) / ((1.0 - (Math.tan(a) * Math.tan(b))) * Math.cos(a));
}
def code(r, a, b): return (r * math.tan(b)) / ((1.0 - (math.tan(a) * math.tan(b))) * math.cos(a))
function code(r, a, b) return Float64(Float64(r * tan(b)) / Float64(Float64(1.0 - Float64(tan(a) * tan(b))) * cos(a))) end
function tmp = code(r, a, b) tmp = (r * tan(b)) / ((1.0 - (tan(a) * tan(b))) * cos(a)); end
code[r_, a_, b_] := N[(N[(r * N[Tan[b], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 - N[(N[Tan[a], $MachinePrecision] * N[Tan[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{r \cdot \tan b}{\left(1 - \tan a \cdot \tan b\right) \cdot \cos a}
\end{array}
Initial program 76.6%
lift-cos.f64N/A
lift-+.f64N/A
cos-sumN/A
sub-to-multN/A
lower-*.f64N/A
lower--.f64N/A
lift-sin.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-cos.f6499.5
Applied rewrites99.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lift-*.f64N/A
associate-/r*N/A
frac-timesN/A
lower-/.f64N/A
Applied rewrites99.5%
(FPCore (r a b) :precision binary64 (* (tan b) (/ r (* (- 1.0 (* (tan a) (tan b))) (cos a)))))
double code(double r, double a, double b) {
return tan(b) * (r / ((1.0 - (tan(a) * tan(b))) * cos(a)));
}
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(r, a, b)
use fmin_fmax_functions
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
code = tan(b) * (r / ((1.0d0 - (tan(a) * tan(b))) * cos(a)))
end function
public static double code(double r, double a, double b) {
return Math.tan(b) * (r / ((1.0 - (Math.tan(a) * Math.tan(b))) * Math.cos(a)));
}
def code(r, a, b): return math.tan(b) * (r / ((1.0 - (math.tan(a) * math.tan(b))) * math.cos(a)))
function code(r, a, b) return Float64(tan(b) * Float64(r / Float64(Float64(1.0 - Float64(tan(a) * tan(b))) * cos(a)))) end
function tmp = code(r, a, b) tmp = tan(b) * (r / ((1.0 - (tan(a) * tan(b))) * cos(a))); end
code[r_, a_, b_] := N[(N[Tan[b], $MachinePrecision] * N[(r / N[(N[(1.0 - N[(N[Tan[a], $MachinePrecision] * N[Tan[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\tan b \cdot \frac{r}{\left(1 - \tan a \cdot \tan b\right) \cdot \cos a}
\end{array}
Initial program 76.6%
lift-cos.f64N/A
lift-+.f64N/A
cos-sumN/A
sub-to-multN/A
lower-*.f64N/A
lower--.f64N/A
lift-sin.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-cos.f6499.5
Applied rewrites99.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.5%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6499.5
Applied rewrites99.5%
(FPCore (r a b) :precision binary64 (/ (* (/ r 1.0) (tan b)) (cos a)))
double code(double r, double a, double b) {
return ((r / 1.0) * tan(b)) / cos(a);
}
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(r, a, b)
use fmin_fmax_functions
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((r / 1.0d0) * tan(b)) / cos(a)
end function
public static double code(double r, double a, double b) {
return ((r / 1.0) * Math.tan(b)) / Math.cos(a);
}
def code(r, a, b): return ((r / 1.0) * math.tan(b)) / math.cos(a)
function code(r, a, b) return Float64(Float64(Float64(r / 1.0) * tan(b)) / cos(a)) end
function tmp = code(r, a, b) tmp = ((r / 1.0) * tan(b)) / cos(a); end
code[r_, a_, b_] := N[(N[(N[(r / 1.0), $MachinePrecision] * N[Tan[b], $MachinePrecision]), $MachinePrecision] / N[Cos[a], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{r}{1} \cdot \tan b}{\cos a}
\end{array}
Initial program 76.6%
lift-cos.f64N/A
lift-+.f64N/A
cos-sumN/A
sub-to-multN/A
lower-*.f64N/A
lower--.f64N/A
lift-sin.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-cos.f6499.5
Applied rewrites99.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lift-*.f64N/A
associate-/r*N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites99.5%
Taylor expanded in a around 0
Applied rewrites77.5%
(FPCore (r a b) :precision binary64 (if (<= a -3.1e-6) (* (/ (sin b) (cos a)) r) (if (<= a 1200.0) (/ (* r (sin b)) (cos b)) (* (sin b) (/ r (cos a))))))
double code(double r, double a, double b) {
double tmp;
if (a <= -3.1e-6) {
tmp = (sin(b) / cos(a)) * r;
} else if (a <= 1200.0) {
tmp = (r * sin(b)) / cos(b);
} else {
tmp = sin(b) * (r / cos(a));
}
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(r, a, b)
use fmin_fmax_functions
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (a <= (-3.1d-6)) then
tmp = (sin(b) / cos(a)) * r
else if (a <= 1200.0d0) then
tmp = (r * sin(b)) / cos(b)
else
tmp = sin(b) * (r / cos(a))
end if
code = tmp
end function
public static double code(double r, double a, double b) {
double tmp;
if (a <= -3.1e-6) {
tmp = (Math.sin(b) / Math.cos(a)) * r;
} else if (a <= 1200.0) {
tmp = (r * Math.sin(b)) / Math.cos(b);
} else {
tmp = Math.sin(b) * (r / Math.cos(a));
}
return tmp;
}
def code(r, a, b): tmp = 0 if a <= -3.1e-6: tmp = (math.sin(b) / math.cos(a)) * r elif a <= 1200.0: tmp = (r * math.sin(b)) / math.cos(b) else: tmp = math.sin(b) * (r / math.cos(a)) return tmp
function code(r, a, b) tmp = 0.0 if (a <= -3.1e-6) tmp = Float64(Float64(sin(b) / cos(a)) * r); elseif (a <= 1200.0) tmp = Float64(Float64(r * sin(b)) / cos(b)); else tmp = Float64(sin(b) * Float64(r / cos(a))); end return tmp end
function tmp_2 = code(r, a, b) tmp = 0.0; if (a <= -3.1e-6) tmp = (sin(b) / cos(a)) * r; elseif (a <= 1200.0) tmp = (r * sin(b)) / cos(b); else tmp = sin(b) * (r / cos(a)); end tmp_2 = tmp; end
code[r_, a_, b_] := If[LessEqual[a, -3.1e-6], N[(N[(N[Sin[b], $MachinePrecision] / N[Cos[a], $MachinePrecision]), $MachinePrecision] * r), $MachinePrecision], If[LessEqual[a, 1200.0], N[(N[(r * N[Sin[b], $MachinePrecision]), $MachinePrecision] / N[Cos[b], $MachinePrecision]), $MachinePrecision], N[(N[Sin[b], $MachinePrecision] * N[(r / N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.1 \cdot 10^{-6}:\\
\;\;\;\;\frac{\sin b}{\cos a} \cdot r\\
\mathbf{elif}\;a \leq 1200:\\
\;\;\;\;\frac{r \cdot \sin b}{\cos b}\\
\mathbf{else}:\\
\;\;\;\;\sin b \cdot \frac{r}{\cos a}\\
\end{array}
\end{array}
if a < -3.1e-6Initial program 76.6%
Taylor expanded in b around 0
lower-cos.f6454.7
Applied rewrites54.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6454.8
Applied rewrites54.8%
if -3.1e-6 < a < 1200Initial program 76.6%
Taylor expanded in a around 0
Applied rewrites60.7%
if 1200 < a Initial program 76.6%
Taylor expanded in b around 0
lower-cos.f6454.7
Applied rewrites54.7%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6454.7
Applied rewrites54.7%
(FPCore (r a b) :precision binary64 (* (/ r (cos (+ a b))) (sin b)))
double code(double r, double a, double b) {
return (r / cos((a + b))) * sin(b);
}
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(r, a, b)
use fmin_fmax_functions
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
code = (r / cos((a + b))) * sin(b)
end function
public static double code(double r, double a, double b) {
return (r / Math.cos((a + b))) * Math.sin(b);
}
def code(r, a, b): return (r / math.cos((a + b))) * math.sin(b)
function code(r, a, b) return Float64(Float64(r / cos(Float64(a + b))) * sin(b)) end
function tmp = code(r, a, b) tmp = (r / cos((a + b))) * sin(b); end
code[r_, a_, b_] := N[(N[(r / N[Cos[N[(a + b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[b], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{r}{\cos \left(a + b\right)} \cdot \sin b
\end{array}
Initial program 76.6%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6476.6
Applied rewrites76.6%
(FPCore (r a b)
:precision binary64
(let* ((t_0 (/ (* r (sin b)) 1.0)))
(if (<= b -560.0)
t_0
(if (<= b 5.8)
(/ (* b (+ r (* -0.16666666666666666 (* (pow b 2.0) r)))) (cos (+ a b)))
t_0))))
double code(double r, double a, double b) {
double t_0 = (r * sin(b)) / 1.0;
double tmp;
if (b <= -560.0) {
tmp = t_0;
} else if (b <= 5.8) {
tmp = (b * (r + (-0.16666666666666666 * (pow(b, 2.0) * r)))) / cos((a + b));
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(r, a, b)
use fmin_fmax_functions
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_0
real(8) :: tmp
t_0 = (r * sin(b)) / 1.0d0
if (b <= (-560.0d0)) then
tmp = t_0
else if (b <= 5.8d0) then
tmp = (b * (r + ((-0.16666666666666666d0) * ((b ** 2.0d0) * r)))) / cos((a + b))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double r, double a, double b) {
double t_0 = (r * Math.sin(b)) / 1.0;
double tmp;
if (b <= -560.0) {
tmp = t_0;
} else if (b <= 5.8) {
tmp = (b * (r + (-0.16666666666666666 * (Math.pow(b, 2.0) * r)))) / Math.cos((a + b));
} else {
tmp = t_0;
}
return tmp;
}
def code(r, a, b): t_0 = (r * math.sin(b)) / 1.0 tmp = 0 if b <= -560.0: tmp = t_0 elif b <= 5.8: tmp = (b * (r + (-0.16666666666666666 * (math.pow(b, 2.0) * r)))) / math.cos((a + b)) else: tmp = t_0 return tmp
function code(r, a, b) t_0 = Float64(Float64(r * sin(b)) / 1.0) tmp = 0.0 if (b <= -560.0) tmp = t_0; elseif (b <= 5.8) tmp = Float64(Float64(b * Float64(r + Float64(-0.16666666666666666 * Float64((b ^ 2.0) * r)))) / cos(Float64(a + b))); else tmp = t_0; end return tmp end
function tmp_2 = code(r, a, b) t_0 = (r * sin(b)) / 1.0; tmp = 0.0; if (b <= -560.0) tmp = t_0; elseif (b <= 5.8) tmp = (b * (r + (-0.16666666666666666 * ((b ^ 2.0) * r)))) / cos((a + b)); else tmp = t_0; end tmp_2 = tmp; end
code[r_, a_, b_] := Block[{t$95$0 = N[(N[(r * N[Sin[b], $MachinePrecision]), $MachinePrecision] / 1.0), $MachinePrecision]}, If[LessEqual[b, -560.0], t$95$0, If[LessEqual[b, 5.8], N[(N[(b * N[(r + N[(-0.16666666666666666 * N[(N[Power[b, 2.0], $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Cos[N[(a + b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{r \cdot \sin b}{1}\\
\mathbf{if}\;b \leq -560:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;b \leq 5.8:\\
\;\;\;\;\frac{b \cdot \left(r + -0.16666666666666666 \cdot \left({b}^{2} \cdot r\right)\right)}{\cos \left(a + b\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if b < -560 or 5.79999999999999982 < b Initial program 76.6%
Taylor expanded in b around 0
lower-cos.f6454.7
Applied rewrites54.7%
Taylor expanded in a around 0
Applied rewrites39.1%
if -560 < b < 5.79999999999999982Initial program 76.6%
Taylor expanded in b around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-pow.f6450.5
Applied rewrites50.5%
(FPCore (r a b)
:precision binary64
(let* ((t_0 (/ (* r (sin b)) 1.0)))
(if (<= b -560.0)
t_0
(if (<= b 5.8)
(/
(* r (* b (+ 1.0 (* -0.16666666666666666 (pow b 2.0)))))
(cos (+ a b)))
t_0))))
double code(double r, double a, double b) {
double t_0 = (r * sin(b)) / 1.0;
double tmp;
if (b <= -560.0) {
tmp = t_0;
} else if (b <= 5.8) {
tmp = (r * (b * (1.0 + (-0.16666666666666666 * pow(b, 2.0))))) / cos((a + b));
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(r, a, b)
use fmin_fmax_functions
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_0
real(8) :: tmp
t_0 = (r * sin(b)) / 1.0d0
if (b <= (-560.0d0)) then
tmp = t_0
else if (b <= 5.8d0) then
tmp = (r * (b * (1.0d0 + ((-0.16666666666666666d0) * (b ** 2.0d0))))) / cos((a + b))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double r, double a, double b) {
double t_0 = (r * Math.sin(b)) / 1.0;
double tmp;
if (b <= -560.0) {
tmp = t_0;
} else if (b <= 5.8) {
tmp = (r * (b * (1.0 + (-0.16666666666666666 * Math.pow(b, 2.0))))) / Math.cos((a + b));
} else {
tmp = t_0;
}
return tmp;
}
def code(r, a, b): t_0 = (r * math.sin(b)) / 1.0 tmp = 0 if b <= -560.0: tmp = t_0 elif b <= 5.8: tmp = (r * (b * (1.0 + (-0.16666666666666666 * math.pow(b, 2.0))))) / math.cos((a + b)) else: tmp = t_0 return tmp
function code(r, a, b) t_0 = Float64(Float64(r * sin(b)) / 1.0) tmp = 0.0 if (b <= -560.0) tmp = t_0; elseif (b <= 5.8) tmp = Float64(Float64(r * Float64(b * Float64(1.0 + Float64(-0.16666666666666666 * (b ^ 2.0))))) / cos(Float64(a + b))); else tmp = t_0; end return tmp end
function tmp_2 = code(r, a, b) t_0 = (r * sin(b)) / 1.0; tmp = 0.0; if (b <= -560.0) tmp = t_0; elseif (b <= 5.8) tmp = (r * (b * (1.0 + (-0.16666666666666666 * (b ^ 2.0))))) / cos((a + b)); else tmp = t_0; end tmp_2 = tmp; end
code[r_, a_, b_] := Block[{t$95$0 = N[(N[(r * N[Sin[b], $MachinePrecision]), $MachinePrecision] / 1.0), $MachinePrecision]}, If[LessEqual[b, -560.0], t$95$0, If[LessEqual[b, 5.8], N[(N[(r * N[(b * N[(1.0 + N[(-0.16666666666666666 * N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Cos[N[(a + b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{r \cdot \sin b}{1}\\
\mathbf{if}\;b \leq -560:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;b \leq 5.8:\\
\;\;\;\;\frac{r \cdot \left(b \cdot \left(1 + -0.16666666666666666 \cdot {b}^{2}\right)\right)}{\cos \left(a + b\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if b < -560 or 5.79999999999999982 < b Initial program 76.6%
Taylor expanded in b around 0
lower-cos.f6454.7
Applied rewrites54.7%
Taylor expanded in a around 0
Applied rewrites39.1%
if -560 < b < 5.79999999999999982Initial program 76.6%
Taylor expanded in b around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6450.5
Applied rewrites50.5%
(FPCore (r a b)
:precision binary64
(let* ((t_0 (/ (* r (sin b)) 1.0)))
(if (<= b -25000000000.0)
t_0
(if (<= b 3.4) (/ (* b r) (cos (+ a b))) t_0))))
double code(double r, double a, double b) {
double t_0 = (r * sin(b)) / 1.0;
double tmp;
if (b <= -25000000000.0) {
tmp = t_0;
} else if (b <= 3.4) {
tmp = (b * r) / cos((a + b));
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(r, a, b)
use fmin_fmax_functions
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_0
real(8) :: tmp
t_0 = (r * sin(b)) / 1.0d0
if (b <= (-25000000000.0d0)) then
tmp = t_0
else if (b <= 3.4d0) then
tmp = (b * r) / cos((a + b))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double r, double a, double b) {
double t_0 = (r * Math.sin(b)) / 1.0;
double tmp;
if (b <= -25000000000.0) {
tmp = t_0;
} else if (b <= 3.4) {
tmp = (b * r) / Math.cos((a + b));
} else {
tmp = t_0;
}
return tmp;
}
def code(r, a, b): t_0 = (r * math.sin(b)) / 1.0 tmp = 0 if b <= -25000000000.0: tmp = t_0 elif b <= 3.4: tmp = (b * r) / math.cos((a + b)) else: tmp = t_0 return tmp
function code(r, a, b) t_0 = Float64(Float64(r * sin(b)) / 1.0) tmp = 0.0 if (b <= -25000000000.0) tmp = t_0; elseif (b <= 3.4) tmp = Float64(Float64(b * r) / cos(Float64(a + b))); else tmp = t_0; end return tmp end
function tmp_2 = code(r, a, b) t_0 = (r * sin(b)) / 1.0; tmp = 0.0; if (b <= -25000000000.0) tmp = t_0; elseif (b <= 3.4) tmp = (b * r) / cos((a + b)); else tmp = t_0; end tmp_2 = tmp; end
code[r_, a_, b_] := Block[{t$95$0 = N[(N[(r * N[Sin[b], $MachinePrecision]), $MachinePrecision] / 1.0), $MachinePrecision]}, If[LessEqual[b, -25000000000.0], t$95$0, If[LessEqual[b, 3.4], N[(N[(b * r), $MachinePrecision] / N[Cos[N[(a + b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{r \cdot \sin b}{1}\\
\mathbf{if}\;b \leq -25000000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;b \leq 3.4:\\
\;\;\;\;\frac{b \cdot r}{\cos \left(a + b\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if b < -2.5e10 or 3.39999999999999991 < b Initial program 76.6%
Taylor expanded in b around 0
lower-cos.f6454.7
Applied rewrites54.7%
Taylor expanded in a around 0
Applied rewrites39.1%
if -2.5e10 < b < 3.39999999999999991Initial program 76.6%
Taylor expanded in b around 0
lower-*.f6450.8
Applied rewrites50.8%
(FPCore (r a b) :precision binary64 (let* ((t_0 (/ (* r (sin b)) 1.0))) (if (<= b -20000000000.0) t_0 (if (<= b 4.6) (/ (* b r) (cos a)) t_0))))
double code(double r, double a, double b) {
double t_0 = (r * sin(b)) / 1.0;
double tmp;
if (b <= -20000000000.0) {
tmp = t_0;
} else if (b <= 4.6) {
tmp = (b * r) / cos(a);
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(r, a, b)
use fmin_fmax_functions
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_0
real(8) :: tmp
t_0 = (r * sin(b)) / 1.0d0
if (b <= (-20000000000.0d0)) then
tmp = t_0
else if (b <= 4.6d0) then
tmp = (b * r) / cos(a)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double r, double a, double b) {
double t_0 = (r * Math.sin(b)) / 1.0;
double tmp;
if (b <= -20000000000.0) {
tmp = t_0;
} else if (b <= 4.6) {
tmp = (b * r) / Math.cos(a);
} else {
tmp = t_0;
}
return tmp;
}
def code(r, a, b): t_0 = (r * math.sin(b)) / 1.0 tmp = 0 if b <= -20000000000.0: tmp = t_0 elif b <= 4.6: tmp = (b * r) / math.cos(a) else: tmp = t_0 return tmp
function code(r, a, b) t_0 = Float64(Float64(r * sin(b)) / 1.0) tmp = 0.0 if (b <= -20000000000.0) tmp = t_0; elseif (b <= 4.6) tmp = Float64(Float64(b * r) / cos(a)); else tmp = t_0; end return tmp end
function tmp_2 = code(r, a, b) t_0 = (r * sin(b)) / 1.0; tmp = 0.0; if (b <= -20000000000.0) tmp = t_0; elseif (b <= 4.6) tmp = (b * r) / cos(a); else tmp = t_0; end tmp_2 = tmp; end
code[r_, a_, b_] := Block[{t$95$0 = N[(N[(r * N[Sin[b], $MachinePrecision]), $MachinePrecision] / 1.0), $MachinePrecision]}, If[LessEqual[b, -20000000000.0], t$95$0, If[LessEqual[b, 4.6], N[(N[(b * r), $MachinePrecision] / N[Cos[a], $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{r \cdot \sin b}{1}\\
\mathbf{if}\;b \leq -20000000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;b \leq 4.6:\\
\;\;\;\;\frac{b \cdot r}{\cos a}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if b < -2e10 or 4.5999999999999996 < b Initial program 76.6%
Taylor expanded in b around 0
lower-cos.f6454.7
Applied rewrites54.7%
Taylor expanded in a around 0
Applied rewrites39.1%
if -2e10 < b < 4.5999999999999996Initial program 76.6%
Taylor expanded in b around 0
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f6450.8
Applied rewrites50.8%
(FPCore (r a b) :precision binary64 (let* ((t_0 (/ (* r (sin b)) 1.0))) (if (<= b -20000000000.0) t_0 (if (<= b 4.6) (* (/ r (cos a)) b) t_0))))
double code(double r, double a, double b) {
double t_0 = (r * sin(b)) / 1.0;
double tmp;
if (b <= -20000000000.0) {
tmp = t_0;
} else if (b <= 4.6) {
tmp = (r / cos(a)) * b;
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(r, a, b)
use fmin_fmax_functions
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_0
real(8) :: tmp
t_0 = (r * sin(b)) / 1.0d0
if (b <= (-20000000000.0d0)) then
tmp = t_0
else if (b <= 4.6d0) then
tmp = (r / cos(a)) * b
else
tmp = t_0
end if
code = tmp
end function
public static double code(double r, double a, double b) {
double t_0 = (r * Math.sin(b)) / 1.0;
double tmp;
if (b <= -20000000000.0) {
tmp = t_0;
} else if (b <= 4.6) {
tmp = (r / Math.cos(a)) * b;
} else {
tmp = t_0;
}
return tmp;
}
def code(r, a, b): t_0 = (r * math.sin(b)) / 1.0 tmp = 0 if b <= -20000000000.0: tmp = t_0 elif b <= 4.6: tmp = (r / math.cos(a)) * b else: tmp = t_0 return tmp
function code(r, a, b) t_0 = Float64(Float64(r * sin(b)) / 1.0) tmp = 0.0 if (b <= -20000000000.0) tmp = t_0; elseif (b <= 4.6) tmp = Float64(Float64(r / cos(a)) * b); else tmp = t_0; end return tmp end
function tmp_2 = code(r, a, b) t_0 = (r * sin(b)) / 1.0; tmp = 0.0; if (b <= -20000000000.0) tmp = t_0; elseif (b <= 4.6) tmp = (r / cos(a)) * b; else tmp = t_0; end tmp_2 = tmp; end
code[r_, a_, b_] := Block[{t$95$0 = N[(N[(r * N[Sin[b], $MachinePrecision]), $MachinePrecision] / 1.0), $MachinePrecision]}, If[LessEqual[b, -20000000000.0], t$95$0, If[LessEqual[b, 4.6], N[(N[(r / N[Cos[a], $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{r \cdot \sin b}{1}\\
\mathbf{if}\;b \leq -20000000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;b \leq 4.6:\\
\;\;\;\;\frac{r}{\cos a} \cdot b\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if b < -2e10 or 4.5999999999999996 < b Initial program 76.6%
Taylor expanded in b around 0
lower-cos.f6454.7
Applied rewrites54.7%
Taylor expanded in a around 0
Applied rewrites39.1%
if -2e10 < b < 4.5999999999999996Initial program 76.6%
Taylor expanded in b around 0
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f6450.8
Applied rewrites50.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6450.8
Applied rewrites50.8%
(FPCore (r a b) :precision binary64 (/ (* (sin b) r) (cos a)))
double code(double r, double a, double b) {
return (sin(b) * r) / cos(a);
}
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(r, a, b)
use fmin_fmax_functions
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
code = (sin(b) * r) / cos(a)
end function
public static double code(double r, double a, double b) {
return (Math.sin(b) * r) / Math.cos(a);
}
def code(r, a, b): return (math.sin(b) * r) / math.cos(a)
function code(r, a, b) return Float64(Float64(sin(b) * r) / cos(a)) end
function tmp = code(r, a, b) tmp = (sin(b) * r) / cos(a); end
code[r_, a_, b_] := N[(N[(N[Sin[b], $MachinePrecision] * r), $MachinePrecision] / N[Cos[a], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin b \cdot r}{\cos a}
\end{array}
Initial program 76.6%
Taylor expanded in b around 0
lower-cos.f6454.7
Applied rewrites54.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6454.7
Applied rewrites54.7%
(FPCore (r a b) :precision binary64 (* (sin b) (/ r (cos a))))
double code(double r, double a, double b) {
return sin(b) * (r / cos(a));
}
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(r, a, b)
use fmin_fmax_functions
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
code = sin(b) * (r / cos(a))
end function
public static double code(double r, double a, double b) {
return Math.sin(b) * (r / Math.cos(a));
}
def code(r, a, b): return math.sin(b) * (r / math.cos(a))
function code(r, a, b) return Float64(sin(b) * Float64(r / cos(a))) end
function tmp = code(r, a, b) tmp = sin(b) * (r / cos(a)); end
code[r_, a_, b_] := N[(N[Sin[b], $MachinePrecision] * N[(r / N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin b \cdot \frac{r}{\cos a}
\end{array}
Initial program 76.6%
Taylor expanded in b around 0
lower-cos.f6454.7
Applied rewrites54.7%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6454.7
Applied rewrites54.7%
(FPCore (r a b) :precision binary64 (/ (* r (sin b)) 1.0))
double code(double r, double a, double b) {
return (r * sin(b)) / 1.0;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(r, a, b)
use fmin_fmax_functions
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
code = (r * sin(b)) / 1.0d0
end function
public static double code(double r, double a, double b) {
return (r * Math.sin(b)) / 1.0;
}
def code(r, a, b): return (r * math.sin(b)) / 1.0
function code(r, a, b) return Float64(Float64(r * sin(b)) / 1.0) end
function tmp = code(r, a, b) tmp = (r * sin(b)) / 1.0; end
code[r_, a_, b_] := N[(N[(r * N[Sin[b], $MachinePrecision]), $MachinePrecision] / 1.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{r \cdot \sin b}{1}
\end{array}
Initial program 76.6%
Taylor expanded in b around 0
lower-cos.f6454.7
Applied rewrites54.7%
Taylor expanded in a around 0
Applied rewrites39.1%
(FPCore (r a b) :precision binary64 (* r b))
double code(double r, double a, double b) {
return r * b;
}
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(r, a, b)
use fmin_fmax_functions
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
code = r * b
end function
public static double code(double r, double a, double b) {
return r * b;
}
def code(r, a, b): return r * b
function code(r, a, b) return Float64(r * b) end
function tmp = code(r, a, b) tmp = r * b; end
code[r_, a_, b_] := N[(r * b), $MachinePrecision]
\begin{array}{l}
\\
r \cdot b
\end{array}
Initial program 76.6%
Taylor expanded in b around 0
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f6450.8
Applied rewrites50.8%
Taylor expanded in a around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6433.8
Applied rewrites33.8%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6433.8
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6433.8
lift-pow.f64N/A
unpow2N/A
lower-*.f6433.8
Applied rewrites33.8%
Taylor expanded in a around 0
Applied rewrites35.0%
herbie shell --seed 2025150
(FPCore (r a b)
:name "rsin A (should all be same)"
:precision binary64
(/ (* r (sin b)) (cos (+ a b))))