
(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 (/ (fma (/ y t) z x) (fma (/ b t) y (+ a 1.0)))))
(if (<= t -2e+71)
t_1
(if (<= t -1.25e-141)
(fma
(/ z (fma (fma (/ y t) b a) t t))
y
(/ x (fma (/ y t) b (+ a 1.0))))
(if (<= t 1e-18) (/ (fma t x (* y z)) (fma b y (fma a t t))) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma((y / t), z, x) / fma((b / t), y, (a + 1.0));
double tmp;
if (t <= -2e+71) {
tmp = t_1;
} else if (t <= -1.25e-141) {
tmp = fma((z / fma(fma((y / t), b, a), t, t)), y, (x / fma((y / t), b, (a + 1.0))));
} else if (t <= 1e-18) {
tmp = fma(t, x, (y * z)) / fma(b, y, fma(a, t, t));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(fma(Float64(y / t), z, x) / fma(Float64(b / t), y, Float64(a + 1.0))) tmp = 0.0 if (t <= -2e+71) tmp = t_1; elseif (t <= -1.25e-141) tmp = fma(Float64(z / fma(fma(Float64(y / t), b, a), t, t)), y, Float64(x / fma(Float64(y / t), b, Float64(a + 1.0)))); elseif (t <= 1e-18) tmp = Float64(fma(t, x, Float64(y * z)) / fma(b, y, fma(a, t, t))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(y / t), $MachinePrecision] * z + x), $MachinePrecision] / N[(N[(b / t), $MachinePrecision] * y + N[(a + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -2e+71], t$95$1, If[LessEqual[t, -1.25e-141], N[(N[(z / N[(N[(N[(y / t), $MachinePrecision] * b + a), $MachinePrecision] * t + t), $MachinePrecision]), $MachinePrecision] * y + N[(x / N[(N[(y / t), $MachinePrecision] * b + N[(a + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1e-18], N[(N[(t * x + N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(b * y + N[(a * t + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\mathsf{fma}\left(\frac{y}{t}, z, x\right)}{\mathsf{fma}\left(\frac{b}{t}, y, a + 1\right)}\\
\mathbf{if}\;t \leq -2 \cdot 10^{+71}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -1.25 \cdot 10^{-141}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{\mathsf{fma}\left(\mathsf{fma}\left(\frac{y}{t}, b, a\right), t, t\right)}, y, \frac{x}{\mathsf{fma}\left(\frac{y}{t}, b, a + 1\right)}\right)\\
\mathbf{elif}\;t \leq 10^{-18}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t, x, y \cdot z\right)}{\mathsf{fma}\left(b, y, \mathsf{fma}\left(a, t, t\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -2.0000000000000001e71 or 1.0000000000000001e-18 < t Initial program 74.6%
Applied rewrites76.8%
Applied rewrites74.5%
if -2.0000000000000001e71 < t < -1.25e-141Initial program 74.6%
Applied rewrites75.7%
if -1.25e-141 < t < 1.0000000000000001e-18Initial program 74.6%
Applied rewrites79.3%
Applied rewrites71.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma (/ y t) b (+ a 1.0)))
(t_2 (fma z (/ (/ y t) t_1) (/ x t_1))))
(if (<= t -1.25e-141)
t_2
(if (<= t 1.6e-18) (/ (fma t x (* y z)) (fma b y (fma a t t))) t_2))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma((y / t), b, (a + 1.0));
double t_2 = fma(z, ((y / t) / t_1), (x / t_1));
double tmp;
if (t <= -1.25e-141) {
tmp = t_2;
} else if (t <= 1.6e-18) {
tmp = fma(t, x, (y * z)) / fma(b, y, fma(a, t, t));
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(Float64(y / t), b, Float64(a + 1.0)) t_2 = fma(z, Float64(Float64(y / t) / t_1), Float64(x / t_1)) tmp = 0.0 if (t <= -1.25e-141) tmp = t_2; elseif (t <= 1.6e-18) tmp = Float64(fma(t, x, Float64(y * z)) / fma(b, y, fma(a, t, t))); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(y / t), $MachinePrecision] * b + N[(a + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(z * N[(N[(y / t), $MachinePrecision] / t$95$1), $MachinePrecision] + N[(x / t$95$1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.25e-141], t$95$2, If[LessEqual[t, 1.6e-18], N[(N[(t * x + N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(b * y + N[(a * t + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{y}{t}, b, a + 1\right)\\
t_2 := \mathsf{fma}\left(z, \frac{\frac{y}{t}}{t\_1}, \frac{x}{t\_1}\right)\\
\mathbf{if}\;t \leq -1.25 \cdot 10^{-141}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq 1.6 \cdot 10^{-18}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t, x, y \cdot z\right)}{\mathsf{fma}\left(b, y, \mathsf{fma}\left(a, t, t\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if t < -1.25e-141 or 1.6e-18 < t Initial program 74.6%
Applied rewrites79.3%
if -1.25e-141 < t < 1.6e-18Initial program 74.6%
Applied rewrites79.3%
Applied rewrites71.0%
(FPCore (x y z t a b)
:precision binary64
(if (<= t -2.9e-81)
(/ (fma (/ z t) y x) (fma (/ y t) b (+ a 1.0)))
(if (<= t 1e-18)
(/ (fma t x (* y z)) (fma b y (fma a t t)))
(/ (fma (/ y t) z x) (fma (/ b t) y (+ a 1.0))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -2.9e-81) {
tmp = fma((z / t), y, x) / fma((y / t), b, (a + 1.0));
} else if (t <= 1e-18) {
tmp = fma(t, x, (y * z)) / fma(b, y, fma(a, t, t));
} else {
tmp = fma((y / t), z, x) / fma((b / t), y, (a + 1.0));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -2.9e-81) tmp = Float64(fma(Float64(z / t), y, x) / fma(Float64(y / t), b, Float64(a + 1.0))); elseif (t <= 1e-18) tmp = Float64(fma(t, x, Float64(y * z)) / fma(b, y, fma(a, t, t))); else tmp = Float64(fma(Float64(y / t), z, x) / fma(Float64(b / t), y, Float64(a + 1.0))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -2.9e-81], N[(N[(N[(z / t), $MachinePrecision] * y + x), $MachinePrecision] / N[(N[(y / t), $MachinePrecision] * b + N[(a + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1e-18], N[(N[(t * x + N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(b * y + N[(a * t + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y / t), $MachinePrecision] * z + x), $MachinePrecision] / N[(N[(b / t), $MachinePrecision] * y + N[(a + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.9 \cdot 10^{-81}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{z}{t}, y, x\right)}{\mathsf{fma}\left(\frac{y}{t}, b, a + 1\right)}\\
\mathbf{elif}\;t \leq 10^{-18}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t, x, y \cdot z\right)}{\mathsf{fma}\left(b, y, \mathsf{fma}\left(a, t, t\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{y}{t}, z, x\right)}{\mathsf{fma}\left(\frac{b}{t}, y, a + 1\right)}\\
\end{array}
\end{array}
if t < -2.89999999999999989e-81Initial program 74.6%
Applied rewrites76.8%
Applied rewrites74.3%
if -2.89999999999999989e-81 < t < 1.0000000000000001e-18Initial program 74.6%
Applied rewrites79.3%
Applied rewrites71.0%
if 1.0000000000000001e-18 < t Initial program 74.6%
Applied rewrites76.8%
Applied rewrites74.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (fma (/ y t) z x) (fma (/ b t) y (+ a 1.0)))))
(if (<= t -1.4e+71)
t_1
(if (<= t 1e-18) (/ (fma t x (* y z)) (fma b y (fma a t t))) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma((y / t), z, x) / fma((b / t), y, (a + 1.0));
double tmp;
if (t <= -1.4e+71) {
tmp = t_1;
} else if (t <= 1e-18) {
tmp = fma(t, x, (y * z)) / fma(b, y, fma(a, t, t));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(fma(Float64(y / t), z, x) / fma(Float64(b / t), y, Float64(a + 1.0))) tmp = 0.0 if (t <= -1.4e+71) tmp = t_1; elseif (t <= 1e-18) tmp = Float64(fma(t, x, Float64(y * z)) / fma(b, y, fma(a, t, t))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(y / t), $MachinePrecision] * z + x), $MachinePrecision] / N[(N[(b / t), $MachinePrecision] * y + N[(a + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.4e+71], t$95$1, If[LessEqual[t, 1e-18], N[(N[(t * x + N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(b * y + N[(a * t + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\mathsf{fma}\left(\frac{y}{t}, z, x\right)}{\mathsf{fma}\left(\frac{b}{t}, y, a + 1\right)}\\
\mathbf{if}\;t \leq -1.4 \cdot 10^{+71}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 10^{-18}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t, x, y \cdot z\right)}{\mathsf{fma}\left(b, y, \mathsf{fma}\left(a, t, t\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.40000000000000001e71 or 1.0000000000000001e-18 < t Initial program 74.6%
Applied rewrites76.8%
Applied rewrites74.5%
if -1.40000000000000001e71 < t < 1.0000000000000001e-18Initial program 74.6%
Applied rewrites79.3%
Applied rewrites71.0%
(FPCore (x y z t a b)
:precision binary64
(if (<= t -3.1e+99)
(/ (fma (/ y t) z x) (+ 1.0 a))
(if (<= t 1.45e+88)
(/ (fma t x (* y z)) (fma b y (fma a t t)))
(/ (+ x (/ (* y z) t)) (+ 1.0 a)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -3.1e+99) {
tmp = fma((y / t), z, x) / (1.0 + a);
} else if (t <= 1.45e+88) {
tmp = fma(t, x, (y * z)) / fma(b, y, fma(a, t, t));
} else {
tmp = (x + ((y * z) / t)) / (1.0 + a);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -3.1e+99) tmp = Float64(fma(Float64(y / t), z, x) / Float64(1.0 + a)); elseif (t <= 1.45e+88) tmp = Float64(fma(t, x, Float64(y * z)) / fma(b, y, fma(a, t, t))); else tmp = Float64(Float64(x + Float64(Float64(y * z) / t)) / Float64(1.0 + a)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -3.1e+99], N[(N[(N[(y / t), $MachinePrecision] * z + x), $MachinePrecision] / N[(1.0 + a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.45e+88], N[(N[(t * x + N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(b * y + N[(a * t + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / N[(1.0 + a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.1 \cdot 10^{+99}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{y}{t}, z, x\right)}{1 + a}\\
\mathbf{elif}\;t \leq 1.45 \cdot 10^{+88}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t, x, y \cdot z\right)}{\mathsf{fma}\left(b, y, \mathsf{fma}\left(a, t, t\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{y \cdot z}{t}}{1 + a}\\
\end{array}
\end{array}
if t < -3.1000000000000001e99Initial program 74.6%
Applied rewrites76.8%
Taylor expanded in y around 0
Applied rewrites57.6%
if -3.1000000000000001e99 < t < 1.45e88Initial program 74.6%
Applied rewrites79.3%
Applied rewrites71.0%
if 1.45e88 < t Initial program 74.6%
Taylor expanded in y around 0
Applied rewrites55.8%
(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 z (/ (/ y t) (+ 1.0 a)) (/ x (+ 1.0 a)))))
(if (<= t_1 -5e-313)
t_2
(if (<= t_1 0.0)
(fma (/ x y) (/ t b) (/ z b))
(if (<= t_1 INFINITY) t_2 (/ (fma x (/ t y) 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(z, ((y / t) / (1.0 + a)), (x / (1.0 + a)));
double tmp;
if (t_1 <= -5e-313) {
tmp = t_2;
} else if (t_1 <= 0.0) {
tmp = fma((x / y), (t / b), (z / b));
} else if (t_1 <= ((double) INFINITY)) {
tmp = t_2;
} else {
tmp = fma(x, (t / y), 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 = fma(z, Float64(Float64(y / t) / Float64(1.0 + a)), Float64(x / Float64(1.0 + a))) tmp = 0.0 if (t_1 <= -5e-313) tmp = t_2; elseif (t_1 <= 0.0) tmp = fma(Float64(x / y), Float64(t / b), Float64(z / b)); elseif (t_1 <= Inf) tmp = t_2; else tmp = Float64(fma(x, Float64(t / y), 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[(z * N[(N[(y / t), $MachinePrecision] / N[(1.0 + a), $MachinePrecision]), $MachinePrecision] + N[(x / N[(1.0 + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e-313], t$95$2, If[LessEqual[t$95$1, 0.0], N[(N[(x / y), $MachinePrecision] * N[(t / b), $MachinePrecision] + N[(z / b), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], t$95$2, N[(N[(x * N[(t / y), $MachinePrecision] + z), $MachinePrecision] / 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 := \mathsf{fma}\left(z, \frac{\frac{y}{t}}{1 + a}, \frac{x}{1 + a}\right)\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{-313}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{y}, \frac{t}{b}, \frac{z}{b}\right)\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, \frac{t}{y}, z\right)}{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))) < -5.00000000002e-313 or -0.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < +inf.0Initial program 74.6%
Applied rewrites79.3%
Taylor expanded in y around 0
Applied rewrites63.5%
Taylor expanded in y around 0
Applied rewrites57.6%
if -5.00000000002e-313 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < -0.0Initial program 74.6%
Taylor expanded in b around inf
Applied rewrites26.3%
Applied rewrites31.1%
Applied rewrites40.3%
if +inf.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) Initial program 74.6%
Taylor expanded in b around inf
Applied rewrites26.3%
Applied rewrites31.1%
Applied rewrites42.2%
(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 -5e-313)
(/ (fma (/ y t) z x) (+ 1.0 a))
(if (<= t_2 0.0)
(fma (/ x y) (/ t b) (/ z b))
(if (<= t_2 5e+282) (/ t_1 (+ 1.0 a)) (/ (fma x (/ t y) 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 <= -5e-313) {
tmp = fma((y / t), z, x) / (1.0 + a);
} else if (t_2 <= 0.0) {
tmp = fma((x / y), (t / b), (z / b));
} else if (t_2 <= 5e+282) {
tmp = t_1 / (1.0 + a);
} else {
tmp = fma(x, (t / y), 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 <= -5e-313) tmp = Float64(fma(Float64(y / t), z, x) / Float64(1.0 + a)); elseif (t_2 <= 0.0) tmp = fma(Float64(x / y), Float64(t / b), Float64(z / b)); elseif (t_2 <= 5e+282) tmp = Float64(t_1 / Float64(1.0 + a)); else tmp = Float64(fma(x, Float64(t / y), 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, -5e-313], N[(N[(N[(y / t), $MachinePrecision] * z + x), $MachinePrecision] / N[(1.0 + a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.0], N[(N[(x / y), $MachinePrecision] * N[(t / b), $MachinePrecision] + N[(z / b), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 5e+282], N[(t$95$1 / N[(1.0 + a), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(t / y), $MachinePrecision] + z), $MachinePrecision] / 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 -5 \cdot 10^{-313}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{y}{t}, z, x\right)}{1 + a}\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{y}, \frac{t}{b}, \frac{z}{b}\right)\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+282}:\\
\;\;\;\;\frac{t\_1}{1 + a}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, \frac{t}{y}, z\right)}{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))) < -5.00000000002e-313Initial program 74.6%
Applied rewrites76.8%
Taylor expanded in y around 0
Applied rewrites57.6%
if -5.00000000002e-313 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < -0.0Initial program 74.6%
Taylor expanded in b around inf
Applied rewrites26.3%
Applied rewrites31.1%
Applied rewrites40.3%
if -0.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < 4.99999999999999978e282Initial program 74.6%
Taylor expanded in y around 0
Applied rewrites55.8%
if 4.99999999999999978e282 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) Initial program 74.6%
Taylor expanded in b around inf
Applied rewrites26.3%
Applied rewrites31.1%
Applied rewrites42.2%
(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 t) z x) (+ 1.0 a))))
(if (<= t_1 -5e-313)
t_2
(if (<= t_1 0.0)
(fma (/ x y) (/ t b) (/ z b))
(if (<= t_1 5e+282) t_2 (/ (fma x (/ t y) 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 / t), z, x) / (1.0 + a);
double tmp;
if (t_1 <= -5e-313) {
tmp = t_2;
} else if (t_1 <= 0.0) {
tmp = fma((x / y), (t / b), (z / b));
} else if (t_1 <= 5e+282) {
tmp = t_2;
} else {
tmp = fma(x, (t / y), 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(Float64(y / t), z, x) / Float64(1.0 + a)) tmp = 0.0 if (t_1 <= -5e-313) tmp = t_2; elseif (t_1 <= 0.0) tmp = fma(Float64(x / y), Float64(t / b), Float64(z / b)); elseif (t_1 <= 5e+282) tmp = t_2; else tmp = Float64(fma(x, Float64(t / y), 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[(N[(y / t), $MachinePrecision] * z + x), $MachinePrecision] / N[(1.0 + a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e-313], t$95$2, If[LessEqual[t$95$1, 0.0], N[(N[(x / y), $MachinePrecision] * N[(t / b), $MachinePrecision] + N[(z / b), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+282], t$95$2, N[(N[(x * N[(t / y), $MachinePrecision] + z), $MachinePrecision] / 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(\frac{y}{t}, z, x\right)}{1 + a}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{-313}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{y}, \frac{t}{b}, \frac{z}{b}\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+282}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, \frac{t}{y}, z\right)}{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))) < -5.00000000002e-313 or -0.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < 4.99999999999999978e282Initial program 74.6%
Applied rewrites76.8%
Taylor expanded in y around 0
Applied rewrites57.6%
if -5.00000000002e-313 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < -0.0Initial program 74.6%
Taylor expanded in b around inf
Applied rewrites26.3%
Applied rewrites31.1%
Applied rewrites40.3%
if 4.99999999999999978e282 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) Initial program 74.6%
Taylor expanded in b around inf
Applied rewrites26.3%
Applied rewrites31.1%
Applied rewrites42.2%
(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 t) z x) (+ 1.0 a))))
(if (<= t_1 -5e-313)
t_2
(if (<= t_1 0.0)
(/ (fma (/ x y) t z) b)
(if (<= t_1 5e+282) t_2 (/ (fma x (/ t y) 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 / t), z, x) / (1.0 + a);
double tmp;
if (t_1 <= -5e-313) {
tmp = t_2;
} else if (t_1 <= 0.0) {
tmp = fma((x / y), t, z) / b;
} else if (t_1 <= 5e+282) {
tmp = t_2;
} else {
tmp = fma(x, (t / y), 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(Float64(y / t), z, x) / Float64(1.0 + a)) tmp = 0.0 if (t_1 <= -5e-313) tmp = t_2; elseif (t_1 <= 0.0) tmp = Float64(fma(Float64(x / y), t, z) / b); elseif (t_1 <= 5e+282) tmp = t_2; else tmp = Float64(fma(x, Float64(t / y), 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[(N[(y / t), $MachinePrecision] * z + x), $MachinePrecision] / N[(1.0 + a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e-313], t$95$2, If[LessEqual[t$95$1, 0.0], N[(N[(N[(x / y), $MachinePrecision] * t + z), $MachinePrecision] / b), $MachinePrecision], If[LessEqual[t$95$1, 5e+282], t$95$2, N[(N[(x * N[(t / y), $MachinePrecision] + z), $MachinePrecision] / 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(\frac{y}{t}, z, x\right)}{1 + a}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{-313}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{x}{y}, t, z\right)}{b}\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+282}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, \frac{t}{y}, z\right)}{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))) < -5.00000000002e-313 or -0.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < 4.99999999999999978e282Initial program 74.6%
Applied rewrites76.8%
Taylor expanded in y around 0
Applied rewrites57.6%
if -5.00000000002e-313 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < -0.0Initial program 74.6%
Applied rewrites79.3%
Taylor expanded in b around inf
Applied rewrites41.1%
Applied rewrites41.2%
if 4.99999999999999978e282 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) Initial program 74.6%
Taylor expanded in b around inf
Applied rewrites26.3%
Applied rewrites31.1%
Applied rewrites42.2%
(FPCore (x y z t a b)
:precision binary64
(if (<= t -1.8e+29)
(/ (fma (/ y t) z x) (+ 1.0 a))
(if (<= t 4.7e-11)
(/ (fma t x (* y z)) (+ t (* b y)))
(/ (+ x (/ (* y z) t)) (+ 1.0 a)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -1.8e+29) {
tmp = fma((y / t), z, x) / (1.0 + a);
} else if (t <= 4.7e-11) {
tmp = fma(t, x, (y * z)) / (t + (b * y));
} else {
tmp = (x + ((y * z) / t)) / (1.0 + a);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -1.8e+29) tmp = Float64(fma(Float64(y / t), z, x) / Float64(1.0 + a)); elseif (t <= 4.7e-11) tmp = Float64(fma(t, x, Float64(y * z)) / Float64(t + Float64(b * y))); else tmp = Float64(Float64(x + Float64(Float64(y * z) / t)) / Float64(1.0 + a)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -1.8e+29], N[(N[(N[(y / t), $MachinePrecision] * z + x), $MachinePrecision] / N[(1.0 + a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 4.7e-11], N[(N[(t * x + N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(t + N[(b * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / N[(1.0 + a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.8 \cdot 10^{+29}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{y}{t}, z, x\right)}{1 + a}\\
\mathbf{elif}\;t \leq 4.7 \cdot 10^{-11}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t, x, y \cdot z\right)}{t + b \cdot y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{y \cdot z}{t}}{1 + a}\\
\end{array}
\end{array}
if t < -1.79999999999999988e29Initial program 74.6%
Applied rewrites76.8%
Taylor expanded in y around 0
Applied rewrites57.6%
if -1.79999999999999988e29 < t < 4.69999999999999993e-11Initial program 74.6%
Taylor expanded in b around inf
Applied rewrites26.3%
Applied rewrites31.1%
Taylor expanded in a around 0
Applied rewrites50.0%
if 4.69999999999999993e-11 < t Initial program 74.6%
Taylor expanded in y around 0
Applied rewrites55.8%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (/ x (+ 1.0 a)))) (if (<= t -4e-49) t_1 (if (<= t 1.05e-10) (/ (+ z (/ (* t x) y)) b) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x / (1.0 + a);
double tmp;
if (t <= -4e-49) {
tmp = t_1;
} else if (t <= 1.05e-10) {
tmp = (z + ((t * x) / y)) / b;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = x / (1.0d0 + a)
if (t <= (-4d-49)) then
tmp = t_1
else if (t <= 1.05d-10) then
tmp = (z + ((t * x) / y)) / b
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x / (1.0 + a);
double tmp;
if (t <= -4e-49) {
tmp = t_1;
} else if (t <= 1.05e-10) {
tmp = (z + ((t * x) / y)) / b;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x / (1.0 + a) tmp = 0 if t <= -4e-49: tmp = t_1 elif t <= 1.05e-10: tmp = (z + ((t * x) / y)) / b else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x / Float64(1.0 + a)) tmp = 0.0 if (t <= -4e-49) tmp = t_1; elseif (t <= 1.05e-10) tmp = Float64(Float64(z + Float64(Float64(t * x) / y)) / b); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = x / (1.0 + a); tmp = 0.0; if (t <= -4e-49) tmp = t_1; elseif (t <= 1.05e-10) tmp = (z + ((t * x) / y)) / b; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x / N[(1.0 + a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -4e-49], t$95$1, If[LessEqual[t, 1.05e-10], N[(N[(z + N[(N[(t * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{1 + a}\\
\mathbf{if}\;t \leq -4 \cdot 10^{-49}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.05 \cdot 10^{-10}:\\
\;\;\;\;\frac{z + \frac{t \cdot x}{y}}{b}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -3.99999999999999975e-49 or 1.05e-10 < t Initial program 74.6%
Taylor expanded in y around 0
Applied rewrites41.7%
if -3.99999999999999975e-49 < t < 1.05e-10Initial program 74.6%
Applied rewrites79.3%
Taylor expanded in b around inf
Applied rewrites41.1%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (/ x (+ 1.0 a)))) (if (<= t -4e-49) t_1 (if (<= t 1.05e-10) (/ (fma (/ x y) t z) b) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x / (1.0 + a);
double tmp;
if (t <= -4e-49) {
tmp = t_1;
} else if (t <= 1.05e-10) {
tmp = fma((x / y), t, z) / b;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(x / Float64(1.0 + a)) tmp = 0.0 if (t <= -4e-49) tmp = t_1; elseif (t <= 1.05e-10) tmp = Float64(fma(Float64(x / y), t, z) / b); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x / N[(1.0 + a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -4e-49], t$95$1, If[LessEqual[t, 1.05e-10], N[(N[(N[(x / y), $MachinePrecision] * t + z), $MachinePrecision] / b), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{1 + a}\\
\mathbf{if}\;t \leq -4 \cdot 10^{-49}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.05 \cdot 10^{-10}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{x}{y}, t, z\right)}{b}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -3.99999999999999975e-49 or 1.05e-10 < t Initial program 74.6%
Taylor expanded in y around 0
Applied rewrites41.7%
if -3.99999999999999975e-49 < t < 1.05e-10Initial program 74.6%
Applied rewrites79.3%
Taylor expanded in b around inf
Applied rewrites41.1%
Applied rewrites41.2%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (/ x (+ 1.0 a)))) (if (<= t -4.8e-49) t_1 (if (<= t 1.75e-13) (/ z b) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x / (1.0 + a);
double tmp;
if (t <= -4.8e-49) {
tmp = t_1;
} else if (t <= 1.75e-13) {
tmp = z / b;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = x / (1.0d0 + a)
if (t <= (-4.8d-49)) then
tmp = t_1
else if (t <= 1.75d-13) then
tmp = z / b
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x / (1.0 + a);
double tmp;
if (t <= -4.8e-49) {
tmp = t_1;
} else if (t <= 1.75e-13) {
tmp = z / b;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x / (1.0 + a) tmp = 0 if t <= -4.8e-49: tmp = t_1 elif t <= 1.75e-13: tmp = z / b else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x / Float64(1.0 + a)) tmp = 0.0 if (t <= -4.8e-49) tmp = t_1; elseif (t <= 1.75e-13) tmp = Float64(z / b); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = x / (1.0 + a); tmp = 0.0; if (t <= -4.8e-49) tmp = t_1; elseif (t <= 1.75e-13) tmp = z / b; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x / N[(1.0 + a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -4.8e-49], t$95$1, If[LessEqual[t, 1.75e-13], N[(z / b), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{1 + a}\\
\mathbf{if}\;t \leq -4.8 \cdot 10^{-49}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.75 \cdot 10^{-13}:\\
\;\;\;\;\frac{z}{b}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -4.79999999999999985e-49 or 1.7500000000000001e-13 < t Initial program 74.6%
Taylor expanded in y around 0
Applied rewrites41.7%
if -4.79999999999999985e-49 < t < 1.7500000000000001e-13Initial program 74.6%
Taylor expanded in y around inf
Applied rewrites34.2%
(FPCore (x y z t a b) :precision binary64 (if (<= t -3.8e+99) (/ x a) (if (<= t 2.5e-12) (/ z b) (/ x a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -3.8e+99) {
tmp = x / a;
} else if (t <= 2.5e-12) {
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 (t <= (-3.8d+99)) then
tmp = x / a
else if (t <= 2.5d-12) 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 (t <= -3.8e+99) {
tmp = x / a;
} else if (t <= 2.5e-12) {
tmp = z / b;
} else {
tmp = x / a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -3.8e+99: tmp = x / a elif t <= 2.5e-12: tmp = z / b else: tmp = x / a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -3.8e+99) tmp = Float64(x / a); elseif (t <= 2.5e-12) 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 (t <= -3.8e+99) tmp = x / a; elseif (t <= 2.5e-12) tmp = z / b; else tmp = x / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -3.8e+99], N[(x / a), $MachinePrecision], If[LessEqual[t, 2.5e-12], N[(z / b), $MachinePrecision], N[(x / a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.8 \cdot 10^{+99}:\\
\;\;\;\;\frac{x}{a}\\
\mathbf{elif}\;t \leq 2.5 \cdot 10^{-12}:\\
\;\;\;\;\frac{z}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{a}\\
\end{array}
\end{array}
if t < -3.8e99 or 2.49999999999999985e-12 < t Initial program 74.6%
Taylor expanded in y around 0
Applied rewrites41.7%
Taylor expanded in a around inf
Applied rewrites24.8%
if -3.8e99 < t < 2.49999999999999985e-12Initial program 74.6%
Taylor expanded in y around inf
Applied rewrites34.2%
(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 74.6%
Taylor expanded in y around 0
Applied rewrites41.7%
Taylor expanded in a around inf
Applied rewrites24.8%
herbie shell --seed 2025153
(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))))