
(FPCore (x y z t a b) :precision binary64 (/ (+ x (/ (* y z) t)) (+ (+ a 1.0) (/ (* y b) t))))
double code(double x, double y, double z, double t, double a, double b) {
return (x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t));
}
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) / t)) / ((a + 1.0d0) + ((y * b) / t))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return (x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t));
}
def code(x, y, z, t, a, b): return (x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t))
function code(x, y, z, t, a, b) return Float64(Float64(x + Float64(Float64(y * z) / t)) / Float64(Float64(a + 1.0) + Float64(Float64(y * b) / t))) end
function tmp = code(x, y, z, t, a, b) tmp = (x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t)); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / N[(N[(a + 1.0), $MachinePrecision] + N[(N[(y * b), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}
\end{array}
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (/ (+ x (/ (* y z) t)) (+ (+ a 1.0) (/ (* y b) t))))
double code(double x, double y, double z, double t, double a, double b) {
return (x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t));
}
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) / t)) / ((a + 1.0d0) + ((y * b) / t))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return (x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t));
}
def code(x, y, z, t, a, b): return (x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t))
function code(x, y, z, t, a, b) return Float64(Float64(x + Float64(Float64(y * z) / t)) / Float64(Float64(a + 1.0) + Float64(Float64(y * b) / t))) end
function tmp = code(x, y, z, t, a, b) tmp = (x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t)); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / N[(N[(a + 1.0), $MachinePrecision] + N[(N[(y * b), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}
\end{array}
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ x (/ (* y z) t))) (t_2 (/ t_1 (+ (+ a 1.0) (/ (* y b) t)))))
(if (<= t_2 (- INFINITY))
(* (/ z (fma b (/ y t) (- a -1.0))) (/ y t))
(if (<= t_2 -1e-315)
t_2
(if (<= t_2 1e+279) (/ t_1 (fma y (/ b t) (- a -1.0))) (/ z b))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + ((y * z) / t);
double t_2 = t_1 / ((a + 1.0) + ((y * b) / t));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = (z / fma(b, (y / t), (a - -1.0))) * (y / t);
} else if (t_2 <= -1e-315) {
tmp = t_2;
} else if (t_2 <= 1e+279) {
tmp = t_1 / fma(y, (b / t), (a - -1.0));
} else {
tmp = z / b;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(x + Float64(Float64(y * z) / t)) t_2 = Float64(t_1 / Float64(Float64(a + 1.0) + Float64(Float64(y * b) / t))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = Float64(Float64(z / fma(b, Float64(y / t), Float64(a - -1.0))) * Float64(y / t)); elseif (t_2 <= -1e-315) tmp = t_2; elseif (t_2 <= 1e+279) tmp = Float64(t_1 / fma(y, Float64(b / t), Float64(a - -1.0))); else tmp = Float64(z / b); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 / N[(N[(a + 1.0), $MachinePrecision] + N[(N[(y * b), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(N[(z / N[(b * N[(y / t), $MachinePrecision] + N[(a - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -1e-315], t$95$2, If[LessEqual[t$95$2, 1e+279], N[(t$95$1 / N[(y * N[(b / t), $MachinePrecision] + N[(a - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z / b), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y \cdot z}{t}\\
t_2 := \frac{t\_1}{\left(a + 1\right) + \frac{y \cdot b}{t}}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;\frac{z}{\mathsf{fma}\left(b, \frac{y}{t}, a - -1\right)} \cdot \frac{y}{t}\\
\mathbf{elif}\;t\_2 \leq -1 \cdot 10^{-315}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_2 \leq 10^{+279}:\\
\;\;\;\;\frac{t\_1}{\mathsf{fma}\left(y, \frac{b}{t}, a - -1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{b}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < -inf.0Initial program 75.3%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6433.4
Applied rewrites33.4%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-fma.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f6436.2
Applied rewrites36.2%
if -inf.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < -9.999999985e-316Initial program 75.3%
if -9.999999985e-316 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < 1.00000000000000006e279Initial program 75.3%
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
+-commutativeN/A
associate-/l*N/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6474.7
Applied rewrites74.7%
if 1.00000000000000006e279 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) Initial program 75.3%
Taylor expanded in y around inf
lower-/.f6433.9
Applied rewrites33.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ x (/ (* y z) t))) (t_2 (/ t_1 (+ (+ a 1.0) (/ (* y b) t)))))
(if (<= t_2 (- INFINITY))
(* (/ z (fma b (/ y t) (- a -1.0))) (/ y t))
(if (<= t_2 1e+279) (/ t_1 (fma y (/ b t) (- a -1.0))) (/ z b)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + ((y * z) / t);
double t_2 = t_1 / ((a + 1.0) + ((y * b) / t));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = (z / fma(b, (y / t), (a - -1.0))) * (y / t);
} else if (t_2 <= 1e+279) {
tmp = t_1 / fma(y, (b / t), (a - -1.0));
} else {
tmp = z / b;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(x + Float64(Float64(y * z) / t)) t_2 = Float64(t_1 / Float64(Float64(a + 1.0) + Float64(Float64(y * b) / t))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = Float64(Float64(z / fma(b, Float64(y / t), Float64(a - -1.0))) * Float64(y / t)); elseif (t_2 <= 1e+279) tmp = Float64(t_1 / fma(y, Float64(b / t), Float64(a - -1.0))); else tmp = Float64(z / b); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 / N[(N[(a + 1.0), $MachinePrecision] + N[(N[(y * b), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(N[(z / N[(b * N[(y / t), $MachinePrecision] + N[(a - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+279], N[(t$95$1 / N[(y * N[(b / t), $MachinePrecision] + N[(a - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z / b), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y \cdot z}{t}\\
t_2 := \frac{t\_1}{\left(a + 1\right) + \frac{y \cdot b}{t}}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;\frac{z}{\mathsf{fma}\left(b, \frac{y}{t}, a - -1\right)} \cdot \frac{y}{t}\\
\mathbf{elif}\;t\_2 \leq 10^{+279}:\\
\;\;\;\;\frac{t\_1}{\mathsf{fma}\left(y, \frac{b}{t}, a - -1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{b}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < -inf.0Initial program 75.3%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6433.4
Applied rewrites33.4%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-fma.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f6436.2
Applied rewrites36.2%
if -inf.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < 1.00000000000000006e279Initial program 75.3%
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
+-commutativeN/A
associate-/l*N/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6474.7
Applied rewrites74.7%
if 1.00000000000000006e279 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) Initial program 75.3%
Taylor expanded in y around inf
lower-/.f6433.9
Applied rewrites33.9%
(FPCore (x y z t a b)
:precision binary64
(if (<= a -2.5e+15)
(fma (* z y) (/ 1.0 (* (+ 1.0 a) t)) (/ x (+ 1.0 a)))
(if (<= a -1.7e-12)
(/ (+ z (/ (* t x) y)) b)
(if (<= a 42000000.0)
(/ (fma y (/ z t) x) (fma b (/ y t) 1.0))
(/ (+ x (/ (* y z) t)) (- a -1.0))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -2.5e+15) {
tmp = fma((z * y), (1.0 / ((1.0 + a) * t)), (x / (1.0 + a)));
} else if (a <= -1.7e-12) {
tmp = (z + ((t * x) / y)) / b;
} else if (a <= 42000000.0) {
tmp = fma(y, (z / t), x) / fma(b, (y / t), 1.0);
} else {
tmp = (x + ((y * z) / t)) / (a - -1.0);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -2.5e+15) tmp = fma(Float64(z * y), Float64(1.0 / Float64(Float64(1.0 + a) * t)), Float64(x / Float64(1.0 + a))); elseif (a <= -1.7e-12) tmp = Float64(Float64(z + Float64(Float64(t * x) / y)) / b); elseif (a <= 42000000.0) tmp = Float64(fma(y, Float64(z / t), x) / fma(b, Float64(y / t), 1.0)); else tmp = Float64(Float64(x + Float64(Float64(y * z) / t)) / Float64(a - -1.0)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -2.5e+15], N[(N[(z * y), $MachinePrecision] * N[(1.0 / N[(N[(1.0 + a), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(x / N[(1.0 + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, -1.7e-12], N[(N[(z + N[(N[(t * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision], If[LessEqual[a, 42000000.0], N[(N[(y * N[(z / t), $MachinePrecision] + x), $MachinePrecision] / N[(b * N[(y / t), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / N[(a - -1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.5 \cdot 10^{+15}:\\
\;\;\;\;\mathsf{fma}\left(z \cdot y, \frac{1}{\left(1 + a\right) \cdot t}, \frac{x}{1 + a}\right)\\
\mathbf{elif}\;a \leq -1.7 \cdot 10^{-12}:\\
\;\;\;\;\frac{z + \frac{t \cdot x}{y}}{b}\\
\mathbf{elif}\;a \leq 42000000:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, \frac{z}{t}, x\right)}{\mathsf{fma}\left(b, \frac{y}{t}, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{y \cdot z}{t}}{a - -1}\\
\end{array}
\end{array}
if a < -2.5e15Initial program 75.3%
Applied rewrites75.5%
Taylor expanded in y around 0
lower-+.f6462.5
Applied rewrites62.5%
Taylor expanded in y around 0
lower-+.f6456.0
Applied rewrites56.0%
if -2.5e15 < a < -1.7e-12Initial program 75.3%
Applied rewrites75.5%
Taylor expanded in b around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6440.5
Applied rewrites40.5%
if -1.7e-12 < a < 4.2e7Initial program 75.3%
Taylor expanded in a around 0
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6445.3
Applied rewrites45.3%
if 4.2e7 < a Initial program 75.3%
Taylor expanded in y around 0
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6456.4
Applied rewrites56.4%
(FPCore (x y z t a b)
:precision binary64
(if (<= a -2.5e+15)
(+ (/ x (+ 1.0 a)) (/ (* y z) (* t (+ 1.0 a))))
(if (<= a -1.7e-12)
(/ (+ z (/ (* t x) y)) b)
(if (<= a 42000000.0)
(/ (fma y (/ z t) x) (fma b (/ y t) 1.0))
(/ (+ x (/ (* y z) t)) (- a -1.0))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -2.5e+15) {
tmp = (x / (1.0 + a)) + ((y * z) / (t * (1.0 + a)));
} else if (a <= -1.7e-12) {
tmp = (z + ((t * x) / y)) / b;
} else if (a <= 42000000.0) {
tmp = fma(y, (z / t), x) / fma(b, (y / t), 1.0);
} else {
tmp = (x + ((y * z) / t)) / (a - -1.0);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -2.5e+15) tmp = Float64(Float64(x / Float64(1.0 + a)) + Float64(Float64(y * z) / Float64(t * Float64(1.0 + a)))); elseif (a <= -1.7e-12) tmp = Float64(Float64(z + Float64(Float64(t * x) / y)) / b); elseif (a <= 42000000.0) tmp = Float64(fma(y, Float64(z / t), x) / fma(b, Float64(y / t), 1.0)); else tmp = Float64(Float64(x + Float64(Float64(y * z) / t)) / Float64(a - -1.0)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -2.5e+15], N[(N[(x / N[(1.0 + a), $MachinePrecision]), $MachinePrecision] + N[(N[(y * z), $MachinePrecision] / N[(t * N[(1.0 + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, -1.7e-12], N[(N[(z + N[(N[(t * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision], If[LessEqual[a, 42000000.0], N[(N[(y * N[(z / t), $MachinePrecision] + x), $MachinePrecision] / N[(b * N[(y / t), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / N[(a - -1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.5 \cdot 10^{+15}:\\
\;\;\;\;\frac{x}{1 + a} + \frac{y \cdot z}{t \cdot \left(1 + a\right)}\\
\mathbf{elif}\;a \leq -1.7 \cdot 10^{-12}:\\
\;\;\;\;\frac{z + \frac{t \cdot x}{y}}{b}\\
\mathbf{elif}\;a \leq 42000000:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, \frac{z}{t}, x\right)}{\mathsf{fma}\left(b, \frac{y}{t}, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{y \cdot z}{t}}{a - -1}\\
\end{array}
\end{array}
if a < -2.5e15Initial program 75.3%
Applied rewrites75.5%
Taylor expanded in b around 0
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lift-*.f64N/A
lower-*.f64N/A
lower-+.f6456.0
Applied rewrites56.0%
if -2.5e15 < a < -1.7e-12Initial program 75.3%
Applied rewrites75.5%
Taylor expanded in b around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6440.5
Applied rewrites40.5%
if -1.7e-12 < a < 4.2e7Initial program 75.3%
Taylor expanded in a around 0
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6445.3
Applied rewrites45.3%
if 4.2e7 < a Initial program 75.3%
Taylor expanded in y around 0
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6456.4
Applied rewrites56.4%
(FPCore (x y z t a b)
:precision binary64
(if (<= a -2.5e+15)
(fma y (/ z (* (+ 1.0 a) t)) (/ x (+ 1.0 a)))
(if (<= a -1.7e-12)
(/ (+ z (/ (* t x) y)) b)
(if (<= a 42000000.0)
(/ (fma y (/ z t) x) (fma b (/ y t) 1.0))
(/ (+ x (/ (* y z) t)) (- a -1.0))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -2.5e+15) {
tmp = fma(y, (z / ((1.0 + a) * t)), (x / (1.0 + a)));
} else if (a <= -1.7e-12) {
tmp = (z + ((t * x) / y)) / b;
} else if (a <= 42000000.0) {
tmp = fma(y, (z / t), x) / fma(b, (y / t), 1.0);
} else {
tmp = (x + ((y * z) / t)) / (a - -1.0);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -2.5e+15) tmp = fma(y, Float64(z / Float64(Float64(1.0 + a) * t)), Float64(x / Float64(1.0 + a))); elseif (a <= -1.7e-12) tmp = Float64(Float64(z + Float64(Float64(t * x) / y)) / b); elseif (a <= 42000000.0) tmp = Float64(fma(y, Float64(z / t), x) / fma(b, Float64(y / t), 1.0)); else tmp = Float64(Float64(x + Float64(Float64(y * z) / t)) / Float64(a - -1.0)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -2.5e+15], N[(y * N[(z / N[(N[(1.0 + a), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(x / N[(1.0 + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, -1.7e-12], N[(N[(z + N[(N[(t * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision], If[LessEqual[a, 42000000.0], N[(N[(y * N[(z / t), $MachinePrecision] + x), $MachinePrecision] / N[(b * N[(y / t), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / N[(a - -1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.5 \cdot 10^{+15}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z}{\left(1 + a\right) \cdot t}, \frac{x}{1 + a}\right)\\
\mathbf{elif}\;a \leq -1.7 \cdot 10^{-12}:\\
\;\;\;\;\frac{z + \frac{t \cdot x}{y}}{b}\\
\mathbf{elif}\;a \leq 42000000:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, \frac{z}{t}, x\right)}{\mathsf{fma}\left(b, \frac{y}{t}, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{y \cdot z}{t}}{a - -1}\\
\end{array}
\end{array}
if a < -2.5e15Initial program 75.3%
Applied rewrites76.7%
Taylor expanded in y around 0
lower-+.f6463.5
Applied rewrites63.5%
Taylor expanded in y around 0
lower-+.f6456.7
Applied rewrites56.7%
if -2.5e15 < a < -1.7e-12Initial program 75.3%
Applied rewrites75.5%
Taylor expanded in b around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6440.5
Applied rewrites40.5%
if -1.7e-12 < a < 4.2e7Initial program 75.3%
Taylor expanded in a around 0
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6445.3
Applied rewrites45.3%
if 4.2e7 < a Initial program 75.3%
Taylor expanded in y around 0
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6456.4
Applied rewrites56.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (+ x (/ (* y z) t)) (- a -1.0))))
(if (<= (+ a 1.0) -5e+16)
t_1
(if (<= (+ a 1.0) 0.999999999999)
(/ (+ z (/ (* t x) y)) b)
(if (<= (+ a 1.0) 50000000.0)
(/ (fma y (/ z t) x) (fma b (/ y t) 1.0))
t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + ((y * z) / t)) / (a - -1.0);
double tmp;
if ((a + 1.0) <= -5e+16) {
tmp = t_1;
} else if ((a + 1.0) <= 0.999999999999) {
tmp = (z + ((t * x) / y)) / b;
} else if ((a + 1.0) <= 50000000.0) {
tmp = fma(y, (z / t), x) / fma(b, (y / t), 1.0);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + Float64(Float64(y * z) / t)) / Float64(a - -1.0)) tmp = 0.0 if (Float64(a + 1.0) <= -5e+16) tmp = t_1; elseif (Float64(a + 1.0) <= 0.999999999999) tmp = Float64(Float64(z + Float64(Float64(t * x) / y)) / b); elseif (Float64(a + 1.0) <= 50000000.0) tmp = Float64(fma(y, Float64(z / t), x) / fma(b, Float64(y / t), 1.0)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / N[(a - -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a + 1.0), $MachinePrecision], -5e+16], t$95$1, If[LessEqual[N[(a + 1.0), $MachinePrecision], 0.999999999999], N[(N[(z + N[(N[(t * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision], If[LessEqual[N[(a + 1.0), $MachinePrecision], 50000000.0], N[(N[(y * N[(z / t), $MachinePrecision] + x), $MachinePrecision] / N[(b * N[(y / t), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x + \frac{y \cdot z}{t}}{a - -1}\\
\mathbf{if}\;a + 1 \leq -5 \cdot 10^{+16}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a + 1 \leq 0.999999999999:\\
\;\;\;\;\frac{z + \frac{t \cdot x}{y}}{b}\\
\mathbf{elif}\;a + 1 \leq 50000000:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, \frac{z}{t}, x\right)}{\mathsf{fma}\left(b, \frac{y}{t}, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 a #s(literal 1 binary64)) < -5e16 or 5e7 < (+.f64 a #s(literal 1 binary64)) Initial program 75.3%
Taylor expanded in y around 0
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6456.4
Applied rewrites56.4%
if -5e16 < (+.f64 a #s(literal 1 binary64)) < 0.999999999999000022Initial program 75.3%
Applied rewrites75.5%
Taylor expanded in b around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6440.5
Applied rewrites40.5%
if 0.999999999999000022 < (+.f64 a #s(literal 1 binary64)) < 5e7Initial program 75.3%
Taylor expanded in a around 0
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6445.3
Applied rewrites45.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (+ z (/ (* t x) y)) b)))
(if (<= y -6.2e+173)
t_1
(if (<= y -3.5e+61)
(/ (* z y) (fma b y (* t (+ 1.0 a))))
(if (<= y -7.4e-162)
(/ x (fma b (/ y t) (- a -1.0)))
(if (<= y 4.8e+79) (/ (+ x (/ (* y z) t)) (- a -1.0)) t_1))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (z + ((t * x) / y)) / b;
double tmp;
if (y <= -6.2e+173) {
tmp = t_1;
} else if (y <= -3.5e+61) {
tmp = (z * y) / fma(b, y, (t * (1.0 + a)));
} else if (y <= -7.4e-162) {
tmp = x / fma(b, (y / t), (a - -1.0));
} else if (y <= 4.8e+79) {
tmp = (x + ((y * z) / t)) / (a - -1.0);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(z + Float64(Float64(t * x) / y)) / b) tmp = 0.0 if (y <= -6.2e+173) tmp = t_1; elseif (y <= -3.5e+61) tmp = Float64(Float64(z * y) / fma(b, y, Float64(t * Float64(1.0 + a)))); elseif (y <= -7.4e-162) tmp = Float64(x / fma(b, Float64(y / t), Float64(a - -1.0))); elseif (y <= 4.8e+79) tmp = Float64(Float64(x + Float64(Float64(y * z) / t)) / Float64(a - -1.0)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(z + N[(N[(t * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]}, If[LessEqual[y, -6.2e+173], t$95$1, If[LessEqual[y, -3.5e+61], N[(N[(z * y), $MachinePrecision] / N[(b * y + N[(t * N[(1.0 + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -7.4e-162], N[(x / N[(b * N[(y / t), $MachinePrecision] + N[(a - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.8e+79], N[(N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / N[(a - -1.0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z + \frac{t \cdot x}{y}}{b}\\
\mathbf{if}\;y \leq -6.2 \cdot 10^{+173}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -3.5 \cdot 10^{+61}:\\
\;\;\;\;\frac{z \cdot y}{\mathsf{fma}\left(b, y, t \cdot \left(1 + a\right)\right)}\\
\mathbf{elif}\;y \leq -7.4 \cdot 10^{-162}:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(b, \frac{y}{t}, a - -1\right)}\\
\mathbf{elif}\;y \leq 4.8 \cdot 10^{+79}:\\
\;\;\;\;\frac{x + \frac{y \cdot z}{t}}{a - -1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -6.2e173 or 4.79999999999999971e79 < y Initial program 75.3%
Applied rewrites75.5%
Taylor expanded in b around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6440.5
Applied rewrites40.5%
if -6.2e173 < y < -3.50000000000000018e61Initial program 75.3%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6433.4
Applied rewrites33.4%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-+.f6441.9
Applied rewrites41.9%
if -3.50000000000000018e61 < y < -7.4000000000000003e-162Initial program 75.3%
Taylor expanded in x around inf
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6454.4
Applied rewrites54.4%
if -7.4000000000000003e-162 < y < 4.79999999999999971e79Initial program 75.3%
Taylor expanded in y around 0
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6456.4
Applied rewrites56.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ x (/ (* y z) t)))
(t_2 (/ t_1 (+ (+ a 1.0) (/ (* y b) t))))
(t_3 (/ t_1 (- a -1.0))))
(if (<= t_2 -1e-27)
t_3
(if (<= t_2 -2e-82)
(/ (/ (fma t x (* y z)) y) b)
(if (<= t_2 2e-310)
(/ x (fma b (/ y t) (- a -1.0)))
(if (<= t_2 1e+279) t_3 (/ z b)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + ((y * z) / t);
double t_2 = t_1 / ((a + 1.0) + ((y * b) / t));
double t_3 = t_1 / (a - -1.0);
double tmp;
if (t_2 <= -1e-27) {
tmp = t_3;
} else if (t_2 <= -2e-82) {
tmp = (fma(t, x, (y * z)) / y) / b;
} else if (t_2 <= 2e-310) {
tmp = x / fma(b, (y / t), (a - -1.0));
} else if (t_2 <= 1e+279) {
tmp = t_3;
} else {
tmp = z / b;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(x + Float64(Float64(y * z) / t)) t_2 = Float64(t_1 / Float64(Float64(a + 1.0) + Float64(Float64(y * b) / t))) t_3 = Float64(t_1 / Float64(a - -1.0)) tmp = 0.0 if (t_2 <= -1e-27) tmp = t_3; elseif (t_2 <= -2e-82) tmp = Float64(Float64(fma(t, x, Float64(y * z)) / y) / b); elseif (t_2 <= 2e-310) tmp = Float64(x / fma(b, Float64(y / t), Float64(a - -1.0))); elseif (t_2 <= 1e+279) tmp = t_3; else tmp = Float64(z / b); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 / N[(N[(a + 1.0), $MachinePrecision] + N[(N[(y * b), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 / N[(a - -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e-27], t$95$3, If[LessEqual[t$95$2, -2e-82], N[(N[(N[(t * x + N[(y * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] / b), $MachinePrecision], If[LessEqual[t$95$2, 2e-310], N[(x / N[(b * N[(y / t), $MachinePrecision] + N[(a - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+279], t$95$3, N[(z / b), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y \cdot z}{t}\\
t_2 := \frac{t\_1}{\left(a + 1\right) + \frac{y \cdot b}{t}}\\
t_3 := \frac{t\_1}{a - -1}\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{-27}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-82}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(t, x, y \cdot z\right)}{y}}{b}\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-310}:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(b, \frac{y}{t}, a - -1\right)}\\
\mathbf{elif}\;t\_2 \leq 10^{+279}:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{b}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < -1e-27 or 1.999999999999994e-310 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < 1.00000000000000006e279Initial program 75.3%
Taylor expanded in y around 0
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6456.4
Applied rewrites56.4%
if -1e-27 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < -2e-82Initial program 75.3%
Applied rewrites75.5%
Taylor expanded in b around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6440.5
Applied rewrites40.5%
Taylor expanded in y around 0
lower-/.f64N/A
lower-fma.f64N/A
lower-*.f6435.0
Applied rewrites35.0%
if -2e-82 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < 1.999999999999994e-310Initial program 75.3%
Taylor expanded in x around inf
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6454.4
Applied rewrites54.4%
if 1.00000000000000006e279 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) Initial program 75.3%
Taylor expanded in y around inf
lower-/.f6433.9
Applied rewrites33.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (+ x (/ (* y z) t)) (+ (+ a 1.0) (/ (* y b) t))))
(t_2 (/ (fma y (/ z t) x) (- a -1.0))))
(if (<= t_1 -1e-15)
t_2
(if (<= t_1 -2e-82)
(/ (/ (fma t x (* y z)) y) b)
(if (<= t_1 2e-310)
(/ x (fma b (/ y t) (- a -1.0)))
(if (<= t_1 1e+279) t_2 (/ z b)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t));
double t_2 = fma(y, (z / t), x) / (a - -1.0);
double tmp;
if (t_1 <= -1e-15) {
tmp = t_2;
} else if (t_1 <= -2e-82) {
tmp = (fma(t, x, (y * z)) / y) / b;
} else if (t_1 <= 2e-310) {
tmp = x / fma(b, (y / t), (a - -1.0));
} else if (t_1 <= 1e+279) {
tmp = t_2;
} else {
tmp = z / b;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + Float64(Float64(y * z) / t)) / Float64(Float64(a + 1.0) + Float64(Float64(y * b) / t))) t_2 = Float64(fma(y, Float64(z / t), x) / Float64(a - -1.0)) tmp = 0.0 if (t_1 <= -1e-15) tmp = t_2; elseif (t_1 <= -2e-82) tmp = Float64(Float64(fma(t, x, Float64(y * z)) / y) / b); elseif (t_1 <= 2e-310) tmp = Float64(x / fma(b, Float64(y / t), Float64(a - -1.0))); elseif (t_1 <= 1e+279) tmp = t_2; else tmp = Float64(z / b); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / N[(N[(a + 1.0), $MachinePrecision] + N[(N[(y * b), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y * N[(z / t), $MachinePrecision] + x), $MachinePrecision] / N[(a - -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-15], t$95$2, If[LessEqual[t$95$1, -2e-82], N[(N[(N[(t * x + N[(y * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] / b), $MachinePrecision], If[LessEqual[t$95$1, 2e-310], N[(x / N[(b * N[(y / t), $MachinePrecision] + N[(a - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+279], t$95$2, N[(z / b), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}\\
t_2 := \frac{\mathsf{fma}\left(y, \frac{z}{t}, x\right)}{a - -1}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-15}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq -2 \cdot 10^{-82}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(t, x, y \cdot z\right)}{y}}{b}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-310}:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(b, \frac{y}{t}, a - -1\right)}\\
\mathbf{elif}\;t\_1 \leq 10^{+279}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{b}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < -1.0000000000000001e-15 or 1.999999999999994e-310 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < 1.00000000000000006e279Initial program 75.3%
Taylor expanded in b around 0
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6456.4
Applied rewrites56.4%
if -1.0000000000000001e-15 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < -2e-82Initial program 75.3%
Applied rewrites75.5%
Taylor expanded in b around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6440.5
Applied rewrites40.5%
Taylor expanded in y around 0
lower-/.f64N/A
lower-fma.f64N/A
lower-*.f6435.0
Applied rewrites35.0%
if -2e-82 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < 1.999999999999994e-310Initial program 75.3%
Taylor expanded in x around inf
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6454.4
Applied rewrites54.4%
if 1.00000000000000006e279 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) Initial program 75.3%
Taylor expanded in y around inf
lower-/.f6433.9
Applied rewrites33.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (+ x (/ (* y z) t)) (+ (+ a 1.0) (/ (* y b) t))))
(t_2 (/ (fma y (/ z t) x) (- a -1.0))))
(if (<= t_1 -1e-15)
t_2
(if (<= t_1 -2e-82)
(/ (+ z (/ (* t x) y)) b)
(if (<= t_1 2e-310)
(/ x (fma b (/ y t) (- a -1.0)))
(if (<= t_1 1e+279) t_2 (/ z b)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t));
double t_2 = fma(y, (z / t), x) / (a - -1.0);
double tmp;
if (t_1 <= -1e-15) {
tmp = t_2;
} else if (t_1 <= -2e-82) {
tmp = (z + ((t * x) / y)) / b;
} else if (t_1 <= 2e-310) {
tmp = x / fma(b, (y / t), (a - -1.0));
} else if (t_1 <= 1e+279) {
tmp = t_2;
} else {
tmp = z / b;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + Float64(Float64(y * z) / t)) / Float64(Float64(a + 1.0) + Float64(Float64(y * b) / t))) t_2 = Float64(fma(y, Float64(z / t), x) / Float64(a - -1.0)) tmp = 0.0 if (t_1 <= -1e-15) tmp = t_2; elseif (t_1 <= -2e-82) tmp = Float64(Float64(z + Float64(Float64(t * x) / y)) / b); elseif (t_1 <= 2e-310) tmp = Float64(x / fma(b, Float64(y / t), Float64(a - -1.0))); elseif (t_1 <= 1e+279) tmp = t_2; else tmp = Float64(z / b); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / N[(N[(a + 1.0), $MachinePrecision] + N[(N[(y * b), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y * N[(z / t), $MachinePrecision] + x), $MachinePrecision] / N[(a - -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-15], t$95$2, If[LessEqual[t$95$1, -2e-82], N[(N[(z + N[(N[(t * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision], If[LessEqual[t$95$1, 2e-310], N[(x / N[(b * N[(y / t), $MachinePrecision] + N[(a - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+279], t$95$2, N[(z / b), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}\\
t_2 := \frac{\mathsf{fma}\left(y, \frac{z}{t}, x\right)}{a - -1}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-15}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq -2 \cdot 10^{-82}:\\
\;\;\;\;\frac{z + \frac{t \cdot x}{y}}{b}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-310}:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(b, \frac{y}{t}, a - -1\right)}\\
\mathbf{elif}\;t\_1 \leq 10^{+279}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{b}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < -1.0000000000000001e-15 or 1.999999999999994e-310 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < 1.00000000000000006e279Initial program 75.3%
Taylor expanded in b around 0
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6456.4
Applied rewrites56.4%
if -1.0000000000000001e-15 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < -2e-82Initial program 75.3%
Applied rewrites75.5%
Taylor expanded in b around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6440.5
Applied rewrites40.5%
if -2e-82 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < 1.999999999999994e-310Initial program 75.3%
Taylor expanded in x around inf
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6454.4
Applied rewrites54.4%
if 1.00000000000000006e279 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) Initial program 75.3%
Taylor expanded in y around inf
lower-/.f6433.9
Applied rewrites33.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (+ z (/ (* t x) y)) b)))
(if (<= y -4.3e+42)
t_1
(if (<= y 1.3e+97) (/ x (fma b (/ y t) (- a -1.0))) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (z + ((t * x) / y)) / b;
double tmp;
if (y <= -4.3e+42) {
tmp = t_1;
} else if (y <= 1.3e+97) {
tmp = x / fma(b, (y / t), (a - -1.0));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(z + Float64(Float64(t * x) / y)) / b) tmp = 0.0 if (y <= -4.3e+42) tmp = t_1; elseif (y <= 1.3e+97) tmp = Float64(x / fma(b, Float64(y / t), Float64(a - -1.0))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(z + N[(N[(t * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]}, If[LessEqual[y, -4.3e+42], t$95$1, If[LessEqual[y, 1.3e+97], N[(x / N[(b * N[(y / t), $MachinePrecision] + N[(a - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z + \frac{t \cdot x}{y}}{b}\\
\mathbf{if}\;y \leq -4.3 \cdot 10^{+42}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.3 \cdot 10^{+97}:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(b, \frac{y}{t}, a - -1\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -4.2999999999999998e42 or 1.3e97 < y Initial program 75.3%
Applied rewrites75.5%
Taylor expanded in b around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6440.5
Applied rewrites40.5%
if -4.2999999999999998e42 < y < 1.3e97Initial program 75.3%
Taylor expanded in x around inf
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6454.4
Applied rewrites54.4%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (/ (+ z (/ (* t x) y)) b))) (if (<= y -2.2e+41) t_1 (if (<= y 0.00016) (/ x (- a -1.0)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (z + ((t * x) / y)) / b;
double tmp;
if (y <= -2.2e+41) {
tmp = t_1;
} else if (y <= 0.00016) {
tmp = x / (a - -1.0);
} 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 = (z + ((t * x) / y)) / b
if (y <= (-2.2d+41)) then
tmp = t_1
else if (y <= 0.00016d0) then
tmp = x / (a - (-1.0d0))
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 = (z + ((t * x) / y)) / b;
double tmp;
if (y <= -2.2e+41) {
tmp = t_1;
} else if (y <= 0.00016) {
tmp = x / (a - -1.0);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (z + ((t * x) / y)) / b tmp = 0 if y <= -2.2e+41: tmp = t_1 elif y <= 0.00016: tmp = x / (a - -1.0) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(z + Float64(Float64(t * x) / y)) / b) tmp = 0.0 if (y <= -2.2e+41) tmp = t_1; elseif (y <= 0.00016) tmp = Float64(x / Float64(a - -1.0)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (z + ((t * x) / y)) / b; tmp = 0.0; if (y <= -2.2e+41) tmp = t_1; elseif (y <= 0.00016) tmp = x / (a - -1.0); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(z + N[(N[(t * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]}, If[LessEqual[y, -2.2e+41], t$95$1, If[LessEqual[y, 0.00016], N[(x / N[(a - -1.0), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z + \frac{t \cdot x}{y}}{b}\\
\mathbf{if}\;y \leq -2.2 \cdot 10^{+41}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 0.00016:\\
\;\;\;\;\frac{x}{a - -1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -2.1999999999999999e41 or 1.60000000000000013e-4 < y Initial program 75.3%
Applied rewrites75.5%
Taylor expanded in b around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6440.5
Applied rewrites40.5%
if -2.1999999999999999e41 < y < 1.60000000000000013e-4Initial program 75.3%
Taylor expanded in y around 0
lower-/.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6442.3
Applied rewrites42.3%
(FPCore (x y z t a b) :precision binary64 (if (<= y -4.3e+42) (/ z b) (if (<= y 5e+79) (/ x (- a -1.0)) (/ z b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -4.3e+42) {
tmp = z / b;
} else if (y <= 5e+79) {
tmp = x / (a - -1.0);
} else {
tmp = z / b;
}
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) :: tmp
if (y <= (-4.3d+42)) then
tmp = z / b
else if (y <= 5d+79) then
tmp = x / (a - (-1.0d0))
else
tmp = z / b
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -4.3e+42) {
tmp = z / b;
} else if (y <= 5e+79) {
tmp = x / (a - -1.0);
} else {
tmp = z / b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y <= -4.3e+42: tmp = z / b elif y <= 5e+79: tmp = x / (a - -1.0) else: tmp = z / b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -4.3e+42) tmp = Float64(z / b); elseif (y <= 5e+79) tmp = Float64(x / Float64(a - -1.0)); else tmp = Float64(z / b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (y <= -4.3e+42) tmp = z / b; elseif (y <= 5e+79) tmp = x / (a - -1.0); else tmp = z / b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -4.3e+42], N[(z / b), $MachinePrecision], If[LessEqual[y, 5e+79], N[(x / N[(a - -1.0), $MachinePrecision]), $MachinePrecision], N[(z / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.3 \cdot 10^{+42}:\\
\;\;\;\;\frac{z}{b}\\
\mathbf{elif}\;y \leq 5 \cdot 10^{+79}:\\
\;\;\;\;\frac{x}{a - -1}\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{b}\\
\end{array}
\end{array}
if y < -4.2999999999999998e42 or 5e79 < y Initial program 75.3%
Taylor expanded in y around inf
lower-/.f6433.9
Applied rewrites33.9%
if -4.2999999999999998e42 < y < 5e79Initial program 75.3%
Taylor expanded in y around 0
lower-/.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6442.3
Applied rewrites42.3%
(FPCore (x y z t a b) :precision binary64 (if (<= a -2.5e+15) (/ x a) (if (<= a 105000000.0) (/ z b) (/ x a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -2.5e+15) {
tmp = x / a;
} else if (a <= 105000000.0) {
tmp = z / b;
} else {
tmp = x / a;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, 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) :: tmp
if (a <= (-2.5d+15)) then
tmp = x / a
else if (a <= 105000000.0d0) then
tmp = z / b
else
tmp = x / a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -2.5e+15) {
tmp = x / a;
} else if (a <= 105000000.0) {
tmp = z / b;
} else {
tmp = x / a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if a <= -2.5e+15: tmp = x / a elif a <= 105000000.0: tmp = z / b else: tmp = x / a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -2.5e+15) tmp = Float64(x / a); elseif (a <= 105000000.0) tmp = Float64(z / b); else tmp = Float64(x / a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (a <= -2.5e+15) tmp = x / a; elseif (a <= 105000000.0) tmp = z / b; else tmp = x / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -2.5e+15], N[(x / a), $MachinePrecision], If[LessEqual[a, 105000000.0], N[(z / b), $MachinePrecision], N[(x / a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.5 \cdot 10^{+15}:\\
\;\;\;\;\frac{x}{a}\\
\mathbf{elif}\;a \leq 105000000:\\
\;\;\;\;\frac{z}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{a}\\
\end{array}
\end{array}
if a < -2.5e15 or 1.05e8 < a Initial program 75.3%
Taylor expanded in y around 0
lower-/.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6442.3
Applied rewrites42.3%
Taylor expanded in a around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6419.3
Applied rewrites19.3%
Taylor expanded in a around inf
lower-/.f6425.6
Applied rewrites25.6%
if -2.5e15 < a < 1.05e8Initial program 75.3%
Taylor expanded in y around inf
lower-/.f6433.9
Applied rewrites33.9%
(FPCore (x y z t a b) :precision binary64 (/ x a))
double code(double x, double y, double z, double t, double a, double b) {
return x / a;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, 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 / a
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x / a;
}
def code(x, y, z, t, a, b): return x / a
function code(x, y, z, t, a, b) return Float64(x / a) end
function tmp = code(x, y, z, t, a, b) tmp = x / a; end
code[x_, y_, z_, t_, a_, b_] := N[(x / a), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{a}
\end{array}
Initial program 75.3%
Taylor expanded in y around 0
lower-/.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6442.3
Applied rewrites42.3%
Taylor expanded in a around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6419.3
Applied rewrites19.3%
Taylor expanded in a around inf
lower-/.f6425.6
Applied rewrites25.6%
herbie shell --seed 2025139
(FPCore (x y z t a b)
:name "Diagrams.Solve.Tridiagonal:solveCyclicTriDiagonal from diagrams-solve-0.1, B"
:precision binary64
(/ (+ x (/ (* y z) t)) (+ (+ a 1.0) (/ (* y b) t))))