
(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}
Sampling outcomes in binary64 precision:
Herbie found 16 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 (<= z -4.5e+61)
(+ x (fma 3.13060547623 y (* (- y) (/ (- t) (* z z)))))
(if (<= z 56.0)
(+
x
(/
(* y (fma (fma t z a) z b))
(+
(*
(+ (* (+ (* (+ z 15.234687407) z) 31.4690115749) z) 11.9400905721)
z)
0.607771387771)))
(+ x (fma 3.13060547623 y (* (/ t z) (/ y z)))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -4.5e+61) {
tmp = x + fma(3.13060547623, y, (-y * (-t / (z * z))));
} else if (z <= 56.0) {
tmp = x + ((y * fma(fma(t, z, a), z, b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771));
} else {
tmp = x + fma(3.13060547623, y, ((t / z) * (y / z)));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -4.5e+61) tmp = Float64(x + fma(3.13060547623, y, Float64(Float64(-y) * Float64(Float64(-t) / Float64(z * z))))); elseif (z <= 56.0) tmp = Float64(x + Float64(Float64(y * fma(fma(t, z, a), z, b)) / Float64(Float64(Float64(Float64(Float64(Float64(Float64(z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771))); else tmp = Float64(x + fma(3.13060547623, y, Float64(Float64(t / z) * Float64(y / z)))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -4.5e+61], N[(x + N[(3.13060547623 * y + N[((-y) * N[((-t) / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 56.0], N[(x + N[(N[(y * N[(N[(t * z + a), $MachinePrecision] * z + 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], N[(x + N[(3.13060547623 * y + N[(N[(t / z), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.5 \cdot 10^{+61}:\\
\;\;\;\;x + \mathsf{fma}\left(3.13060547623, y, \left(-y\right) \cdot \frac{-t}{z \cdot z}\right)\\
\mathbf{elif}\;z \leq 56:\\
\;\;\;\;x + \frac{y \cdot \mathsf{fma}\left(\mathsf{fma}\left(t, z, a\right), z, b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771}\\
\mathbf{else}:\\
\;\;\;\;x + \mathsf{fma}\left(3.13060547623, y, \frac{t}{z} \cdot \frac{y}{z}\right)\\
\end{array}
\end{array}
if z < -4.5e61Initial program 3.9%
Taylor expanded in z around -inf
Applied rewrites90.5%
Taylor expanded in y around 0
Applied rewrites99.8%
Taylor expanded in t around inf
Applied rewrites99.8%
if -4.5e61 < z < 56Initial program 99.1%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6499.0
Applied rewrites99.0%
if 56 < z Initial program 25.0%
Taylor expanded in z around -inf
Applied rewrites91.6%
Taylor expanded in t around inf
Applied rewrites98.7%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1
(/
(*
y
(+
(* (+ (* (+ (* (+ (* z 3.13060547623) 11.1667541262) z) t) z) a) z)
b))
(+
(*
(+ (* (+ (* (+ z 15.234687407) z) 31.4690115749) z) 11.9400905721)
z)
0.607771387771))))
(if (or (<= t_1 -1e+103) (not (or (<= t_1 1e+25) (not (<= t_1 INFINITY)))))
(* (* b y) 1.6453555072203998)
(fma 3.13060547623 y x))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (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 tmp;
if ((t_1 <= -1e+103) || !((t_1 <= 1e+25) || !(t_1 <= ((double) INFINITY)))) {
tmp = (b * y) * 1.6453555072203998;
} else {
tmp = fma(3.13060547623, y, x);
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = 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)) tmp = 0.0 if ((t_1 <= -1e+103) || !((t_1 <= 1e+25) || !(t_1 <= Inf))) tmp = Float64(Float64(b * y) * 1.6453555072203998); else tmp = fma(3.13060547623, y, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = 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]}, If[Or[LessEqual[t$95$1, -1e+103], N[Not[Or[LessEqual[t$95$1, 1e+25], N[Not[LessEqual[t$95$1, Infinity]], $MachinePrecision]]], $MachinePrecision]], N[(N[(b * y), $MachinePrecision] * 1.6453555072203998), $MachinePrecision], N[(3.13060547623 * y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \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}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+103} \lor \neg \left(t\_1 \leq 10^{+25} \lor \neg \left(t\_1 \leq \infty\right)\right):\\
\;\;\;\;\left(b \cdot y\right) \cdot 1.6453555072203998\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(3.13060547623, y, x\right)\\
\end{array}
\end{array}
if (/.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))) < -1e103 or 1.00000000000000009e25 < (/.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 91.7%
Taylor expanded in z around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6467.9
Applied rewrites67.9%
Taylor expanded in b around inf
Applied rewrites47.6%
Taylor expanded in z around 0
Applied rewrites48.4%
if -1e103 < (/.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))) < 1.00000000000000009e25 or +inf.0 < (/.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 45.0%
Taylor expanded in z around inf
+-commutativeN/A
lower-fma.f6486.5
Applied rewrites86.5%
Final simplification74.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1
(/
(*
y
(+
(* (+ (* (+ (* (+ (* z 3.13060547623) 11.1667541262) z) t) z) a) z)
b))
(+
(*
(+ (* (+ (* (+ z 15.234687407) z) 31.4690115749) z) 11.9400905721)
z)
0.607771387771))))
(if (or (<= t_1 -1e+103) (not (or (<= t_1 1e+25) (not (<= t_1 INFINITY)))))
(* (* 1.6453555072203998 b) y)
(fma 3.13060547623 y x))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (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 tmp;
if ((t_1 <= -1e+103) || !((t_1 <= 1e+25) || !(t_1 <= ((double) INFINITY)))) {
tmp = (1.6453555072203998 * b) * y;
} else {
tmp = fma(3.13060547623, y, x);
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = 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)) tmp = 0.0 if ((t_1 <= -1e+103) || !((t_1 <= 1e+25) || !(t_1 <= Inf))) tmp = Float64(Float64(1.6453555072203998 * b) * y); else tmp = fma(3.13060547623, y, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = 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]}, If[Or[LessEqual[t$95$1, -1e+103], N[Not[Or[LessEqual[t$95$1, 1e+25], N[Not[LessEqual[t$95$1, Infinity]], $MachinePrecision]]], $MachinePrecision]], N[(N[(1.6453555072203998 * b), $MachinePrecision] * y), $MachinePrecision], N[(3.13060547623 * y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \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}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+103} \lor \neg \left(t\_1 \leq 10^{+25} \lor \neg \left(t\_1 \leq \infty\right)\right):\\
\;\;\;\;\left(1.6453555072203998 \cdot b\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(3.13060547623, y, x\right)\\
\end{array}
\end{array}
if (/.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))) < -1e103 or 1.00000000000000009e25 < (/.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 91.7%
Taylor expanded in z around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6467.9
Applied rewrites67.9%
Taylor expanded in b around inf
Applied rewrites47.6%
Taylor expanded in z around 0
Applied rewrites48.4%
Applied rewrites48.4%
if -1e103 < (/.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))) < 1.00000000000000009e25 or +inf.0 < (/.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 45.0%
Taylor expanded in z around inf
+-commutativeN/A
lower-fma.f6486.5
Applied rewrites86.5%
Final simplification74.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1
(/
(*
y
(+
(* (+ (* (+ (* (+ (* z 3.13060547623) 11.1667541262) z) t) z) a) z)
b))
(+
(*
(+ (* (+ (* (+ z 15.234687407) z) 31.4690115749) z) 11.9400905721)
z)
0.607771387771))))
(if (<= t_1 -1e+103)
(* (* 1.6453555072203998 y) b)
(if (or (<= t_1 1e+25) (not (<= t_1 INFINITY)))
(fma 3.13060547623 y x)
(* (* b y) 1.6453555072203998)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (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 tmp;
if (t_1 <= -1e+103) {
tmp = (1.6453555072203998 * y) * b;
} else if ((t_1 <= 1e+25) || !(t_1 <= ((double) INFINITY))) {
tmp = fma(3.13060547623, y, x);
} else {
tmp = (b * y) * 1.6453555072203998;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = 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)) tmp = 0.0 if (t_1 <= -1e+103) tmp = Float64(Float64(1.6453555072203998 * y) * b); elseif ((t_1 <= 1e+25) || !(t_1 <= Inf)) tmp = fma(3.13060547623, y, x); else tmp = Float64(Float64(b * y) * 1.6453555072203998); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = 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]}, If[LessEqual[t$95$1, -1e+103], N[(N[(1.6453555072203998 * y), $MachinePrecision] * b), $MachinePrecision], If[Or[LessEqual[t$95$1, 1e+25], N[Not[LessEqual[t$95$1, Infinity]], $MachinePrecision]], N[(3.13060547623 * y + x), $MachinePrecision], N[(N[(b * y), $MachinePrecision] * 1.6453555072203998), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \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}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+103}:\\
\;\;\;\;\left(1.6453555072203998 \cdot y\right) \cdot b\\
\mathbf{elif}\;t\_1 \leq 10^{+25} \lor \neg \left(t\_1 \leq \infty\right):\\
\;\;\;\;\mathsf{fma}\left(3.13060547623, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(b \cdot y\right) \cdot 1.6453555072203998\\
\end{array}
\end{array}
if (/.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))) < -1e103Initial program 96.6%
Taylor expanded in z around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6461.5
Applied rewrites61.5%
Taylor expanded in b around inf
Applied rewrites48.4%
Taylor expanded in z around 0
Applied rewrites47.4%
if -1e103 < (/.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))) < 1.00000000000000009e25 or +inf.0 < (/.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 45.0%
Taylor expanded in z around inf
+-commutativeN/A
lower-fma.f6486.5
Applied rewrites86.5%
if 1.00000000000000009e25 < (/.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 89.0%
Taylor expanded in z around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6471.5
Applied rewrites71.5%
Taylor expanded in b around inf
Applied rewrites47.2%
Taylor expanded in z around 0
Applied rewrites49.0%
Final simplification74.2%
(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 3.13060547623 z 11.1667541262) z t) z a) z b)
(fma
(fma (fma (+ 15.234687407 z) z 31.4690115749) z 11.9400905721)
z
0.607771387771))
y
x)
(+ x (fma 3.13060547623 y (* (- y) (/ (- t) (* z z)))))))
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(3.13060547623, z, 11.1667541262), z, t), z, a), z, b) / fma(fma(fma((15.234687407 + z), z, 31.4690115749), z, 11.9400905721), z, 0.607771387771)), y, x);
} else {
tmp = x + fma(3.13060547623, y, (-y * (-t / (z * z))));
}
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(3.13060547623, z, 11.1667541262), z, t), z, a), z, b) / fma(fma(fma(Float64(15.234687407 + z), z, 31.4690115749), z, 11.9400905721), z, 0.607771387771)), y, x); else tmp = Float64(x + fma(3.13060547623, y, Float64(Float64(-y) * Float64(Float64(-t) / Float64(z * z))))); 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[(3.13060547623 * z + 11.1667541262), $MachinePrecision] * z + t), $MachinePrecision] * z + a), $MachinePrecision] * z + b), $MachinePrecision] / N[(N[(N[(N[(15.234687407 + z), $MachinePrecision] * z + 31.4690115749), $MachinePrecision] * z + 11.9400905721), $MachinePrecision] * z + 0.607771387771), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision], N[(x + N[(3.13060547623 * y + N[((-y) * N[((-t) / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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(3.13060547623, z, 11.1667541262\right), z, t\right), z, a\right), z, b\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(15.234687407 + z, z, 31.4690115749\right), z, 11.9400905721\right), z, 0.607771387771\right)}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + \mathsf{fma}\left(3.13060547623, y, \left(-y\right) \cdot \frac{-t}{z \cdot z}\right)\\
\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 95.6%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites97.9%
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 0.0%
Taylor expanded in z around -inf
Applied rewrites90.8%
Taylor expanded in y around 0
Applied rewrites99.9%
Taylor expanded in t around inf
Applied rewrites99.9%
(FPCore (x y z t a b)
:precision binary64
(if (<= z -3.5e+22)
(fma 3.13060547623 y x)
(if (<= z 1.55)
(fma
(fma -32.324150453290734 b (* 1.6453555072203998 a))
(* y z)
(fma 1.6453555072203998 (* b y) x))
(if (<= z 2.05e+91)
(+ x (fma 3.13060547623 y (/ (* (+ 457.9610022158428 t) y) (* z z))))
(fma 3.13060547623 y x)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -3.5e+22) {
tmp = fma(3.13060547623, y, x);
} else if (z <= 1.55) {
tmp = fma(fma(-32.324150453290734, b, (1.6453555072203998 * a)), (y * z), fma(1.6453555072203998, (b * y), x));
} else if (z <= 2.05e+91) {
tmp = x + fma(3.13060547623, y, (((457.9610022158428 + t) * y) / (z * z)));
} else {
tmp = fma(3.13060547623, y, x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -3.5e+22) tmp = fma(3.13060547623, y, x); elseif (z <= 1.55) tmp = fma(fma(-32.324150453290734, b, Float64(1.6453555072203998 * a)), Float64(y * z), fma(1.6453555072203998, Float64(b * y), x)); elseif (z <= 2.05e+91) tmp = Float64(x + fma(3.13060547623, y, Float64(Float64(Float64(457.9610022158428 + t) * y) / Float64(z * z)))); else tmp = fma(3.13060547623, y, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -3.5e+22], N[(3.13060547623 * y + x), $MachinePrecision], If[LessEqual[z, 1.55], N[(N[(-32.324150453290734 * b + N[(1.6453555072203998 * a), $MachinePrecision]), $MachinePrecision] * N[(y * z), $MachinePrecision] + N[(1.6453555072203998 * N[(b * y), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.05e+91], N[(x + N[(3.13060547623 * y + N[(N[(N[(457.9610022158428 + t), $MachinePrecision] * y), $MachinePrecision] / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(3.13060547623 * y + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.5 \cdot 10^{+22}:\\
\;\;\;\;\mathsf{fma}\left(3.13060547623, y, x\right)\\
\mathbf{elif}\;z \leq 1.55:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-32.324150453290734, b, 1.6453555072203998 \cdot a\right), y \cdot z, \mathsf{fma}\left(1.6453555072203998, b \cdot y, x\right)\right)\\
\mathbf{elif}\;z \leq 2.05 \cdot 10^{+91}:\\
\;\;\;\;x + \mathsf{fma}\left(3.13060547623, y, \frac{\left(457.9610022158428 + t\right) \cdot y}{z \cdot z}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(3.13060547623, y, x\right)\\
\end{array}
\end{array}
if z < -3.5e22 or 2.0500000000000001e91 < z Initial program 6.0%
Taylor expanded in z around inf
+-commutativeN/A
lower-fma.f6497.0
Applied rewrites97.0%
if -3.5e22 < z < 1.55000000000000004Initial program 99.0%
Taylor expanded in z around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6483.1
Applied rewrites83.1%
Applied rewrites91.2%
if 1.55000000000000004 < z < 2.0500000000000001e91Initial program 71.8%
Taylor expanded in z around -inf
Applied rewrites92.1%
Taylor expanded in z around 0
Applied rewrites96.3%
(FPCore (x y z t a b)
:precision binary64
(if (<= z -3.75e-34)
(+ x (fma 3.13060547623 y (* (- y) (/ (- t) (* z z)))))
(if (<= z 1.55)
(fma
(fma -32.324150453290734 b (* 1.6453555072203998 a))
(* y z)
(fma 1.6453555072203998 (* b y) x))
(+ x (fma 3.13060547623 y (* (/ t z) (/ y z)))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -3.75e-34) {
tmp = x + fma(3.13060547623, y, (-y * (-t / (z * z))));
} else if (z <= 1.55) {
tmp = fma(fma(-32.324150453290734, b, (1.6453555072203998 * a)), (y * z), fma(1.6453555072203998, (b * y), x));
} else {
tmp = x + fma(3.13060547623, y, ((t / z) * (y / z)));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -3.75e-34) tmp = Float64(x + fma(3.13060547623, y, Float64(Float64(-y) * Float64(Float64(-t) / Float64(z * z))))); elseif (z <= 1.55) tmp = fma(fma(-32.324150453290734, b, Float64(1.6453555072203998 * a)), Float64(y * z), fma(1.6453555072203998, Float64(b * y), x)); else tmp = Float64(x + fma(3.13060547623, y, Float64(Float64(t / z) * Float64(y / z)))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -3.75e-34], N[(x + N[(3.13060547623 * y + N[((-y) * N[((-t) / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.55], N[(N[(-32.324150453290734 * b + N[(1.6453555072203998 * a), $MachinePrecision]), $MachinePrecision] * N[(y * z), $MachinePrecision] + N[(1.6453555072203998 * N[(b * y), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], N[(x + N[(3.13060547623 * y + N[(N[(t / z), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.75 \cdot 10^{-34}:\\
\;\;\;\;x + \mathsf{fma}\left(3.13060547623, y, \left(-y\right) \cdot \frac{-t}{z \cdot z}\right)\\
\mathbf{elif}\;z \leq 1.55:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-32.324150453290734, b, 1.6453555072203998 \cdot a\right), y \cdot z, \mathsf{fma}\left(1.6453555072203998, b \cdot y, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + \mathsf{fma}\left(3.13060547623, y, \frac{t}{z} \cdot \frac{y}{z}\right)\\
\end{array}
\end{array}
if z < -3.7500000000000002e-34Initial program 16.7%
Taylor expanded in z around -inf
Applied rewrites84.0%
Taylor expanded in y around 0
Applied rewrites93.5%
Taylor expanded in t around inf
Applied rewrites93.5%
if -3.7500000000000002e-34 < z < 1.55000000000000004Initial program 99.7%
Taylor expanded in z around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6485.4
Applied rewrites85.4%
Applied rewrites93.8%
if 1.55000000000000004 < z Initial program 25.0%
Taylor expanded in z around -inf
Applied rewrites91.6%
Taylor expanded in t around inf
Applied rewrites98.7%
(FPCore (x y z t a b)
:precision binary64
(if (or (<= z -3.75e-34) (not (<= z 1.55)))
(+ x (fma 3.13060547623 y (* (- y) (/ (- t) (* z z)))))
(fma
(fma -32.324150453290734 b (* 1.6453555072203998 a))
(* y z)
(fma 1.6453555072203998 (* b y) x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -3.75e-34) || !(z <= 1.55)) {
tmp = x + fma(3.13060547623, y, (-y * (-t / (z * z))));
} else {
tmp = fma(fma(-32.324150453290734, b, (1.6453555072203998 * a)), (y * z), fma(1.6453555072203998, (b * y), x));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -3.75e-34) || !(z <= 1.55)) tmp = Float64(x + fma(3.13060547623, y, Float64(Float64(-y) * Float64(Float64(-t) / Float64(z * z))))); else tmp = fma(fma(-32.324150453290734, b, Float64(1.6453555072203998 * a)), Float64(y * z), fma(1.6453555072203998, Float64(b * y), x)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -3.75e-34], N[Not[LessEqual[z, 1.55]], $MachinePrecision]], N[(x + N[(3.13060547623 * y + N[((-y) * N[((-t) / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-32.324150453290734 * b + N[(1.6453555072203998 * a), $MachinePrecision]), $MachinePrecision] * N[(y * z), $MachinePrecision] + N[(1.6453555072203998 * N[(b * y), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.75 \cdot 10^{-34} \lor \neg \left(z \leq 1.55\right):\\
\;\;\;\;x + \mathsf{fma}\left(3.13060547623, y, \left(-y\right) \cdot \frac{-t}{z \cdot z}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-32.324150453290734, b, 1.6453555072203998 \cdot a\right), y \cdot z, \mathsf{fma}\left(1.6453555072203998, b \cdot y, x\right)\right)\\
\end{array}
\end{array}
if z < -3.7500000000000002e-34 or 1.55000000000000004 < z Initial program 21.1%
Taylor expanded in z around -inf
Applied rewrites88.1%
Taylor expanded in y around 0
Applied rewrites96.2%
Taylor expanded in t around inf
Applied rewrites96.2%
if -3.7500000000000002e-34 < z < 1.55000000000000004Initial program 99.7%
Taylor expanded in z around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6485.4
Applied rewrites85.4%
Applied rewrites93.8%
Final simplification95.0%
(FPCore (x y z t a b)
:precision binary64
(if (<= z -3.5e+22)
(fma 3.13060547623 y x)
(if (<= z 8e+15)
(fma
(fma -32.324150453290734 b (* 1.6453555072203998 a))
(* y z)
(fma 1.6453555072203998 (* b y) x))
(+ x (fma 3.13060547623 y (/ (* (- y) 36.52704169880642) z))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -3.5e+22) {
tmp = fma(3.13060547623, y, x);
} else if (z <= 8e+15) {
tmp = fma(fma(-32.324150453290734, b, (1.6453555072203998 * a)), (y * z), fma(1.6453555072203998, (b * y), x));
} else {
tmp = x + fma(3.13060547623, y, ((-y * 36.52704169880642) / z));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -3.5e+22) tmp = fma(3.13060547623, y, x); elseif (z <= 8e+15) tmp = fma(fma(-32.324150453290734, b, Float64(1.6453555072203998 * a)), Float64(y * z), fma(1.6453555072203998, Float64(b * y), x)); else tmp = Float64(x + fma(3.13060547623, y, Float64(Float64(Float64(-y) * 36.52704169880642) / z))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -3.5e+22], N[(3.13060547623 * y + x), $MachinePrecision], If[LessEqual[z, 8e+15], N[(N[(-32.324150453290734 * b + N[(1.6453555072203998 * a), $MachinePrecision]), $MachinePrecision] * N[(y * z), $MachinePrecision] + N[(1.6453555072203998 * N[(b * y), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], N[(x + N[(3.13060547623 * y + N[(N[((-y) * 36.52704169880642), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.5 \cdot 10^{+22}:\\
\;\;\;\;\mathsf{fma}\left(3.13060547623, y, x\right)\\
\mathbf{elif}\;z \leq 8 \cdot 10^{+15}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-32.324150453290734, b, 1.6453555072203998 \cdot a\right), y \cdot z, \mathsf{fma}\left(1.6453555072203998, b \cdot y, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + \mathsf{fma}\left(3.13060547623, y, \frac{\left(-y\right) \cdot 36.52704169880642}{z}\right)\\
\end{array}
\end{array}
if z < -3.5e22Initial program 10.9%
Taylor expanded in z around inf
+-commutativeN/A
lower-fma.f6494.6
Applied rewrites94.6%
if -3.5e22 < z < 8e15Initial program 99.0%
Taylor expanded in z around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6481.9
Applied rewrites81.9%
Applied rewrites89.9%
if 8e15 < z Initial program 22.7%
Taylor expanded in z around -inf
+-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
distribute-neg-fracN/A
lower-/.f64N/A
mul-1-negN/A
distribute-rgt-out--N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
metadata-eval94.3
Applied rewrites94.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -3.2e+22) (not (<= z 4.2e+16))) (fma 3.13060547623 y x) (fma (* y (* 1.6453555072203998 a)) z (fma (* b y) 1.6453555072203998 x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -3.2e+22) || !(z <= 4.2e+16)) {
tmp = fma(3.13060547623, y, x);
} else {
tmp = fma((y * (1.6453555072203998 * a)), z, fma((b * y), 1.6453555072203998, x));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -3.2e+22) || !(z <= 4.2e+16)) tmp = fma(3.13060547623, y, x); else tmp = fma(Float64(y * Float64(1.6453555072203998 * a)), z, fma(Float64(b * y), 1.6453555072203998, x)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -3.2e+22], N[Not[LessEqual[z, 4.2e+16]], $MachinePrecision]], N[(3.13060547623 * y + x), $MachinePrecision], N[(N[(y * N[(1.6453555072203998 * a), $MachinePrecision]), $MachinePrecision] * z + N[(N[(b * y), $MachinePrecision] * 1.6453555072203998 + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.2 \cdot 10^{+22} \lor \neg \left(z \leq 4.2 \cdot 10^{+16}\right):\\
\;\;\;\;\mathsf{fma}\left(3.13060547623, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot \left(1.6453555072203998 \cdot a\right), z, \mathsf{fma}\left(b \cdot y, 1.6453555072203998, x\right)\right)\\
\end{array}
\end{array}
if z < -3.2e22 or 4.2e16 < z Initial program 17.4%
Taylor expanded in z around inf
+-commutativeN/A
lower-fma.f6493.6
Applied rewrites93.6%
if -3.2e22 < z < 4.2e16Initial program 99.0%
Taylor expanded in z around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6481.9
Applied rewrites81.9%
Taylor expanded in a around inf
Applied rewrites83.0%
Final simplification88.1%
(FPCore (x y z t a b)
:precision binary64
(if (<= z -3.2e+22)
(fma 3.13060547623 y x)
(if (<= z 4.2e+16)
(fma (* y (* 1.6453555072203998 a)) z (fma (* b y) 1.6453555072203998 x))
(+ x (fma 3.13060547623 y (/ (* (- y) 36.52704169880642) z))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -3.2e+22) {
tmp = fma(3.13060547623, y, x);
} else if (z <= 4.2e+16) {
tmp = fma((y * (1.6453555072203998 * a)), z, fma((b * y), 1.6453555072203998, x));
} else {
tmp = x + fma(3.13060547623, y, ((-y * 36.52704169880642) / z));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -3.2e+22) tmp = fma(3.13060547623, y, x); elseif (z <= 4.2e+16) tmp = fma(Float64(y * Float64(1.6453555072203998 * a)), z, fma(Float64(b * y), 1.6453555072203998, x)); else tmp = Float64(x + fma(3.13060547623, y, Float64(Float64(Float64(-y) * 36.52704169880642) / z))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -3.2e+22], N[(3.13060547623 * y + x), $MachinePrecision], If[LessEqual[z, 4.2e+16], N[(N[(y * N[(1.6453555072203998 * a), $MachinePrecision]), $MachinePrecision] * z + N[(N[(b * y), $MachinePrecision] * 1.6453555072203998 + x), $MachinePrecision]), $MachinePrecision], N[(x + N[(3.13060547623 * y + N[(N[((-y) * 36.52704169880642), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.2 \cdot 10^{+22}:\\
\;\;\;\;\mathsf{fma}\left(3.13060547623, y, x\right)\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{+16}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot \left(1.6453555072203998 \cdot a\right), z, \mathsf{fma}\left(b \cdot y, 1.6453555072203998, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + \mathsf{fma}\left(3.13060547623, y, \frac{\left(-y\right) \cdot 36.52704169880642}{z}\right)\\
\end{array}
\end{array}
if z < -3.2e22Initial program 10.9%
Taylor expanded in z around inf
+-commutativeN/A
lower-fma.f6494.6
Applied rewrites94.6%
if -3.2e22 < z < 4.2e16Initial program 99.0%
Taylor expanded in z around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6481.9
Applied rewrites81.9%
Taylor expanded in a around inf
Applied rewrites83.0%
if 4.2e16 < z Initial program 22.7%
Taylor expanded in z around -inf
+-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
distribute-neg-fracN/A
lower-/.f64N/A
mul-1-negN/A
distribute-rgt-out--N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
metadata-eval94.3
Applied rewrites94.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -13.0) (not (<= z 9000000000000.0))) (fma 3.13060547623 y x) (+ x (/ (* b y) (fma 11.9400905721 z 0.607771387771)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -13.0) || !(z <= 9000000000000.0)) {
tmp = fma(3.13060547623, y, x);
} else {
tmp = x + ((b * y) / fma(11.9400905721, z, 0.607771387771));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -13.0) || !(z <= 9000000000000.0)) tmp = fma(3.13060547623, y, x); else tmp = Float64(x + Float64(Float64(b * y) / fma(11.9400905721, z, 0.607771387771))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -13.0], N[Not[LessEqual[z, 9000000000000.0]], $MachinePrecision]], N[(3.13060547623 * y + x), $MachinePrecision], N[(x + N[(N[(b * y), $MachinePrecision] / N[(11.9400905721 * z + 0.607771387771), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -13 \lor \neg \left(z \leq 9000000000000\right):\\
\;\;\;\;\mathsf{fma}\left(3.13060547623, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{b \cdot y}{\mathsf{fma}\left(11.9400905721, z, 0.607771387771\right)}\\
\end{array}
\end{array}
if z < -13 or 9e12 < z Initial program 18.6%
Taylor expanded in z around inf
+-commutativeN/A
lower-fma.f6491.4
Applied rewrites91.4%
if -13 < z < 9e12Initial program 99.7%
Taylor expanded in z around 0
lower-*.f6481.7
Applied rewrites81.7%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f6481.4
Applied rewrites81.4%
Final simplification86.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -2.7e+26) (not (<= z 5500000000000.0))) (fma 3.13060547623 y x) (fma (* b y) 1.6453555072203998 x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -2.7e+26) || !(z <= 5500000000000.0)) {
tmp = fma(3.13060547623, y, x);
} else {
tmp = fma((b * y), 1.6453555072203998, x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -2.7e+26) || !(z <= 5500000000000.0)) tmp = fma(3.13060547623, y, x); else tmp = fma(Float64(b * y), 1.6453555072203998, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -2.7e+26], N[Not[LessEqual[z, 5500000000000.0]], $MachinePrecision]], N[(3.13060547623 * y + x), $MachinePrecision], N[(N[(b * y), $MachinePrecision] * 1.6453555072203998 + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.7 \cdot 10^{+26} \lor \neg \left(z \leq 5500000000000\right):\\
\;\;\;\;\mathsf{fma}\left(3.13060547623, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b \cdot y, 1.6453555072203998, x\right)\\
\end{array}
\end{array}
if z < -2.7e26 or 5.5e12 < z Initial program 16.0%
Taylor expanded in z around inf
+-commutativeN/A
lower-fma.f6493.5
Applied rewrites93.5%
if -2.7e26 < z < 5.5e12Initial program 99.1%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6479.7
Applied rewrites79.7%
Final simplification86.2%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -2.7e+26) (not (<= z 5500000000000.0))) (fma 3.13060547623 y x) (fma (* 1.6453555072203998 b) y x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -2.7e+26) || !(z <= 5500000000000.0)) {
tmp = fma(3.13060547623, y, x);
} else {
tmp = fma((1.6453555072203998 * b), y, x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -2.7e+26) || !(z <= 5500000000000.0)) tmp = fma(3.13060547623, y, x); else tmp = fma(Float64(1.6453555072203998 * b), y, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -2.7e+26], N[Not[LessEqual[z, 5500000000000.0]], $MachinePrecision]], N[(3.13060547623 * y + x), $MachinePrecision], N[(N[(1.6453555072203998 * b), $MachinePrecision] * y + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.7 \cdot 10^{+26} \lor \neg \left(z \leq 5500000000000\right):\\
\;\;\;\;\mathsf{fma}\left(3.13060547623, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1.6453555072203998 \cdot b, y, x\right)\\
\end{array}
\end{array}
if z < -2.7e26 or 5.5e12 < z Initial program 16.0%
Taylor expanded in z around inf
+-commutativeN/A
lower-fma.f6493.5
Applied rewrites93.5%
if -2.7e26 < z < 5.5e12Initial program 99.1%
Taylor expanded in z around 0
lower-*.f6480.4
Applied rewrites80.4%
Taylor expanded in z around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6479.7
Applied rewrites79.7%
Final simplification86.2%
(FPCore (x y z t a b) :precision binary64 (fma 3.13060547623 y x))
double code(double x, double y, double z, double t, double a, double b) {
return fma(3.13060547623, y, x);
}
function code(x, y, z, t, a, b) return fma(3.13060547623, y, x) end
code[x_, y_, z_, t_, a_, b_] := N[(3.13060547623 * y + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(3.13060547623, y, x\right)
\end{array}
Initial program 60.1%
Taylor expanded in z around inf
+-commutativeN/A
lower-fma.f6465.8
Applied rewrites65.8%
(FPCore (x y z t a b) :precision binary64 (* 3.13060547623 y))
double code(double x, double y, double z, double t, double a, double b) {
return 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 = 3.13060547623d0 * y
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return 3.13060547623 * y;
}
def code(x, y, z, t, a, b): return 3.13060547623 * y
function code(x, y, z, t, a, b) return Float64(3.13060547623 * y) end
function tmp = code(x, y, z, t, a, b) tmp = 3.13060547623 * y; end
code[x_, y_, z_, t_, a_, b_] := N[(3.13060547623 * y), $MachinePrecision]
\begin{array}{l}
\\
3.13060547623 \cdot y
\end{array}
Initial program 60.1%
Taylor expanded in z around inf
+-commutativeN/A
lower-fma.f6465.8
Applied rewrites65.8%
Taylor expanded in x around 0
Applied rewrites22.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1
(+
x
(*
(+ (- 3.13060547623 (/ 36.527041698806414 z)) (/ t (* z z)))
(/ y 1.0)))))
(if (< z -6.499344996252632e+53)
t_1
(if (< z 7.066965436914287e+59)
(+
x
(/
y
(/
(+
(*
(+ (* (+ (* (+ z 15.234687407) z) 31.4690115749) z) 11.9400905721)
z)
0.607771387771)
(+
(* (+ (* (+ (* (+ (* z 3.13060547623) 11.1667541262) z) t) z) a) z)
b))))
t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + (((3.13060547623 - (36.527041698806414 / z)) + (t / (z * z))) * (y / 1.0));
double tmp;
if (z < -6.499344996252632e+53) {
tmp = t_1;
} else if (z < 7.066965436914287e+59) {
tmp = x + (y / ((((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771) / ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)));
} 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 - (36.527041698806414d0 / z)) + (t / (z * z))) * (y / 1.0d0))
if (z < (-6.499344996252632d+53)) then
tmp = t_1
else if (z < 7.066965436914287d+59) then
tmp = x + (y / ((((((((z + 15.234687407d0) * z) + 31.4690115749d0) * z) + 11.9400905721d0) * z) + 0.607771387771d0) / ((((((((z * 3.13060547623d0) + 11.1667541262d0) * z) + t) * z) + a) * z) + b)))
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 - (36.527041698806414 / z)) + (t / (z * z))) * (y / 1.0));
double tmp;
if (z < -6.499344996252632e+53) {
tmp = t_1;
} else if (z < 7.066965436914287e+59) {
tmp = x + (y / ((((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771) / ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x + (((3.13060547623 - (36.527041698806414 / z)) + (t / (z * z))) * (y / 1.0)) tmp = 0 if z < -6.499344996252632e+53: tmp = t_1 elif z < 7.066965436914287e+59: tmp = x + (y / ((((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771) / ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b))) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x + Float64(Float64(Float64(3.13060547623 - Float64(36.527041698806414 / z)) + Float64(t / Float64(z * z))) * Float64(y / 1.0))) tmp = 0.0 if (z < -6.499344996252632e+53) tmp = t_1; elseif (z < 7.066965436914287e+59) tmp = Float64(x + Float64(y / Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771) / Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = x + (((3.13060547623 - (36.527041698806414 / z)) + (t / (z * z))) * (y / 1.0)); tmp = 0.0; if (z < -6.499344996252632e+53) tmp = t_1; elseif (z < 7.066965436914287e+59) tmp = x + (y / ((((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771) / ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b))); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(N[(N[(3.13060547623 - N[(36.527041698806414 / z), $MachinePrecision]), $MachinePrecision] + N[(t / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(y / 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[z, -6.499344996252632e+53], t$95$1, If[Less[z, 7.066965436914287e+59], N[(x + N[(y / N[(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] / 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]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(\left(3.13060547623 - \frac{36.527041698806414}{z}\right) + \frac{t}{z \cdot z}\right) \cdot \frac{y}{1}\\
\mathbf{if}\;z < -6.499344996252632 \cdot 10^{+53}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z < 7.066965436914287 \cdot 10^{+59}:\\
\;\;\;\;x + \frac{y}{\frac{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771}{\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2024359
(FPCore (x y z t a b)
:name "Numeric.SpecFunctions:logGamma from math-functions-0.1.5.2, D"
:precision binary64
:alt
(! :herbie-platform default (if (< z -649934499625263200000000000000000000000000000000000000) (+ x (* (+ (- 313060547623/100000000000 (/ 18263520849403207/500000000000000 z)) (/ t (* z z))) (/ y 1))) (if (< z 706696543691428700000000000000000000000000000000000000000000) (+ x (/ y (/ (+ (* (+ (* (+ (* (+ z 15234687407/1000000000) z) 314690115749/10000000000) z) 119400905721/10000000000) z) 607771387771/1000000000000) (+ (* (+ (* (+ (* (+ (* z 313060547623/100000000000) 55833770631/5000000000) z) t) z) a) z) b)))) (+ x (* (+ (- 313060547623/100000000000 (/ 18263520849403207/500000000000000 z)) (/ t (* z z))) (/ y 1))))))
(+ 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))))