
(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 13 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)) (+ (+ a 1.0) (/ (* y b) t)))))
(if (<= t_1 1e+308)
t_1
(if (<= t_1 INFINITY)
(/ (fma x t (* y z)) (fma b y (fma a t t)))
(/ 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 tmp;
if (t_1 <= 1e+308) {
tmp = t_1;
} else if (t_1 <= ((double) INFINITY)) {
tmp = fma(x, t, (y * z)) / fma(b, y, fma(a, t, t));
} 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))) tmp = 0.0 if (t_1 <= 1e+308) tmp = t_1; elseif (t_1 <= Inf) tmp = Float64(fma(x, t, Float64(y * z)) / fma(b, y, fma(a, t, t))); 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]}, If[LessEqual[t$95$1, 1e+308], t$95$1, If[LessEqual[t$95$1, Infinity], N[(N[(x * t + N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(b * y + N[(a * t + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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}}\\
\mathbf{if}\;t\_1 \leq 10^{+308}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, t, y \cdot z\right)}{\mathsf{fma}\left(b, y, \mathsf{fma}\left(a, t, t\right)\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))) < 1e308Initial program 75.0%
if 1e308 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < +inf.0Initial program 75.0%
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
mult-flipN/A
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
mult-flipN/A
times-fracN/A
inv-powN/A
metadata-evalN/A
inv-powN/A
metadata-evalN/A
pow-divN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
Applied rewrites69.8%
lift-*.f64N/A
*-rgt-identity69.8
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6469.8
lift-*.f64N/A
*-commutativeN/A
lift-*.f6469.8
Applied rewrites69.8%
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 75.0%
Taylor expanded in y around inf
lower-/.f6433.8
Applied rewrites33.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (+ x (/ (* y z) t)) (+ (+ a 1.0) (/ (* y b) t)))))
(if (<= t_1 (- INFINITY))
(/ z b)
(if (<= t_1 1e+308)
(/ (fma (/ y t) z x) (fma (/ y t) b (- a -1.0)))
(if (<= t_1 INFINITY)
(/ (fma x t (* y z)) (fma b y (fma a t t)))
(/ 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 tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = z / b;
} else if (t_1 <= 1e+308) {
tmp = fma((y / t), z, x) / fma((y / t), b, (a - -1.0));
} else if (t_1 <= ((double) INFINITY)) {
tmp = fma(x, t, (y * z)) / fma(b, y, fma(a, t, t));
} 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))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(z / b); elseif (t_1 <= 1e+308) tmp = Float64(fma(Float64(y / t), z, x) / fma(Float64(y / t), b, Float64(a - -1.0))); elseif (t_1 <= Inf) tmp = Float64(fma(x, t, Float64(y * z)) / fma(b, y, fma(a, t, t))); 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]}, If[LessEqual[t$95$1, (-Infinity)], N[(z / b), $MachinePrecision], If[LessEqual[t$95$1, 1e+308], N[(N[(N[(y / t), $MachinePrecision] * z + x), $MachinePrecision] / N[(N[(y / t), $MachinePrecision] * b + N[(a - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(x * t + N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(b * y + N[(a * t + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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}}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\frac{z}{b}\\
\mathbf{elif}\;t\_1 \leq 10^{+308}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{y}{t}, z, x\right)}{\mathsf{fma}\left(\frac{y}{t}, b, a - -1\right)}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, t, y \cdot z\right)}{\mathsf{fma}\left(b, y, \mathsf{fma}\left(a, t, t\right)\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.0 or +inf.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) Initial program 75.0%
Taylor expanded in y around inf
lower-/.f6433.8
Applied rewrites33.8%
if -inf.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < 1e308Initial program 75.0%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6475.1
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flip-reverseN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-negateN/A
sub-negate-revN/A
add-flipN/A
+-commutativeN/A
lift-+.f64N/A
lower-fma.f64N/A
lower-/.f6476.9
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
Applied rewrites76.9%
if 1e308 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < +inf.0Initial program 75.0%
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
mult-flipN/A
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
mult-flipN/A
times-fracN/A
inv-powN/A
metadata-evalN/A
inv-powN/A
metadata-evalN/A
pow-divN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
Applied rewrites69.8%
lift-*.f64N/A
*-rgt-identity69.8
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6469.8
lift-*.f64N/A
*-commutativeN/A
lift-*.f6469.8
Applied rewrites69.8%
(FPCore (x y z t a b)
:precision binary64
(if (<= t -8e+154)
(/ (+ x (/ (* y z) t)) (- a -1.0))
(if (<= t 3.7e+55)
(/ (fma x t (* y z)) (fma b y (fma a t t)))
(fma (/ z t) (/ y (- a -1.0)) (/ x (- a -1.0))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -8e+154) {
tmp = (x + ((y * z) / t)) / (a - -1.0);
} else if (t <= 3.7e+55) {
tmp = fma(x, t, (y * z)) / fma(b, y, fma(a, t, t));
} else {
tmp = fma((z / t), (y / (a - -1.0)), (x / (a - -1.0)));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -8e+154) tmp = Float64(Float64(x + Float64(Float64(y * z) / t)) / Float64(a - -1.0)); elseif (t <= 3.7e+55) tmp = Float64(fma(x, t, Float64(y * z)) / fma(b, y, fma(a, t, t))); else tmp = fma(Float64(z / t), Float64(y / Float64(a - -1.0)), Float64(x / Float64(a - -1.0))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -8e+154], N[(N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / N[(a - -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.7e+55], N[(N[(x * t + N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(b * y + N[(a * t + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z / t), $MachinePrecision] * N[(y / N[(a - -1.0), $MachinePrecision]), $MachinePrecision] + N[(x / N[(a - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8 \cdot 10^{+154}:\\
\;\;\;\;\frac{x + \frac{y \cdot z}{t}}{a - -1}\\
\mathbf{elif}\;t \leq 3.7 \cdot 10^{+55}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, t, y \cdot z\right)}{\mathsf{fma}\left(b, y, \mathsf{fma}\left(a, t, t\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t}, \frac{y}{a - -1}, \frac{x}{a - -1}\right)\\
\end{array}
\end{array}
if t < -8.0000000000000003e154Initial program 75.0%
Taylor expanded in y around 0
lower-+.f6456.6
Applied rewrites56.6%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lift--.f6456.6
Applied rewrites56.6%
if -8.0000000000000003e154 < t < 3.7000000000000002e55Initial program 75.0%
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
mult-flipN/A
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
mult-flipN/A
times-fracN/A
inv-powN/A
metadata-evalN/A
inv-powN/A
metadata-evalN/A
pow-divN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
Applied rewrites69.8%
lift-*.f64N/A
*-rgt-identity69.8
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6469.8
lift-*.f64N/A
*-commutativeN/A
lift-*.f6469.8
Applied rewrites69.8%
if 3.7000000000000002e55 < t Initial program 75.0%
Taylor expanded in y around 0
lower-+.f6456.6
Applied rewrites56.6%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
div-addN/A
lift-/.f64N/A
associate-/l/N/A
lift-*.f64N/A
*-commutativeN/A
times-fracN/A
lower-fma.f64N/A
Applied rewrites56.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (+ z (/ (* t x) y)) b)))
(if (<= y -9.2e+52)
t_1
(if (<= y 1.55e-222)
(/ x (+ 1.0 (+ a (/ (* b y) t))))
(if (<= y 1.85e+77) (/ (+ x (* (/ y t) z)) (+ 1.0 a)) 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 <= -9.2e+52) {
tmp = t_1;
} else if (y <= 1.55e-222) {
tmp = x / (1.0 + (a + ((b * y) / t)));
} else if (y <= 1.85e+77) {
tmp = (x + ((y / t) * z)) / (1.0 + a);
} 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 <= (-9.2d+52)) then
tmp = t_1
else if (y <= 1.55d-222) then
tmp = x / (1.0d0 + (a + ((b * y) / t)))
else if (y <= 1.85d+77) then
tmp = (x + ((y / t) * z)) / (1.0d0 + a)
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 <= -9.2e+52) {
tmp = t_1;
} else if (y <= 1.55e-222) {
tmp = x / (1.0 + (a + ((b * y) / t)));
} else if (y <= 1.85e+77) {
tmp = (x + ((y / t) * z)) / (1.0 + a);
} 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 <= -9.2e+52: tmp = t_1 elif y <= 1.55e-222: tmp = x / (1.0 + (a + ((b * y) / t))) elif y <= 1.85e+77: tmp = (x + ((y / t) * z)) / (1.0 + a) 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 <= -9.2e+52) tmp = t_1; elseif (y <= 1.55e-222) tmp = Float64(x / Float64(1.0 + Float64(a + Float64(Float64(b * y) / t)))); elseif (y <= 1.85e+77) tmp = Float64(Float64(x + Float64(Float64(y / t) * z)) / Float64(1.0 + a)); 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 <= -9.2e+52) tmp = t_1; elseif (y <= 1.55e-222) tmp = x / (1.0 + (a + ((b * y) / t))); elseif (y <= 1.85e+77) tmp = (x + ((y / t) * z)) / (1.0 + a); 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, -9.2e+52], t$95$1, If[LessEqual[y, 1.55e-222], N[(x / N[(1.0 + N[(a + N[(N[(b * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.85e+77], N[(N[(x + N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] / N[(1.0 + a), $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 -9.2 \cdot 10^{+52}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.55 \cdot 10^{-222}:\\
\;\;\;\;\frac{x}{1 + \left(a + \frac{b \cdot y}{t}\right)}\\
\mathbf{elif}\;y \leq 1.85 \cdot 10^{+77}:\\
\;\;\;\;\frac{x + \frac{y}{t} \cdot z}{1 + a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -9.1999999999999999e52 or 1.84999999999999997e77 < y Initial program 75.0%
Taylor expanded in y around 0
lower-+.f6456.6
Applied rewrites56.6%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
div-addN/A
lift-/.f64N/A
associate-/l/N/A
lift-*.f64N/A
*-commutativeN/A
times-fracN/A
lower-fma.f64N/A
Applied rewrites56.4%
Taylor expanded in b around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6440.0
Applied rewrites40.0%
if -9.1999999999999999e52 < y < 1.5499999999999999e-222Initial program 75.0%
Taylor expanded in x around inf
lower-/.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6452.7
Applied rewrites52.7%
if 1.5499999999999999e-222 < y < 1.84999999999999997e77Initial program 75.0%
Taylor expanded in y around 0
lower-+.f6456.6
Applied rewrites56.6%
lift-/.f64N/A
lift-*.f64N/A
associate-*l/N/A
lift-/.f64N/A
lower-*.f6458.4
Applied rewrites58.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (+ z (/ (* t x) y)) b)))
(if (<= y -9.2e+52)
t_1
(if (<= y 9.5e-223)
(/ x (+ 1.0 (+ a (/ (* b y) t))))
(if (<= y 1.65e+76) (/ (+ 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 <= -9.2e+52) {
tmp = t_1;
} else if (y <= 9.5e-223) {
tmp = x / (1.0 + (a + ((b * y) / t)));
} else if (y <= 1.65e+76) {
tmp = (x + ((y * z) / t)) / (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 <= (-9.2d+52)) then
tmp = t_1
else if (y <= 9.5d-223) then
tmp = x / (1.0d0 + (a + ((b * y) / t)))
else if (y <= 1.65d+76) then
tmp = (x + ((y * z) / t)) / (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 <= -9.2e+52) {
tmp = t_1;
} else if (y <= 9.5e-223) {
tmp = x / (1.0 + (a + ((b * y) / t)));
} else if (y <= 1.65e+76) {
tmp = (x + ((y * z) / t)) / (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 <= -9.2e+52: tmp = t_1 elif y <= 9.5e-223: tmp = x / (1.0 + (a + ((b * y) / t))) elif y <= 1.65e+76: 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 <= -9.2e+52) tmp = t_1; elseif (y <= 9.5e-223) tmp = Float64(x / Float64(1.0 + Float64(a + Float64(Float64(b * y) / t)))); elseif (y <= 1.65e+76) tmp = Float64(Float64(x + Float64(Float64(y * z) / t)) / 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 <= -9.2e+52) tmp = t_1; elseif (y <= 9.5e-223) tmp = x / (1.0 + (a + ((b * y) / t))); elseif (y <= 1.65e+76) tmp = (x + ((y * z) / t)) / (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, -9.2e+52], t$95$1, If[LessEqual[y, 9.5e-223], N[(x / N[(1.0 + N[(a + N[(N[(b * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.65e+76], 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 -9.2 \cdot 10^{+52}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 9.5 \cdot 10^{-223}:\\
\;\;\;\;\frac{x}{1 + \left(a + \frac{b \cdot y}{t}\right)}\\
\mathbf{elif}\;y \leq 1.65 \cdot 10^{+76}:\\
\;\;\;\;\frac{x + \frac{y \cdot z}{t}}{a - -1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -9.1999999999999999e52 or 1.65e76 < y Initial program 75.0%
Taylor expanded in y around 0
lower-+.f6456.6
Applied rewrites56.6%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
div-addN/A
lift-/.f64N/A
associate-/l/N/A
lift-*.f64N/A
*-commutativeN/A
times-fracN/A
lower-fma.f64N/A
Applied rewrites56.4%
Taylor expanded in b around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6440.0
Applied rewrites40.0%
if -9.1999999999999999e52 < y < 9.49999999999999992e-223Initial program 75.0%
Taylor expanded in x around inf
lower-/.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6452.7
Applied rewrites52.7%
if 9.49999999999999992e-223 < y < 1.65e76Initial program 75.0%
Taylor expanded in y around 0
lower-+.f6456.6
Applied rewrites56.6%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lift--.f6456.6
Applied rewrites56.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (+ z (/ (* t x) y)) b)))
(if (<= y -9.2e+52)
t_1
(if (<= y 1.1e-221)
(/ x (fma (/ y t) b (- a -1.0)))
(if (<= y 1.65e+76) (/ (+ 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 <= -9.2e+52) {
tmp = t_1;
} else if (y <= 1.1e-221) {
tmp = x / fma((y / t), b, (a - -1.0));
} else if (y <= 1.65e+76) {
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 <= -9.2e+52) tmp = t_1; elseif (y <= 1.1e-221) tmp = Float64(x / fma(Float64(y / t), b, Float64(a - -1.0))); elseif (y <= 1.65e+76) 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, -9.2e+52], t$95$1, If[LessEqual[y, 1.1e-221], N[(x / N[(N[(y / t), $MachinePrecision] * b + N[(a - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.65e+76], 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 -9.2 \cdot 10^{+52}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.1 \cdot 10^{-221}:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(\frac{y}{t}, b, a - -1\right)}\\
\mathbf{elif}\;y \leq 1.65 \cdot 10^{+76}:\\
\;\;\;\;\frac{x + \frac{y \cdot z}{t}}{a - -1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -9.1999999999999999e52 or 1.65e76 < y Initial program 75.0%
Taylor expanded in y around 0
lower-+.f6456.6
Applied rewrites56.6%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
div-addN/A
lift-/.f64N/A
associate-/l/N/A
lift-*.f64N/A
*-commutativeN/A
times-fracN/A
lower-fma.f64N/A
Applied rewrites56.4%
Taylor expanded in b around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6440.0
Applied rewrites40.0%
if -9.1999999999999999e52 < y < 1.10000000000000001e-221Initial program 75.0%
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
mult-flipN/A
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
mult-flipN/A
times-fracN/A
inv-powN/A
metadata-evalN/A
inv-powN/A
metadata-evalN/A
pow-divN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
Applied rewrites69.8%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-*.f6440.0
Applied rewrites40.0%
Applied rewrites54.1%
if 1.10000000000000001e-221 < y < 1.65e76Initial program 75.0%
Taylor expanded in y around 0
lower-+.f6456.6
Applied rewrites56.6%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lift--.f6456.6
Applied rewrites56.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (+ z (/ (* t x) y)) b)))
(if (<= y -9.2e+52)
t_1
(if (<= y 1.35e-102)
(/ x (fma (/ y t) b (- a -1.0)))
(if (<= y 1.85e+77) (/ (fma (/ z t) y 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 <= -9.2e+52) {
tmp = t_1;
} else if (y <= 1.35e-102) {
tmp = x / fma((y / t), b, (a - -1.0));
} else if (y <= 1.85e+77) {
tmp = fma((z / t), y, 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 <= -9.2e+52) tmp = t_1; elseif (y <= 1.35e-102) tmp = Float64(x / fma(Float64(y / t), b, Float64(a - -1.0))); elseif (y <= 1.85e+77) tmp = Float64(fma(Float64(z / t), y, x) / 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, -9.2e+52], t$95$1, If[LessEqual[y, 1.35e-102], N[(x / N[(N[(y / t), $MachinePrecision] * b + N[(a - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.85e+77], N[(N[(N[(z / t), $MachinePrecision] * y + x), $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 -9.2 \cdot 10^{+52}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{-102}:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(\frac{y}{t}, b, a - -1\right)}\\
\mathbf{elif}\;y \leq 1.85 \cdot 10^{+77}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{z}{t}, y, x\right)}{a - -1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -9.1999999999999999e52 or 1.84999999999999997e77 < y Initial program 75.0%
Taylor expanded in y around 0
lower-+.f6456.6
Applied rewrites56.6%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
div-addN/A
lift-/.f64N/A
associate-/l/N/A
lift-*.f64N/A
*-commutativeN/A
times-fracN/A
lower-fma.f64N/A
Applied rewrites56.4%
Taylor expanded in b around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6440.0
Applied rewrites40.0%
if -9.1999999999999999e52 < y < 1.35e-102Initial program 75.0%
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
mult-flipN/A
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
mult-flipN/A
times-fracN/A
inv-powN/A
metadata-evalN/A
inv-powN/A
metadata-evalN/A
pow-divN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
Applied rewrites69.8%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-*.f6440.0
Applied rewrites40.0%
Applied rewrites54.1%
if 1.35e-102 < y < 1.84999999999999997e77Initial program 75.0%
Taylor expanded in y around 0
lower-+.f6456.6
Applied rewrites56.6%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6456.4
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lift--.f6456.4
Applied rewrites56.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (+ z (/ (* t x) y)) b)))
(if (<= y -9.2e+52)
t_1
(if (<= y 1.8e-75)
(/ x (fma (/ y t) b (- a -1.0)))
(if (<= y 5.5e+58) (/ (fma z (/ y t) x) a) 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 <= -9.2e+52) {
tmp = t_1;
} else if (y <= 1.8e-75) {
tmp = x / fma((y / t), b, (a - -1.0));
} else if (y <= 5.5e+58) {
tmp = fma(z, (y / t), x) / a;
} 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 <= -9.2e+52) tmp = t_1; elseif (y <= 1.8e-75) tmp = Float64(x / fma(Float64(y / t), b, Float64(a - -1.0))); elseif (y <= 5.5e+58) tmp = Float64(fma(z, Float64(y / t), x) / a); 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, -9.2e+52], t$95$1, If[LessEqual[y, 1.8e-75], N[(x / N[(N[(y / t), $MachinePrecision] * b + N[(a - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.5e+58], N[(N[(z * N[(y / t), $MachinePrecision] + x), $MachinePrecision] / a), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z + \frac{t \cdot x}{y}}{b}\\
\mathbf{if}\;y \leq -9.2 \cdot 10^{+52}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{-75}:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(\frac{y}{t}, b, a - -1\right)}\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{+58}:\\
\;\;\;\;\frac{\mathsf{fma}\left(z, \frac{y}{t}, x\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -9.1999999999999999e52 or 5.4999999999999999e58 < y Initial program 75.0%
Taylor expanded in y around 0
lower-+.f6456.6
Applied rewrites56.6%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
div-addN/A
lift-/.f64N/A
associate-/l/N/A
lift-*.f64N/A
*-commutativeN/A
times-fracN/A
lower-fma.f64N/A
Applied rewrites56.4%
Taylor expanded in b around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6440.0
Applied rewrites40.0%
if -9.1999999999999999e52 < y < 1.8e-75Initial program 75.0%
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
mult-flipN/A
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
mult-flipN/A
times-fracN/A
inv-powN/A
metadata-evalN/A
inv-powN/A
metadata-evalN/A
pow-divN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
Applied rewrites69.8%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-*.f6440.0
Applied rewrites40.0%
Applied rewrites54.1%
if 1.8e-75 < y < 5.4999999999999999e58Initial program 75.0%
lift-/.f64N/A
mult-flipN/A
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
associate-*l/N/A
mult-flipN/A
lower-*.f64N/A
Applied rewrites63.1%
Taylor expanded in a around inf
lower-/.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6425.3
Applied rewrites25.3%
Applied rewrites35.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (+ z (/ (* t x) y)) b)))
(if (<= y -1.8e-100)
t_1
(if (<= y 1.6e-75)
(/ x (- a -1.0))
(if (<= y 5.5e+58) (/ (fma z (/ y t) x) a) 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 <= -1.8e-100) {
tmp = t_1;
} else if (y <= 1.6e-75) {
tmp = x / (a - -1.0);
} else if (y <= 5.5e+58) {
tmp = fma(z, (y / t), x) / a;
} 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 <= -1.8e-100) tmp = t_1; elseif (y <= 1.6e-75) tmp = Float64(x / Float64(a - -1.0)); elseif (y <= 5.5e+58) tmp = Float64(fma(z, Float64(y / t), x) / a); 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, -1.8e-100], t$95$1, If[LessEqual[y, 1.6e-75], N[(x / N[(a - -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.5e+58], N[(N[(z * N[(y / t), $MachinePrecision] + x), $MachinePrecision] / a), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z + \frac{t \cdot x}{y}}{b}\\
\mathbf{if}\;y \leq -1.8 \cdot 10^{-100}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{-75}:\\
\;\;\;\;\frac{x}{a - -1}\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{+58}:\\
\;\;\;\;\frac{\mathsf{fma}\left(z, \frac{y}{t}, x\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.7999999999999999e-100 or 5.4999999999999999e58 < y Initial program 75.0%
Taylor expanded in y around 0
lower-+.f6456.6
Applied rewrites56.6%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
div-addN/A
lift-/.f64N/A
associate-/l/N/A
lift-*.f64N/A
*-commutativeN/A
times-fracN/A
lower-fma.f64N/A
Applied rewrites56.4%
Taylor expanded in b around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6440.0
Applied rewrites40.0%
if -1.7999999999999999e-100 < y < 1.59999999999999988e-75Initial program 75.0%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
associate-*l*N/A
lower-fma.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
distribute-neg-frac2N/A
distribute-neg-fracN/A
lower-/.f64N/A
metadata-eval75.1
Applied rewrites75.1%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6442.8
Applied rewrites42.8%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lift--.f6442.8
Applied rewrites42.8%
if 1.59999999999999988e-75 < y < 5.4999999999999999e58Initial program 75.0%
lift-/.f64N/A
mult-flipN/A
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
associate-*l/N/A
mult-flipN/A
lower-*.f64N/A
Applied rewrites63.1%
Taylor expanded in a around inf
lower-/.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6425.3
Applied rewrites25.3%
Applied rewrites35.3%
(FPCore (x y z t a b)
:precision binary64
(if (<= y -1.8e-100)
(/ z b)
(if (<= y 1.6e-75)
(/ x (- a -1.0))
(if (<= y 1.25e+72) (/ (fma z (/ y t) x) a) (/ z b)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -1.8e-100) {
tmp = z / b;
} else if (y <= 1.6e-75) {
tmp = x / (a - -1.0);
} else if (y <= 1.25e+72) {
tmp = fma(z, (y / t), x) / a;
} else {
tmp = z / b;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -1.8e-100) tmp = Float64(z / b); elseif (y <= 1.6e-75) tmp = Float64(x / Float64(a - -1.0)); elseif (y <= 1.25e+72) tmp = Float64(fma(z, Float64(y / t), x) / a); else tmp = Float64(z / b); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -1.8e-100], N[(z / b), $MachinePrecision], If[LessEqual[y, 1.6e-75], N[(x / N[(a - -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.25e+72], N[(N[(z * N[(y / t), $MachinePrecision] + x), $MachinePrecision] / a), $MachinePrecision], N[(z / b), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.8 \cdot 10^{-100}:\\
\;\;\;\;\frac{z}{b}\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{-75}:\\
\;\;\;\;\frac{x}{a - -1}\\
\mathbf{elif}\;y \leq 1.25 \cdot 10^{+72}:\\
\;\;\;\;\frac{\mathsf{fma}\left(z, \frac{y}{t}, x\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{b}\\
\end{array}
\end{array}
if y < -1.7999999999999999e-100 or 1.24999999999999998e72 < y Initial program 75.0%
Taylor expanded in y around inf
lower-/.f6433.8
Applied rewrites33.8%
if -1.7999999999999999e-100 < y < 1.59999999999999988e-75Initial program 75.0%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
associate-*l*N/A
lower-fma.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
distribute-neg-frac2N/A
distribute-neg-fracN/A
lower-/.f64N/A
metadata-eval75.1
Applied rewrites75.1%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6442.8
Applied rewrites42.8%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lift--.f6442.8
Applied rewrites42.8%
if 1.59999999999999988e-75 < y < 1.24999999999999998e72Initial program 75.0%
lift-/.f64N/A
mult-flipN/A
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
associate-*l/N/A
mult-flipN/A
lower-*.f64N/A
Applied rewrites63.1%
Taylor expanded in a around inf
lower-/.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6425.3
Applied rewrites25.3%
Applied rewrites35.3%
(FPCore (x y z t a b) :precision binary64 (if (<= y -1.8e-100) (/ z b) (if (<= y 1.45e+59) (/ x (- a -1.0)) (/ z b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -1.8e-100) {
tmp = z / b;
} else if (y <= 1.45e+59) {
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 <= (-1.8d-100)) then
tmp = z / b
else if (y <= 1.45d+59) 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 <= -1.8e-100) {
tmp = z / b;
} else if (y <= 1.45e+59) {
tmp = x / (a - -1.0);
} else {
tmp = z / b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y <= -1.8e-100: tmp = z / b elif y <= 1.45e+59: tmp = x / (a - -1.0) else: tmp = z / b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -1.8e-100) tmp = Float64(z / b); elseif (y <= 1.45e+59) 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 <= -1.8e-100) tmp = z / b; elseif (y <= 1.45e+59) tmp = x / (a - -1.0); else tmp = z / b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -1.8e-100], N[(z / b), $MachinePrecision], If[LessEqual[y, 1.45e+59], N[(x / N[(a - -1.0), $MachinePrecision]), $MachinePrecision], N[(z / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.8 \cdot 10^{-100}:\\
\;\;\;\;\frac{z}{b}\\
\mathbf{elif}\;y \leq 1.45 \cdot 10^{+59}:\\
\;\;\;\;\frac{x}{a - -1}\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{b}\\
\end{array}
\end{array}
if y < -1.7999999999999999e-100 or 1.44999999999999995e59 < y Initial program 75.0%
Taylor expanded in y around inf
lower-/.f6433.8
Applied rewrites33.8%
if -1.7999999999999999e-100 < y < 1.44999999999999995e59Initial program 75.0%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
associate-*l*N/A
lower-fma.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
distribute-neg-frac2N/A
distribute-neg-fracN/A
lower-/.f64N/A
metadata-eval75.1
Applied rewrites75.1%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6442.8
Applied rewrites42.8%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lift--.f6442.8
Applied rewrites42.8%
(FPCore (x y z t a b) :precision binary64 (if (<= y -1.8e-100) (/ z b) (if (<= y 1.25e+59) (/ x a) (/ z b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -1.8e-100) {
tmp = z / b;
} else if (y <= 1.25e+59) {
tmp = x / a;
} 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 <= (-1.8d-100)) then
tmp = z / b
else if (y <= 1.25d+59) then
tmp = x / a
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 <= -1.8e-100) {
tmp = z / b;
} else if (y <= 1.25e+59) {
tmp = x / a;
} else {
tmp = z / b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y <= -1.8e-100: tmp = z / b elif y <= 1.25e+59: tmp = x / a else: tmp = z / b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -1.8e-100) tmp = Float64(z / b); elseif (y <= 1.25e+59) tmp = Float64(x / a); else tmp = Float64(z / b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (y <= -1.8e-100) tmp = z / b; elseif (y <= 1.25e+59) tmp = x / a; else tmp = z / b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -1.8e-100], N[(z / b), $MachinePrecision], If[LessEqual[y, 1.25e+59], N[(x / a), $MachinePrecision], N[(z / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.8 \cdot 10^{-100}:\\
\;\;\;\;\frac{z}{b}\\
\mathbf{elif}\;y \leq 1.25 \cdot 10^{+59}:\\
\;\;\;\;\frac{x}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{b}\\
\end{array}
\end{array}
if y < -1.7999999999999999e-100 or 1.2499999999999999e59 < y Initial program 75.0%
Taylor expanded in y around inf
lower-/.f6433.8
Applied rewrites33.8%
if -1.7999999999999999e-100 < y < 1.2499999999999999e59Initial program 75.0%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
associate-*l*N/A
lower-fma.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
distribute-neg-frac2N/A
distribute-neg-fracN/A
lower-/.f64N/A
metadata-eval75.1
Applied rewrites75.1%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6442.8
Applied rewrites42.8%
Taylor expanded in a around inf
lower-/.f6426.6
Applied rewrites26.6%
(FPCore (x y z t a b) :precision binary64 (/ z b))
double code(double x, double y, double z, double t, double a, double b) {
return z / b;
}
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 = z / b
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return z / b;
}
def code(x, y, z, t, a, b): return z / b
function code(x, y, z, t, a, b) return Float64(z / b) end
function tmp = code(x, y, z, t, a, b) tmp = z / b; end
code[x_, y_, z_, t_, a_, b_] := N[(z / b), $MachinePrecision]
\begin{array}{l}
\\
\frac{z}{b}
\end{array}
Initial program 75.0%
Taylor expanded in y around inf
lower-/.f6433.8
Applied rewrites33.8%
herbie shell --seed 2025156
(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))))