
(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 17 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 (- 1.0 (* (tan y) (tan z))))) (+ x (- (+ (/ (tan y) t_0) (/ (tan z) t_0)) (tan a)))))
double code(double x, double y, double z, double a) {
double t_0 = 1.0 - (tan(y) * tan(z));
return x + (((tan(y) / t_0) + (tan(z) / 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 = 1.0d0 - (tan(y) * tan(z))
code = x + (((tan(y) / t_0) + (tan(z) / t_0)) - tan(a))
end function
public static double code(double x, double y, double z, double a) {
double t_0 = 1.0 - (Math.tan(y) * Math.tan(z));
return x + (((Math.tan(y) / t_0) + (Math.tan(z) / t_0)) - Math.tan(a));
}
def code(x, y, z, a): t_0 = 1.0 - (math.tan(y) * math.tan(z)) return x + (((math.tan(y) / t_0) + (math.tan(z) / t_0)) - math.tan(a))
function code(x, y, z, a) t_0 = Float64(1.0 - Float64(tan(y) * tan(z))) return Float64(x + Float64(Float64(Float64(tan(y) / t_0) + Float64(tan(z) / t_0)) - tan(a))) end
function tmp = code(x, y, z, a) t_0 = 1.0 - (tan(y) * tan(z)); tmp = x + (((tan(y) / t_0) + (tan(z) / t_0)) - tan(a)); end
code[x_, y_, z_, a_] := Block[{t$95$0 = N[(1.0 - N[(N[Tan[y], $MachinePrecision] * N[Tan[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x + N[(N[(N[(N[Tan[y], $MachinePrecision] / t$95$0), $MachinePrecision] + N[(N[Tan[z], $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \tan y \cdot \tan z\\
x + \left(\left(\frac{\tan y}{t\_0} + \frac{\tan z}{t\_0}\right) - \tan a\right)
\end{array}
\end{array}
Initial program 79.2%
lift-+.f64N/A
lift-tan.f64N/A
tan-sumN/A
quot-tanN/A
quot-tanN/A
div-addN/A
lower-+.f64N/A
Applied rewrites99.7%
(FPCore (x y z a)
:precision binary64
(let* ((t_0 (+ x (- (tan (+ y z)) (tan a)))))
(if (<= (tan a) -0.02)
t_0
(if (<= (tan a) 4e-10)
(+ x (- (/ (+ (tan z) (tan y)) (- 1.0 (* (tan z) (tan y)))) a))
t_0))))
double code(double x, double y, double z, double a) {
double t_0 = x + (tan((y + z)) - tan(a));
double tmp;
if (tan(a) <= -0.02) {
tmp = t_0;
} else if (tan(a) <= 4e-10) {
tmp = x + (((tan(z) + tan(y)) / (1.0 - (tan(z) * tan(y)))) - 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(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) :: tmp
t_0 = x + (tan((y + z)) - tan(a))
if (tan(a) <= (-0.02d0)) then
tmp = t_0
else if (tan(a) <= 4d-10) then
tmp = x + (((tan(z) + tan(y)) / (1.0d0 - (tan(z) * tan(y)))) - a)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z, double a) {
double t_0 = x + (Math.tan((y + z)) - Math.tan(a));
double tmp;
if (Math.tan(a) <= -0.02) {
tmp = t_0;
} else if (Math.tan(a) <= 4e-10) {
tmp = x + (((Math.tan(z) + Math.tan(y)) / (1.0 - (Math.tan(z) * Math.tan(y)))) - a);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z, a): t_0 = x + (math.tan((y + z)) - math.tan(a)) tmp = 0 if math.tan(a) <= -0.02: tmp = t_0 elif math.tan(a) <= 4e-10: tmp = x + (((math.tan(z) + math.tan(y)) / (1.0 - (math.tan(z) * math.tan(y)))) - a) else: tmp = t_0 return tmp
function code(x, y, z, a) t_0 = Float64(x + Float64(tan(Float64(y + z)) - tan(a))) tmp = 0.0 if (tan(a) <= -0.02) tmp = t_0; elseif (tan(a) <= 4e-10) tmp = Float64(x + Float64(Float64(Float64(tan(z) + tan(y)) / Float64(1.0 - Float64(tan(z) * tan(y)))) - a)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z, a) t_0 = x + (tan((y + z)) - tan(a)); tmp = 0.0; if (tan(a) <= -0.02) tmp = t_0; elseif (tan(a) <= 4e-10) tmp = x + (((tan(z) + tan(y)) / (1.0 - (tan(z) * tan(y)))) - a); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_, a_] := Block[{t$95$0 = N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Tan[a], $MachinePrecision], -0.02], t$95$0, If[LessEqual[N[Tan[a], $MachinePrecision], 4e-10], N[(x + N[(N[(N[(N[Tan[z], $MachinePrecision] + N[Tan[y], $MachinePrecision]), $MachinePrecision] / N[(1.0 - N[(N[Tan[z], $MachinePrecision] * N[Tan[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \left(\tan \left(y + z\right) - \tan a\right)\\
\mathbf{if}\;\tan a \leq -0.02:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\tan a \leq 4 \cdot 10^{-10}:\\
\;\;\;\;x + \left(\frac{\tan z + \tan y}{1 - \tan z \cdot \tan y} - a\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (tan.f64 a) < -0.0200000000000000004 or 4.00000000000000015e-10 < (tan.f64 a) Initial program 80.2%
if -0.0200000000000000004 < (tan.f64 a) < 4.00000000000000015e-10Initial program 78.2%
lift-+.f64N/A
lift-tan.f64N/A
+-commutativeN/A
tan-sumN/A
lower-/.f64N/A
quot-tanN/A
quot-tanN/A
lower-+.f64N/A
quot-tanN/A
lower-tan.f64N/A
quot-tanN/A
lower-tan.f64N/A
lower--.f64N/A
quot-tanN/A
quot-tanN/A
lower-*.f64N/A
quot-tanN/A
lower-tan.f64N/A
quot-tanN/A
lower-tan.f6499.7
Applied rewrites99.7%
Taylor expanded in a around 0
Applied rewrites99.0%
(FPCore (x y z a) :precision binary64 (+ x (- (/ (+ (tan z) (tan y)) (- 1.0 (* (tan z) (tan y)))) (tan a))))
double code(double x, double y, double z, double a) {
return x + (((tan(z) + tan(y)) / (1.0 - (tan(z) * tan(y)))) - 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(z) + tan(y)) / (1.0d0 - (tan(z) * tan(y)))) - tan(a))
end function
public static double code(double x, double y, double z, double a) {
return x + (((Math.tan(z) + Math.tan(y)) / (1.0 - (Math.tan(z) * Math.tan(y)))) - Math.tan(a));
}
def code(x, y, z, a): return x + (((math.tan(z) + math.tan(y)) / (1.0 - (math.tan(z) * math.tan(y)))) - math.tan(a))
function code(x, y, z, a) return Float64(x + Float64(Float64(Float64(tan(z) + tan(y)) / Float64(1.0 - Float64(tan(z) * tan(y)))) - tan(a))) end
function tmp = code(x, y, z, a) tmp = x + (((tan(z) + tan(y)) / (1.0 - (tan(z) * tan(y)))) - tan(a)); end
code[x_, y_, z_, a_] := N[(x + N[(N[(N[(N[Tan[z], $MachinePrecision] + N[Tan[y], $MachinePrecision]), $MachinePrecision] / N[(1.0 - N[(N[Tan[z], $MachinePrecision] * N[Tan[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\frac{\tan z + \tan y}{1 - \tan z \cdot \tan y} - \tan a\right)
\end{array}
Initial program 79.2%
lift-+.f64N/A
lift-tan.f64N/A
+-commutativeN/A
tan-sumN/A
lower-/.f64N/A
quot-tanN/A
quot-tanN/A
lower-+.f64N/A
quot-tanN/A
lower-tan.f64N/A
quot-tanN/A
lower-tan.f64N/A
lower--.f64N/A
quot-tanN/A
quot-tanN/A
lower-*.f64N/A
quot-tanN/A
lower-tan.f64N/A
quot-tanN/A
lower-tan.f6499.7
Applied rewrites99.7%
(FPCore (x y z a)
:precision binary64
(let* ((t_0 (+ x (- (/ (+ (/ (sin z) (cos z)) (tan y)) 1.0) (tan a)))))
(if (<= a -0.04)
t_0
(if (<= a 0.00042)
(+
x
(-
(/ (+ (tan z) (tan y)) (- 1.0 (* (tan z) (tan y))))
(*
(fma
(fma (* a a) 0.13333333333333333 0.3333333333333333)
(* a a)
1.0)
a)))
t_0))))
double code(double x, double y, double z, double a) {
double t_0 = x + ((((sin(z) / cos(z)) + tan(y)) / 1.0) - tan(a));
double tmp;
if (a <= -0.04) {
tmp = t_0;
} else if (a <= 0.00042) {
tmp = x + (((tan(z) + tan(y)) / (1.0 - (tan(z) * tan(y)))) - (fma(fma((a * a), 0.13333333333333333, 0.3333333333333333), (a * a), 1.0) * a));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z, a) t_0 = Float64(x + Float64(Float64(Float64(Float64(sin(z) / cos(z)) + tan(y)) / 1.0) - tan(a))) tmp = 0.0 if (a <= -0.04) tmp = t_0; elseif (a <= 0.00042) tmp = Float64(x + Float64(Float64(Float64(tan(z) + tan(y)) / Float64(1.0 - Float64(tan(z) * tan(y)))) - Float64(fma(fma(Float64(a * a), 0.13333333333333333, 0.3333333333333333), Float64(a * a), 1.0) * a))); else tmp = t_0; end return tmp end
code[x_, y_, z_, a_] := Block[{t$95$0 = N[(x + N[(N[(N[(N[(N[Sin[z], $MachinePrecision] / N[Cos[z], $MachinePrecision]), $MachinePrecision] + N[Tan[y], $MachinePrecision]), $MachinePrecision] / 1.0), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -0.04], t$95$0, If[LessEqual[a, 0.00042], N[(x + N[(N[(N[(N[Tan[z], $MachinePrecision] + N[Tan[y], $MachinePrecision]), $MachinePrecision] / N[(1.0 - N[(N[Tan[z], $MachinePrecision] * N[Tan[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(N[(a * a), $MachinePrecision] * 0.13333333333333333 + 0.3333333333333333), $MachinePrecision] * N[(a * a), $MachinePrecision] + 1.0), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \left(\frac{\frac{\sin z}{\cos z} + \tan y}{1} - \tan a\right)\\
\mathbf{if}\;a \leq -0.04:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;a \leq 0.00042:\\
\;\;\;\;x + \left(\frac{\tan z + \tan y}{1 - \tan z \cdot \tan y} - \mathsf{fma}\left(\mathsf{fma}\left(a \cdot a, 0.13333333333333333, 0.3333333333333333\right), a \cdot a, 1\right) \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if a < -0.0400000000000000008 or 4.2000000000000002e-4 < a Initial program 80.3%
lift-+.f64N/A
lift-tan.f64N/A
+-commutativeN/A
tan-sumN/A
lower-/.f64N/A
quot-tanN/A
quot-tanN/A
lower-+.f64N/A
quot-tanN/A
lower-tan.f64N/A
quot-tanN/A
lower-tan.f64N/A
lower--.f64N/A
quot-tanN/A
quot-tanN/A
lower-*.f64N/A
quot-tanN/A
lower-tan.f64N/A
quot-tanN/A
lower-tan.f6499.6
Applied rewrites99.6%
lift-tan.f64N/A
tan-quotN/A
lower-/.f64N/A
lower-sin.f64N/A
lower-cos.f6499.6
Applied rewrites99.6%
Taylor expanded in y around 0
Applied rewrites80.7%
if -0.0400000000000000008 < a < 4.2000000000000002e-4Initial program 78.1%
lift-+.f64N/A
lift-tan.f64N/A
+-commutativeN/A
tan-sumN/A
lower-/.f64N/A
quot-tanN/A
quot-tanN/A
lower-+.f64N/A
quot-tanN/A
lower-tan.f64N/A
quot-tanN/A
lower-tan.f64N/A
lower--.f64N/A
quot-tanN/A
quot-tanN/A
lower-*.f64N/A
quot-tanN/A
lower-tan.f64N/A
quot-tanN/A
lower-tan.f6499.7
Applied rewrites99.7%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6499.7
Applied rewrites99.7%
(FPCore (x y z a)
:precision binary64
(let* ((t_0 (+ x (- (/ (+ (/ (sin z) (cos z)) (tan y)) 1.0) (tan a)))))
(if (<= a -0.0112)
t_0
(if (<= a 0.00042)
(+
x
(-
(/ (+ (tan z) (tan y)) (- 1.0 (* (tan z) (tan y))))
(* (fma (* a a) 0.3333333333333333 1.0) a)))
t_0))))
double code(double x, double y, double z, double a) {
double t_0 = x + ((((sin(z) / cos(z)) + tan(y)) / 1.0) - tan(a));
double tmp;
if (a <= -0.0112) {
tmp = t_0;
} else if (a <= 0.00042) {
tmp = x + (((tan(z) + tan(y)) / (1.0 - (tan(z) * tan(y)))) - (fma((a * a), 0.3333333333333333, 1.0) * a));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z, a) t_0 = Float64(x + Float64(Float64(Float64(Float64(sin(z) / cos(z)) + tan(y)) / 1.0) - tan(a))) tmp = 0.0 if (a <= -0.0112) tmp = t_0; elseif (a <= 0.00042) tmp = Float64(x + Float64(Float64(Float64(tan(z) + tan(y)) / Float64(1.0 - Float64(tan(z) * tan(y)))) - Float64(fma(Float64(a * a), 0.3333333333333333, 1.0) * a))); else tmp = t_0; end return tmp end
code[x_, y_, z_, a_] := Block[{t$95$0 = N[(x + N[(N[(N[(N[(N[Sin[z], $MachinePrecision] / N[Cos[z], $MachinePrecision]), $MachinePrecision] + N[Tan[y], $MachinePrecision]), $MachinePrecision] / 1.0), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -0.0112], t$95$0, If[LessEqual[a, 0.00042], N[(x + N[(N[(N[(N[Tan[z], $MachinePrecision] + N[Tan[y], $MachinePrecision]), $MachinePrecision] / N[(1.0 - N[(N[Tan[z], $MachinePrecision] * N[Tan[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(a * a), $MachinePrecision] * 0.3333333333333333 + 1.0), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \left(\frac{\frac{\sin z}{\cos z} + \tan y}{1} - \tan a\right)\\
\mathbf{if}\;a \leq -0.0112:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;a \leq 0.00042:\\
\;\;\;\;x + \left(\frac{\tan z + \tan y}{1 - \tan z \cdot \tan y} - \mathsf{fma}\left(a \cdot a, 0.3333333333333333, 1\right) \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if a < -0.0111999999999999999 or 4.2000000000000002e-4 < a Initial program 80.4%
lift-+.f64N/A
lift-tan.f64N/A
+-commutativeN/A
tan-sumN/A
lower-/.f64N/A
quot-tanN/A
quot-tanN/A
lower-+.f64N/A
quot-tanN/A
lower-tan.f64N/A
quot-tanN/A
lower-tan.f64N/A
lower--.f64N/A
quot-tanN/A
quot-tanN/A
lower-*.f64N/A
quot-tanN/A
lower-tan.f64N/A
quot-tanN/A
lower-tan.f6499.6
Applied rewrites99.6%
lift-tan.f64N/A
tan-quotN/A
lower-/.f64N/A
lower-sin.f64N/A
lower-cos.f6499.6
Applied rewrites99.6%
Taylor expanded in y around 0
Applied rewrites80.7%
if -0.0111999999999999999 < a < 4.2000000000000002e-4Initial program 78.1%
lift-+.f64N/A
lift-tan.f64N/A
+-commutativeN/A
tan-sumN/A
lower-/.f64N/A
quot-tanN/A
quot-tanN/A
lower-+.f64N/A
quot-tanN/A
lower-tan.f64N/A
quot-tanN/A
lower-tan.f64N/A
lower--.f64N/A
quot-tanN/A
quot-tanN/A
lower-*.f64N/A
quot-tanN/A
lower-tan.f64N/A
quot-tanN/A
lower-tan.f6499.7
Applied rewrites99.7%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6499.7
Applied rewrites99.7%
(FPCore (x y z a)
:precision binary64
(let* ((t_0 (+ x (- (/ (+ (/ (sin z) (cos z)) (tan y)) 1.0) (tan a)))))
(if (<= a -0.0054)
t_0
(if (<= a 0.000215)
(+ x (- (/ (+ (tan z) (tan y)) (- 1.0 (* (tan z) (tan y)))) a))
t_0))))
double code(double x, double y, double z, double a) {
double t_0 = x + ((((sin(z) / cos(z)) + tan(y)) / 1.0) - tan(a));
double tmp;
if (a <= -0.0054) {
tmp = t_0;
} else if (a <= 0.000215) {
tmp = x + (((tan(z) + tan(y)) / (1.0 - (tan(z) * tan(y)))) - 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(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) :: tmp
t_0 = x + ((((sin(z) / cos(z)) + tan(y)) / 1.0d0) - tan(a))
if (a <= (-0.0054d0)) then
tmp = t_0
else if (a <= 0.000215d0) then
tmp = x + (((tan(z) + tan(y)) / (1.0d0 - (tan(z) * tan(y)))) - a)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z, double a) {
double t_0 = x + ((((Math.sin(z) / Math.cos(z)) + Math.tan(y)) / 1.0) - Math.tan(a));
double tmp;
if (a <= -0.0054) {
tmp = t_0;
} else if (a <= 0.000215) {
tmp = x + (((Math.tan(z) + Math.tan(y)) / (1.0 - (Math.tan(z) * Math.tan(y)))) - a);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z, a): t_0 = x + ((((math.sin(z) / math.cos(z)) + math.tan(y)) / 1.0) - math.tan(a)) tmp = 0 if a <= -0.0054: tmp = t_0 elif a <= 0.000215: tmp = x + (((math.tan(z) + math.tan(y)) / (1.0 - (math.tan(z) * math.tan(y)))) - a) else: tmp = t_0 return tmp
function code(x, y, z, a) t_0 = Float64(x + Float64(Float64(Float64(Float64(sin(z) / cos(z)) + tan(y)) / 1.0) - tan(a))) tmp = 0.0 if (a <= -0.0054) tmp = t_0; elseif (a <= 0.000215) tmp = Float64(x + Float64(Float64(Float64(tan(z) + tan(y)) / Float64(1.0 - Float64(tan(z) * tan(y)))) - a)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z, a) t_0 = x + ((((sin(z) / cos(z)) + tan(y)) / 1.0) - tan(a)); tmp = 0.0; if (a <= -0.0054) tmp = t_0; elseif (a <= 0.000215) tmp = x + (((tan(z) + tan(y)) / (1.0 - (tan(z) * tan(y)))) - a); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_, a_] := Block[{t$95$0 = N[(x + N[(N[(N[(N[(N[Sin[z], $MachinePrecision] / N[Cos[z], $MachinePrecision]), $MachinePrecision] + N[Tan[y], $MachinePrecision]), $MachinePrecision] / 1.0), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -0.0054], t$95$0, If[LessEqual[a, 0.000215], N[(x + N[(N[(N[(N[Tan[z], $MachinePrecision] + N[Tan[y], $MachinePrecision]), $MachinePrecision] / N[(1.0 - N[(N[Tan[z], $MachinePrecision] * N[Tan[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \left(\frac{\frac{\sin z}{\cos z} + \tan y}{1} - \tan a\right)\\
\mathbf{if}\;a \leq -0.0054:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;a \leq 0.000215:\\
\;\;\;\;x + \left(\frac{\tan z + \tan y}{1 - \tan z \cdot \tan y} - a\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if a < -0.0054000000000000003 or 2.14999999999999995e-4 < a Initial program 80.3%
lift-+.f64N/A
lift-tan.f64N/A
+-commutativeN/A
tan-sumN/A
lower-/.f64N/A
quot-tanN/A
quot-tanN/A
lower-+.f64N/A
quot-tanN/A
lower-tan.f64N/A
quot-tanN/A
lower-tan.f64N/A
lower--.f64N/A
quot-tanN/A
quot-tanN/A
lower-*.f64N/A
quot-tanN/A
lower-tan.f64N/A
quot-tanN/A
lower-tan.f6499.6
Applied rewrites99.6%
lift-tan.f64N/A
tan-quotN/A
lower-/.f64N/A
lower-sin.f64N/A
lower-cos.f6499.6
Applied rewrites99.6%
Taylor expanded in y around 0
Applied rewrites80.7%
if -0.0054000000000000003 < a < 2.14999999999999995e-4Initial program 78.2%
lift-+.f64N/A
lift-tan.f64N/A
+-commutativeN/A
tan-sumN/A
lower-/.f64N/A
quot-tanN/A
quot-tanN/A
lower-+.f64N/A
quot-tanN/A
lower-tan.f64N/A
quot-tanN/A
lower-tan.f64N/A
lower--.f64N/A
quot-tanN/A
quot-tanN/A
lower-*.f64N/A
quot-tanN/A
lower-tan.f64N/A
quot-tanN/A
lower-tan.f6499.7
Applied rewrites99.7%
Taylor expanded in a around 0
Applied rewrites99.6%
(FPCore (x y z a) :precision binary64 (if (<= (+ y z) 4e-102) (+ x (- (tan y) (tan a))) (+ x (- (tan z) (tan a)))))
double code(double x, double y, double z, double a) {
double tmp;
if ((y + z) <= 4e-102) {
tmp = x + (tan(y) - tan(a));
} 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) <= 4d-102) then
tmp = x + (tan(y) - tan(a))
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) <= 4e-102) {
tmp = x + (Math.tan(y) - Math.tan(a));
} else {
tmp = x + (Math.tan(z) - Math.tan(a));
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if (y + z) <= 4e-102: tmp = x + (math.tan(y) - math.tan(a)) else: tmp = x + (math.tan(z) - math.tan(a)) return tmp
function code(x, y, z, a) tmp = 0.0 if (Float64(y + z) <= 4e-102) tmp = Float64(x + Float64(tan(y) - tan(a))); 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) <= 4e-102) tmp = x + (tan(y) - tan(a)); else tmp = x + (tan(z) - tan(a)); end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[LessEqual[N[(y + z), $MachinePrecision], 4e-102], N[(x + N[(N[Tan[y], $MachinePrecision] - N[Tan[a], $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 4 \cdot 10^{-102}:\\
\;\;\;\;x + \left(\tan y - \tan a\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(\tan z - \tan a\right)\\
\end{array}
\end{array}
if (+.f64 y z) < 3.99999999999999973e-102Initial program 81.0%
Taylor expanded in y around inf
Applied rewrites63.2%
if 3.99999999999999973e-102 < (+.f64 y z) Initial program 77.1%
Taylor expanded in y around 0
Applied rewrites56.4%
(FPCore (x y z a) :precision binary64 (if (<= (+ y z) 4e-102) (+ x (- (tan y) (tan a))) (+ (tan z) (- x (tan a)))))
double code(double x, double y, double z, double a) {
double tmp;
if ((y + z) <= 4e-102) {
tmp = x + (tan(y) - tan(a));
} else {
tmp = tan(z) + (x - 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) <= 4d-102) then
tmp = x + (tan(y) - tan(a))
else
tmp = tan(z) + (x - 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) <= 4e-102) {
tmp = x + (Math.tan(y) - Math.tan(a));
} else {
tmp = Math.tan(z) + (x - Math.tan(a));
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if (y + z) <= 4e-102: tmp = x + (math.tan(y) - math.tan(a)) else: tmp = math.tan(z) + (x - math.tan(a)) return tmp
function code(x, y, z, a) tmp = 0.0 if (Float64(y + z) <= 4e-102) tmp = Float64(x + Float64(tan(y) - tan(a))); else tmp = Float64(tan(z) + Float64(x - tan(a))); end return tmp end
function tmp_2 = code(x, y, z, a) tmp = 0.0; if ((y + z) <= 4e-102) tmp = x + (tan(y) - tan(a)); else tmp = tan(z) + (x - tan(a)); end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[LessEqual[N[(y + z), $MachinePrecision], 4e-102], N[(x + N[(N[Tan[y], $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Tan[z], $MachinePrecision] + N[(x - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y + z \leq 4 \cdot 10^{-102}:\\
\;\;\;\;x + \left(\tan y - \tan a\right)\\
\mathbf{else}:\\
\;\;\;\;\tan z + \left(x - \tan a\right)\\
\end{array}
\end{array}
if (+.f64 y z) < 3.99999999999999973e-102Initial program 81.0%
Taylor expanded in y around inf
Applied rewrites63.2%
if 3.99999999999999973e-102 < (+.f64 y z) Initial program 77.1%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
quot-tanN/A
lower-tan.f64N/A
tan-quotN/A
lift-tan.f6456.3
Applied rewrites56.3%
lift--.f64N/A
lift-+.f64N/A
lift-tan.f64N/A
lift-tan.f64N/A
tan-quotN/A
tan-quotN/A
associate--l+N/A
lower-+.f64N/A
tan-quotN/A
lift-tan.f64N/A
lower--.f64N/A
tan-quotN/A
lift-tan.f6456.3
Applied rewrites56.3%
(FPCore (x y z a) :precision binary64 (if (<= (+ y z) 4e-102) (- (+ (tan y) x) (tan a)) (+ (tan z) (- x (tan a)))))
double code(double x, double y, double z, double a) {
double tmp;
if ((y + z) <= 4e-102) {
tmp = (tan(y) + x) - tan(a);
} else {
tmp = tan(z) + (x - 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) <= 4d-102) then
tmp = (tan(y) + x) - tan(a)
else
tmp = tan(z) + (x - 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) <= 4e-102) {
tmp = (Math.tan(y) + x) - Math.tan(a);
} else {
tmp = Math.tan(z) + (x - Math.tan(a));
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if (y + z) <= 4e-102: tmp = (math.tan(y) + x) - math.tan(a) else: tmp = math.tan(z) + (x - math.tan(a)) return tmp
function code(x, y, z, a) tmp = 0.0 if (Float64(y + z) <= 4e-102) tmp = Float64(Float64(tan(y) + x) - tan(a)); else tmp = Float64(tan(z) + Float64(x - tan(a))); end return tmp end
function tmp_2 = code(x, y, z, a) tmp = 0.0; if ((y + z) <= 4e-102) tmp = (tan(y) + x) - tan(a); else tmp = tan(z) + (x - tan(a)); end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[LessEqual[N[(y + z), $MachinePrecision], 4e-102], N[(N[(N[Tan[y], $MachinePrecision] + x), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision], N[(N[Tan[z], $MachinePrecision] + N[(x - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y + z \leq 4 \cdot 10^{-102}:\\
\;\;\;\;\left(\tan y + x\right) - \tan a\\
\mathbf{else}:\\
\;\;\;\;\tan z + \left(x - \tan a\right)\\
\end{array}
\end{array}
if (+.f64 y z) < 3.99999999999999973e-102Initial program 81.0%
Taylor expanded in z around 0
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
quot-tanN/A
lower-tan.f64N/A
tan-quotN/A
lift-tan.f6463.1
Applied rewrites63.1%
if 3.99999999999999973e-102 < (+.f64 y z) Initial program 77.1%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
quot-tanN/A
lower-tan.f64N/A
tan-quotN/A
lift-tan.f6456.3
Applied rewrites56.3%
lift--.f64N/A
lift-+.f64N/A
lift-tan.f64N/A
lift-tan.f64N/A
tan-quotN/A
tan-quotN/A
associate--l+N/A
lower-+.f64N/A
tan-quotN/A
lift-tan.f64N/A
lower--.f64N/A
tan-quotN/A
lift-tan.f6456.3
Applied rewrites56.3%
(FPCore (x y z a) :precision binary64 (if (<= (+ y z) -0.5) (+ x (tan (+ z y))) (+ (tan z) (- x (tan a)))))
double code(double x, double y, double z, double a) {
double tmp;
if ((y + z) <= -0.5) {
tmp = x + tan((z + y));
} else {
tmp = tan(z) + (x - 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.5d0)) then
tmp = x + tan((z + y))
else
tmp = tan(z) + (x - 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.5) {
tmp = x + Math.tan((z + y));
} else {
tmp = Math.tan(z) + (x - Math.tan(a));
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if (y + z) <= -0.5: tmp = x + math.tan((z + y)) else: tmp = math.tan(z) + (x - math.tan(a)) return tmp
function code(x, y, z, a) tmp = 0.0 if (Float64(y + z) <= -0.5) tmp = Float64(x + tan(Float64(z + y))); else tmp = Float64(tan(z) + Float64(x - tan(a))); end return tmp end
function tmp_2 = code(x, y, z, a) tmp = 0.0; if ((y + z) <= -0.5) tmp = x + tan((z + y)); else tmp = tan(z) + (x - tan(a)); end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[LessEqual[N[(y + z), $MachinePrecision], -0.5], N[(x + N[Tan[N[(z + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Tan[z], $MachinePrecision] + N[(x - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y + z \leq -0.5:\\
\;\;\;\;x + \tan \left(z + y\right)\\
\mathbf{else}:\\
\;\;\;\;\tan z + \left(x - \tan a\right)\\
\end{array}
\end{array}
if (+.f64 y z) < -0.5Initial program 72.3%
Taylor expanded in a around 0
tan-quotN/A
lift-tan.f64N/A
+-commutativeN/A
lower-+.f6446.4
Applied rewrites46.4%
if -0.5 < (+.f64 y z) Initial program 83.6%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
quot-tanN/A
lower-tan.f64N/A
tan-quotN/A
lift-tan.f6468.4
Applied rewrites68.4%
lift--.f64N/A
lift-+.f64N/A
lift-tan.f64N/A
lift-tan.f64N/A
tan-quotN/A
tan-quotN/A
associate--l+N/A
lower-+.f64N/A
tan-quotN/A
lift-tan.f64N/A
lower--.f64N/A
tan-quotN/A
lift-tan.f6468.4
Applied rewrites68.4%
(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}
Initial program 79.2%
(FPCore (x y z a)
:precision binary64
(let* ((t_0 (- x (tan a))))
(if (<= a -0.0052)
t_0
(if (<= a 0.15)
(+ x (- (tan (+ y z)) (* (fma 0.3333333333333333 (* a a) 1.0) a)))
t_0))))
double code(double x, double y, double z, double a) {
double t_0 = x - tan(a);
double tmp;
if (a <= -0.0052) {
tmp = t_0;
} else if (a <= 0.15) {
tmp = x + (tan((y + z)) - (fma(0.3333333333333333, (a * a), 1.0) * a));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z, a) t_0 = Float64(x - tan(a)) tmp = 0.0 if (a <= -0.0052) tmp = t_0; elseif (a <= 0.15) tmp = Float64(x + Float64(tan(Float64(y + z)) - Float64(fma(0.3333333333333333, Float64(a * a), 1.0) * a))); else tmp = t_0; end return tmp end
code[x_, y_, z_, a_] := Block[{t$95$0 = N[(x - N[Tan[a], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -0.0052], t$95$0, If[LessEqual[a, 0.15], N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - N[(N[(0.3333333333333333 * N[(a * a), $MachinePrecision] + 1.0), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x - \tan a\\
\mathbf{if}\;a \leq -0.0052:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;a \leq 0.15:\\
\;\;\;\;x + \left(\tan \left(y + z\right) - \mathsf{fma}\left(0.3333333333333333, a \cdot a, 1\right) \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if a < -0.0051999999999999998 or 0.149999999999999994 < a Initial program 80.3%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
quot-tanN/A
lower-tan.f64N/A
tan-quotN/A
lift-tan.f6461.5
Applied rewrites61.5%
Taylor expanded in x around inf
Applied rewrites41.9%
if -0.0051999999999999998 < a < 0.149999999999999994Initial program 78.2%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6478.1
Applied rewrites78.1%
(FPCore (x y z a) :precision binary64 (if (<= (+ y z) -0.5) (+ x (tan (+ z y))) (if (<= (+ y z) 0.0004) (- (+ z x) (tan a)) (+ (tan z) x))))
double code(double x, double y, double z, double a) {
double tmp;
if ((y + z) <= -0.5) {
tmp = x + tan((z + y));
} else if ((y + z) <= 0.0004) {
tmp = (z + x) - tan(a);
} else {
tmp = tan(z) + x;
}
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.5d0)) then
tmp = x + tan((z + y))
else if ((y + z) <= 0.0004d0) then
tmp = (z + x) - tan(a)
else
tmp = tan(z) + x
end if
code = tmp
end function
public static double code(double x, double y, double z, double a) {
double tmp;
if ((y + z) <= -0.5) {
tmp = x + Math.tan((z + y));
} else if ((y + z) <= 0.0004) {
tmp = (z + x) - Math.tan(a);
} else {
tmp = Math.tan(z) + x;
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if (y + z) <= -0.5: tmp = x + math.tan((z + y)) elif (y + z) <= 0.0004: tmp = (z + x) - math.tan(a) else: tmp = math.tan(z) + x return tmp
function code(x, y, z, a) tmp = 0.0 if (Float64(y + z) <= -0.5) tmp = Float64(x + tan(Float64(z + y))); elseif (Float64(y + z) <= 0.0004) tmp = Float64(Float64(z + x) - tan(a)); else tmp = Float64(tan(z) + x); end return tmp end
function tmp_2 = code(x, y, z, a) tmp = 0.0; if ((y + z) <= -0.5) tmp = x + tan((z + y)); elseif ((y + z) <= 0.0004) tmp = (z + x) - tan(a); else tmp = tan(z) + x; end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[LessEqual[N[(y + z), $MachinePrecision], -0.5], N[(x + N[Tan[N[(z + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(y + z), $MachinePrecision], 0.0004], N[(N[(z + x), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision], N[(N[Tan[z], $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y + z \leq -0.5:\\
\;\;\;\;x + \tan \left(z + y\right)\\
\mathbf{elif}\;y + z \leq 0.0004:\\
\;\;\;\;\left(z + x\right) - \tan a\\
\mathbf{else}:\\
\;\;\;\;\tan z + x\\
\end{array}
\end{array}
if (+.f64 y z) < -0.5Initial program 72.3%
Taylor expanded in a around 0
tan-quotN/A
lift-tan.f64N/A
+-commutativeN/A
lower-+.f6446.4
Applied rewrites46.4%
if -0.5 < (+.f64 y z) < 4.00000000000000019e-4Initial program 99.9%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
quot-tanN/A
lower-tan.f64N/A
tan-quotN/A
lift-tan.f6498.6
Applied rewrites98.6%
Taylor expanded in z around 0
Applied rewrites98.3%
if 4.00000000000000019e-4 < (+.f64 y z) Initial program 73.1%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
quot-tanN/A
lower-tan.f64N/A
tan-quotN/A
lift-tan.f6449.0
Applied rewrites49.0%
Taylor expanded in a around 0
+-commutativeN/A
tan-quotN/A
lift-tan.f64N/A
lift-+.f6434.9
Applied rewrites34.9%
(FPCore (x y z a) :precision binary64 (let* ((t_0 (- x (tan a)))) (if (<= a -0.00095) t_0 (if (<= a 0.033) (+ x (- (tan (+ y z)) a)) t_0))))
double code(double x, double y, double z, double a) {
double t_0 = x - tan(a);
double tmp;
if (a <= -0.00095) {
tmp = t_0;
} else if (a <= 0.033) {
tmp = x + (tan((y + z)) - 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(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) :: tmp
t_0 = x - tan(a)
if (a <= (-0.00095d0)) then
tmp = t_0
else if (a <= 0.033d0) then
tmp = x + (tan((y + z)) - a)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z, double a) {
double t_0 = x - Math.tan(a);
double tmp;
if (a <= -0.00095) {
tmp = t_0;
} else if (a <= 0.033) {
tmp = x + (Math.tan((y + z)) - a);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z, a): t_0 = x - math.tan(a) tmp = 0 if a <= -0.00095: tmp = t_0 elif a <= 0.033: tmp = x + (math.tan((y + z)) - a) else: tmp = t_0 return tmp
function code(x, y, z, a) t_0 = Float64(x - tan(a)) tmp = 0.0 if (a <= -0.00095) tmp = t_0; elseif (a <= 0.033) tmp = Float64(x + Float64(tan(Float64(y + z)) - a)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z, a) t_0 = x - tan(a); tmp = 0.0; if (a <= -0.00095) tmp = t_0; elseif (a <= 0.033) tmp = x + (tan((y + z)) - a); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_, a_] := Block[{t$95$0 = N[(x - N[Tan[a], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -0.00095], t$95$0, If[LessEqual[a, 0.033], N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x - \tan a\\
\mathbf{if}\;a \leq -0.00095:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;a \leq 0.033:\\
\;\;\;\;x + \left(\tan \left(y + z\right) - a\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if a < -9.49999999999999998e-4 or 0.033000000000000002 < a Initial program 80.3%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
quot-tanN/A
lower-tan.f64N/A
tan-quotN/A
lift-tan.f6461.5
Applied rewrites61.5%
Taylor expanded in x around inf
Applied rewrites41.9%
if -9.49999999999999998e-4 < a < 0.033000000000000002Initial program 78.2%
Taylor expanded in a around 0
Applied rewrites78.0%
(FPCore (x y z a) :precision binary64 (if (<= (+ y z) 1e-20) (- x (tan a)) (+ (tan z) x)))
double code(double x, double y, double z, double a) {
double tmp;
if ((y + z) <= 1e-20) {
tmp = x - tan(a);
} else {
tmp = tan(z) + x;
}
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) <= 1d-20) then
tmp = x - tan(a)
else
tmp = tan(z) + x
end if
code = tmp
end function
public static double code(double x, double y, double z, double a) {
double tmp;
if ((y + z) <= 1e-20) {
tmp = x - Math.tan(a);
} else {
tmp = Math.tan(z) + x;
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if (y + z) <= 1e-20: tmp = x - math.tan(a) else: tmp = math.tan(z) + x return tmp
function code(x, y, z, a) tmp = 0.0 if (Float64(y + z) <= 1e-20) tmp = Float64(x - tan(a)); else tmp = Float64(tan(z) + x); end return tmp end
function tmp_2 = code(x, y, z, a) tmp = 0.0; if ((y + z) <= 1e-20) tmp = x - tan(a); else tmp = tan(z) + x; end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[LessEqual[N[(y + z), $MachinePrecision], 1e-20], N[(x - N[Tan[a], $MachinePrecision]), $MachinePrecision], N[(N[Tan[z], $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y + z \leq 10^{-20}:\\
\;\;\;\;x - \tan a\\
\mathbf{else}:\\
\;\;\;\;\tan z + x\\
\end{array}
\end{array}
if (+.f64 y z) < 9.99999999999999945e-21Initial program 82.6%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
quot-tanN/A
lower-tan.f64N/A
tan-quotN/A
lift-tan.f6467.2
Applied rewrites67.2%
Taylor expanded in x around inf
Applied rewrites51.5%
if 9.99999999999999945e-21 < (+.f64 y z) Initial program 74.0%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
quot-tanN/A
lower-tan.f64N/A
tan-quotN/A
lift-tan.f6450.4
Applied rewrites50.4%
Taylor expanded in a around 0
+-commutativeN/A
tan-quotN/A
lift-tan.f64N/A
lift-+.f6435.5
Applied rewrites35.5%
(FPCore (x y z a) :precision binary64 (+ (tan z) x))
double code(double x, double y, double z, double a) {
return tan(z) + x;
}
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 = tan(z) + x
end function
public static double code(double x, double y, double z, double a) {
return Math.tan(z) + x;
}
def code(x, y, z, a): return math.tan(z) + x
function code(x, y, z, a) return Float64(tan(z) + x) end
function tmp = code(x, y, z, a) tmp = tan(z) + x; end
code[x_, y_, z_, a_] := N[(N[Tan[z], $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\tan z + x
\end{array}
Initial program 79.2%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
quot-tanN/A
lower-tan.f64N/A
tan-quotN/A
lift-tan.f6460.7
Applied rewrites60.7%
Taylor expanded in a around 0
+-commutativeN/A
tan-quotN/A
lift-tan.f64N/A
lift-+.f6440.6
Applied rewrites40.6%
(FPCore (x y z a) :precision binary64 x)
double code(double x, double y, double z, double a) {
return x;
}
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
end function
public static double code(double x, double y, double z, double a) {
return x;
}
def code(x, y, z, a): return x
function code(x, y, z, a) return x end
function tmp = code(x, y, z, a) tmp = x; end
code[x_, y_, z_, a_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 79.2%
Taylor expanded in x around inf
Applied rewrites31.3%
herbie shell --seed 2025105
(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))))