
(FPCore (x y z a) :precision binary64 (+ x (- (tan (+ y z)) (tan a))))
double code(double x, double y, double z, double a) {
return x + (tan((y + z)) - tan(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(x, y, z, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
code = x + (tan((y + z)) - tan(a))
end function
public static double code(double x, double y, double z, double a) {
return x + (Math.tan((y + z)) - Math.tan(a));
}
def code(x, y, z, a): return x + (math.tan((y + z)) - math.tan(a))
function code(x, y, z, a) return Float64(x + Float64(tan(Float64(y + z)) - tan(a))) end
function tmp = code(x, y, z, a) tmp = x + (tan((y + z)) - tan(a)); end
code[x_, y_, z_, a_] := N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\tan \left(y + z\right) - \tan a\right)
\end{array}
Herbie found 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z a) :precision binary64 (+ x (- (tan (+ y z)) (tan a))))
double code(double x, double y, double z, double a) {
return x + (tan((y + z)) - tan(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(x, y, z, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
code = x + (tan((y + z)) - tan(a))
end function
public static double code(double x, double y, double z, double a) {
return x + (Math.tan((y + z)) - Math.tan(a));
}
def code(x, y, z, a): return x + (math.tan((y + z)) - math.tan(a))
function code(x, y, z, a) return Float64(x + Float64(tan(Float64(y + z)) - tan(a))) end
function tmp = code(x, y, z, a) tmp = x + (tan((y + z)) - tan(a)); end
code[x_, y_, z_, a_] := N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\tan \left(y + z\right) - \tan a\right)
\end{array}
(FPCore (x y z a)
:precision binary64
(let* ((t_0 (fma (cos z) (cos y) (* (sin z) (sin (- y))))))
(+
x
(- (+ (/ (* (sin z) (cos y)) t_0) (/ (* (cos z) (sin y)) t_0)) (tan a)))))
double code(double x, double y, double z, double a) {
double t_0 = fma(cos(z), cos(y), (sin(z) * sin(-y)));
return x + ((((sin(z) * cos(y)) / t_0) + ((cos(z) * sin(y)) / t_0)) - tan(a));
}
function code(x, y, z, a) t_0 = fma(cos(z), cos(y), Float64(sin(z) * sin(Float64(-y)))) return Float64(x + Float64(Float64(Float64(Float64(sin(z) * cos(y)) / t_0) + Float64(Float64(cos(z) * sin(y)) / t_0)) - tan(a))) end
code[x_, y_, z_, a_] := Block[{t$95$0 = N[(N[Cos[z], $MachinePrecision] * N[Cos[y], $MachinePrecision] + N[(N[Sin[z], $MachinePrecision] * N[Sin[(-y)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x + N[(N[(N[(N[(N[Sin[z], $MachinePrecision] * N[Cos[y], $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision] + N[(N[(N[Cos[z], $MachinePrecision] * N[Sin[y], $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\cos z, \cos y, \sin z \cdot \sin \left(-y\right)\right)\\
x + \left(\left(\frac{\sin z \cdot \cos y}{t\_0} + \frac{\cos z \cdot \sin y}{t\_0}\right) - \tan a\right)
\end{array}
\end{array}
Initial program 79.1%
lift-tan.f64N/A
tan-quotN/A
lift-+.f64N/A
+-commutativeN/A
sin-sumN/A
div-addN/A
*-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
Applied rewrites79.6%
lift-cos.f64N/A
lift-+.f64N/A
add-flipN/A
cos-diffN/A
cos-neg-revN/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-fma.f64N/A
lift-sin.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-neg.f6480.4
Applied rewrites80.4%
lift-cos.f64N/A
lift-+.f64N/A
add-flipN/A
cos-diffN/A
cos-neg-revN/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-fma.f64N/A
lift-sin.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-neg.f6499.7
Applied rewrites99.7%
(FPCore (x y z a)
:precision binary64
(let* ((t_0 (- (* (cos z) (cos y)) (* (sin y) (sin z)))))
(+
x
(- (+ (/ (* (sin z) (cos y)) t_0) (/ (* (cos z) (sin y)) t_0)) (tan a)))))
double code(double x, double y, double z, double a) {
double t_0 = (cos(z) * cos(y)) - (sin(y) * sin(z));
return x + ((((sin(z) * cos(y)) / t_0) + ((cos(z) * sin(y)) / t_0)) - tan(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(x, y, z, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
real(8) :: t_0
t_0 = (cos(z) * cos(y)) - (sin(y) * sin(z))
code = x + ((((sin(z) * cos(y)) / t_0) + ((cos(z) * sin(y)) / t_0)) - tan(a))
end function
public static double code(double x, double y, double z, double a) {
double t_0 = (Math.cos(z) * Math.cos(y)) - (Math.sin(y) * Math.sin(z));
return x + ((((Math.sin(z) * Math.cos(y)) / t_0) + ((Math.cos(z) * Math.sin(y)) / t_0)) - Math.tan(a));
}
def code(x, y, z, a): t_0 = (math.cos(z) * math.cos(y)) - (math.sin(y) * math.sin(z)) return x + ((((math.sin(z) * math.cos(y)) / t_0) + ((math.cos(z) * math.sin(y)) / t_0)) - math.tan(a))
function code(x, y, z, a) t_0 = Float64(Float64(cos(z) * cos(y)) - Float64(sin(y) * sin(z))) return Float64(x + Float64(Float64(Float64(Float64(sin(z) * cos(y)) / t_0) + Float64(Float64(cos(z) * sin(y)) / t_0)) - tan(a))) end
function tmp = code(x, y, z, a) t_0 = (cos(z) * cos(y)) - (sin(y) * sin(z)); tmp = x + ((((sin(z) * cos(y)) / t_0) + ((cos(z) * sin(y)) / t_0)) - tan(a)); end
code[x_, y_, z_, a_] := Block[{t$95$0 = N[(N[(N[Cos[z], $MachinePrecision] * N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[y], $MachinePrecision] * N[Sin[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x + N[(N[(N[(N[(N[Sin[z], $MachinePrecision] * N[Cos[y], $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision] + N[(N[(N[Cos[z], $MachinePrecision] * N[Sin[y], $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos z \cdot \cos y - \sin y \cdot \sin z\\
x + \left(\left(\frac{\sin z \cdot \cos y}{t\_0} + \frac{\cos z \cdot \sin y}{t\_0}\right) - \tan a\right)
\end{array}
\end{array}
Initial program 79.1%
lift-tan.f64N/A
tan-quotN/A
lift-+.f64N/A
+-commutativeN/A
sin-sumN/A
div-addN/A
*-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
Applied rewrites79.6%
lift-cos.f64N/A
lift-+.f64N/A
cos-sumN/A
lift-sin.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-sin.f64N/A
lower--.f64N/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
lower-*.f6480.4
Applied rewrites80.4%
lift-cos.f64N/A
lift-+.f64N/A
cos-sumN/A
lift-sin.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-sin.f64N/A
lower--.f64N/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
lower-*.f6499.7
Applied rewrites99.7%
(FPCore (x y z a)
:precision binary64
(let* ((t_0 (cos (+ y z)))
(t_1 (fma (cos z) (cos y) (* (sin z) (sin (- y)))))
(t_2 (/ (* (sin z) (cos y)) t_1))
(t_3 (/ (* (cos z) (sin y)) t_1)))
(if (<= (tan a) -0.0005)
(+ x (- (+ t_2 (/ (* (sin y) (cos z)) t_0)) (tan a)))
(if (<= (tan a) 5e-70)
(+ x (- (+ t_2 t_3) a))
(+ x (- (+ (/ (* (cos y) (sin z)) t_0) t_3) (tan a)))))))
double code(double x, double y, double z, double a) {
double t_0 = cos((y + z));
double t_1 = fma(cos(z), cos(y), (sin(z) * sin(-y)));
double t_2 = (sin(z) * cos(y)) / t_1;
double t_3 = (cos(z) * sin(y)) / t_1;
double tmp;
if (tan(a) <= -0.0005) {
tmp = x + ((t_2 + ((sin(y) * cos(z)) / t_0)) - tan(a));
} else if (tan(a) <= 5e-70) {
tmp = x + ((t_2 + t_3) - a);
} else {
tmp = x + ((((cos(y) * sin(z)) / t_0) + t_3) - tan(a));
}
return tmp;
}
function code(x, y, z, a) t_0 = cos(Float64(y + z)) t_1 = fma(cos(z), cos(y), Float64(sin(z) * sin(Float64(-y)))) t_2 = Float64(Float64(sin(z) * cos(y)) / t_1) t_3 = Float64(Float64(cos(z) * sin(y)) / t_1) tmp = 0.0 if (tan(a) <= -0.0005) tmp = Float64(x + Float64(Float64(t_2 + Float64(Float64(sin(y) * cos(z)) / t_0)) - tan(a))); elseif (tan(a) <= 5e-70) tmp = Float64(x + Float64(Float64(t_2 + t_3) - a)); else tmp = Float64(x + Float64(Float64(Float64(Float64(cos(y) * sin(z)) / t_0) + t_3) - tan(a))); end return tmp end
code[x_, y_, z_, a_] := Block[{t$95$0 = N[Cos[N[(y + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[z], $MachinePrecision] * N[Cos[y], $MachinePrecision] + N[(N[Sin[z], $MachinePrecision] * N[Sin[(-y)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Sin[z], $MachinePrecision] * N[Cos[y], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[Cos[z], $MachinePrecision] * N[Sin[y], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, If[LessEqual[N[Tan[a], $MachinePrecision], -0.0005], N[(x + N[(N[(t$95$2 + N[(N[(N[Sin[y], $MachinePrecision] * N[Cos[z], $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Tan[a], $MachinePrecision], 5e-70], N[(x + N[(N[(t$95$2 + t$95$3), $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(N[(N[(N[Cos[y], $MachinePrecision] * N[Sin[z], $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision] + t$95$3), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(y + z\right)\\
t_1 := \mathsf{fma}\left(\cos z, \cos y, \sin z \cdot \sin \left(-y\right)\right)\\
t_2 := \frac{\sin z \cdot \cos y}{t\_1}\\
t_3 := \frac{\cos z \cdot \sin y}{t\_1}\\
\mathbf{if}\;\tan a \leq -0.0005:\\
\;\;\;\;x + \left(\left(t\_2 + \frac{\sin y \cdot \cos z}{t\_0}\right) - \tan a\right)\\
\mathbf{elif}\;\tan a \leq 5 \cdot 10^{-70}:\\
\;\;\;\;x + \left(\left(t\_2 + t\_3\right) - a\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(\left(\frac{\cos y \cdot \sin z}{t\_0} + t\_3\right) - \tan a\right)\\
\end{array}
\end{array}
if (tan.f64 a) < -5.0000000000000001e-4Initial program 79.1%
lift-tan.f64N/A
tan-quotN/A
lift-+.f64N/A
+-commutativeN/A
sin-sumN/A
div-addN/A
*-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
Applied rewrites79.6%
lift-cos.f64N/A
lift-+.f64N/A
add-flipN/A
cos-diffN/A
cos-neg-revN/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-fma.f64N/A
lift-sin.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-neg.f6480.4
Applied rewrites80.4%
lift-cos.f64N/A
lift-+.f64N/A
add-flipN/A
cos-diffN/A
cos-neg-revN/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-fma.f64N/A
lift-sin.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-neg.f6499.7
Applied rewrites99.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.7
lift-fma.f64N/A
lift-cos.f64N/A
lift-cos.f64N/A
cos-neg-revN/A
lift-neg.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
cos-diff-revN/A
lift-neg.f64N/A
add-flipN/A
+-commutativeN/A
lift-+.f64N/A
lift-cos.f6480.4
Applied rewrites80.4%
if -5.0000000000000001e-4 < (tan.f64 a) < 4.9999999999999998e-70Initial program 79.1%
lift-tan.f64N/A
tan-quotN/A
lift-+.f64N/A
+-commutativeN/A
sin-sumN/A
div-addN/A
*-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
Applied rewrites79.6%
lift-cos.f64N/A
lift-+.f64N/A
add-flipN/A
cos-diffN/A
cos-neg-revN/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-fma.f64N/A
lift-sin.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-neg.f6480.4
Applied rewrites80.4%
lift-cos.f64N/A
lift-+.f64N/A
add-flipN/A
cos-diffN/A
cos-neg-revN/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-fma.f64N/A
lift-sin.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-neg.f6499.7
Applied rewrites99.7%
Taylor expanded in a around 0
Applied rewrites50.6%
if 4.9999999999999998e-70 < (tan.f64 a) Initial program 79.1%
lift-tan.f64N/A
tan-quotN/A
lift-+.f64N/A
+-commutativeN/A
sin-sumN/A
div-addN/A
*-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
Applied rewrites79.6%
lift-cos.f64N/A
lift-+.f64N/A
add-flipN/A
cos-diffN/A
cos-neg-revN/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-fma.f64N/A
lift-sin.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-neg.f6480.4
Applied rewrites80.4%
lift-cos.f64N/A
lift-+.f64N/A
add-flipN/A
cos-diffN/A
cos-neg-revN/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-fma.f64N/A
lift-sin.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-neg.f6499.7
Applied rewrites99.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.7
lift-fma.f64N/A
lift-cos.f64N/A
lift-cos.f64N/A
cos-neg-revN/A
lift-neg.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
cos-diff-revN/A
lift-neg.f64N/A
add-flipN/A
+-commutativeN/A
lift-+.f64N/A
lift-cos.f6480.3
Applied rewrites80.3%
(FPCore (x y z a)
:precision binary64
(let* ((t_0 (* (sin z) (sin (- y))))
(t_1 (fma (cos z) (cos y) t_0))
(t_2 (* (cos y) (sin z)))
(t_3 (* (cos z) (sin y)))
(t_4 (cos (+ y z)))
(t_5 (fma (cos y) (cos z) t_0)))
(if (<= (tan a) -0.02)
(+
x
(- (+ (/ (* (sin z) (cos y)) t_1) (/ (* (sin y) (cos z)) t_4)) (tan a)))
(if (<= (tan a) 5e-70)
(+
x
(fma
a
(- (* -0.3333333333333333 (pow a 2.0)) 1.0)
(+ (/ t_2 t_5) (/ t_3 t_5))))
(+ x (- (+ (/ t_2 t_4) (/ t_3 t_1)) (tan a)))))))
double code(double x, double y, double z, double a) {
double t_0 = sin(z) * sin(-y);
double t_1 = fma(cos(z), cos(y), t_0);
double t_2 = cos(y) * sin(z);
double t_3 = cos(z) * sin(y);
double t_4 = cos((y + z));
double t_5 = fma(cos(y), cos(z), t_0);
double tmp;
if (tan(a) <= -0.02) {
tmp = x + ((((sin(z) * cos(y)) / t_1) + ((sin(y) * cos(z)) / t_4)) - tan(a));
} else if (tan(a) <= 5e-70) {
tmp = x + fma(a, ((-0.3333333333333333 * pow(a, 2.0)) - 1.0), ((t_2 / t_5) + (t_3 / t_5)));
} else {
tmp = x + (((t_2 / t_4) + (t_3 / t_1)) - tan(a));
}
return tmp;
}
function code(x, y, z, a) t_0 = Float64(sin(z) * sin(Float64(-y))) t_1 = fma(cos(z), cos(y), t_0) t_2 = Float64(cos(y) * sin(z)) t_3 = Float64(cos(z) * sin(y)) t_4 = cos(Float64(y + z)) t_5 = fma(cos(y), cos(z), t_0) tmp = 0.0 if (tan(a) <= -0.02) tmp = Float64(x + Float64(Float64(Float64(Float64(sin(z) * cos(y)) / t_1) + Float64(Float64(sin(y) * cos(z)) / t_4)) - tan(a))); elseif (tan(a) <= 5e-70) tmp = Float64(x + fma(a, Float64(Float64(-0.3333333333333333 * (a ^ 2.0)) - 1.0), Float64(Float64(t_2 / t_5) + Float64(t_3 / t_5)))); else tmp = Float64(x + Float64(Float64(Float64(t_2 / t_4) + Float64(t_3 / t_1)) - tan(a))); end return tmp end
code[x_, y_, z_, a_] := Block[{t$95$0 = N[(N[Sin[z], $MachinePrecision] * N[Sin[(-y)], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[z], $MachinePrecision] * N[Cos[y], $MachinePrecision] + t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[Cos[y], $MachinePrecision] * N[Sin[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Cos[z], $MachinePrecision] * N[Sin[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Cos[N[(y + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[(N[Cos[y], $MachinePrecision] * N[Cos[z], $MachinePrecision] + t$95$0), $MachinePrecision]}, If[LessEqual[N[Tan[a], $MachinePrecision], -0.02], N[(x + N[(N[(N[(N[(N[Sin[z], $MachinePrecision] * N[Cos[y], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision] + N[(N[(N[Sin[y], $MachinePrecision] * N[Cos[z], $MachinePrecision]), $MachinePrecision] / t$95$4), $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Tan[a], $MachinePrecision], 5e-70], N[(x + N[(a * N[(N[(-0.3333333333333333 * N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision] + N[(N[(t$95$2 / t$95$5), $MachinePrecision] + N[(t$95$3 / t$95$5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(N[(t$95$2 / t$95$4), $MachinePrecision] + N[(t$95$3 / t$95$1), $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin z \cdot \sin \left(-y\right)\\
t_1 := \mathsf{fma}\left(\cos z, \cos y, t\_0\right)\\
t_2 := \cos y \cdot \sin z\\
t_3 := \cos z \cdot \sin y\\
t_4 := \cos \left(y + z\right)\\
t_5 := \mathsf{fma}\left(\cos y, \cos z, t\_0\right)\\
\mathbf{if}\;\tan a \leq -0.02:\\
\;\;\;\;x + \left(\left(\frac{\sin z \cdot \cos y}{t\_1} + \frac{\sin y \cdot \cos z}{t\_4}\right) - \tan a\right)\\
\mathbf{elif}\;\tan a \leq 5 \cdot 10^{-70}:\\
\;\;\;\;x + \mathsf{fma}\left(a, -0.3333333333333333 \cdot {a}^{2} - 1, \frac{t\_2}{t\_5} + \frac{t\_3}{t\_5}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(\left(\frac{t\_2}{t\_4} + \frac{t\_3}{t\_1}\right) - \tan a\right)\\
\end{array}
\end{array}
if (tan.f64 a) < -0.0200000000000000004Initial program 79.1%
lift-tan.f64N/A
tan-quotN/A
lift-+.f64N/A
+-commutativeN/A
sin-sumN/A
div-addN/A
*-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
Applied rewrites79.6%
lift-cos.f64N/A
lift-+.f64N/A
add-flipN/A
cos-diffN/A
cos-neg-revN/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-fma.f64N/A
lift-sin.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-neg.f6480.4
Applied rewrites80.4%
lift-cos.f64N/A
lift-+.f64N/A
add-flipN/A
cos-diffN/A
cos-neg-revN/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-fma.f64N/A
lift-sin.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-neg.f6499.7
Applied rewrites99.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.7
lift-fma.f64N/A
lift-cos.f64N/A
lift-cos.f64N/A
cos-neg-revN/A
lift-neg.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
cos-diff-revN/A
lift-neg.f64N/A
add-flipN/A
+-commutativeN/A
lift-+.f64N/A
lift-cos.f6480.4
Applied rewrites80.4%
if -0.0200000000000000004 < (tan.f64 a) < 4.9999999999999998e-70Initial program 79.1%
lift-tan.f64N/A
tan-quotN/A
lift-+.f64N/A
+-commutativeN/A
sin-sumN/A
div-addN/A
*-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
Applied rewrites79.6%
lift-cos.f64N/A
lift-+.f64N/A
add-flipN/A
cos-diffN/A
cos-neg-revN/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-fma.f64N/A
lift-sin.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-neg.f6480.4
Applied rewrites80.4%
lift-cos.f64N/A
lift-+.f64N/A
add-flipN/A
cos-diffN/A
cos-neg-revN/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-fma.f64N/A
lift-sin.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-neg.f6499.7
Applied rewrites99.7%
Taylor expanded in a around 0
lower-fma.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
Applied rewrites50.3%
if 4.9999999999999998e-70 < (tan.f64 a) Initial program 79.1%
lift-tan.f64N/A
tan-quotN/A
lift-+.f64N/A
+-commutativeN/A
sin-sumN/A
div-addN/A
*-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
Applied rewrites79.6%
lift-cos.f64N/A
lift-+.f64N/A
add-flipN/A
cos-diffN/A
cos-neg-revN/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-fma.f64N/A
lift-sin.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-neg.f6480.4
Applied rewrites80.4%
lift-cos.f64N/A
lift-+.f64N/A
add-flipN/A
cos-diffN/A
cos-neg-revN/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-fma.f64N/A
lift-sin.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-neg.f6499.7
Applied rewrites99.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.7
lift-fma.f64N/A
lift-cos.f64N/A
lift-cos.f64N/A
cos-neg-revN/A
lift-neg.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
cos-diff-revN/A
lift-neg.f64N/A
add-flipN/A
+-commutativeN/A
lift-+.f64N/A
lift-cos.f6480.3
Applied rewrites80.3%
(FPCore (x y z a)
:precision binary64
(let* ((t_0 (* (sin z) (sin (- y))))
(t_1 (fma (cos y) (cos z) t_0))
(t_2 (* (cos z) (sin y)))
(t_3 (cos (+ y z)))
(t_4 (fma (cos z) (cos y) t_0))
(t_5 (* (cos y) (sin z))))
(if (<= (tan a) -5e-8)
(+
x
(- (+ (/ (* (sin z) (cos y)) t_4) (/ (* (sin y) (cos z)) t_3)) (tan a)))
(if (<= (tan a) 5e-70)
(+ x (+ (/ t_5 t_1) (/ t_2 t_1)))
(+ x (- (+ (/ t_5 t_3) (/ t_2 t_4)) (tan a)))))))
double code(double x, double y, double z, double a) {
double t_0 = sin(z) * sin(-y);
double t_1 = fma(cos(y), cos(z), t_0);
double t_2 = cos(z) * sin(y);
double t_3 = cos((y + z));
double t_4 = fma(cos(z), cos(y), t_0);
double t_5 = cos(y) * sin(z);
double tmp;
if (tan(a) <= -5e-8) {
tmp = x + ((((sin(z) * cos(y)) / t_4) + ((sin(y) * cos(z)) / t_3)) - tan(a));
} else if (tan(a) <= 5e-70) {
tmp = x + ((t_5 / t_1) + (t_2 / t_1));
} else {
tmp = x + (((t_5 / t_3) + (t_2 / t_4)) - tan(a));
}
return tmp;
}
function code(x, y, z, a) t_0 = Float64(sin(z) * sin(Float64(-y))) t_1 = fma(cos(y), cos(z), t_0) t_2 = Float64(cos(z) * sin(y)) t_3 = cos(Float64(y + z)) t_4 = fma(cos(z), cos(y), t_0) t_5 = Float64(cos(y) * sin(z)) tmp = 0.0 if (tan(a) <= -5e-8) tmp = Float64(x + Float64(Float64(Float64(Float64(sin(z) * cos(y)) / t_4) + Float64(Float64(sin(y) * cos(z)) / t_3)) - tan(a))); elseif (tan(a) <= 5e-70) tmp = Float64(x + Float64(Float64(t_5 / t_1) + Float64(t_2 / t_1))); else tmp = Float64(x + Float64(Float64(Float64(t_5 / t_3) + Float64(t_2 / t_4)) - tan(a))); end return tmp end
code[x_, y_, z_, a_] := Block[{t$95$0 = N[(N[Sin[z], $MachinePrecision] * N[Sin[(-y)], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[y], $MachinePrecision] * N[Cos[z], $MachinePrecision] + t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[Cos[z], $MachinePrecision] * N[Sin[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Cos[N[(y + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(N[Cos[z], $MachinePrecision] * N[Cos[y], $MachinePrecision] + t$95$0), $MachinePrecision]}, Block[{t$95$5 = N[(N[Cos[y], $MachinePrecision] * N[Sin[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Tan[a], $MachinePrecision], -5e-8], N[(x + N[(N[(N[(N[(N[Sin[z], $MachinePrecision] * N[Cos[y], $MachinePrecision]), $MachinePrecision] / t$95$4), $MachinePrecision] + N[(N[(N[Sin[y], $MachinePrecision] * N[Cos[z], $MachinePrecision]), $MachinePrecision] / t$95$3), $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Tan[a], $MachinePrecision], 5e-70], N[(x + N[(N[(t$95$5 / t$95$1), $MachinePrecision] + N[(t$95$2 / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(N[(t$95$5 / t$95$3), $MachinePrecision] + N[(t$95$2 / t$95$4), $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin z \cdot \sin \left(-y\right)\\
t_1 := \mathsf{fma}\left(\cos y, \cos z, t\_0\right)\\
t_2 := \cos z \cdot \sin y\\
t_3 := \cos \left(y + z\right)\\
t_4 := \mathsf{fma}\left(\cos z, \cos y, t\_0\right)\\
t_5 := \cos y \cdot \sin z\\
\mathbf{if}\;\tan a \leq -5 \cdot 10^{-8}:\\
\;\;\;\;x + \left(\left(\frac{\sin z \cdot \cos y}{t\_4} + \frac{\sin y \cdot \cos z}{t\_3}\right) - \tan a\right)\\
\mathbf{elif}\;\tan a \leq 5 \cdot 10^{-70}:\\
\;\;\;\;x + \left(\frac{t\_5}{t\_1} + \frac{t\_2}{t\_1}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(\left(\frac{t\_5}{t\_3} + \frac{t\_2}{t\_4}\right) - \tan a\right)\\
\end{array}
\end{array}
if (tan.f64 a) < -4.9999999999999998e-8Initial program 79.1%
lift-tan.f64N/A
tan-quotN/A
lift-+.f64N/A
+-commutativeN/A
sin-sumN/A
div-addN/A
*-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
Applied rewrites79.6%
lift-cos.f64N/A
lift-+.f64N/A
add-flipN/A
cos-diffN/A
cos-neg-revN/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-fma.f64N/A
lift-sin.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-neg.f6480.4
Applied rewrites80.4%
lift-cos.f64N/A
lift-+.f64N/A
add-flipN/A
cos-diffN/A
cos-neg-revN/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-fma.f64N/A
lift-sin.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-neg.f6499.7
Applied rewrites99.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.7
lift-fma.f64N/A
lift-cos.f64N/A
lift-cos.f64N/A
cos-neg-revN/A
lift-neg.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
cos-diff-revN/A
lift-neg.f64N/A
add-flipN/A
+-commutativeN/A
lift-+.f64N/A
lift-cos.f6480.4
Applied rewrites80.4%
if -4.9999999999999998e-8 < (tan.f64 a) < 4.9999999999999998e-70Initial program 79.1%
lift-tan.f64N/A
tan-quotN/A
lift-+.f64N/A
+-commutativeN/A
sin-sumN/A
div-addN/A
*-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
Applied rewrites79.6%
lift-cos.f64N/A
lift-+.f64N/A
add-flipN/A
cos-diffN/A
cos-neg-revN/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-fma.f64N/A
lift-sin.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-neg.f6480.4
Applied rewrites80.4%
lift-cos.f64N/A
lift-+.f64N/A
add-flipN/A
cos-diffN/A
cos-neg-revN/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-fma.f64N/A
lift-sin.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-neg.f6499.7
Applied rewrites99.7%
Taylor expanded in a around 0
lower-+.f64N/A
lower-+.f64N/A
Applied rewrites60.5%
if 4.9999999999999998e-70 < (tan.f64 a) Initial program 79.1%
lift-tan.f64N/A
tan-quotN/A
lift-+.f64N/A
+-commutativeN/A
sin-sumN/A
div-addN/A
*-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
Applied rewrites79.6%
lift-cos.f64N/A
lift-+.f64N/A
add-flipN/A
cos-diffN/A
cos-neg-revN/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-fma.f64N/A
lift-sin.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-neg.f6480.4
Applied rewrites80.4%
lift-cos.f64N/A
lift-+.f64N/A
add-flipN/A
cos-diffN/A
cos-neg-revN/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-fma.f64N/A
lift-sin.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-neg.f6499.7
Applied rewrites99.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.7
lift-fma.f64N/A
lift-cos.f64N/A
lift-cos.f64N/A
cos-neg-revN/A
lift-neg.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
cos-diff-revN/A
lift-neg.f64N/A
add-flipN/A
+-commutativeN/A
lift-+.f64N/A
lift-cos.f6480.3
Applied rewrites80.3%
(FPCore (x y z a)
:precision binary64
(+
x
(-
(+
(/ (* (sin z) (cos y)) (fma (cos z) (cos y) (* (sin z) (sin (- y)))))
(/ (* (sin y) (cos z)) (cos (+ y z))))
(tan a))))
double code(double x, double y, double z, double a) {
return x + ((((sin(z) * cos(y)) / fma(cos(z), cos(y), (sin(z) * sin(-y)))) + ((sin(y) * cos(z)) / cos((y + z)))) - tan(a));
}
function code(x, y, z, a) return Float64(x + Float64(Float64(Float64(Float64(sin(z) * cos(y)) / fma(cos(z), cos(y), Float64(sin(z) * sin(Float64(-y))))) + Float64(Float64(sin(y) * cos(z)) / cos(Float64(y + z)))) - tan(a))) end
code[x_, y_, z_, a_] := N[(x + N[(N[(N[(N[(N[Sin[z], $MachinePrecision] * N[Cos[y], $MachinePrecision]), $MachinePrecision] / N[(N[Cos[z], $MachinePrecision] * N[Cos[y], $MachinePrecision] + N[(N[Sin[z], $MachinePrecision] * N[Sin[(-y)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sin[y], $MachinePrecision] * N[Cos[z], $MachinePrecision]), $MachinePrecision] / N[Cos[N[(y + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\left(\frac{\sin z \cdot \cos y}{\mathsf{fma}\left(\cos z, \cos y, \sin z \cdot \sin \left(-y\right)\right)} + \frac{\sin y \cdot \cos z}{\cos \left(y + z\right)}\right) - \tan a\right)
\end{array}
Initial program 79.1%
lift-tan.f64N/A
tan-quotN/A
lift-+.f64N/A
+-commutativeN/A
sin-sumN/A
div-addN/A
*-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
Applied rewrites79.6%
lift-cos.f64N/A
lift-+.f64N/A
add-flipN/A
cos-diffN/A
cos-neg-revN/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-fma.f64N/A
lift-sin.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-neg.f6480.4
Applied rewrites80.4%
lift-cos.f64N/A
lift-+.f64N/A
add-flipN/A
cos-diffN/A
cos-neg-revN/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-fma.f64N/A
lift-sin.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-neg.f6499.7
Applied rewrites99.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.7
lift-fma.f64N/A
lift-cos.f64N/A
lift-cos.f64N/A
cos-neg-revN/A
lift-neg.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
cos-diff-revN/A
lift-neg.f64N/A
add-flipN/A
+-commutativeN/A
lift-+.f64N/A
lift-cos.f6480.4
Applied rewrites80.4%
(FPCore (x y z a)
:precision binary64
(+
x
(-
(+
(/ (* (cos y) (sin z)) (cos (+ y z)))
(/ (* (cos z) (sin y)) (fma (cos z) (cos y) (* (sin z) (sin (- y))))))
(tan a))))
double code(double x, double y, double z, double a) {
return x + ((((cos(y) * sin(z)) / cos((y + z))) + ((cos(z) * sin(y)) / fma(cos(z), cos(y), (sin(z) * sin(-y))))) - tan(a));
}
function code(x, y, z, a) return Float64(x + Float64(Float64(Float64(Float64(cos(y) * sin(z)) / cos(Float64(y + z))) + Float64(Float64(cos(z) * sin(y)) / fma(cos(z), cos(y), Float64(sin(z) * sin(Float64(-y)))))) - tan(a))) end
code[x_, y_, z_, a_] := N[(x + N[(N[(N[(N[(N[Cos[y], $MachinePrecision] * N[Sin[z], $MachinePrecision]), $MachinePrecision] / N[Cos[N[(y + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Cos[z], $MachinePrecision] * N[Sin[y], $MachinePrecision]), $MachinePrecision] / N[(N[Cos[z], $MachinePrecision] * N[Cos[y], $MachinePrecision] + N[(N[Sin[z], $MachinePrecision] * N[Sin[(-y)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\left(\frac{\cos y \cdot \sin z}{\cos \left(y + z\right)} + \frac{\cos z \cdot \sin y}{\mathsf{fma}\left(\cos z, \cos y, \sin z \cdot \sin \left(-y\right)\right)}\right) - \tan a\right)
\end{array}
Initial program 79.1%
lift-tan.f64N/A
tan-quotN/A
lift-+.f64N/A
+-commutativeN/A
sin-sumN/A
div-addN/A
*-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
Applied rewrites79.6%
lift-cos.f64N/A
lift-+.f64N/A
add-flipN/A
cos-diffN/A
cos-neg-revN/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-fma.f64N/A
lift-sin.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-neg.f6480.4
Applied rewrites80.4%
lift-cos.f64N/A
lift-+.f64N/A
add-flipN/A
cos-diffN/A
cos-neg-revN/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-fma.f64N/A
lift-sin.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-neg.f6499.7
Applied rewrites99.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.7
lift-fma.f64N/A
lift-cos.f64N/A
lift-cos.f64N/A
cos-neg-revN/A
lift-neg.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
cos-diff-revN/A
lift-neg.f64N/A
add-flipN/A
+-commutativeN/A
lift-+.f64N/A
lift-cos.f6480.3
Applied rewrites80.3%
(FPCore (x y z a) :precision binary64 (+ x (- (/ (fma (- (sin z)) (cos y) (* (- (cos z)) (sin y))) (- (cos (+ y z)))) (tan a))))
double code(double x, double y, double z, double a) {
return x + ((fma(-sin(z), cos(y), (-cos(z) * sin(y))) / -cos((y + z))) - tan(a));
}
function code(x, y, z, a) return Float64(x + Float64(Float64(fma(Float64(-sin(z)), cos(y), Float64(Float64(-cos(z)) * sin(y))) / Float64(-cos(Float64(y + z)))) - tan(a))) end
code[x_, y_, z_, a_] := N[(x + N[(N[(N[((-N[Sin[z], $MachinePrecision]) * N[Cos[y], $MachinePrecision] + N[((-N[Cos[z], $MachinePrecision]) * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / (-N[Cos[N[(y + z), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\frac{\mathsf{fma}\left(-\sin z, \cos y, \left(-\cos z\right) \cdot \sin y\right)}{-\cos \left(y + z\right)} - \tan a\right)
\end{array}
Initial program 79.1%
lift-tan.f64N/A
tan-quotN/A
lift-+.f64N/A
+-commutativeN/A
sin-sumN/A
div-addN/A
*-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
Applied rewrites79.6%
lift-+.f64N/A
lift-/.f64N/A
frac-2negN/A
lift-/.f64N/A
frac-2negN/A
div-add-revN/A
lower-/.f64N/A
Applied rewrites79.6%
(FPCore (x y z a) :precision binary64 (- x (- (tan a) (tan (+ z y)))))
double code(double x, double y, double z, double a) {
return x - (tan(a) - tan((z + y)));
}
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(x, y, z, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
code = x - (tan(a) - tan((z + y)))
end function
public static double code(double x, double y, double z, double a) {
return x - (Math.tan(a) - Math.tan((z + y)));
}
def code(x, y, z, a): return x - (math.tan(a) - math.tan((z + y)))
function code(x, y, z, a) return Float64(x - Float64(tan(a) - tan(Float64(z + y)))) end
function tmp = code(x, y, z, a) tmp = x - (tan(a) - tan((z + y))); end
code[x_, y_, z_, a_] := N[(x - N[(N[Tan[a], $MachinePrecision] - N[Tan[N[(z + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \left(\tan a - \tan \left(z + y\right)\right)
\end{array}
Initial program 79.1%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6479.1
lift-+.f64N/A
+-commutativeN/A
lower-+.f6479.1
Applied rewrites79.1%
(FPCore (x y z a) :precision binary64 (if (<= (+ y z) -0.005) (+ x (fma (sin a) -1.0 (tan (+ z y)))) (+ x (- (tan z) (tan a)))))
double code(double x, double y, double z, double a) {
double tmp;
if ((y + z) <= -0.005) {
tmp = x + fma(sin(a), -1.0, tan((z + y)));
} else {
tmp = x + (tan(z) - tan(a));
}
return tmp;
}
function code(x, y, z, a) tmp = 0.0 if (Float64(y + z) <= -0.005) tmp = Float64(x + fma(sin(a), -1.0, tan(Float64(z + y)))); else tmp = Float64(x + Float64(tan(z) - tan(a))); end return tmp end
code[x_, y_, z_, a_] := If[LessEqual[N[(y + z), $MachinePrecision], -0.005], N[(x + N[(N[Sin[a], $MachinePrecision] * -1.0 + N[Tan[N[(z + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[Tan[z], $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y + z \leq -0.005:\\
\;\;\;\;x + \mathsf{fma}\left(\sin a, -1, \tan \left(z + y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(\tan z - \tan a\right)\\
\end{array}
\end{array}
if (+.f64 y z) < -0.0050000000000000001Initial program 79.1%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-tan.f64N/A
tan-quotN/A
distribute-neg-frac2N/A
mult-flipN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
lower-cos.f6479.1
lift-+.f64N/A
+-commutativeN/A
lower-+.f6479.1
Applied rewrites79.1%
Taylor expanded in a around 0
Applied rewrites51.1%
if -0.0050000000000000001 < (+.f64 y z) Initial program 79.1%
Taylor expanded in y around 0
Applied rewrites60.3%
(FPCore (x y z a) :precision binary64 (if (<= (+ y z) -0.005) (+ x (/ (sin (+ y z)) (cos (+ y z)))) (+ x (- (tan z) (tan a)))))
double code(double x, double y, double z, double a) {
double tmp;
if ((y + z) <= -0.005) {
tmp = x + (sin((y + z)) / cos((y + z)));
} else {
tmp = x + (tan(z) - tan(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(x, y, z, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
real(8) :: tmp
if ((y + z) <= (-0.005d0)) then
tmp = x + (sin((y + z)) / cos((y + z)))
else
tmp = x + (tan(z) - tan(a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double a) {
double tmp;
if ((y + z) <= -0.005) {
tmp = x + (Math.sin((y + z)) / Math.cos((y + z)));
} else {
tmp = x + (Math.tan(z) - Math.tan(a));
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if (y + z) <= -0.005: tmp = x + (math.sin((y + z)) / math.cos((y + z))) else: tmp = x + (math.tan(z) - math.tan(a)) return tmp
function code(x, y, z, a) tmp = 0.0 if (Float64(y + z) <= -0.005) tmp = Float64(x + Float64(sin(Float64(y + z)) / cos(Float64(y + z)))); else tmp = Float64(x + Float64(tan(z) - tan(a))); end return tmp end
function tmp_2 = code(x, y, z, a) tmp = 0.0; if ((y + z) <= -0.005) tmp = x + (sin((y + z)) / cos((y + z))); else tmp = x + (tan(z) - tan(a)); end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[LessEqual[N[(y + z), $MachinePrecision], -0.005], N[(x + N[(N[Sin[N[(y + z), $MachinePrecision]], $MachinePrecision] / N[Cos[N[(y + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[Tan[z], $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y + z \leq -0.005:\\
\;\;\;\;x + \frac{\sin \left(y + z\right)}{\cos \left(y + z\right)}\\
\mathbf{else}:\\
\;\;\;\;x + \left(\tan z - \tan a\right)\\
\end{array}
\end{array}
if (+.f64 y z) < -0.0050000000000000001Initial program 79.1%
Taylor expanded in a around 0
lower-+.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
lower-+.f64N/A
lower-cos.f64N/A
lower-+.f6450.1
Applied rewrites50.1%
if -0.0050000000000000001 < (+.f64 y z) Initial program 79.1%
Taylor expanded in y around 0
Applied rewrites60.3%
(FPCore (x y z a)
:precision binary64
(let* ((t_0 (tan (+ y z))) (t_1 (+ x (/ (sin (+ y z)) (cos (+ y z))))))
(if (<= t_0 -0.005)
t_1
(if (<= t_0 0.002)
(+
x
(- (+ y (* z (+ 1.0 (* z (+ y (* 0.3333333333333333 z)))))) (tan a)))
t_1))))
double code(double x, double y, double z, double a) {
double t_0 = tan((y + z));
double t_1 = x + (sin((y + z)) / cos((y + z)));
double tmp;
if (t_0 <= -0.005) {
tmp = t_1;
} else if (t_0 <= 0.002) {
tmp = x + ((y + (z * (1.0 + (z * (y + (0.3333333333333333 * z)))))) - tan(a));
} 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(x, y, z, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = tan((y + z))
t_1 = x + (sin((y + z)) / cos((y + z)))
if (t_0 <= (-0.005d0)) then
tmp = t_1
else if (t_0 <= 0.002d0) then
tmp = x + ((y + (z * (1.0d0 + (z * (y + (0.3333333333333333d0 * z)))))) - tan(a))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double a) {
double t_0 = Math.tan((y + z));
double t_1 = x + (Math.sin((y + z)) / Math.cos((y + z)));
double tmp;
if (t_0 <= -0.005) {
tmp = t_1;
} else if (t_0 <= 0.002) {
tmp = x + ((y + (z * (1.0 + (z * (y + (0.3333333333333333 * z)))))) - Math.tan(a));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, a): t_0 = math.tan((y + z)) t_1 = x + (math.sin((y + z)) / math.cos((y + z))) tmp = 0 if t_0 <= -0.005: tmp = t_1 elif t_0 <= 0.002: tmp = x + ((y + (z * (1.0 + (z * (y + (0.3333333333333333 * z)))))) - math.tan(a)) else: tmp = t_1 return tmp
function code(x, y, z, a) t_0 = tan(Float64(y + z)) t_1 = Float64(x + Float64(sin(Float64(y + z)) / cos(Float64(y + z)))) tmp = 0.0 if (t_0 <= -0.005) tmp = t_1; elseif (t_0 <= 0.002) tmp = Float64(x + Float64(Float64(y + Float64(z * Float64(1.0 + Float64(z * Float64(y + Float64(0.3333333333333333 * z)))))) - tan(a))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, a) t_0 = tan((y + z)); t_1 = x + (sin((y + z)) / cos((y + z))); tmp = 0.0; if (t_0 <= -0.005) tmp = t_1; elseif (t_0 <= 0.002) tmp = x + ((y + (z * (1.0 + (z * (y + (0.3333333333333333 * z)))))) - tan(a)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, a_] := Block[{t$95$0 = N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(x + N[(N[Sin[N[(y + z), $MachinePrecision]], $MachinePrecision] / N[Cos[N[(y + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -0.005], t$95$1, If[LessEqual[t$95$0, 0.002], N[(x + N[(N[(y + N[(z * N[(1.0 + N[(z * N[(y + N[(0.3333333333333333 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan \left(y + z\right)\\
t_1 := x + \frac{\sin \left(y + z\right)}{\cos \left(y + z\right)}\\
\mathbf{if}\;t\_0 \leq -0.005:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 0.002:\\
\;\;\;\;x + \left(\left(y + z \cdot \left(1 + z \cdot \left(y + 0.3333333333333333 \cdot z\right)\right)\right) - \tan a\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (tan.f64 (+.f64 y z)) < -0.0050000000000000001 or 2e-3 < (tan.f64 (+.f64 y z)) Initial program 79.1%
Taylor expanded in a around 0
lower-+.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
lower-+.f64N/A
lower-cos.f64N/A
lower-+.f6450.1
Applied rewrites50.1%
if -0.0050000000000000001 < (tan.f64 (+.f64 y z)) < 2e-3Initial program 79.1%
lift-tan.f64N/A
tan-quotN/A
lift-+.f64N/A
+-commutativeN/A
sin-sumN/A
div-addN/A
*-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
Applied rewrites79.6%
lift-cos.f64N/A
lift-+.f64N/A
add-flipN/A
cos-diffN/A
cos-neg-revN/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-fma.f64N/A
lift-sin.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-neg.f6480.4
Applied rewrites80.4%
lift-cos.f64N/A
lift-+.f64N/A
add-flipN/A
cos-diffN/A
cos-neg-revN/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-fma.f64N/A
lift-sin.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-neg.f6499.7
Applied rewrites99.7%
Taylor expanded in y around 0
lower-fma.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
lower-cos.f6451.1
Applied rewrites51.1%
Taylor expanded in z around 0
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6427.2
Applied rewrites27.2%
(FPCore (x y z a)
:precision binary64
(if (<= a -72000.0)
(+ x (- (+ y (* z (+ 1.0 (* z (+ y (* 0.3333333333333333 z)))))) (tan a)))
(if (<= a 1.6)
(+ x (- (tan (+ y z)) (* a (+ 1.0 (* 0.3333333333333333 (pow a 2.0))))))
(* x 1.0))))
double code(double x, double y, double z, double a) {
double tmp;
if (a <= -72000.0) {
tmp = x + ((y + (z * (1.0 + (z * (y + (0.3333333333333333 * z)))))) - tan(a));
} else if (a <= 1.6) {
tmp = x + (tan((y + z)) - (a * (1.0 + (0.3333333333333333 * pow(a, 2.0)))));
} else {
tmp = x * 1.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(x, y, z, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
real(8) :: tmp
if (a <= (-72000.0d0)) then
tmp = x + ((y + (z * (1.0d0 + (z * (y + (0.3333333333333333d0 * z)))))) - tan(a))
else if (a <= 1.6d0) then
tmp = x + (tan((y + z)) - (a * (1.0d0 + (0.3333333333333333d0 * (a ** 2.0d0)))))
else
tmp = x * 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double a) {
double tmp;
if (a <= -72000.0) {
tmp = x + ((y + (z * (1.0 + (z * (y + (0.3333333333333333 * z)))))) - Math.tan(a));
} else if (a <= 1.6) {
tmp = x + (Math.tan((y + z)) - (a * (1.0 + (0.3333333333333333 * Math.pow(a, 2.0)))));
} else {
tmp = x * 1.0;
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if a <= -72000.0: tmp = x + ((y + (z * (1.0 + (z * (y + (0.3333333333333333 * z)))))) - math.tan(a)) elif a <= 1.6: tmp = x + (math.tan((y + z)) - (a * (1.0 + (0.3333333333333333 * math.pow(a, 2.0))))) else: tmp = x * 1.0 return tmp
function code(x, y, z, a) tmp = 0.0 if (a <= -72000.0) tmp = Float64(x + Float64(Float64(y + Float64(z * Float64(1.0 + Float64(z * Float64(y + Float64(0.3333333333333333 * z)))))) - tan(a))); elseif (a <= 1.6) tmp = Float64(x + Float64(tan(Float64(y + z)) - Float64(a * Float64(1.0 + Float64(0.3333333333333333 * (a ^ 2.0)))))); else tmp = Float64(x * 1.0); end return tmp end
function tmp_2 = code(x, y, z, a) tmp = 0.0; if (a <= -72000.0) tmp = x + ((y + (z * (1.0 + (z * (y + (0.3333333333333333 * z)))))) - tan(a)); elseif (a <= 1.6) tmp = x + (tan((y + z)) - (a * (1.0 + (0.3333333333333333 * (a ^ 2.0))))); else tmp = x * 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[LessEqual[a, -72000.0], N[(x + N[(N[(y + N[(z * N[(1.0 + N[(z * N[(y + N[(0.3333333333333333 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.6], N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - N[(a * N[(1.0 + N[(0.3333333333333333 * N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -72000:\\
\;\;\;\;x + \left(\left(y + z \cdot \left(1 + z \cdot \left(y + 0.3333333333333333 \cdot z\right)\right)\right) - \tan a\right)\\
\mathbf{elif}\;a \leq 1.6:\\
\;\;\;\;x + \left(\tan \left(y + z\right) - a \cdot \left(1 + 0.3333333333333333 \cdot {a}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 1\\
\end{array}
\end{array}
if a < -72000Initial program 79.1%
lift-tan.f64N/A
tan-quotN/A
lift-+.f64N/A
+-commutativeN/A
sin-sumN/A
div-addN/A
*-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
Applied rewrites79.6%
lift-cos.f64N/A
lift-+.f64N/A
add-flipN/A
cos-diffN/A
cos-neg-revN/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-fma.f64N/A
lift-sin.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-neg.f6480.4
Applied rewrites80.4%
lift-cos.f64N/A
lift-+.f64N/A
add-flipN/A
cos-diffN/A
cos-neg-revN/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-fma.f64N/A
lift-sin.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-neg.f6499.7
Applied rewrites99.7%
Taylor expanded in y around 0
lower-fma.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
lower-cos.f6451.1
Applied rewrites51.1%
Taylor expanded in z around 0
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6427.2
Applied rewrites27.2%
if -72000 < a < 1.6000000000000001Initial program 79.1%
Taylor expanded in a around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6440.1
Applied rewrites40.1%
if 1.6000000000000001 < a Initial program 79.1%
Taylor expanded in x around inf
lower-*.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-cos.f6478.8
Applied rewrites78.8%
Taylor expanded in x around inf
Applied rewrites31.8%
(FPCore (x y z a) :precision binary64 (if (<= a -72000.0) (+ x (- (+ y (* z (+ 1.0 (* z (+ y (* 0.3333333333333333 z)))))) (tan a))) (if (<= a 1.6) (- x (- a (tan (+ y z)))) (* x 1.0))))
double code(double x, double y, double z, double a) {
double tmp;
if (a <= -72000.0) {
tmp = x + ((y + (z * (1.0 + (z * (y + (0.3333333333333333 * z)))))) - tan(a));
} else if (a <= 1.6) {
tmp = x - (a - tan((y + z)));
} else {
tmp = x * 1.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(x, y, z, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
real(8) :: tmp
if (a <= (-72000.0d0)) then
tmp = x + ((y + (z * (1.0d0 + (z * (y + (0.3333333333333333d0 * z)))))) - tan(a))
else if (a <= 1.6d0) then
tmp = x - (a - tan((y + z)))
else
tmp = x * 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double a) {
double tmp;
if (a <= -72000.0) {
tmp = x + ((y + (z * (1.0 + (z * (y + (0.3333333333333333 * z)))))) - Math.tan(a));
} else if (a <= 1.6) {
tmp = x - (a - Math.tan((y + z)));
} else {
tmp = x * 1.0;
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if a <= -72000.0: tmp = x + ((y + (z * (1.0 + (z * (y + (0.3333333333333333 * z)))))) - math.tan(a)) elif a <= 1.6: tmp = x - (a - math.tan((y + z))) else: tmp = x * 1.0 return tmp
function code(x, y, z, a) tmp = 0.0 if (a <= -72000.0) tmp = Float64(x + Float64(Float64(y + Float64(z * Float64(1.0 + Float64(z * Float64(y + Float64(0.3333333333333333 * z)))))) - tan(a))); elseif (a <= 1.6) tmp = Float64(x - Float64(a - tan(Float64(y + z)))); else tmp = Float64(x * 1.0); end return tmp end
function tmp_2 = code(x, y, z, a) tmp = 0.0; if (a <= -72000.0) tmp = x + ((y + (z * (1.0 + (z * (y + (0.3333333333333333 * z)))))) - tan(a)); elseif (a <= 1.6) tmp = x - (a - tan((y + z))); else tmp = x * 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[LessEqual[a, -72000.0], N[(x + N[(N[(y + N[(z * N[(1.0 + N[(z * N[(y + N[(0.3333333333333333 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.6], N[(x - N[(a - N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -72000:\\
\;\;\;\;x + \left(\left(y + z \cdot \left(1 + z \cdot \left(y + 0.3333333333333333 \cdot z\right)\right)\right) - \tan a\right)\\
\mathbf{elif}\;a \leq 1.6:\\
\;\;\;\;x - \left(a - \tan \left(y + z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 1\\
\end{array}
\end{array}
if a < -72000Initial program 79.1%
lift-tan.f64N/A
tan-quotN/A
lift-+.f64N/A
+-commutativeN/A
sin-sumN/A
div-addN/A
*-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
Applied rewrites79.6%
lift-cos.f64N/A
lift-+.f64N/A
add-flipN/A
cos-diffN/A
cos-neg-revN/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-fma.f64N/A
lift-sin.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-neg.f6480.4
Applied rewrites80.4%
lift-cos.f64N/A
lift-+.f64N/A
add-flipN/A
cos-diffN/A
cos-neg-revN/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-fma.f64N/A
lift-sin.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-neg.f6499.7
Applied rewrites99.7%
Taylor expanded in y around 0
lower-fma.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
lower-cos.f6451.1
Applied rewrites51.1%
Taylor expanded in z around 0
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6427.2
Applied rewrites27.2%
if -72000 < a < 1.6000000000000001Initial program 79.1%
Taylor expanded in a around 0
Applied rewrites40.5%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6440.5
Applied rewrites40.5%
if 1.6000000000000001 < a Initial program 79.1%
Taylor expanded in x around inf
lower-*.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-cos.f6478.8
Applied rewrites78.8%
Taylor expanded in x around inf
Applied rewrites31.8%
(FPCore (x y z a) :precision binary64 (if (<= a -72000.0) (+ x (- (+ y (* z (+ 1.0 (* y z)))) (tan a))) (if (<= a 1.6) (- x (- a (tan (+ y z)))) (* x 1.0))))
double code(double x, double y, double z, double a) {
double tmp;
if (a <= -72000.0) {
tmp = x + ((y + (z * (1.0 + (y * z)))) - tan(a));
} else if (a <= 1.6) {
tmp = x - (a - tan((y + z)));
} else {
tmp = x * 1.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(x, y, z, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
real(8) :: tmp
if (a <= (-72000.0d0)) then
tmp = x + ((y + (z * (1.0d0 + (y * z)))) - tan(a))
else if (a <= 1.6d0) then
tmp = x - (a - tan((y + z)))
else
tmp = x * 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double a) {
double tmp;
if (a <= -72000.0) {
tmp = x + ((y + (z * (1.0 + (y * z)))) - Math.tan(a));
} else if (a <= 1.6) {
tmp = x - (a - Math.tan((y + z)));
} else {
tmp = x * 1.0;
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if a <= -72000.0: tmp = x + ((y + (z * (1.0 + (y * z)))) - math.tan(a)) elif a <= 1.6: tmp = x - (a - math.tan((y + z))) else: tmp = x * 1.0 return tmp
function code(x, y, z, a) tmp = 0.0 if (a <= -72000.0) tmp = Float64(x + Float64(Float64(y + Float64(z * Float64(1.0 + Float64(y * z)))) - tan(a))); elseif (a <= 1.6) tmp = Float64(x - Float64(a - tan(Float64(y + z)))); else tmp = Float64(x * 1.0); end return tmp end
function tmp_2 = code(x, y, z, a) tmp = 0.0; if (a <= -72000.0) tmp = x + ((y + (z * (1.0 + (y * z)))) - tan(a)); elseif (a <= 1.6) tmp = x - (a - tan((y + z))); else tmp = x * 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[LessEqual[a, -72000.0], N[(x + N[(N[(y + N[(z * N[(1.0 + N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.6], N[(x - N[(a - N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -72000:\\
\;\;\;\;x + \left(\left(y + z \cdot \left(1 + y \cdot z\right)\right) - \tan a\right)\\
\mathbf{elif}\;a \leq 1.6:\\
\;\;\;\;x - \left(a - \tan \left(y + z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 1\\
\end{array}
\end{array}
if a < -72000Initial program 79.1%
lift-tan.f64N/A
tan-quotN/A
lift-+.f64N/A
+-commutativeN/A
sin-sumN/A
div-addN/A
*-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
Applied rewrites79.6%
lift-cos.f64N/A
lift-+.f64N/A
add-flipN/A
cos-diffN/A
cos-neg-revN/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-fma.f64N/A
lift-sin.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-neg.f6480.4
Applied rewrites80.4%
lift-cos.f64N/A
lift-+.f64N/A
add-flipN/A
cos-diffN/A
cos-neg-revN/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-fma.f64N/A
lift-sin.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-neg.f6499.7
Applied rewrites99.7%
Taylor expanded in y around 0
lower-fma.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
lower-cos.f6451.1
Applied rewrites51.1%
Taylor expanded in z around 0
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6427.3
Applied rewrites27.3%
if -72000 < a < 1.6000000000000001Initial program 79.1%
Taylor expanded in a around 0
Applied rewrites40.5%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6440.5
Applied rewrites40.5%
if 1.6000000000000001 < a Initial program 79.1%
Taylor expanded in x around inf
lower-*.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-cos.f6478.8
Applied rewrites78.8%
Taylor expanded in x around inf
Applied rewrites31.8%
(FPCore (x y z a) :precision binary64 (if (<= a -0.09) (* x 1.0) (if (<= a 1.6) (- x (- a (tan (+ y z)))) (* x 1.0))))
double code(double x, double y, double z, double a) {
double tmp;
if (a <= -0.09) {
tmp = x * 1.0;
} else if (a <= 1.6) {
tmp = x - (a - tan((y + z)));
} else {
tmp = x * 1.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(x, y, z, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
real(8) :: tmp
if (a <= (-0.09d0)) then
tmp = x * 1.0d0
else if (a <= 1.6d0) then
tmp = x - (a - tan((y + z)))
else
tmp = x * 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double a) {
double tmp;
if (a <= -0.09) {
tmp = x * 1.0;
} else if (a <= 1.6) {
tmp = x - (a - Math.tan((y + z)));
} else {
tmp = x * 1.0;
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if a <= -0.09: tmp = x * 1.0 elif a <= 1.6: tmp = x - (a - math.tan((y + z))) else: tmp = x * 1.0 return tmp
function code(x, y, z, a) tmp = 0.0 if (a <= -0.09) tmp = Float64(x * 1.0); elseif (a <= 1.6) tmp = Float64(x - Float64(a - tan(Float64(y + z)))); else tmp = Float64(x * 1.0); end return tmp end
function tmp_2 = code(x, y, z, a) tmp = 0.0; if (a <= -0.09) tmp = x * 1.0; elseif (a <= 1.6) tmp = x - (a - tan((y + z))); else tmp = x * 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[LessEqual[a, -0.09], N[(x * 1.0), $MachinePrecision], If[LessEqual[a, 1.6], N[(x - N[(a - N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.09:\\
\;\;\;\;x \cdot 1\\
\mathbf{elif}\;a \leq 1.6:\\
\;\;\;\;x - \left(a - \tan \left(y + z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 1\\
\end{array}
\end{array}
if a < -0.089999999999999997 or 1.6000000000000001 < a Initial program 79.1%
Taylor expanded in x around inf
lower-*.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-cos.f6478.8
Applied rewrites78.8%
Taylor expanded in x around inf
Applied rewrites31.8%
if -0.089999999999999997 < a < 1.6000000000000001Initial program 79.1%
Taylor expanded in a around 0
Applied rewrites40.5%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6440.5
Applied rewrites40.5%
(FPCore (x y z a) :precision binary64 (if (<= a -1.65) (* x 1.0) (if (<= a 1.55) (- x (- a (tan z))) (* x 1.0))))
double code(double x, double y, double z, double a) {
double tmp;
if (a <= -1.65) {
tmp = x * 1.0;
} else if (a <= 1.55) {
tmp = x - (a - tan(z));
} else {
tmp = x * 1.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(x, y, z, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
real(8) :: tmp
if (a <= (-1.65d0)) then
tmp = x * 1.0d0
else if (a <= 1.55d0) then
tmp = x - (a - tan(z))
else
tmp = x * 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double a) {
double tmp;
if (a <= -1.65) {
tmp = x * 1.0;
} else if (a <= 1.55) {
tmp = x - (a - Math.tan(z));
} else {
tmp = x * 1.0;
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if a <= -1.65: tmp = x * 1.0 elif a <= 1.55: tmp = x - (a - math.tan(z)) else: tmp = x * 1.0 return tmp
function code(x, y, z, a) tmp = 0.0 if (a <= -1.65) tmp = Float64(x * 1.0); elseif (a <= 1.55) tmp = Float64(x - Float64(a - tan(z))); else tmp = Float64(x * 1.0); end return tmp end
function tmp_2 = code(x, y, z, a) tmp = 0.0; if (a <= -1.65) tmp = x * 1.0; elseif (a <= 1.55) tmp = x - (a - tan(z)); else tmp = x * 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[LessEqual[a, -1.65], N[(x * 1.0), $MachinePrecision], If[LessEqual[a, 1.55], N[(x - N[(a - N[Tan[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.65:\\
\;\;\;\;x \cdot 1\\
\mathbf{elif}\;a \leq 1.55:\\
\;\;\;\;x - \left(a - \tan z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 1\\
\end{array}
\end{array}
if a < -1.6499999999999999 or 1.55000000000000004 < a Initial program 79.1%
Taylor expanded in x around inf
lower-*.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-cos.f6478.8
Applied rewrites78.8%
Taylor expanded in x around inf
Applied rewrites31.8%
if -1.6499999999999999 < a < 1.55000000000000004Initial program 79.1%
Taylor expanded in a around 0
Applied rewrites40.5%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6440.5
Applied rewrites40.5%
Taylor expanded in y around 0
Applied rewrites31.1%
(FPCore (x y z a) :precision binary64 (* x 1.0))
double code(double x, double y, double z, double a) {
return x * 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(x, y, z, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
code = x * 1.0d0
end function
public static double code(double x, double y, double z, double a) {
return x * 1.0;
}
def code(x, y, z, a): return x * 1.0
function code(x, y, z, a) return Float64(x * 1.0) end
function tmp = code(x, y, z, a) tmp = x * 1.0; end
code[x_, y_, z_, a_] := N[(x * 1.0), $MachinePrecision]
\begin{array}{l}
\\
x \cdot 1
\end{array}
Initial program 79.1%
Taylor expanded in x around inf
lower-*.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-cos.f6478.8
Applied rewrites78.8%
Taylor expanded in x around inf
Applied rewrites31.8%
herbie shell --seed 2025147
(FPCore (x y z a)
:name "tan-example (used to crash)"
:precision binary64
:pre (and (and (and (or (== x 0.0) (and (<= 0.5884142 x) (<= x 505.5909))) (or (and (<= -1.796658e+308 y) (<= y -9.425585e-310)) (and (<= 1.284938e-309 y) (<= y 1.751224e+308)))) (or (and (<= -1.776707e+308 z) (<= z -8.599796e-310)) (and (<= 3.293145e-311 z) (<= z 1.725154e+308)))) (or (and (<= -1.796658e+308 a) (<= a -9.425585e-310)) (and (<= 1.284938e-309 a) (<= a 1.751224e+308))))
(+ x (- (tan (+ y z)) (tan a))))