
(FPCore (x y z t a b)
:precision binary64
(+
x
(/
(*
y
(+ (* (+ (* (+ (* (+ (* z 3.13060547623) 11.1667541262) z) t) z) a) z) b))
(+
(* (+ (* (+ (* (+ z 15.234687407) z) 31.4690115749) z) 11.9400905721) z)
0.607771387771))))
double code(double x, double y, double z, double t, double a, double b) {
return x + ((y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771));
}
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, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = x + ((y * ((((((((z * 3.13060547623d0) + 11.1667541262d0) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407d0) * z) + 31.4690115749d0) * z) + 11.9400905721d0) * z) + 0.607771387771d0))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x + ((y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771));
}
def code(x, y, z, t, a, b): return x + ((y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771))
function code(x, y, z, t, a, b) return Float64(x + Float64(Float64(y * Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / Float64(Float64(Float64(Float64(Float64(Float64(Float64(z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771))) end
function tmp = code(x, y, z, t, a, b) tmp = x + ((y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771)); end
code[x_, y_, z_, t_, a_, b_] := N[(x + N[(N[(y * N[(N[(N[(N[(N[(N[(N[(N[(z * 3.13060547623), $MachinePrecision] + 11.1667541262), $MachinePrecision] * z), $MachinePrecision] + t), $MachinePrecision] * z), $MachinePrecision] + a), $MachinePrecision] * z), $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(N[(N[(N[(N[(z + 15.234687407), $MachinePrecision] * z), $MachinePrecision] + 31.4690115749), $MachinePrecision] * z), $MachinePrecision] + 11.9400905721), $MachinePrecision] * z), $MachinePrecision] + 0.607771387771), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771}
\end{array}
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b)
:precision binary64
(+
x
(/
(*
y
(+ (* (+ (* (+ (* (+ (* z 3.13060547623) 11.1667541262) z) t) z) a) z) b))
(+
(* (+ (* (+ (* (+ z 15.234687407) z) 31.4690115749) z) 11.9400905721) z)
0.607771387771))))
double code(double x, double y, double z, double t, double a, double b) {
return x + ((y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771));
}
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, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = x + ((y * ((((((((z * 3.13060547623d0) + 11.1667541262d0) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407d0) * z) + 31.4690115749d0) * z) + 11.9400905721d0) * z) + 0.607771387771d0))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x + ((y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771));
}
def code(x, y, z, t, a, b): return x + ((y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771))
function code(x, y, z, t, a, b) return Float64(x + Float64(Float64(y * Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / Float64(Float64(Float64(Float64(Float64(Float64(Float64(z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771))) end
function tmp = code(x, y, z, t, a, b) tmp = x + ((y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771)); end
code[x_, y_, z_, t_, a_, b_] := N[(x + N[(N[(y * N[(N[(N[(N[(N[(N[(N[(N[(z * 3.13060547623), $MachinePrecision] + 11.1667541262), $MachinePrecision] * z), $MachinePrecision] + t), $MachinePrecision] * z), $MachinePrecision] + a), $MachinePrecision] * z), $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(N[(N[(N[(N[(z + 15.234687407), $MachinePrecision] * z), $MachinePrecision] + 31.4690115749), $MachinePrecision] * z), $MachinePrecision] + 11.9400905721), $MachinePrecision] * z), $MachinePrecision] + 0.607771387771), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771}
\end{array}
(FPCore (x y z t a b)
:precision binary64
(if (<=
(+
x
(/
(*
y
(+
(* (+ (* (+ (* (+ (* z 3.13060547623) 11.1667541262) z) t) z) a) z)
b))
(+
(*
(+ (* (+ (* (+ z 15.234687407) z) 31.4690115749) z) 11.9400905721)
z)
0.607771387771)))
INFINITY)
(fma
(/
(fma (fma (fma (fma z 3.13060547623 11.1667541262) z t) z a) z b)
(fma
(fma (fma (+ z 15.234687407) z 31.4690115749) z 11.9400905721)
z
0.607771387771))
y
x)
(+ x (* 3.13060547623 y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x + ((y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771))) <= ((double) INFINITY)) {
tmp = fma((fma(fma(fma(fma(z, 3.13060547623, 11.1667541262), z, t), z, a), z, b) / fma(fma(fma((z + 15.234687407), z, 31.4690115749), z, 11.9400905721), z, 0.607771387771)), y, x);
} else {
tmp = x + (3.13060547623 * y);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(x + Float64(Float64(y * Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / Float64(Float64(Float64(Float64(Float64(Float64(Float64(z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771))) <= Inf) tmp = fma(Float64(fma(fma(fma(fma(z, 3.13060547623, 11.1667541262), z, t), z, a), z, b) / fma(fma(fma(Float64(z + 15.234687407), z, 31.4690115749), z, 11.9400905721), z, 0.607771387771)), y, x); else tmp = Float64(x + Float64(3.13060547623 * y)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(x + N[(N[(y * N[(N[(N[(N[(N[(N[(N[(N[(z * 3.13060547623), $MachinePrecision] + 11.1667541262), $MachinePrecision] * z), $MachinePrecision] + t), $MachinePrecision] * z), $MachinePrecision] + a), $MachinePrecision] * z), $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(N[(N[(N[(N[(z + 15.234687407), $MachinePrecision] * z), $MachinePrecision] + 31.4690115749), $MachinePrecision] * z), $MachinePrecision] + 11.9400905721), $MachinePrecision] * z), $MachinePrecision] + 0.607771387771), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(N[(N[(N[(N[(z * 3.13060547623 + 11.1667541262), $MachinePrecision] * z + t), $MachinePrecision] * z + a), $MachinePrecision] * z + b), $MachinePrecision] / N[(N[(N[(N[(z + 15.234687407), $MachinePrecision] * z + 31.4690115749), $MachinePrecision] * z + 11.9400905721), $MachinePrecision] * z + 0.607771387771), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision], N[(x + N[(3.13060547623 * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(\frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(z, 3.13060547623, 11.1667541262\right), z, t\right), z, a\right), z, b\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(z + 15.234687407, z, 31.4690115749\right), z, 11.9400905721\right), z, 0.607771387771\right)}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + 3.13060547623 \cdot y\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 y (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 z #s(literal 313060547623/100000000000 binary64)) #s(literal 55833770631/5000000000 binary64)) z) t) z) a) z) b)) (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 z #s(literal 15234687407/1000000000 binary64)) z) #s(literal 314690115749/10000000000 binary64)) z) #s(literal 119400905721/10000000000 binary64)) z) #s(literal 607771387771/1000000000000 binary64)))) < +inf.0Initial program 58.1%
Applied rewrites60.4%
if +inf.0 < (+.f64 x (/.f64 (*.f64 y (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 z #s(literal 313060547623/100000000000 binary64)) #s(literal 55833770631/5000000000 binary64)) z) t) z) a) z) b)) (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 z #s(literal 15234687407/1000000000 binary64)) z) #s(literal 314690115749/10000000000 binary64)) z) #s(literal 119400905721/10000000000 binary64)) z) #s(literal 607771387771/1000000000000 binary64)))) Initial program 58.1%
Taylor expanded in z around inf
Applied rewrites62.9%
(FPCore (x y z t a b)
:precision binary64
(if (<=
(+
x
(/
(*
y
(+
(* (+ (* (+ (* (+ (* z 3.13060547623) 11.1667541262) z) t) z) a) z)
b))
(+
(*
(+ (* (+ (* (+ z 15.234687407) z) 31.4690115749) z) 11.9400905721)
z)
0.607771387771)))
INFINITY)
(+
x
(/
(* y (+ (* (+ (* t z) a) z) b))
(fma
(* (fma (+ z 15.234687407) z 31.4690115749) z)
z
(fma z 11.9400905721 0.607771387771))))
(+ x (* 3.13060547623 y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x + ((y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771))) <= ((double) INFINITY)) {
tmp = x + ((y * ((((t * z) + a) * z) + b)) / fma((fma((z + 15.234687407), z, 31.4690115749) * z), z, fma(z, 11.9400905721, 0.607771387771)));
} else {
tmp = x + (3.13060547623 * y);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(x + Float64(Float64(y * Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / Float64(Float64(Float64(Float64(Float64(Float64(Float64(z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771))) <= Inf) tmp = Float64(x + Float64(Float64(y * Float64(Float64(Float64(Float64(t * z) + a) * z) + b)) / fma(Float64(fma(Float64(z + 15.234687407), z, 31.4690115749) * z), z, fma(z, 11.9400905721, 0.607771387771)))); else tmp = Float64(x + Float64(3.13060547623 * y)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(x + N[(N[(y * N[(N[(N[(N[(N[(N[(N[(N[(z * 3.13060547623), $MachinePrecision] + 11.1667541262), $MachinePrecision] * z), $MachinePrecision] + t), $MachinePrecision] * z), $MachinePrecision] + a), $MachinePrecision] * z), $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(N[(N[(N[(N[(z + 15.234687407), $MachinePrecision] * z), $MachinePrecision] + 31.4690115749), $MachinePrecision] * z), $MachinePrecision] + 11.9400905721), $MachinePrecision] * z), $MachinePrecision] + 0.607771387771), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(x + N[(N[(y * N[(N[(N[(N[(t * z), $MachinePrecision] + a), $MachinePrecision] * z), $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(N[(z + 15.234687407), $MachinePrecision] * z + 31.4690115749), $MachinePrecision] * z), $MachinePrecision] * z + N[(z * 11.9400905721 + 0.607771387771), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(3.13060547623 * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \leq \infty:\\
\;\;\;\;x + \frac{y \cdot \left(\left(t \cdot z + a\right) \cdot z + b\right)}{\mathsf{fma}\left(\mathsf{fma}\left(z + 15.234687407, z, 31.4690115749\right) \cdot z, z, \mathsf{fma}\left(z, 11.9400905721, 0.607771387771\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;x + 3.13060547623 \cdot y\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 y (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 z #s(literal 313060547623/100000000000 binary64)) #s(literal 55833770631/5000000000 binary64)) z) t) z) a) z) b)) (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 z #s(literal 15234687407/1000000000 binary64)) z) #s(literal 314690115749/10000000000 binary64)) z) #s(literal 119400905721/10000000000 binary64)) z) #s(literal 607771387771/1000000000000 binary64)))) < +inf.0Initial program 58.1%
Taylor expanded in z around 0
Applied rewrites61.4%
Applied rewrites61.4%
if +inf.0 < (+.f64 x (/.f64 (*.f64 y (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 z #s(literal 313060547623/100000000000 binary64)) #s(literal 55833770631/5000000000 binary64)) z) t) z) a) z) b)) (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 z #s(literal 15234687407/1000000000 binary64)) z) #s(literal 314690115749/10000000000 binary64)) z) #s(literal 119400905721/10000000000 binary64)) z) #s(literal 607771387771/1000000000000 binary64)))) Initial program 58.1%
Taylor expanded in z around inf
Applied rewrites62.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1
(+
(*
(+ (* (+ (* (+ z 15.234687407) z) 31.4690115749) z) 11.9400905721)
z)
0.607771387771)))
(if (<=
(+
x
(/
(*
y
(+
(* (+ (* (+ (* (+ (* z 3.13060547623) 11.1667541262) z) t) z) a) z)
b))
t_1))
INFINITY)
(+ x (/ (* y (+ (* (+ (* t z) a) z) b)) t_1))
(+ x (* 3.13060547623 y)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771;
double tmp;
if ((x + ((y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / t_1)) <= ((double) INFINITY)) {
tmp = x + ((y * ((((t * z) + a) * z) + b)) / t_1);
} else {
tmp = x + (3.13060547623 * y);
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771;
double tmp;
if ((x + ((y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / t_1)) <= Double.POSITIVE_INFINITY) {
tmp = x + ((y * ((((t * z) + a) * z) + b)) / t_1);
} else {
tmp = x + (3.13060547623 * y);
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = ((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771 tmp = 0 if (x + ((y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / t_1)) <= math.inf: tmp = x + ((y * ((((t * z) + a) * z) + b)) / t_1) else: tmp = x + (3.13060547623 * y) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(Float64(Float64(Float64(Float64(z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771) tmp = 0.0 if (Float64(x + Float64(Float64(y * Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / t_1)) <= Inf) tmp = Float64(x + Float64(Float64(y * Float64(Float64(Float64(Float64(t * z) + a) * z) + b)) / t_1)); else tmp = Float64(x + Float64(3.13060547623 * y)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = ((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771; tmp = 0.0; if ((x + ((y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / t_1)) <= Inf) tmp = x + ((y * ((((t * z) + a) * z) + b)) / t_1); else tmp = x + (3.13060547623 * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(N[(N[(N[(N[(z + 15.234687407), $MachinePrecision] * z), $MachinePrecision] + 31.4690115749), $MachinePrecision] * z), $MachinePrecision] + 11.9400905721), $MachinePrecision] * z), $MachinePrecision] + 0.607771387771), $MachinePrecision]}, If[LessEqual[N[(x + N[(N[(y * N[(N[(N[(N[(N[(N[(N[(N[(z * 3.13060547623), $MachinePrecision] + 11.1667541262), $MachinePrecision] * z), $MachinePrecision] + t), $MachinePrecision] * z), $MachinePrecision] + a), $MachinePrecision] * z), $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], Infinity], N[(x + N[(N[(y * N[(N[(N[(N[(t * z), $MachinePrecision] + a), $MachinePrecision] * z), $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], N[(x + N[(3.13060547623 * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771\\
\mathbf{if}\;x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{t\_1} \leq \infty:\\
\;\;\;\;x + \frac{y \cdot \left(\left(t \cdot z + a\right) \cdot z + b\right)}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;x + 3.13060547623 \cdot y\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 y (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 z #s(literal 313060547623/100000000000 binary64)) #s(literal 55833770631/5000000000 binary64)) z) t) z) a) z) b)) (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 z #s(literal 15234687407/1000000000 binary64)) z) #s(literal 314690115749/10000000000 binary64)) z) #s(literal 119400905721/10000000000 binary64)) z) #s(literal 607771387771/1000000000000 binary64)))) < +inf.0Initial program 58.1%
Taylor expanded in z around 0
Applied rewrites61.4%
if +inf.0 < (+.f64 x (/.f64 (*.f64 y (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 z #s(literal 313060547623/100000000000 binary64)) #s(literal 55833770631/5000000000 binary64)) z) t) z) a) z) b)) (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 z #s(literal 15234687407/1000000000 binary64)) z) #s(literal 314690115749/10000000000 binary64)) z) #s(literal 119400905721/10000000000 binary64)) z) #s(literal 607771387771/1000000000000 binary64)))) Initial program 58.1%
Taylor expanded in z around inf
Applied rewrites62.9%
(FPCore (x y z t a b)
:precision binary64
(if (<=
(+
x
(/
(*
y
(+
(* (+ (* (+ (* (+ (* z 3.13060547623) 11.1667541262) z) t) z) a) z)
b))
(+
(*
(+ (* (+ (* (+ z 15.234687407) z) 31.4690115749) z) 11.9400905721)
z)
0.607771387771)))
INFINITY)
(+
x
(/
(* y (+ (* (+ (* t z) a) z) b))
(fma
(fma (fma (+ z 15.234687407) z 31.4690115749) z 11.9400905721)
z
0.607771387771)))
(+ x (* 3.13060547623 y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x + ((y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771))) <= ((double) INFINITY)) {
tmp = x + ((y * ((((t * z) + a) * z) + b)) / fma(fma(fma((z + 15.234687407), z, 31.4690115749), z, 11.9400905721), z, 0.607771387771));
} else {
tmp = x + (3.13060547623 * y);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(x + Float64(Float64(y * Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / Float64(Float64(Float64(Float64(Float64(Float64(Float64(z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771))) <= Inf) tmp = Float64(x + Float64(Float64(y * Float64(Float64(Float64(Float64(t * z) + a) * z) + b)) / fma(fma(fma(Float64(z + 15.234687407), z, 31.4690115749), z, 11.9400905721), z, 0.607771387771))); else tmp = Float64(x + Float64(3.13060547623 * y)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(x + N[(N[(y * N[(N[(N[(N[(N[(N[(N[(N[(z * 3.13060547623), $MachinePrecision] + 11.1667541262), $MachinePrecision] * z), $MachinePrecision] + t), $MachinePrecision] * z), $MachinePrecision] + a), $MachinePrecision] * z), $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(N[(N[(N[(N[(z + 15.234687407), $MachinePrecision] * z), $MachinePrecision] + 31.4690115749), $MachinePrecision] * z), $MachinePrecision] + 11.9400905721), $MachinePrecision] * z), $MachinePrecision] + 0.607771387771), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(x + N[(N[(y * N[(N[(N[(N[(t * z), $MachinePrecision] + a), $MachinePrecision] * z), $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(N[(z + 15.234687407), $MachinePrecision] * z + 31.4690115749), $MachinePrecision] * z + 11.9400905721), $MachinePrecision] * z + 0.607771387771), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(3.13060547623 * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \leq \infty:\\
\;\;\;\;x + \frac{y \cdot \left(\left(t \cdot z + a\right) \cdot z + b\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(z + 15.234687407, z, 31.4690115749\right), z, 11.9400905721\right), z, 0.607771387771\right)}\\
\mathbf{else}:\\
\;\;\;\;x + 3.13060547623 \cdot y\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 y (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 z #s(literal 313060547623/100000000000 binary64)) #s(literal 55833770631/5000000000 binary64)) z) t) z) a) z) b)) (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 z #s(literal 15234687407/1000000000 binary64)) z) #s(literal 314690115749/10000000000 binary64)) z) #s(literal 119400905721/10000000000 binary64)) z) #s(literal 607771387771/1000000000000 binary64)))) < +inf.0Initial program 58.1%
Taylor expanded in z around 0
Applied rewrites61.4%
Applied rewrites61.4%
if +inf.0 < (+.f64 x (/.f64 (*.f64 y (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 z #s(literal 313060547623/100000000000 binary64)) #s(literal 55833770631/5000000000 binary64)) z) t) z) a) z) b)) (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 z #s(literal 15234687407/1000000000 binary64)) z) #s(literal 314690115749/10000000000 binary64)) z) #s(literal 119400905721/10000000000 binary64)) z) #s(literal 607771387771/1000000000000 binary64)))) Initial program 58.1%
Taylor expanded in z around inf
Applied rewrites62.9%
(FPCore (x y z t a b)
:precision binary64
(if (<= z -2.7e+69)
(+ x (* 3.13060547623 y))
(if (<= z 500000000000.0)
(+
x
(/
(* y (+ (* (+ (* t z) a) z) b))
(+ (* (+ (* 31.4690115749 z) 11.9400905721) z) 0.607771387771)))
(+
x
(fma
-1.0
(/ (- (* -11.1667541262 y) (* -47.69379582500642 y)) z)
(* 3.13060547623 y))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -2.7e+69) {
tmp = x + (3.13060547623 * y);
} else if (z <= 500000000000.0) {
tmp = x + ((y * ((((t * z) + a) * z) + b)) / ((((31.4690115749 * z) + 11.9400905721) * z) + 0.607771387771));
} else {
tmp = x + fma(-1.0, (((-11.1667541262 * y) - (-47.69379582500642 * y)) / z), (3.13060547623 * y));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -2.7e+69) tmp = Float64(x + Float64(3.13060547623 * y)); elseif (z <= 500000000000.0) tmp = Float64(x + Float64(Float64(y * Float64(Float64(Float64(Float64(t * z) + a) * z) + b)) / Float64(Float64(Float64(Float64(31.4690115749 * z) + 11.9400905721) * z) + 0.607771387771))); else tmp = Float64(x + fma(-1.0, Float64(Float64(Float64(-11.1667541262 * y) - Float64(-47.69379582500642 * y)) / z), Float64(3.13060547623 * y))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -2.7e+69], N[(x + N[(3.13060547623 * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 500000000000.0], N[(x + N[(N[(y * N[(N[(N[(N[(t * z), $MachinePrecision] + a), $MachinePrecision] * z), $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(N[(31.4690115749 * z), $MachinePrecision] + 11.9400905721), $MachinePrecision] * z), $MachinePrecision] + 0.607771387771), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(-1.0 * N[(N[(N[(-11.1667541262 * y), $MachinePrecision] - N[(-47.69379582500642 * y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] + N[(3.13060547623 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.7 \cdot 10^{+69}:\\
\;\;\;\;x + 3.13060547623 \cdot y\\
\mathbf{elif}\;z \leq 500000000000:\\
\;\;\;\;x + \frac{y \cdot \left(\left(t \cdot z + a\right) \cdot z + b\right)}{\left(31.4690115749 \cdot z + 11.9400905721\right) \cdot z + 0.607771387771}\\
\mathbf{else}:\\
\;\;\;\;x + \mathsf{fma}\left(-1, \frac{-11.1667541262 \cdot y - -47.69379582500642 \cdot y}{z}, 3.13060547623 \cdot y\right)\\
\end{array}
\end{array}
if z < -2.6999999999999998e69Initial program 58.1%
Taylor expanded in z around inf
Applied rewrites62.9%
if -2.6999999999999998e69 < z < 5e11Initial program 58.1%
Taylor expanded in z around 0
Applied rewrites61.4%
Taylor expanded in z around 0
Applied rewrites59.5%
if 5e11 < z Initial program 58.1%
Taylor expanded in z around -inf
Applied rewrites58.5%
(FPCore (x y z t a b)
:precision binary64
(if (<= z -6e+34)
(+ x (* 3.13060547623 y))
(if (<= z 500000000000.0)
(+
x
(/
(* y (+ (* (+ (* (+ t (* 11.1667541262 z)) z) a) z) b))
0.607771387771))
(+
x
(fma
-1.0
(/ (- (* -11.1667541262 y) (* -47.69379582500642 y)) z)
(* 3.13060547623 y))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -6e+34) {
tmp = x + (3.13060547623 * y);
} else if (z <= 500000000000.0) {
tmp = x + ((y * (((((t + (11.1667541262 * z)) * z) + a) * z) + b)) / 0.607771387771);
} else {
tmp = x + fma(-1.0, (((-11.1667541262 * y) - (-47.69379582500642 * y)) / z), (3.13060547623 * y));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -6e+34) tmp = Float64(x + Float64(3.13060547623 * y)); elseif (z <= 500000000000.0) tmp = Float64(x + Float64(Float64(y * Float64(Float64(Float64(Float64(Float64(t + Float64(11.1667541262 * z)) * z) + a) * z) + b)) / 0.607771387771)); else tmp = Float64(x + fma(-1.0, Float64(Float64(Float64(-11.1667541262 * y) - Float64(-47.69379582500642 * y)) / z), Float64(3.13060547623 * y))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -6e+34], N[(x + N[(3.13060547623 * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 500000000000.0], N[(x + N[(N[(y * N[(N[(N[(N[(N[(t + N[(11.1667541262 * z), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision] + a), $MachinePrecision] * z), $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision] / 0.607771387771), $MachinePrecision]), $MachinePrecision], N[(x + N[(-1.0 * N[(N[(N[(-11.1667541262 * y), $MachinePrecision] - N[(-47.69379582500642 * y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] + N[(3.13060547623 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6 \cdot 10^{+34}:\\
\;\;\;\;x + 3.13060547623 \cdot y\\
\mathbf{elif}\;z \leq 500000000000:\\
\;\;\;\;x + \frac{y \cdot \left(\left(\left(t + 11.1667541262 \cdot z\right) \cdot z + a\right) \cdot z + b\right)}{0.607771387771}\\
\mathbf{else}:\\
\;\;\;\;x + \mathsf{fma}\left(-1, \frac{-11.1667541262 \cdot y - -47.69379582500642 \cdot y}{z}, 3.13060547623 \cdot y\right)\\
\end{array}
\end{array}
if z < -6.00000000000000037e34Initial program 58.1%
Taylor expanded in z around inf
Applied rewrites62.9%
if -6.00000000000000037e34 < z < 5e11Initial program 58.1%
Taylor expanded in z around 0
Applied rewrites61.4%
Taylor expanded in z around 0
Applied rewrites57.1%
Taylor expanded in z around 0
Applied rewrites54.8%
if 5e11 < z Initial program 58.1%
Taylor expanded in z around -inf
Applied rewrites58.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ x (* 3.13060547623 y))))
(if (<= z -6e+34)
t_1
(if (<= z 500000000000.0)
(+ x (/ (* y (+ (* (+ (* t z) a) z) b)) 0.607771387771))
t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + (3.13060547623 * y);
double tmp;
if (z <= -6e+34) {
tmp = t_1;
} else if (z <= 500000000000.0) {
tmp = x + ((y * ((((t * z) + a) * z) + b)) / 0.607771387771);
} 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, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = x + (3.13060547623d0 * y)
if (z <= (-6d+34)) then
tmp = t_1
else if (z <= 500000000000.0d0) then
tmp = x + ((y * ((((t * z) + a) * z) + b)) / 0.607771387771d0)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + (3.13060547623 * y);
double tmp;
if (z <= -6e+34) {
tmp = t_1;
} else if (z <= 500000000000.0) {
tmp = x + ((y * ((((t * z) + a) * z) + b)) / 0.607771387771);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x + (3.13060547623 * y) tmp = 0 if z <= -6e+34: tmp = t_1 elif z <= 500000000000.0: tmp = x + ((y * ((((t * z) + a) * z) + b)) / 0.607771387771) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x + Float64(3.13060547623 * y)) tmp = 0.0 if (z <= -6e+34) tmp = t_1; elseif (z <= 500000000000.0) tmp = Float64(x + Float64(Float64(y * Float64(Float64(Float64(Float64(t * z) + a) * z) + b)) / 0.607771387771)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = x + (3.13060547623 * y); tmp = 0.0; if (z <= -6e+34) tmp = t_1; elseif (z <= 500000000000.0) tmp = x + ((y * ((((t * z) + a) * z) + b)) / 0.607771387771); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(3.13060547623 * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -6e+34], t$95$1, If[LessEqual[z, 500000000000.0], N[(x + N[(N[(y * N[(N[(N[(N[(t * z), $MachinePrecision] + a), $MachinePrecision] * z), $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision] / 0.607771387771), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + 3.13060547623 \cdot y\\
\mathbf{if}\;z \leq -6 \cdot 10^{+34}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 500000000000:\\
\;\;\;\;x + \frac{y \cdot \left(\left(t \cdot z + a\right) \cdot z + b\right)}{0.607771387771}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -6.00000000000000037e34 or 5e11 < z Initial program 58.1%
Taylor expanded in z around inf
Applied rewrites62.9%
if -6.00000000000000037e34 < z < 5e11Initial program 58.1%
Taylor expanded in z around 0
Applied rewrites61.4%
Taylor expanded in z around 0
Applied rewrites57.1%
(FPCore (x y z t a b)
:precision binary64
(if (<= z -6e+34)
(+ x (* 3.13060547623 y))
(if (<= z 500000000000.0)
(+ x (/ (* y (+ (* (+ (* t z) a) z) b)) 0.607771387771))
(+
x
(fma
-1.0
(/ (- (* -11.1667541262 y) (* -47.69379582500642 y)) z)
(* 3.13060547623 y))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -6e+34) {
tmp = x + (3.13060547623 * y);
} else if (z <= 500000000000.0) {
tmp = x + ((y * ((((t * z) + a) * z) + b)) / 0.607771387771);
} else {
tmp = x + fma(-1.0, (((-11.1667541262 * y) - (-47.69379582500642 * y)) / z), (3.13060547623 * y));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -6e+34) tmp = Float64(x + Float64(3.13060547623 * y)); elseif (z <= 500000000000.0) tmp = Float64(x + Float64(Float64(y * Float64(Float64(Float64(Float64(t * z) + a) * z) + b)) / 0.607771387771)); else tmp = Float64(x + fma(-1.0, Float64(Float64(Float64(-11.1667541262 * y) - Float64(-47.69379582500642 * y)) / z), Float64(3.13060547623 * y))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -6e+34], N[(x + N[(3.13060547623 * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 500000000000.0], N[(x + N[(N[(y * N[(N[(N[(N[(t * z), $MachinePrecision] + a), $MachinePrecision] * z), $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision] / 0.607771387771), $MachinePrecision]), $MachinePrecision], N[(x + N[(-1.0 * N[(N[(N[(-11.1667541262 * y), $MachinePrecision] - N[(-47.69379582500642 * y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] + N[(3.13060547623 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6 \cdot 10^{+34}:\\
\;\;\;\;x + 3.13060547623 \cdot y\\
\mathbf{elif}\;z \leq 500000000000:\\
\;\;\;\;x + \frac{y \cdot \left(\left(t \cdot z + a\right) \cdot z + b\right)}{0.607771387771}\\
\mathbf{else}:\\
\;\;\;\;x + \mathsf{fma}\left(-1, \frac{-11.1667541262 \cdot y - -47.69379582500642 \cdot y}{z}, 3.13060547623 \cdot y\right)\\
\end{array}
\end{array}
if z < -6.00000000000000037e34Initial program 58.1%
Taylor expanded in z around inf
Applied rewrites62.9%
if -6.00000000000000037e34 < z < 5e11Initial program 58.1%
Taylor expanded in z around 0
Applied rewrites61.4%
Taylor expanded in z around 0
Applied rewrites57.1%
if 5e11 < z Initial program 58.1%
Taylor expanded in z around -inf
Applied rewrites58.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ x (* 3.13060547623 y))))
(if (<= z -8.5e+39)
t_1
(if (<= z 500000000000.0)
(+ x (/ (* y (+ b (* a z))) (+ (* 11.9400905721 z) 0.607771387771)))
t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + (3.13060547623 * y);
double tmp;
if (z <= -8.5e+39) {
tmp = t_1;
} else if (z <= 500000000000.0) {
tmp = x + ((y * (b + (a * z))) / ((11.9400905721 * z) + 0.607771387771));
} 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, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = x + (3.13060547623d0 * y)
if (z <= (-8.5d+39)) then
tmp = t_1
else if (z <= 500000000000.0d0) then
tmp = x + ((y * (b + (a * z))) / ((11.9400905721d0 * z) + 0.607771387771d0))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + (3.13060547623 * y);
double tmp;
if (z <= -8.5e+39) {
tmp = t_1;
} else if (z <= 500000000000.0) {
tmp = x + ((y * (b + (a * z))) / ((11.9400905721 * z) + 0.607771387771));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x + (3.13060547623 * y) tmp = 0 if z <= -8.5e+39: tmp = t_1 elif z <= 500000000000.0: tmp = x + ((y * (b + (a * z))) / ((11.9400905721 * z) + 0.607771387771)) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x + Float64(3.13060547623 * y)) tmp = 0.0 if (z <= -8.5e+39) tmp = t_1; elseif (z <= 500000000000.0) tmp = Float64(x + Float64(Float64(y * Float64(b + Float64(a * z))) / Float64(Float64(11.9400905721 * z) + 0.607771387771))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = x + (3.13060547623 * y); tmp = 0.0; if (z <= -8.5e+39) tmp = t_1; elseif (z <= 500000000000.0) tmp = x + ((y * (b + (a * z))) / ((11.9400905721 * z) + 0.607771387771)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(3.13060547623 * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -8.5e+39], t$95$1, If[LessEqual[z, 500000000000.0], N[(x + N[(N[(y * N[(b + N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(11.9400905721 * z), $MachinePrecision] + 0.607771387771), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + 3.13060547623 \cdot y\\
\mathbf{if}\;z \leq -8.5 \cdot 10^{+39}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 500000000000:\\
\;\;\;\;x + \frac{y \cdot \left(b + a \cdot z\right)}{11.9400905721 \cdot z + 0.607771387771}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -8.49999999999999971e39 or 5e11 < z Initial program 58.1%
Taylor expanded in z around inf
Applied rewrites62.9%
if -8.49999999999999971e39 < z < 5e11Initial program 58.1%
Taylor expanded in z around 0
Applied rewrites64.4%
Taylor expanded in z around 0
Applied rewrites63.1%
Taylor expanded in z around 0
Applied rewrites63.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ x (* 3.13060547623 y))))
(if (<= z -1.9e+31)
t_1
(if (<= z 500000000000.0)
(+ x (/ (* y (+ (* a z) b)) 0.607771387771))
t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + (3.13060547623 * y);
double tmp;
if (z <= -1.9e+31) {
tmp = t_1;
} else if (z <= 500000000000.0) {
tmp = x + ((y * ((a * z) + b)) / 0.607771387771);
} 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, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = x + (3.13060547623d0 * y)
if (z <= (-1.9d+31)) then
tmp = t_1
else if (z <= 500000000000.0d0) then
tmp = x + ((y * ((a * z) + b)) / 0.607771387771d0)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + (3.13060547623 * y);
double tmp;
if (z <= -1.9e+31) {
tmp = t_1;
} else if (z <= 500000000000.0) {
tmp = x + ((y * ((a * z) + b)) / 0.607771387771);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x + (3.13060547623 * y) tmp = 0 if z <= -1.9e+31: tmp = t_1 elif z <= 500000000000.0: tmp = x + ((y * ((a * z) + b)) / 0.607771387771) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x + Float64(3.13060547623 * y)) tmp = 0.0 if (z <= -1.9e+31) tmp = t_1; elseif (z <= 500000000000.0) tmp = Float64(x + Float64(Float64(y * Float64(Float64(a * z) + b)) / 0.607771387771)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = x + (3.13060547623 * y); tmp = 0.0; if (z <= -1.9e+31) tmp = t_1; elseif (z <= 500000000000.0) tmp = x + ((y * ((a * z) + b)) / 0.607771387771); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(3.13060547623 * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.9e+31], t$95$1, If[LessEqual[z, 500000000000.0], N[(x + N[(N[(y * N[(N[(a * z), $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision] / 0.607771387771), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + 3.13060547623 \cdot y\\
\mathbf{if}\;z \leq -1.9 \cdot 10^{+31}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 500000000000:\\
\;\;\;\;x + \frac{y \cdot \left(a \cdot z + b\right)}{0.607771387771}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.9000000000000001e31 or 5e11 < z Initial program 58.1%
Taylor expanded in z around inf
Applied rewrites62.9%
if -1.9000000000000001e31 < z < 5e11Initial program 58.1%
Taylor expanded in z around 0
Applied rewrites61.4%
Taylor expanded in z around 0
Applied rewrites57.1%
Taylor expanded in z around 0
Applied rewrites59.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ x (* 3.13060547623 y))))
(if (<= z -7e+43)
t_1
(if (<= z 60000000.0)
(+ x (* (* b y) (fma z -32.324150453290734 1.6453555072203998)))
t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + (3.13060547623 * y);
double tmp;
if (z <= -7e+43) {
tmp = t_1;
} else if (z <= 60000000.0) {
tmp = x + ((b * y) * fma(z, -32.324150453290734, 1.6453555072203998));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(x + Float64(3.13060547623 * y)) tmp = 0.0 if (z <= -7e+43) tmp = t_1; elseif (z <= 60000000.0) tmp = Float64(x + Float64(Float64(b * y) * fma(z, -32.324150453290734, 1.6453555072203998))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(3.13060547623 * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7e+43], t$95$1, If[LessEqual[z, 60000000.0], N[(x + N[(N[(b * y), $MachinePrecision] * N[(z * -32.324150453290734 + 1.6453555072203998), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + 3.13060547623 \cdot y\\
\mathbf{if}\;z \leq -7 \cdot 10^{+43}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 60000000:\\
\;\;\;\;x + \left(b \cdot y\right) \cdot \mathsf{fma}\left(z, -32.324150453290734, 1.6453555072203998\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7.0000000000000002e43 or 6e7 < z Initial program 58.1%
Taylor expanded in z around inf
Applied rewrites62.9%
if -7.0000000000000002e43 < z < 6e7Initial program 58.1%
Taylor expanded in z around 0
Applied rewrites51.7%
Taylor expanded in a around 0
Applied rewrites53.2%
Applied rewrites54.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ x (* 3.13060547623 y))))
(if (<= z -7e+43)
t_1
(if (<= z 850000.0) (+ x (/ (* y b) 0.607771387771)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + (3.13060547623 * y);
double tmp;
if (z <= -7e+43) {
tmp = t_1;
} else if (z <= 850000.0) {
tmp = x + ((y * b) / 0.607771387771);
} 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, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = x + (3.13060547623d0 * y)
if (z <= (-7d+43)) then
tmp = t_1
else if (z <= 850000.0d0) then
tmp = x + ((y * b) / 0.607771387771d0)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + (3.13060547623 * y);
double tmp;
if (z <= -7e+43) {
tmp = t_1;
} else if (z <= 850000.0) {
tmp = x + ((y * b) / 0.607771387771);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x + (3.13060547623 * y) tmp = 0 if z <= -7e+43: tmp = t_1 elif z <= 850000.0: tmp = x + ((y * b) / 0.607771387771) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x + Float64(3.13060547623 * y)) tmp = 0.0 if (z <= -7e+43) tmp = t_1; elseif (z <= 850000.0) tmp = Float64(x + Float64(Float64(y * b) / 0.607771387771)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = x + (3.13060547623 * y); tmp = 0.0; if (z <= -7e+43) tmp = t_1; elseif (z <= 850000.0) tmp = x + ((y * b) / 0.607771387771); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(3.13060547623 * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7e+43], t$95$1, If[LessEqual[z, 850000.0], N[(x + N[(N[(y * b), $MachinePrecision] / 0.607771387771), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + 3.13060547623 \cdot y\\
\mathbf{if}\;z \leq -7 \cdot 10^{+43}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 850000:\\
\;\;\;\;x + \frac{y \cdot b}{0.607771387771}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7.0000000000000002e43 or 8.5e5 < z Initial program 58.1%
Taylor expanded in z around inf
Applied rewrites62.9%
if -7.0000000000000002e43 < z < 8.5e5Initial program 58.1%
Taylor expanded in z around 0
Applied rewrites64.4%
Taylor expanded in z around 0
Applied rewrites60.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ x (* 3.13060547623 y))))
(if (<= z -7e+43)
t_1
(if (<= z 850000.0) (+ x (* (* b 1.6453555072203998) y)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + (3.13060547623 * y);
double tmp;
if (z <= -7e+43) {
tmp = t_1;
} else if (z <= 850000.0) {
tmp = x + ((b * 1.6453555072203998) * y);
} 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, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = x + (3.13060547623d0 * y)
if (z <= (-7d+43)) then
tmp = t_1
else if (z <= 850000.0d0) then
tmp = x + ((b * 1.6453555072203998d0) * y)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + (3.13060547623 * y);
double tmp;
if (z <= -7e+43) {
tmp = t_1;
} else if (z <= 850000.0) {
tmp = x + ((b * 1.6453555072203998) * y);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x + (3.13060547623 * y) tmp = 0 if z <= -7e+43: tmp = t_1 elif z <= 850000.0: tmp = x + ((b * 1.6453555072203998) * y) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x + Float64(3.13060547623 * y)) tmp = 0.0 if (z <= -7e+43) tmp = t_1; elseif (z <= 850000.0) tmp = Float64(x + Float64(Float64(b * 1.6453555072203998) * y)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = x + (3.13060547623 * y); tmp = 0.0; if (z <= -7e+43) tmp = t_1; elseif (z <= 850000.0) tmp = x + ((b * 1.6453555072203998) * y); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(3.13060547623 * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7e+43], t$95$1, If[LessEqual[z, 850000.0], N[(x + N[(N[(b * 1.6453555072203998), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + 3.13060547623 \cdot y\\
\mathbf{if}\;z \leq -7 \cdot 10^{+43}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 850000:\\
\;\;\;\;x + \left(b \cdot 1.6453555072203998\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7.0000000000000002e43 or 8.5e5 < z Initial program 58.1%
Taylor expanded in z around inf
Applied rewrites62.9%
if -7.0000000000000002e43 < z < 8.5e5Initial program 58.1%
Taylor expanded in z around 0
Applied rewrites60.5%
Applied rewrites60.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ x (* 3.13060547623 y))))
(if (<= z -7e+43)
t_1
(if (<= z 850000.0) (+ x (* 1.6453555072203998 (* b y))) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + (3.13060547623 * y);
double tmp;
if (z <= -7e+43) {
tmp = t_1;
} else if (z <= 850000.0) {
tmp = x + (1.6453555072203998 * (b * y));
} 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, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = x + (3.13060547623d0 * y)
if (z <= (-7d+43)) then
tmp = t_1
else if (z <= 850000.0d0) then
tmp = x + (1.6453555072203998d0 * (b * y))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + (3.13060547623 * y);
double tmp;
if (z <= -7e+43) {
tmp = t_1;
} else if (z <= 850000.0) {
tmp = x + (1.6453555072203998 * (b * y));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x + (3.13060547623 * y) tmp = 0 if z <= -7e+43: tmp = t_1 elif z <= 850000.0: tmp = x + (1.6453555072203998 * (b * y)) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x + Float64(3.13060547623 * y)) tmp = 0.0 if (z <= -7e+43) tmp = t_1; elseif (z <= 850000.0) tmp = Float64(x + Float64(1.6453555072203998 * Float64(b * y))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = x + (3.13060547623 * y); tmp = 0.0; if (z <= -7e+43) tmp = t_1; elseif (z <= 850000.0) tmp = x + (1.6453555072203998 * (b * y)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(3.13060547623 * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7e+43], t$95$1, If[LessEqual[z, 850000.0], N[(x + N[(1.6453555072203998 * N[(b * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + 3.13060547623 \cdot y\\
\mathbf{if}\;z \leq -7 \cdot 10^{+43}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 850000:\\
\;\;\;\;x + 1.6453555072203998 \cdot \left(b \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7.0000000000000002e43 or 8.5e5 < z Initial program 58.1%
Taylor expanded in z around inf
Applied rewrites62.9%
if -7.0000000000000002e43 < z < 8.5e5Initial program 58.1%
Taylor expanded in z around 0
Applied rewrites60.5%
(FPCore (x y z t a b) :precision binary64 (+ x (* 3.13060547623 y)))
double code(double x, double y, double z, double t, double a, double b) {
return x + (3.13060547623 * 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, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = x + (3.13060547623d0 * y)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x + (3.13060547623 * y);
}
def code(x, y, z, t, a, b): return x + (3.13060547623 * y)
function code(x, y, z, t, a, b) return Float64(x + Float64(3.13060547623 * y)) end
function tmp = code(x, y, z, t, a, b) tmp = x + (3.13060547623 * y); end
code[x_, y_, z_, t_, a_, b_] := N[(x + N[(3.13060547623 * y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + 3.13060547623 \cdot y
\end{array}
Initial program 58.1%
Taylor expanded in z around inf
Applied rewrites62.9%
herbie shell --seed 2025153
(FPCore (x y z t a b)
:name "Numeric.SpecFunctions:logGamma from math-functions-0.1.5.2, D"
:precision binary64
(+ x (/ (* y (+ (* (+ (* (+ (* (+ (* z 3.13060547623) 11.1667541262) z) t) z) a) z) b)) (+ (* (+ (* (+ (* (+ z 15.234687407) z) 31.4690115749) z) 11.9400905721) z) 0.607771387771))))