
(FPCore (x y z t a b c i) :precision binary64 (/ (+ (* (+ (* (+ (* (+ (* x y) z) y) 27464.7644705) y) 230661.510616) y) t) (+ (* (+ (* (+ (* (+ y a) y) b) y) c) y) i)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return ((((((((x * y) + z) * y) + 27464.7644705) * y) + 230661.510616) * y) + t) / (((((((y + a) * y) + b) * y) + c) * y) + i);
}
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, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
code = ((((((((x * y) + z) * y) + 27464.7644705d0) * y) + 230661.510616d0) * y) + t) / (((((((y + a) * y) + b) * y) + c) * y) + i)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return ((((((((x * y) + z) * y) + 27464.7644705) * y) + 230661.510616) * y) + t) / (((((((y + a) * y) + b) * y) + c) * y) + i);
}
def code(x, y, z, t, a, b, c, i): return ((((((((x * y) + z) * y) + 27464.7644705) * y) + 230661.510616) * y) + t) / (((((((y + a) * y) + b) * y) + c) * y) + i)
function code(x, y, z, t, a, b, c, i) return Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(x * y) + z) * y) + 27464.7644705) * y) + 230661.510616) * y) + t) / Float64(Float64(Float64(Float64(Float64(Float64(Float64(y + a) * y) + b) * y) + c) * y) + i)) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = ((((((((x * y) + z) * y) + 27464.7644705) * y) + 230661.510616) * y) + t) / (((((((y + a) * y) + b) * y) + c) * y) + i); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(N[(N[(N[(N[(N[(N[(N[(x * y), $MachinePrecision] + z), $MachinePrecision] * y), $MachinePrecision] + 27464.7644705), $MachinePrecision] * y), $MachinePrecision] + 230661.510616), $MachinePrecision] * y), $MachinePrecision] + t), $MachinePrecision] / N[(N[(N[(N[(N[(N[(N[(y + a), $MachinePrecision] * y), $MachinePrecision] + b), $MachinePrecision] * y), $MachinePrecision] + c), $MachinePrecision] * y), $MachinePrecision] + i), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(\left(\left(x \cdot y + z\right) \cdot y + 27464.7644705\right) \cdot y + 230661.510616\right) \cdot y + t}{\left(\left(\left(y + a\right) \cdot y + b\right) \cdot y + c\right) \cdot y + i}
\end{array}
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b c i) :precision binary64 (/ (+ (* (+ (* (+ (* (+ (* x y) z) y) 27464.7644705) y) 230661.510616) y) t) (+ (* (+ (* (+ (* (+ y a) y) b) y) c) y) i)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return ((((((((x * y) + z) * y) + 27464.7644705) * y) + 230661.510616) * y) + t) / (((((((y + a) * y) + b) * y) + c) * y) + i);
}
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, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
code = ((((((((x * y) + z) * y) + 27464.7644705d0) * y) + 230661.510616d0) * y) + t) / (((((((y + a) * y) + b) * y) + c) * y) + i)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return ((((((((x * y) + z) * y) + 27464.7644705) * y) + 230661.510616) * y) + t) / (((((((y + a) * y) + b) * y) + c) * y) + i);
}
def code(x, y, z, t, a, b, c, i): return ((((((((x * y) + z) * y) + 27464.7644705) * y) + 230661.510616) * y) + t) / (((((((y + a) * y) + b) * y) + c) * y) + i)
function code(x, y, z, t, a, b, c, i) return Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(x * y) + z) * y) + 27464.7644705) * y) + 230661.510616) * y) + t) / Float64(Float64(Float64(Float64(Float64(Float64(Float64(y + a) * y) + b) * y) + c) * y) + i)) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = ((((((((x * y) + z) * y) + 27464.7644705) * y) + 230661.510616) * y) + t) / (((((((y + a) * y) + b) * y) + c) * y) + i); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(N[(N[(N[(N[(N[(N[(N[(x * y), $MachinePrecision] + z), $MachinePrecision] * y), $MachinePrecision] + 27464.7644705), $MachinePrecision] * y), $MachinePrecision] + 230661.510616), $MachinePrecision] * y), $MachinePrecision] + t), $MachinePrecision] / N[(N[(N[(N[(N[(N[(N[(y + a), $MachinePrecision] * y), $MachinePrecision] + b), $MachinePrecision] * y), $MachinePrecision] + c), $MachinePrecision] * y), $MachinePrecision] + i), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(\left(\left(x \cdot y + z\right) \cdot y + 27464.7644705\right) \cdot y + 230661.510616\right) \cdot y + t}{\left(\left(\left(y + a\right) \cdot y + b\right) \cdot y + c\right) \cdot y + i}
\end{array}
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ (* (+ (* (+ (* (+ y a) y) b) y) c) y) i)))
(if (<=
(/
(+
(* (+ (* (+ (* (+ (* x y) z) y) 27464.7644705) y) 230661.510616) y)
t)
t_1)
INFINITY)
(/
(+ (fma y 230661.510616 (* (* (fma (fma y x z) y 27464.7644705) y) y)) t)
t_1)
(fma (/ (* -1.0 (- z (* a x))) y) -1.0 x))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = ((((((y + a) * y) + b) * y) + c) * y) + i;
double tmp;
if ((((((((((x * y) + z) * y) + 27464.7644705) * y) + 230661.510616) * y) + t) / t_1) <= ((double) INFINITY)) {
tmp = (fma(y, 230661.510616, ((fma(fma(y, x, z), y, 27464.7644705) * y) * y)) + t) / t_1;
} else {
tmp = fma(((-1.0 * (z - (a * x))) / y), -1.0, x);
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(Float64(Float64(Float64(Float64(y + a) * y) + b) * y) + c) * y) + i) tmp = 0.0 if (Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(x * y) + z) * y) + 27464.7644705) * y) + 230661.510616) * y) + t) / t_1) <= Inf) tmp = Float64(Float64(fma(y, 230661.510616, Float64(Float64(fma(fma(y, x, z), y, 27464.7644705) * y) * y)) + t) / t_1); else tmp = fma(Float64(Float64(-1.0 * Float64(z - Float64(a * x))) / y), -1.0, x); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(N[(N[(N[(N[(y + a), $MachinePrecision] * y), $MachinePrecision] + b), $MachinePrecision] * y), $MachinePrecision] + c), $MachinePrecision] * y), $MachinePrecision] + i), $MachinePrecision]}, If[LessEqual[N[(N[(N[(N[(N[(N[(N[(N[(N[(x * y), $MachinePrecision] + z), $MachinePrecision] * y), $MachinePrecision] + 27464.7644705), $MachinePrecision] * y), $MachinePrecision] + 230661.510616), $MachinePrecision] * y), $MachinePrecision] + t), $MachinePrecision] / t$95$1), $MachinePrecision], Infinity], N[(N[(N[(y * 230661.510616 + N[(N[(N[(N[(y * x + z), $MachinePrecision] * y + 27464.7644705), $MachinePrecision] * y), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[(N[(-1.0 * N[(z - N[(a * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] * -1.0 + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(\left(y + a\right) \cdot y + b\right) \cdot y + c\right) \cdot y + i\\
\mathbf{if}\;\frac{\left(\left(\left(x \cdot y + z\right) \cdot y + 27464.7644705\right) \cdot y + 230661.510616\right) \cdot y + t}{t\_1} \leq \infty:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, 230661.510616, \left(\mathsf{fma}\left(\mathsf{fma}\left(y, x, z\right), y, 27464.7644705\right) \cdot y\right) \cdot y\right) + t}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-1 \cdot \left(z - a \cdot x\right)}{y}, -1, x\right)\\
\end{array}
\end{array}
if (/.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 x y) z) y) #s(literal 54929528941/2000000 binary64)) y) #s(literal 28832688827/125000 binary64)) y) t) (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 y a) y) b) y) c) y) i)) < +inf.0Initial program 90.0%
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites90.0%
if +inf.0 < (/.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 x y) z) y) #s(literal 54929528941/2000000 binary64)) y) #s(literal 28832688827/125000 binary64)) y) t) (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 y a) y) b) y) c) y) i)) Initial program 0.0%
Taylor expanded in y around -inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
distribute-lft-out--N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6469.3
Applied rewrites69.3%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1
(/
(+
(* (+ (* (+ (* (+ (* x y) z) y) 27464.7644705) y) 230661.510616) y)
t)
(+ (* (+ (* (+ (* (+ y a) y) b) y) c) y) i))))
(if (<= t_1 2e-71)
(/ (fma (fma (fma z y 27464.7644705) y 230661.510616) y t) (fma c y i))
(if (<= t_1 INFINITY)
(/ t (fma (fma (fma (+ a y) y b) y c) y i))
(fma (/ (* -1.0 (- z (* a x))) y) -1.0 x)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = ((((((((x * y) + z) * y) + 27464.7644705) * y) + 230661.510616) * y) + t) / (((((((y + a) * y) + b) * y) + c) * y) + i);
double tmp;
if (t_1 <= 2e-71) {
tmp = fma(fma(fma(z, y, 27464.7644705), y, 230661.510616), y, t) / fma(c, y, i);
} else if (t_1 <= ((double) INFINITY)) {
tmp = t / fma(fma(fma((a + y), y, b), y, c), y, i);
} else {
tmp = fma(((-1.0 * (z - (a * x))) / y), -1.0, x);
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(x * y) + z) * y) + 27464.7644705) * y) + 230661.510616) * y) + t) / Float64(Float64(Float64(Float64(Float64(Float64(Float64(y + a) * y) + b) * y) + c) * y) + i)) tmp = 0.0 if (t_1 <= 2e-71) tmp = Float64(fma(fma(fma(z, y, 27464.7644705), y, 230661.510616), y, t) / fma(c, y, i)); elseif (t_1 <= Inf) tmp = Float64(t / fma(fma(fma(Float64(a + y), y, b), y, c), y, i)); else tmp = fma(Float64(Float64(-1.0 * Float64(z - Float64(a * x))) / y), -1.0, x); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(N[(N[(N[(N[(N[(N[(x * y), $MachinePrecision] + z), $MachinePrecision] * y), $MachinePrecision] + 27464.7644705), $MachinePrecision] * y), $MachinePrecision] + 230661.510616), $MachinePrecision] * y), $MachinePrecision] + t), $MachinePrecision] / N[(N[(N[(N[(N[(N[(N[(y + a), $MachinePrecision] * y), $MachinePrecision] + b), $MachinePrecision] * y), $MachinePrecision] + c), $MachinePrecision] * y), $MachinePrecision] + i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 2e-71], N[(N[(N[(N[(z * y + 27464.7644705), $MachinePrecision] * y + 230661.510616), $MachinePrecision] * y + t), $MachinePrecision] / N[(c * y + i), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(t / N[(N[(N[(N[(a + y), $MachinePrecision] * y + b), $MachinePrecision] * y + c), $MachinePrecision] * y + i), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-1.0 * N[(z - N[(a * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] * -1.0 + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(\left(\left(x \cdot y + z\right) \cdot y + 27464.7644705\right) \cdot y + 230661.510616\right) \cdot y + t}{\left(\left(\left(y + a\right) \cdot y + b\right) \cdot y + c\right) \cdot y + i}\\
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{-71}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(z, y, 27464.7644705\right), y, 230661.510616\right), y, t\right)}{\mathsf{fma}\left(c, y, i\right)}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{t}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(a + y, y, b\right), y, c\right), y, i\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-1 \cdot \left(z - a \cdot x\right)}{y}, -1, x\right)\\
\end{array}
\end{array}
if (/.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 x y) z) y) #s(literal 54929528941/2000000 binary64)) y) #s(literal 28832688827/125000 binary64)) y) t) (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 y a) y) b) y) c) y) i)) < 1.9999999999999998e-71Initial program 89.3%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
Applied rewrites83.3%
Taylor expanded in y around 0
Applied rewrites70.6%
if 1.9999999999999998e-71 < (/.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 x y) z) y) #s(literal 54929528941/2000000 binary64)) y) #s(literal 28832688827/125000 binary64)) y) t) (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 y a) y) b) y) c) y) i)) < +inf.0Initial program 91.9%
Taylor expanded in t around inf
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6470.5
Applied rewrites70.5%
if +inf.0 < (/.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 x y) z) y) #s(literal 54929528941/2000000 binary64)) y) #s(literal 28832688827/125000 binary64)) y) t) (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 y a) y) b) y) c) y) i)) Initial program 0.0%
Taylor expanded in y around -inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
distribute-lft-out--N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6469.3
Applied rewrites69.3%
(FPCore (x y z t a b c i)
:precision binary64
(if (<=
(/
(+
(* (+ (* (+ (* (+ (* x y) z) y) 27464.7644705) y) 230661.510616) y)
t)
(+ (* (+ (* (+ (* (+ y a) y) b) y) c) y) i))
INFINITY)
(/
(fma (fma 27464.7644705 y 230661.510616) y t)
(fma (fma (fma (+ a y) y b) y c) y i))
(fma (/ (* -1.0 (- z (* a x))) y) -1.0 x)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((((((((((x * y) + z) * y) + 27464.7644705) * y) + 230661.510616) * y) + t) / (((((((y + a) * y) + b) * y) + c) * y) + i)) <= ((double) INFINITY)) {
tmp = fma(fma(27464.7644705, y, 230661.510616), y, t) / fma(fma(fma((a + y), y, b), y, c), y, i);
} else {
tmp = fma(((-1.0 * (z - (a * x))) / y), -1.0, x);
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(x * y) + z) * y) + 27464.7644705) * y) + 230661.510616) * y) + t) / Float64(Float64(Float64(Float64(Float64(Float64(Float64(y + a) * y) + b) * y) + c) * y) + i)) <= Inf) tmp = Float64(fma(fma(27464.7644705, y, 230661.510616), y, t) / fma(fma(fma(Float64(a + y), y, b), y, c), y, i)); else tmp = fma(Float64(Float64(-1.0 * Float64(z - Float64(a * x))) / y), -1.0, x); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(N[(N[(N[(N[(N[(N[(N[(N[(x * y), $MachinePrecision] + z), $MachinePrecision] * y), $MachinePrecision] + 27464.7644705), $MachinePrecision] * y), $MachinePrecision] + 230661.510616), $MachinePrecision] * y), $MachinePrecision] + t), $MachinePrecision] / N[(N[(N[(N[(N[(N[(N[(y + a), $MachinePrecision] * y), $MachinePrecision] + b), $MachinePrecision] * y), $MachinePrecision] + c), $MachinePrecision] * y), $MachinePrecision] + i), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(N[(27464.7644705 * y + 230661.510616), $MachinePrecision] * y + t), $MachinePrecision] / N[(N[(N[(N[(a + y), $MachinePrecision] * y + b), $MachinePrecision] * y + c), $MachinePrecision] * y + i), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-1.0 * N[(z - N[(a * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] * -1.0 + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\left(\left(\left(x \cdot y + z\right) \cdot y + 27464.7644705\right) \cdot y + 230661.510616\right) \cdot y + t}{\left(\left(\left(y + a\right) \cdot y + b\right) \cdot y + c\right) \cdot y + i} \leq \infty:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(27464.7644705, y, 230661.510616\right), y, t\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(a + y, y, b\right), y, c\right), y, i\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-1 \cdot \left(z - a \cdot x\right)}{y}, -1, x\right)\\
\end{array}
\end{array}
if (/.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 x y) z) y) #s(literal 54929528941/2000000 binary64)) y) #s(literal 28832688827/125000 binary64)) y) t) (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 y a) y) b) y) c) y) i)) < +inf.0Initial program 90.0%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
Applied rewrites83.7%
Taylor expanded in y around 0
Applied rewrites76.0%
if +inf.0 < (/.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 x y) z) y) #s(literal 54929528941/2000000 binary64)) y) #s(literal 28832688827/125000 binary64)) y) t) (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 y a) y) b) y) c) y) i)) Initial program 0.0%
Taylor expanded in y around -inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
distribute-lft-out--N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6469.3
Applied rewrites69.3%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= y -1.55e+41)
(fma (/ (- (* -1.0 (/ (- 27464.7644705 (* b x)) y)) z) y) -1.0 x)
(if (<= y 1.3e+55)
(/
(fma (fma (fma z y 27464.7644705) y 230661.510616) y t)
(fma (fma (fma (+ a y) y b) y c) y i))
(fma (/ (* -1.0 (- z (* a x))) y) -1.0 x))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (y <= -1.55e+41) {
tmp = fma((((-1.0 * ((27464.7644705 - (b * x)) / y)) - z) / y), -1.0, x);
} else if (y <= 1.3e+55) {
tmp = fma(fma(fma(z, y, 27464.7644705), y, 230661.510616), y, t) / fma(fma(fma((a + y), y, b), y, c), y, i);
} else {
tmp = fma(((-1.0 * (z - (a * x))) / y), -1.0, x);
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (y <= -1.55e+41) tmp = fma(Float64(Float64(Float64(-1.0 * Float64(Float64(27464.7644705 - Float64(b * x)) / y)) - z) / y), -1.0, x); elseif (y <= 1.3e+55) tmp = Float64(fma(fma(fma(z, y, 27464.7644705), y, 230661.510616), y, t) / fma(fma(fma(Float64(a + y), y, b), y, c), y, i)); else tmp = fma(Float64(Float64(-1.0 * Float64(z - Float64(a * x))) / y), -1.0, x); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[y, -1.55e+41], N[(N[(N[(N[(-1.0 * N[(N[(27464.7644705 - N[(b * x), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision] / y), $MachinePrecision] * -1.0 + x), $MachinePrecision], If[LessEqual[y, 1.3e+55], N[(N[(N[(N[(z * y + 27464.7644705), $MachinePrecision] * y + 230661.510616), $MachinePrecision] * y + t), $MachinePrecision] / N[(N[(N[(N[(a + y), $MachinePrecision] * y + b), $MachinePrecision] * y + c), $MachinePrecision] * y + i), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-1.0 * N[(z - N[(a * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] * -1.0 + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.55 \cdot 10^{+41}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-1 \cdot \frac{27464.7644705 - b \cdot x}{y} - z}{y}, -1, x\right)\\
\mathbf{elif}\;y \leq 1.3 \cdot 10^{+55}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(z, y, 27464.7644705\right), y, 230661.510616\right), y, t\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(a + y, y, b\right), y, c\right), y, i\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-1 \cdot \left(z - a \cdot x\right)}{y}, -1, x\right)\\
\end{array}
\end{array}
if y < -1.55e41Initial program 4.3%
Taylor expanded in y around -inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites54.7%
Taylor expanded in a around 0
lower--.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lift-*.f6463.1
Applied rewrites63.1%
if -1.55e41 < y < 1.3e55Initial program 94.5%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
Applied rewrites88.5%
if 1.3e55 < y Initial program 2.8%
Taylor expanded in y around -inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
distribute-lft-out--N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6467.2
Applied rewrites67.2%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= y -7.2e+38)
(fma (/ (- (* -1.0 (/ (- 27464.7644705 (* b x)) y)) z) y) -1.0 x)
(if (<= y 2.6e+55)
(/
(fma (fma 27464.7644705 y 230661.510616) y t)
(fma (fma (fma (+ a y) y b) y c) y i))
(fma (/ (* -1.0 (- z (* a x))) y) -1.0 x))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (y <= -7.2e+38) {
tmp = fma((((-1.0 * ((27464.7644705 - (b * x)) / y)) - z) / y), -1.0, x);
} else if (y <= 2.6e+55) {
tmp = fma(fma(27464.7644705, y, 230661.510616), y, t) / fma(fma(fma((a + y), y, b), y, c), y, i);
} else {
tmp = fma(((-1.0 * (z - (a * x))) / y), -1.0, x);
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (y <= -7.2e+38) tmp = fma(Float64(Float64(Float64(-1.0 * Float64(Float64(27464.7644705 - Float64(b * x)) / y)) - z) / y), -1.0, x); elseif (y <= 2.6e+55) tmp = Float64(fma(fma(27464.7644705, y, 230661.510616), y, t) / fma(fma(fma(Float64(a + y), y, b), y, c), y, i)); else tmp = fma(Float64(Float64(-1.0 * Float64(z - Float64(a * x))) / y), -1.0, x); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[y, -7.2e+38], N[(N[(N[(N[(-1.0 * N[(N[(27464.7644705 - N[(b * x), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision] / y), $MachinePrecision] * -1.0 + x), $MachinePrecision], If[LessEqual[y, 2.6e+55], N[(N[(N[(27464.7644705 * y + 230661.510616), $MachinePrecision] * y + t), $MachinePrecision] / N[(N[(N[(N[(a + y), $MachinePrecision] * y + b), $MachinePrecision] * y + c), $MachinePrecision] * y + i), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-1.0 * N[(z - N[(a * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] * -1.0 + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.2 \cdot 10^{+38}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-1 \cdot \frac{27464.7644705 - b \cdot x}{y} - z}{y}, -1, x\right)\\
\mathbf{elif}\;y \leq 2.6 \cdot 10^{+55}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(27464.7644705, y, 230661.510616\right), y, t\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(a + y, y, b\right), y, c\right), y, i\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-1 \cdot \left(z - a \cdot x\right)}{y}, -1, x\right)\\
\end{array}
\end{array}
if y < -7.19999999999999938e38Initial program 4.7%
Taylor expanded in y around -inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites54.2%
Taylor expanded in a around 0
lower--.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lift-*.f6462.6
Applied rewrites62.6%
if -7.19999999999999938e38 < y < 2.6e55Initial program 94.6%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
Applied rewrites88.7%
Taylor expanded in y around 0
Applied rewrites80.9%
if 2.6e55 < y Initial program 2.8%
Taylor expanded in y around -inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
distribute-lft-out--N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6467.2
Applied rewrites67.2%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma (/ (* -1.0 (- z (* a x))) y) -1.0 x)))
(if (<= y -4.8e+38)
t_1
(if (<= y 2.3e+27)
(/ (fma 230661.510616 y t) (fma (fma (fma (+ a y) y b) y c) y i))
t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(((-1.0 * (z - (a * x))) / y), -1.0, x);
double tmp;
if (y <= -4.8e+38) {
tmp = t_1;
} else if (y <= 2.3e+27) {
tmp = fma(230661.510616, y, t) / fma(fma(fma((a + y), y, b), y, c), y, i);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(Float64(Float64(-1.0 * Float64(z - Float64(a * x))) / y), -1.0, x) tmp = 0.0 if (y <= -4.8e+38) tmp = t_1; elseif (y <= 2.3e+27) tmp = Float64(fma(230661.510616, y, t) / fma(fma(fma(Float64(a + y), y, b), y, c), y, i)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(-1.0 * N[(z - N[(a * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] * -1.0 + x), $MachinePrecision]}, If[LessEqual[y, -4.8e+38], t$95$1, If[LessEqual[y, 2.3e+27], N[(N[(230661.510616 * y + t), $MachinePrecision] / N[(N[(N[(N[(a + y), $MachinePrecision] * y + b), $MachinePrecision] * y + c), $MachinePrecision] * y + i), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{-1 \cdot \left(z - a \cdot x\right)}{y}, -1, x\right)\\
\mathbf{if}\;y \leq -4.8 \cdot 10^{+38}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.3 \cdot 10^{+27}:\\
\;\;\;\;\frac{\mathsf{fma}\left(230661.510616, y, t\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(a + y, y, b\right), y, c\right), y, i\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -4.80000000000000035e38 or 2.3000000000000001e27 < y Initial program 5.5%
Taylor expanded in y around -inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
distribute-lft-out--N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6463.6
Applied rewrites63.6%
if -4.80000000000000035e38 < y < 2.3000000000000001e27Initial program 96.8%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
Applied rewrites91.1%
Taylor expanded in y around 0
Applied rewrites82.1%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma (/ (* -1.0 (- z (* a x))) y) -1.0 x)))
(if (<= y -4.8e+38)
t_1
(if (<= y 2.2e+22) (/ t (fma (fma (fma (+ a y) y b) y c) y i)) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(((-1.0 * (z - (a * x))) / y), -1.0, x);
double tmp;
if (y <= -4.8e+38) {
tmp = t_1;
} else if (y <= 2.2e+22) {
tmp = t / fma(fma(fma((a + y), y, b), y, c), y, i);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(Float64(Float64(-1.0 * Float64(z - Float64(a * x))) / y), -1.0, x) tmp = 0.0 if (y <= -4.8e+38) tmp = t_1; elseif (y <= 2.2e+22) tmp = Float64(t / fma(fma(fma(Float64(a + y), y, b), y, c), y, i)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(-1.0 * N[(z - N[(a * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] * -1.0 + x), $MachinePrecision]}, If[LessEqual[y, -4.8e+38], t$95$1, If[LessEqual[y, 2.2e+22], N[(t / N[(N[(N[(N[(a + y), $MachinePrecision] * y + b), $MachinePrecision] * y + c), $MachinePrecision] * y + i), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{-1 \cdot \left(z - a \cdot x\right)}{y}, -1, x\right)\\
\mathbf{if}\;y \leq -4.8 \cdot 10^{+38}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.2 \cdot 10^{+22}:\\
\;\;\;\;\frac{t}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(a + y, y, b\right), y, c\right), y, i\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -4.80000000000000035e38 or 2.2e22 < y Initial program 5.9%
Taylor expanded in y around -inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
distribute-lft-out--N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6463.2
Applied rewrites63.2%
if -4.80000000000000035e38 < y < 2.2e22Initial program 97.1%
Taylor expanded in t around inf
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6469.6
Applied rewrites69.6%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma (/ (* -1.0 (- z (* a x))) y) -1.0 x)))
(if (<= y -4.8e+38)
t_1
(if (<= y 2.2e+27) (/ t (+ i (* y (+ c (* b y))))) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(((-1.0 * (z - (a * x))) / y), -1.0, x);
double tmp;
if (y <= -4.8e+38) {
tmp = t_1;
} else if (y <= 2.2e+27) {
tmp = t / (i + (y * (c + (b * y))));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(Float64(Float64(-1.0 * Float64(z - Float64(a * x))) / y), -1.0, x) tmp = 0.0 if (y <= -4.8e+38) tmp = t_1; elseif (y <= 2.2e+27) tmp = Float64(t / Float64(i + Float64(y * Float64(c + Float64(b * y))))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(-1.0 * N[(z - N[(a * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] * -1.0 + x), $MachinePrecision]}, If[LessEqual[y, -4.8e+38], t$95$1, If[LessEqual[y, 2.2e+27], N[(t / N[(i + N[(y * N[(c + N[(b * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{-1 \cdot \left(z - a \cdot x\right)}{y}, -1, x\right)\\
\mathbf{if}\;y \leq -4.8 \cdot 10^{+38}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.2 \cdot 10^{+27}:\\
\;\;\;\;\frac{t}{i + y \cdot \left(c + b \cdot y\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -4.80000000000000035e38 or 2.1999999999999999e27 < y Initial program 5.5%
Taylor expanded in y around -inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
distribute-lft-out--N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6463.6
Applied rewrites63.6%
if -4.80000000000000035e38 < y < 2.1999999999999999e27Initial program 96.8%
Taylor expanded in c around inf
lower-*.f6425.8
Applied rewrites25.8%
Taylor expanded in y around 0
Applied rewrites18.3%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6466.6
Applied rewrites66.6%
(FPCore (x y z t a b c i) :precision binary64 (if (<= y -6.4e+33) x (if (<= y 1.45e+35) (/ t (+ i (* y (+ c (* b y))))) x)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (y <= -6.4e+33) {
tmp = x;
} else if (y <= 1.45e+35) {
tmp = t / (i + (y * (c + (b * y))));
} else {
tmp = x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if (y <= (-6.4d+33)) then
tmp = x
else if (y <= 1.45d+35) then
tmp = t / (i + (y * (c + (b * y))))
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (y <= -6.4e+33) {
tmp = x;
} else if (y <= 1.45e+35) {
tmp = t / (i + (y * (c + (b * y))));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if y <= -6.4e+33: tmp = x elif y <= 1.45e+35: tmp = t / (i + (y * (c + (b * y)))) else: tmp = x return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (y <= -6.4e+33) tmp = x; elseif (y <= 1.45e+35) tmp = Float64(t / Float64(i + Float64(y * Float64(c + Float64(b * y))))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if (y <= -6.4e+33) tmp = x; elseif (y <= 1.45e+35) tmp = t / (i + (y * (c + (b * y)))); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[y, -6.4e+33], x, If[LessEqual[y, 1.45e+35], N[(t / N[(i + N[(y * N[(c + N[(b * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.4 \cdot 10^{+33}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1.45 \cdot 10^{+35}:\\
\;\;\;\;\frac{t}{i + y \cdot \left(c + b \cdot y\right)}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -6.40000000000000034e33 or 1.44999999999999997e35 < y Initial program 5.4%
Taylor expanded in y around inf
Applied rewrites54.1%
if -6.40000000000000034e33 < y < 1.44999999999999997e35Initial program 96.5%
Taylor expanded in c around inf
lower-*.f6425.6
Applied rewrites25.6%
Taylor expanded in y around 0
Applied rewrites18.2%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6466.3
Applied rewrites66.3%
(FPCore (x y z t a b c i) :precision binary64 (if (<= y -3.3e+33) x (if (<= y 1.45e+35) (/ t (+ i (* c y))) x)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (y <= -3.3e+33) {
tmp = x;
} else if (y <= 1.45e+35) {
tmp = t / (i + (c * y));
} else {
tmp = x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if (y <= (-3.3d+33)) then
tmp = x
else if (y <= 1.45d+35) then
tmp = t / (i + (c * y))
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (y <= -3.3e+33) {
tmp = x;
} else if (y <= 1.45e+35) {
tmp = t / (i + (c * y));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if y <= -3.3e+33: tmp = x elif y <= 1.45e+35: tmp = t / (i + (c * y)) else: tmp = x return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (y <= -3.3e+33) tmp = x; elseif (y <= 1.45e+35) tmp = Float64(t / Float64(i + Float64(c * y))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if (y <= -3.3e+33) tmp = x; elseif (y <= 1.45e+35) tmp = t / (i + (c * y)); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[y, -3.3e+33], x, If[LessEqual[y, 1.45e+35], N[(t / N[(i + N[(c * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.3 \cdot 10^{+33}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1.45 \cdot 10^{+35}:\\
\;\;\;\;\frac{t}{i + c \cdot y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -3.29999999999999976e33 or 1.44999999999999997e35 < y Initial program 5.4%
Taylor expanded in y around inf
Applied rewrites54.0%
if -3.29999999999999976e33 < y < 1.44999999999999997e35Initial program 96.5%
Taylor expanded in c around inf
lower-*.f6425.6
Applied rewrites25.6%
Taylor expanded in y around 0
Applied rewrites18.2%
Taylor expanded in y around 0
lower-+.f64N/A
lift-*.f6461.8
Applied rewrites61.8%
(FPCore (x y z t a b c i) :precision binary64 (if (<= y -8.8e+27) x (if (<= y 4.8e-10) (/ (fma 230661.510616 y t) i) x)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (y <= -8.8e+27) {
tmp = x;
} else if (y <= 4.8e-10) {
tmp = fma(230661.510616, y, t) / i;
} else {
tmp = x;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (y <= -8.8e+27) tmp = x; elseif (y <= 4.8e-10) tmp = Float64(fma(230661.510616, y, t) / i); else tmp = x; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[y, -8.8e+27], x, If[LessEqual[y, 4.8e-10], N[(N[(230661.510616 * y + t), $MachinePrecision] / i), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.8 \cdot 10^{+27}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 4.8 \cdot 10^{-10}:\\
\;\;\;\;\frac{\mathsf{fma}\left(230661.510616, y, t\right)}{i}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -8.7999999999999995e27 or 4.8e-10 < y Initial program 10.8%
Taylor expanded in y around inf
Applied rewrites50.2%
if -8.7999999999999995e27 < y < 4.8e-10Initial program 98.3%
Taylor expanded in c around 0
lower-/.f64N/A
Applied rewrites75.3%
Taylor expanded in y around 0
Applied rewrites67.0%
Taylor expanded in y around 0
Applied rewrites58.6%
(FPCore (x y z t a b c i) :precision binary64 (if (<= y -9.2e+27) x (if (<= y 1.48e+23) (/ t i) x)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (y <= -9.2e+27) {
tmp = x;
} else if (y <= 1.48e+23) {
tmp = t / i;
} else {
tmp = x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if (y <= (-9.2d+27)) then
tmp = x
else if (y <= 1.48d+23) then
tmp = t / i
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (y <= -9.2e+27) {
tmp = x;
} else if (y <= 1.48e+23) {
tmp = t / i;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if y <= -9.2e+27: tmp = x elif y <= 1.48e+23: tmp = t / i else: tmp = x return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (y <= -9.2e+27) tmp = x; elseif (y <= 1.48e+23) tmp = Float64(t / i); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if (y <= -9.2e+27) tmp = x; elseif (y <= 1.48e+23) tmp = t / i; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[y, -9.2e+27], x, If[LessEqual[y, 1.48e+23], N[(t / i), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.2 \cdot 10^{+27}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1.48 \cdot 10^{+23}:\\
\;\;\;\;\frac{t}{i}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -9.2000000000000002e27 or 1.4799999999999999e23 < y Initial program 6.9%
Taylor expanded in y around inf
Applied rewrites52.6%
if -9.2000000000000002e27 < y < 1.4799999999999999e23Initial program 97.8%
Taylor expanded in y around 0
lower-/.f6450.0
Applied rewrites50.0%
(FPCore (x y z t a b c i) :precision binary64 x)
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return x;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
code = x
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return x;
}
def code(x, y, z, t, a, b, c, i): return x
function code(x, y, z, t, a, b, c, i) return x end
function tmp = code(x, y, z, t, a, b, c, i) tmp = x; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 55.1%
Taylor expanded in y around inf
Applied rewrites26.7%
herbie shell --seed 2025095
(FPCore (x y z t a b c i)
:name "Numeric.SpecFunctions:logGamma from math-functions-0.1.5.2"
:precision binary64
(/ (+ (* (+ (* (+ (* (+ (* x y) z) y) 27464.7644705) y) 230661.510616) y) t) (+ (* (+ (* (+ (* (+ y a) y) b) y) c) y) i)))