
(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}
Sampling outcomes in binary64 precision:
Herbie found 18 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 (if (<= (/ (+ x (/ (* y z) t)) (+ (+ a 1.0) (/ (* y b) t))) INFINITY) (fma y (/ z (fma b y (* t (+ 1.0 a)))) (/ x (fma b (/ y t) (+ 1.0 a)))) (/ z b)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t))) <= ((double) INFINITY)) {
tmp = fma(y, (z / fma(b, y, (t * (1.0 + a)))), (x / fma(b, (y / t), (1.0 + a))));
} else {
tmp = z / b;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(Float64(x + Float64(Float64(y * z) / t)) / Float64(Float64(a + 1.0) + Float64(Float64(y * b) / t))) <= Inf) tmp = fma(y, Float64(z / fma(b, y, Float64(t * Float64(1.0 + a)))), Float64(x / fma(b, Float64(y / t), Float64(1.0 + a)))); else tmp = Float64(z / b); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[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], Infinity], N[(y * N[(z / N[(b * y + N[(t * N[(1.0 + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x / N[(b * N[(y / t), $MachinePrecision] + N[(1.0 + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}} \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z}{\mathsf{fma}\left(b, y, t \cdot \left(1 + a\right)\right)}, \frac{x}{\mathsf{fma}\left(b, \frac{y}{t}, 1 + a\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.0Initial program 81.4%
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
div-addN/A
+-commutativeN/A
*-commutativeN/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
associate-+r+N/A
Applied rewrites82.8%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-*.f64N/A
lift-+.f6490.6
Applied rewrites90.6%
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 0.0%
Taylor expanded in y around inf
lower-/.f64100.0
Applied rewrites100.0%
Final simplification91.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ x (+ 1.0 a)))
(t_2 (/ (+ x (/ (* y z) t)) (+ (+ a 1.0) (/ (* y b) t)))))
(if (<= t_2 (- INFINITY))
(* (/ y t) (/ z (+ 1.0 a)))
(if (<= t_2 -1e+88)
t_1
(if (<= t_2 -5e-320)
(/ (fma y (/ z t) x) a)
(if (or (<= t_2 1e-321) (not (<= t_2 5e+265))) (/ 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 t_2 = (x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = (y / t) * (z / (1.0 + a));
} else if (t_2 <= -1e+88) {
tmp = t_1;
} else if (t_2 <= -5e-320) {
tmp = fma(y, (z / t), x) / a;
} else if ((t_2 <= 1e-321) || !(t_2 <= 5e+265)) {
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)) t_2 = Float64(Float64(x + Float64(Float64(y * z) / t)) / Float64(Float64(a + 1.0) + Float64(Float64(y * b) / t))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = Float64(Float64(y / t) * Float64(z / Float64(1.0 + a))); elseif (t_2 <= -1e+88) tmp = t_1; elseif (t_2 <= -5e-320) tmp = Float64(fma(y, Float64(z / t), x) / a); elseif ((t_2 <= 1e-321) || !(t_2 <= 5e+265)) tmp = Float64(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]}, Block[{t$95$2 = 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$2, (-Infinity)], N[(N[(y / t), $MachinePrecision] * N[(z / N[(1.0 + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -1e+88], t$95$1, If[LessEqual[t$95$2, -5e-320], N[(N[(y * N[(z / t), $MachinePrecision] + x), $MachinePrecision] / a), $MachinePrecision], If[Or[LessEqual[t$95$2, 1e-321], N[Not[LessEqual[t$95$2, 5e+265]], $MachinePrecision]], N[(z / b), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{1 + a}\\
t_2 := \frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;\frac{y}{t} \cdot \frac{z}{1 + a}\\
\mathbf{elif}\;t\_2 \leq -1 \cdot 10^{+88}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -5 \cdot 10^{-320}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, \frac{z}{t}, x\right)}{a}\\
\mathbf{elif}\;t\_2 \leq 10^{-321} \lor \neg \left(t\_2 \leq 5 \cdot 10^{+265}\right):\\
\;\;\;\;\frac{z}{b}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < -inf.0Initial program 31.4%
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
div-addN/A
+-commutativeN/A
*-commutativeN/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
associate-+r+N/A
Applied rewrites71.7%
Taylor expanded in b around 0
lower-+.f64N/A
lower-/.f64N/A
lift-+.f64N/A
times-fracN/A
lower-*.f64N/A
lift-/.f64N/A
lower-/.f64N/A
lift-+.f6456.6
Applied rewrites56.6%
Taylor expanded in x around 0
frac-timesN/A
lift-/.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-*.f6453.9
Applied rewrites53.9%
if -inf.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < -9.99999999999999959e87 or 9.98013e-322 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < 5.0000000000000002e265Initial program 99.7%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6460.4
Applied rewrites60.4%
if -9.99999999999999959e87 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < -4.99994e-320Initial program 99.4%
Taylor expanded in a around inf
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6452.2
Applied rewrites52.2%
if -4.99994e-320 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < 9.98013e-322 or 5.0000000000000002e265 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) Initial program 25.9%
Taylor expanded in y around inf
lower-/.f6473.7
Applied rewrites73.7%
Final simplification62.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (+ x (/ (* y z) t)) (+ (+ a 1.0) (/ (* y b) t))))
(t_2 (/ x (+ 1.0 a))))
(if (<= t_1 (- INFINITY))
(* (/ y a) (/ z t))
(if (<= t_1 -1e+88)
t_2
(if (<= t_1 -5e-320)
(/ (fma y (/ z t) x) a)
(if (or (<= t_1 1e-321) (not (<= t_1 5e+265))) (/ z b) t_2))))))
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 = x / (1.0 + a);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (y / a) * (z / t);
} else if (t_1 <= -1e+88) {
tmp = t_2;
} else if (t_1 <= -5e-320) {
tmp = fma(y, (z / t), x) / a;
} else if ((t_1 <= 1e-321) || !(t_1 <= 5e+265)) {
tmp = z / b;
} else {
tmp = t_2;
}
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(x / Float64(1.0 + a)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(y / a) * Float64(z / t)); elseif (t_1 <= -1e+88) tmp = t_2; elseif (t_1 <= -5e-320) tmp = Float64(fma(y, Float64(z / t), x) / a); elseif ((t_1 <= 1e-321) || !(t_1 <= 5e+265)) tmp = Float64(z / b); else tmp = t_2; 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[(x / N[(1.0 + a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(y / a), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -1e+88], t$95$2, If[LessEqual[t$95$1, -5e-320], N[(N[(y * N[(z / t), $MachinePrecision] + x), $MachinePrecision] / a), $MachinePrecision], If[Or[LessEqual[t$95$1, 1e-321], N[Not[LessEqual[t$95$1, 5e+265]], $MachinePrecision]], N[(z / b), $MachinePrecision], t$95$2]]]]]]
\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{x}{1 + a}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\frac{y}{a} \cdot \frac{z}{t}\\
\mathbf{elif}\;t\_1 \leq -1 \cdot 10^{+88}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq -5 \cdot 10^{-320}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, \frac{z}{t}, x\right)}{a}\\
\mathbf{elif}\;t\_1 \leq 10^{-321} \lor \neg \left(t\_1 \leq 5 \cdot 10^{+265}\right):\\
\;\;\;\;\frac{z}{b}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < -inf.0Initial program 31.4%
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
div-addN/A
+-commutativeN/A
*-commutativeN/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
associate-+r+N/A
Applied rewrites71.7%
Taylor expanded in b around 0
lower-+.f64N/A
lower-/.f64N/A
lift-+.f64N/A
times-fracN/A
lower-*.f64N/A
lift-/.f64N/A
lower-/.f64N/A
lift-+.f6456.6
Applied rewrites56.6%
Taylor expanded in x around 0
frac-timesN/A
lift-/.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-*.f6453.9
Applied rewrites53.9%
Taylor expanded in a around inf
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6448.0
Applied rewrites48.0%
if -inf.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < -9.99999999999999959e87 or 9.98013e-322 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < 5.0000000000000002e265Initial program 99.7%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6460.4
Applied rewrites60.4%
if -9.99999999999999959e87 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < -4.99994e-320Initial program 99.4%
Taylor expanded in a around inf
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6452.2
Applied rewrites52.2%
if -4.99994e-320 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < 9.98013e-322 or 5.0000000000000002e265 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) Initial program 25.9%
Taylor expanded in y around inf
lower-/.f6473.7
Applied rewrites73.7%
Final simplification62.1%
(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+44)
(/ x 1.0)
(if (<= t_1 -5e-320)
(/ x a)
(if (or (<= t_1 1e-321) (not (<= t_1 5e+265))) (/ z b) (/ x 1.0)))))))
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+44) {
tmp = x / 1.0;
} else if (t_1 <= -5e-320) {
tmp = x / a;
} else if ((t_1 <= 1e-321) || !(t_1 <= 5e+265)) {
tmp = z / b;
} else {
tmp = x / 1.0;
}
return tmp;
}
public static 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.POSITIVE_INFINITY) {
tmp = z / b;
} else if (t_1 <= -1e+44) {
tmp = x / 1.0;
} else if (t_1 <= -5e-320) {
tmp = x / a;
} else if ((t_1 <= 1e-321) || !(t_1 <= 5e+265)) {
tmp = z / b;
} else {
tmp = x / 1.0;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t)) tmp = 0 if t_1 <= -math.inf: tmp = z / b elif t_1 <= -1e+44: tmp = x / 1.0 elif t_1 <= -5e-320: tmp = x / a elif (t_1 <= 1e-321) or not (t_1 <= 5e+265): tmp = z / b else: tmp = x / 1.0 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+44) tmp = Float64(x / 1.0); elseif (t_1 <= -5e-320) tmp = Float64(x / a); elseif ((t_1 <= 1e-321) || !(t_1 <= 5e+265)) tmp = Float64(z / b); else tmp = Float64(x / 1.0); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t)); tmp = 0.0; if (t_1 <= -Inf) tmp = z / b; elseif (t_1 <= -1e+44) tmp = x / 1.0; elseif (t_1 <= -5e-320) tmp = x / a; elseif ((t_1 <= 1e-321) || ~((t_1 <= 5e+265))) tmp = z / b; else tmp = x / 1.0; end tmp_2 = 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+44], N[(x / 1.0), $MachinePrecision], If[LessEqual[t$95$1, -5e-320], N[(x / a), $MachinePrecision], If[Or[LessEqual[t$95$1, 1e-321], N[Not[LessEqual[t$95$1, 5e+265]], $MachinePrecision]], N[(z / b), $MachinePrecision], N[(x / 1.0), $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 -1 \cdot 10^{+44}:\\
\;\;\;\;\frac{x}{1}\\
\mathbf{elif}\;t\_1 \leq -5 \cdot 10^{-320}:\\
\;\;\;\;\frac{x}{a}\\
\mathbf{elif}\;t\_1 \leq 10^{-321} \lor \neg \left(t\_1 \leq 5 \cdot 10^{+265}\right):\\
\;\;\;\;\frac{z}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{1}\\
\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 -4.99994e-320 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < 9.98013e-322 or 5.0000000000000002e265 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) Initial program 26.9%
Taylor expanded in y around inf
lower-/.f6466.9
Applied rewrites66.9%
if -inf.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < -1.0000000000000001e44 or 9.98013e-322 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < 5.0000000000000002e265Initial program 99.7%
Taylor expanded in x around inf
Applied rewrites71.9%
Taylor expanded in y around 0
lift-+.f6459.7
Applied rewrites59.7%
Taylor expanded in a around 0
Applied rewrites42.5%
if -1.0000000000000001e44 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < -4.99994e-320Initial program 99.4%
Taylor expanded in x around inf
Applied rewrites54.8%
Taylor expanded in a around inf
Applied rewrites35.9%
Final simplification50.7%
(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 -5e+266)
(fma y (/ z (fma b y (* t (+ 1.0 a)))) (/ x (+ 1.0 a)))
(if (<= t_1 5e+265) t_1 (fma (/ x (* b y)) 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 <= -5e+266) {
tmp = fma(y, (z / fma(b, y, (t * (1.0 + a)))), (x / (1.0 + a)));
} else if (t_1 <= 5e+265) {
tmp = t_1;
} else {
tmp = fma((x / (b * y)), t, (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 <= -5e+266) tmp = fma(y, Float64(z / fma(b, y, Float64(t * Float64(1.0 + a)))), Float64(x / Float64(1.0 + a))); elseif (t_1 <= 5e+265) tmp = t_1; else tmp = fma(Float64(x / Float64(b * y)), t, 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, -5e+266], N[(y * N[(z / N[(b * y + N[(t * N[(1.0 + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x / N[(1.0 + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+265], t$95$1, N[(N[(x / N[(b * y), $MachinePrecision]), $MachinePrecision] * t + N[(z / b), $MachinePrecision]), $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 -5 \cdot 10^{+266}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z}{\mathsf{fma}\left(b, y, t \cdot \left(1 + a\right)\right)}, \frac{x}{1 + a}\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+265}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{b \cdot y}, t, \frac{z}{b}\right)\\
\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))) < -4.9999999999999999e266Initial program 41.1%
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
div-addN/A
+-commutativeN/A
*-commutativeN/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
associate-+r+N/A
Applied rewrites71.7%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-*.f64N/A
lift-+.f6494.9
Applied rewrites94.9%
Taylor expanded in y around 0
lift-+.f6476.6
Applied rewrites76.6%
if -4.9999999999999999e266 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < 5.0000000000000002e265Initial program 89.9%
if 5.0000000000000002e265 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) Initial program 11.7%
Taylor expanded in t around 0
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites55.7%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6487.5
Applied rewrites87.5%
Final simplification88.3%
(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+266)
(fma y (/ z (fma b y (* t (+ 1.0 a)))) (/ x (+ 1.0 a)))
(if (<= t_2 5e+265)
(/ t_1 (fma y (/ b t) (+ 1.0 a)))
(fma (/ x (* b y)) t (/ 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+266) {
tmp = fma(y, (z / fma(b, y, (t * (1.0 + a)))), (x / (1.0 + a)));
} else if (t_2 <= 5e+265) {
tmp = t_1 / fma(y, (b / t), (1.0 + a));
} else {
tmp = fma((x / (b * y)), t, (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+266) tmp = fma(y, Float64(z / fma(b, y, Float64(t * Float64(1.0 + a)))), Float64(x / Float64(1.0 + a))); elseif (t_2 <= 5e+265) tmp = Float64(t_1 / fma(y, Float64(b / t), Float64(1.0 + a))); else tmp = fma(Float64(x / Float64(b * y)), t, Float64(z / b)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 / N[(N[(a + 1.0), $MachinePrecision] + N[(N[(y * b), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+266], N[(y * N[(z / N[(b * y + N[(t * N[(1.0 + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x / N[(1.0 + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 5e+265], N[(t$95$1 / N[(y * N[(b / t), $MachinePrecision] + N[(1.0 + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(b * y), $MachinePrecision]), $MachinePrecision] * t + N[(z / b), $MachinePrecision]), $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^{+266}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z}{\mathsf{fma}\left(b, y, t \cdot \left(1 + a\right)\right)}, \frac{x}{1 + a}\right)\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+265}:\\
\;\;\;\;\frac{t\_1}{\mathsf{fma}\left(y, \frac{b}{t}, 1 + a\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{b \cdot y}, t, \frac{z}{b}\right)\\
\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))) < -4.9999999999999999e266Initial program 41.1%
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
div-addN/A
+-commutativeN/A
*-commutativeN/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
associate-+r+N/A
Applied rewrites71.7%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-*.f64N/A
lift-+.f6494.9
Applied rewrites94.9%
Taylor expanded in y around 0
lift-+.f6476.6
Applied rewrites76.6%
if -4.9999999999999999e266 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < 5.0000000000000002e265Initial program 89.9%
lift-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-+.f6489.7
Applied rewrites89.7%
if 5.0000000000000002e265 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) Initial program 11.7%
Taylor expanded in t around 0
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites55.7%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6487.5
Applied rewrites87.5%
Final simplification88.2%
(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))
(* (/ y t) (/ z (+ 1.0 a)))
(if (<= t_1 5e+265)
(/ x (fma b (/ y t) (+ 1.0 a)))
(/ (+ z (/ (* t x) y)) 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 = (y / t) * (z / (1.0 + a));
} else if (t_1 <= 5e+265) {
tmp = x / fma(b, (y / t), (1.0 + a));
} else {
tmp = (z + ((t * x) / y)) / 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(Float64(y / t) * Float64(z / Float64(1.0 + a))); elseif (t_1 <= 5e+265) tmp = Float64(x / fma(b, Float64(y / t), Float64(1.0 + a))); else tmp = Float64(Float64(z + Float64(Float64(t * x) / y)) / 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[(N[(y / t), $MachinePrecision] * N[(z / N[(1.0 + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+265], N[(x / N[(b * N[(y / t), $MachinePrecision] + N[(1.0 + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z + N[(N[(t * x), $MachinePrecision] / y), $MachinePrecision]), $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}}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\frac{y}{t} \cdot \frac{z}{1 + a}\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+265}:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(b, \frac{y}{t}, 1 + a\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{z + \frac{t \cdot x}{y}}{b}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < -inf.0Initial program 31.4%
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
div-addN/A
+-commutativeN/A
*-commutativeN/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
associate-+r+N/A
Applied rewrites71.7%
Taylor expanded in b around 0
lower-+.f64N/A
lower-/.f64N/A
lift-+.f64N/A
times-fracN/A
lower-*.f64N/A
lift-/.f64N/A
lower-/.f64N/A
lift-+.f6456.6
Applied rewrites56.6%
Taylor expanded in x around 0
frac-timesN/A
lift-/.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-*.f6453.9
Applied rewrites53.9%
if -inf.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < 5.0000000000000002e265Initial program 90.0%
Taylor expanded in x around inf
lower-/.f64N/A
associate-+r+N/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-+.f6464.2
Applied rewrites64.2%
if 5.0000000000000002e265 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) Initial program 11.7%
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
div-addN/A
+-commutativeN/A
*-commutativeN/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
associate-+r+N/A
Applied rewrites30.3%
Taylor expanded in b around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6487.4
Applied rewrites87.4%
Final simplification67.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (+ x (/ (* y z) t)) (+ (+ a 1.0) (/ (* y b) t)))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 5e+265)))
(/ z b)
(/ x (+ 1.0 a)))))
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)) || !(t_1 <= 5e+265)) {
tmp = z / b;
} else {
tmp = x / (1.0 + a);
}
return tmp;
}
public static 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.POSITIVE_INFINITY) || !(t_1 <= 5e+265)) {
tmp = z / b;
} else {
tmp = x / (1.0 + a);
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t)) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 5e+265): tmp = z / b else: tmp = x / (1.0 + a) 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)) || !(t_1 <= 5e+265)) tmp = Float64(z / b); else tmp = Float64(x / Float64(1.0 + a)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t)); tmp = 0.0; if ((t_1 <= -Inf) || ~((t_1 <= 5e+265))) tmp = z / b; else tmp = x / (1.0 + a); end tmp_2 = 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[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 5e+265]], $MachinePrecision]], N[(z / b), $MachinePrecision], N[(x / N[(1.0 + a), $MachinePrecision]), $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 \lor \neg \left(t\_1 \leq 5 \cdot 10^{+265}\right):\\
\;\;\;\;\frac{z}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{1 + a}\\
\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 5.0000000000000002e265 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) Initial program 17.1%
Taylor expanded in y around inf
lower-/.f6473.3
Applied rewrites73.3%
if -inf.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < 5.0000000000000002e265Initial program 90.0%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6450.7
Applied rewrites50.7%
Final simplification56.4%
(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))
(* (/ y a) (/ z t))
(if (<= t_1 5e+265) (/ x (+ 1.0 a)) (/ 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 = (y / a) * (z / t);
} else if (t_1 <= 5e+265) {
tmp = x / (1.0 + a);
} else {
tmp = z / b;
}
return tmp;
}
public static 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.POSITIVE_INFINITY) {
tmp = (y / a) * (z / t);
} else if (t_1 <= 5e+265) {
tmp = x / (1.0 + a);
} else {
tmp = z / b;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t)) tmp = 0 if t_1 <= -math.inf: tmp = (y / a) * (z / t) elif t_1 <= 5e+265: tmp = x / (1.0 + a) 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(Float64(y / a) * Float64(z / t)); elseif (t_1 <= 5e+265) tmp = Float64(x / Float64(1.0 + a)); else tmp = Float64(z / b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t)); tmp = 0.0; if (t_1 <= -Inf) tmp = (y / a) * (z / t); elseif (t_1 <= 5e+265) tmp = x / (1.0 + a); else tmp = z / b; end tmp_2 = 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[(N[(y / a), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+265], N[(x / N[(1.0 + a), $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{y}{a} \cdot \frac{z}{t}\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+265}:\\
\;\;\;\;\frac{x}{1 + a}\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{b}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < -inf.0Initial program 31.4%
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
div-addN/A
+-commutativeN/A
*-commutativeN/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
associate-+r+N/A
Applied rewrites71.7%
Taylor expanded in b around 0
lower-+.f64N/A
lower-/.f64N/A
lift-+.f64N/A
times-fracN/A
lower-*.f64N/A
lift-/.f64N/A
lower-/.f64N/A
lift-+.f6456.6
Applied rewrites56.6%
Taylor expanded in x around 0
frac-timesN/A
lift-/.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-*.f6453.9
Applied rewrites53.9%
Taylor expanded in a around inf
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6448.0
Applied rewrites48.0%
if -inf.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < 5.0000000000000002e265Initial program 90.0%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6450.7
Applied rewrites50.7%
if 5.0000000000000002e265 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) Initial program 11.7%
Taylor expanded in y around inf
lower-/.f6487.4
Applied rewrites87.4%
Final simplification57.3%
(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))
(/ (* y z) (* t (+ 1.0 a)))
(if (<= t_1 5e+265) (/ x (+ 1.0 a)) (/ 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 = (y * z) / (t * (1.0 + a));
} else if (t_1 <= 5e+265) {
tmp = x / (1.0 + a);
} else {
tmp = z / b;
}
return tmp;
}
public static 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.POSITIVE_INFINITY) {
tmp = (y * z) / (t * (1.0 + a));
} else if (t_1 <= 5e+265) {
tmp = x / (1.0 + a);
} else {
tmp = z / b;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t)) tmp = 0 if t_1 <= -math.inf: tmp = (y * z) / (t * (1.0 + a)) elif t_1 <= 5e+265: tmp = x / (1.0 + a) 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(Float64(y * z) / Float64(t * Float64(1.0 + a))); elseif (t_1 <= 5e+265) tmp = Float64(x / Float64(1.0 + a)); else tmp = Float64(z / b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t)); tmp = 0.0; if (t_1 <= -Inf) tmp = (y * z) / (t * (1.0 + a)); elseif (t_1 <= 5e+265) tmp = x / (1.0 + a); else tmp = z / b; end tmp_2 = 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[(N[(y * z), $MachinePrecision] / N[(t * N[(1.0 + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+265], N[(x / N[(1.0 + a), $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{y \cdot z}{t \cdot \left(1 + a\right)}\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+265}:\\
\;\;\;\;\frac{x}{1 + a}\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{b}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < -inf.0Initial program 31.4%
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
div-addN/A
+-commutativeN/A
*-commutativeN/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
associate-+r+N/A
Applied rewrites71.7%
Taylor expanded in b around 0
lower-+.f64N/A
lower-/.f64N/A
lift-+.f64N/A
times-fracN/A
lower-*.f64N/A
lift-/.f64N/A
lower-/.f64N/A
lift-+.f6456.6
Applied rewrites56.6%
Taylor expanded in x around 0
frac-timesN/A
lift-/.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-*.f6453.9
Applied rewrites53.9%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
frac-timesN/A
lower-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f6445.8
Applied rewrites45.8%
if -inf.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < 5.0000000000000002e265Initial program 90.0%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6450.7
Applied rewrites50.7%
if 5.0000000000000002e265 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) Initial program 11.7%
Taylor expanded in y around inf
lower-/.f6487.4
Applied rewrites87.4%
Final simplification57.1%
(FPCore (x y z t a b)
:precision binary64
(if (<= b -1.22e+17)
(fma (/ x (* b y)) t (/ z b))
(if (<= b 1.65e+86)
(fma y (/ z (fma b y (* t (+ 1.0 a)))) (/ x (+ 1.0 a)))
(/ (+ z (/ (* t x) y)) b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -1.22e+17) {
tmp = fma((x / (b * y)), t, (z / b));
} else if (b <= 1.65e+86) {
tmp = fma(y, (z / fma(b, y, (t * (1.0 + a)))), (x / (1.0 + a)));
} else {
tmp = (z + ((t * x) / y)) / b;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -1.22e+17) tmp = fma(Float64(x / Float64(b * y)), t, Float64(z / b)); elseif (b <= 1.65e+86) tmp = fma(y, Float64(z / fma(b, y, Float64(t * Float64(1.0 + a)))), Float64(x / Float64(1.0 + a))); else tmp = Float64(Float64(z + Float64(Float64(t * x) / y)) / b); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -1.22e+17], N[(N[(x / N[(b * y), $MachinePrecision]), $MachinePrecision] * t + N[(z / b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.65e+86], N[(y * N[(z / N[(b * y + N[(t * N[(1.0 + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x / N[(1.0 + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z + N[(N[(t * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.22 \cdot 10^{+17}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{b \cdot y}, t, \frac{z}{b}\right)\\
\mathbf{elif}\;b \leq 1.65 \cdot 10^{+86}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z}{\mathsf{fma}\left(b, y, t \cdot \left(1 + a\right)\right)}, \frac{x}{1 + a}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z + \frac{t \cdot x}{y}}{b}\\
\end{array}
\end{array}
if b < -1.22e17Initial program 50.2%
Taylor expanded in t around 0
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites62.8%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6469.8
Applied rewrites69.8%
if -1.22e17 < b < 1.65e86Initial program 82.8%
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
div-addN/A
+-commutativeN/A
*-commutativeN/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
associate-+r+N/A
Applied rewrites78.7%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-*.f64N/A
lift-+.f6492.1
Applied rewrites92.1%
Taylor expanded in y around 0
lift-+.f6487.3
Applied rewrites87.3%
if 1.65e86 < b Initial program 57.5%
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
div-addN/A
+-commutativeN/A
*-commutativeN/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
associate-+r+N/A
Applied rewrites71.5%
Taylor expanded in b around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6476.9
Applied rewrites76.9%
Final simplification81.7%
(FPCore (x y z t a b)
:precision binary64
(if (<= b -2.6e-8)
(fma (/ x (* b y)) t (/ z b))
(if (<= b 6.8e+38)
(fma y (/ z (* t (+ 1.0 a))) (/ x (+ 1.0 a)))
(/ (+ z (/ (* t x) y)) b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -2.6e-8) {
tmp = fma((x / (b * y)), t, (z / b));
} else if (b <= 6.8e+38) {
tmp = fma(y, (z / (t * (1.0 + a))), (x / (1.0 + a)));
} else {
tmp = (z + ((t * x) / y)) / b;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -2.6e-8) tmp = fma(Float64(x / Float64(b * y)), t, Float64(z / b)); elseif (b <= 6.8e+38) tmp = fma(y, Float64(z / Float64(t * Float64(1.0 + a))), Float64(x / Float64(1.0 + a))); else tmp = Float64(Float64(z + Float64(Float64(t * x) / y)) / b); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -2.6e-8], N[(N[(x / N[(b * y), $MachinePrecision]), $MachinePrecision] * t + N[(z / b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 6.8e+38], N[(y * N[(z / N[(t * N[(1.0 + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x / N[(1.0 + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z + N[(N[(t * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.6 \cdot 10^{-8}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{b \cdot y}, t, \frac{z}{b}\right)\\
\mathbf{elif}\;b \leq 6.8 \cdot 10^{+38}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z}{t \cdot \left(1 + a\right)}, \frac{x}{1 + a}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z + \frac{t \cdot x}{y}}{b}\\
\end{array}
\end{array}
if b < -2.6000000000000001e-8Initial program 50.2%
Taylor expanded in t around 0
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites60.9%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6469.2
Applied rewrites69.2%
if -2.6000000000000001e-8 < b < 6.79999999999999992e38Initial program 83.9%
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
div-addN/A
+-commutativeN/A
*-commutativeN/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
associate-+r+N/A
Applied rewrites79.0%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-*.f64N/A
lift-+.f6491.8
Applied rewrites91.8%
Taylor expanded in y around 0
lift-+.f6488.0
Applied rewrites88.0%
Taylor expanded in y around 0
lift-*.f64N/A
lift-+.f6479.8
Applied rewrites79.8%
if 6.79999999999999992e38 < b Initial program 58.0%
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
div-addN/A
+-commutativeN/A
*-commutativeN/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
associate-+r+N/A
Applied rewrites72.5%
Taylor expanded in b around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6475.0
Applied rewrites75.0%
Final simplification76.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (+ z (/ (* t x) y)) b)))
(if (<= y -5.25e-39)
t_1
(if (<= y 4.2e-104)
(/ x (+ 1.0 a))
(if (<= y 6.5e+70) (/ (/ (* y z) t) (+ 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 <= -5.25e-39) {
tmp = t_1;
} else if (y <= 4.2e-104) {
tmp = x / (1.0 + a);
} else if (y <= 6.5e+70) {
tmp = ((y * z) / t) / (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 <= (-5.25d-39)) then
tmp = t_1
else if (y <= 4.2d-104) then
tmp = x / (1.0d0 + a)
else if (y <= 6.5d+70) then
tmp = ((y * z) / t) / (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 <= -5.25e-39) {
tmp = t_1;
} else if (y <= 4.2e-104) {
tmp = x / (1.0 + a);
} else if (y <= 6.5e+70) {
tmp = ((y * z) / t) / (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 <= -5.25e-39: tmp = t_1 elif y <= 4.2e-104: tmp = x / (1.0 + a) elif y <= 6.5e+70: tmp = ((y * z) / t) / (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 <= -5.25e-39) tmp = t_1; elseif (y <= 4.2e-104) tmp = Float64(x / Float64(1.0 + a)); elseif (y <= 6.5e+70) tmp = Float64(Float64(Float64(y * z) / t) / 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 <= -5.25e-39) tmp = t_1; elseif (y <= 4.2e-104) tmp = x / (1.0 + a); elseif (y <= 6.5e+70) tmp = ((y * z) / t) / (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, -5.25e-39], t$95$1, If[LessEqual[y, 4.2e-104], N[(x / N[(1.0 + a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.5e+70], N[(N[(N[(y * z), $MachinePrecision] / t), $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 -5.25 \cdot 10^{-39}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{-104}:\\
\;\;\;\;\frac{x}{1 + a}\\
\mathbf{elif}\;y \leq 6.5 \cdot 10^{+70}:\\
\;\;\;\;\frac{\frac{y \cdot z}{t}}{1 + a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -5.25000000000000032e-39 or 6.49999999999999978e70 < y Initial program 51.5%
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
div-addN/A
+-commutativeN/A
*-commutativeN/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
associate-+r+N/A
Applied rewrites56.5%
Taylor expanded in b around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6461.1
Applied rewrites61.1%
if -5.25000000000000032e-39 < y < 4.19999999999999997e-104Initial program 94.5%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6472.5
Applied rewrites72.5%
if 4.19999999999999997e-104 < y < 6.49999999999999978e70Initial program 88.9%
Taylor expanded in x around inf
Applied rewrites33.1%
Taylor expanded in y around 0
lift-+.f6427.8
Applied rewrites27.8%
Taylor expanded in x around 0
lower-/.f64N/A
lift-*.f6451.9
Applied rewrites51.9%
Final simplification63.7%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (+ z (/ (* t x) y)) b)))
(if (<= y -5.25e-39)
t_1
(if (<= y 4.2e-104)
(/ x (+ 1.0 a))
(if (<= y 8e+70) (/ (* y z) (* t (+ 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 <= -5.25e-39) {
tmp = t_1;
} else if (y <= 4.2e-104) {
tmp = x / (1.0 + a);
} else if (y <= 8e+70) {
tmp = (y * z) / (t * (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 <= (-5.25d-39)) then
tmp = t_1
else if (y <= 4.2d-104) then
tmp = x / (1.0d0 + a)
else if (y <= 8d+70) then
tmp = (y * z) / (t * (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 <= -5.25e-39) {
tmp = t_1;
} else if (y <= 4.2e-104) {
tmp = x / (1.0 + a);
} else if (y <= 8e+70) {
tmp = (y * z) / (t * (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 <= -5.25e-39: tmp = t_1 elif y <= 4.2e-104: tmp = x / (1.0 + a) elif y <= 8e+70: tmp = (y * z) / (t * (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 <= -5.25e-39) tmp = t_1; elseif (y <= 4.2e-104) tmp = Float64(x / Float64(1.0 + a)); elseif (y <= 8e+70) tmp = Float64(Float64(y * z) / Float64(t * 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 <= -5.25e-39) tmp = t_1; elseif (y <= 4.2e-104) tmp = x / (1.0 + a); elseif (y <= 8e+70) tmp = (y * z) / (t * (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, -5.25e-39], t$95$1, If[LessEqual[y, 4.2e-104], N[(x / N[(1.0 + a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8e+70], N[(N[(y * z), $MachinePrecision] / N[(t * N[(1.0 + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z + \frac{t \cdot x}{y}}{b}\\
\mathbf{if}\;y \leq -5.25 \cdot 10^{-39}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{-104}:\\
\;\;\;\;\frac{x}{1 + a}\\
\mathbf{elif}\;y \leq 8 \cdot 10^{+70}:\\
\;\;\;\;\frac{y \cdot z}{t \cdot \left(1 + a\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -5.25000000000000032e-39 or 8.00000000000000058e70 < y Initial program 51.5%
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
div-addN/A
+-commutativeN/A
*-commutativeN/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
associate-+r+N/A
Applied rewrites56.5%
Taylor expanded in b around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6461.1
Applied rewrites61.1%
if -5.25000000000000032e-39 < y < 4.19999999999999997e-104Initial program 94.5%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6472.5
Applied rewrites72.5%
if 4.19999999999999997e-104 < y < 8.00000000000000058e70Initial program 88.9%
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
div-addN/A
+-commutativeN/A
*-commutativeN/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
associate-+r+N/A
Applied rewrites88.8%
Taylor expanded in b around 0
lower-+.f64N/A
lower-/.f64N/A
lift-+.f64N/A
times-fracN/A
lower-*.f64N/A
lift-/.f64N/A
lower-/.f64N/A
lift-+.f6465.1
Applied rewrites65.1%
Taylor expanded in x around 0
frac-timesN/A
lift-/.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-*.f6446.0
Applied rewrites46.0%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
frac-timesN/A
lower-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f6449.6
Applied rewrites49.6%
Final simplification63.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -2.6e-8) (not (<= b 9.8e+38))) (/ (+ z (/ (* t x) y)) b) (/ (fma y (/ z t) x) (+ 1.0 a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -2.6e-8) || !(b <= 9.8e+38)) {
tmp = (z + ((t * x) / y)) / b;
} else {
tmp = fma(y, (z / t), x) / (1.0 + a);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -2.6e-8) || !(b <= 9.8e+38)) tmp = Float64(Float64(z + Float64(Float64(t * x) / y)) / b); else tmp = Float64(fma(y, Float64(z / t), x) / Float64(1.0 + a)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -2.6e-8], N[Not[LessEqual[b, 9.8e+38]], $MachinePrecision]], N[(N[(z + N[(N[(t * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision], N[(N[(y * N[(z / t), $MachinePrecision] + x), $MachinePrecision] / N[(1.0 + a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.6 \cdot 10^{-8} \lor \neg \left(b \leq 9.8 \cdot 10^{+38}\right):\\
\;\;\;\;\frac{z + \frac{t \cdot x}{y}}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, \frac{z}{t}, x\right)}{1 + a}\\
\end{array}
\end{array}
if b < -2.6000000000000001e-8 or 9.80000000000000004e38 < b Initial program 53.4%
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
div-addN/A
+-commutativeN/A
*-commutativeN/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
associate-+r+N/A
Applied rewrites67.0%
Taylor expanded in b around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6469.7
Applied rewrites69.7%
if -2.6000000000000001e-8 < b < 9.80000000000000004e38Initial program 83.9%
Taylor expanded in b around 0
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-+.f6479.2
Applied rewrites79.2%
Final simplification75.3%
(FPCore (x y z t a b)
:precision binary64
(if (<= b -2.6e-8)
(fma (/ x (* b y)) t (/ z b))
(if (<= b 9.8e+38)
(/ (fma y (/ z t) x) (+ 1.0 a))
(/ (+ z (/ (* t x) y)) b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -2.6e-8) {
tmp = fma((x / (b * y)), t, (z / b));
} else if (b <= 9.8e+38) {
tmp = fma(y, (z / t), x) / (1.0 + a);
} else {
tmp = (z + ((t * x) / y)) / b;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -2.6e-8) tmp = fma(Float64(x / Float64(b * y)), t, Float64(z / b)); elseif (b <= 9.8e+38) tmp = Float64(fma(y, Float64(z / t), x) / Float64(1.0 + a)); else tmp = Float64(Float64(z + Float64(Float64(t * x) / y)) / b); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -2.6e-8], N[(N[(x / N[(b * y), $MachinePrecision]), $MachinePrecision] * t + N[(z / b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 9.8e+38], N[(N[(y * N[(z / t), $MachinePrecision] + x), $MachinePrecision] / N[(1.0 + a), $MachinePrecision]), $MachinePrecision], N[(N[(z + N[(N[(t * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.6 \cdot 10^{-8}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{b \cdot y}, t, \frac{z}{b}\right)\\
\mathbf{elif}\;b \leq 9.8 \cdot 10^{+38}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, \frac{z}{t}, x\right)}{1 + a}\\
\mathbf{else}:\\
\;\;\;\;\frac{z + \frac{t \cdot x}{y}}{b}\\
\end{array}
\end{array}
if b < -2.6000000000000001e-8Initial program 50.2%
Taylor expanded in t around 0
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites60.9%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6469.2
Applied rewrites69.2%
if -2.6000000000000001e-8 < b < 9.80000000000000004e38Initial program 83.9%
Taylor expanded in b around 0
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-+.f6479.2
Applied rewrites79.2%
if 9.80000000000000004e38 < b Initial program 58.0%
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
div-addN/A
+-commutativeN/A
*-commutativeN/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
associate-+r+N/A
Applied rewrites72.5%
Taylor expanded in b around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6475.0
Applied rewrites75.0%
Final simplification76.1%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -1350000000000.0) (not (<= y 8.2e-116))) (/ z b) (/ x a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -1350000000000.0) || !(y <= 8.2e-116)) {
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 ((y <= (-1350000000000.0d0)) .or. (.not. (y <= 8.2d-116))) 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 ((y <= -1350000000000.0) || !(y <= 8.2e-116)) {
tmp = z / b;
} else {
tmp = x / a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -1350000000000.0) or not (y <= 8.2e-116): tmp = z / b else: tmp = x / a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -1350000000000.0) || !(y <= 8.2e-116)) 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 ((y <= -1350000000000.0) || ~((y <= 8.2e-116))) tmp = z / b; else tmp = x / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -1350000000000.0], N[Not[LessEqual[y, 8.2e-116]], $MachinePrecision]], N[(z / b), $MachinePrecision], N[(x / a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1350000000000 \lor \neg \left(y \leq 8.2 \cdot 10^{-116}\right):\\
\;\;\;\;\frac{z}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{a}\\
\end{array}
\end{array}
if y < -1.35e12 or 8.1999999999999998e-116 < y Initial program 57.1%
Taylor expanded in y around inf
lower-/.f6446.8
Applied rewrites46.8%
if -1.35e12 < y < 8.1999999999999998e-116Initial program 94.0%
Taylor expanded in x around inf
Applied rewrites78.3%
Taylor expanded in a around inf
Applied rewrites33.3%
Final simplification41.5%
(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 71.5%
Taylor expanded in y around inf
lower-/.f6433.1
Applied rewrites33.1%
Final simplification33.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1
(* 1.0 (* (+ x (* (/ y t) z)) (/ 1.0 (+ (+ a 1.0) (* (/ y t) b)))))))
(if (< t -1.3659085366310088e-271)
t_1
(if (< t 3.036967103737246e-130) (/ z b) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = 1.0 * ((x + ((y / t) * z)) * (1.0 / ((a + 1.0) + ((y / t) * b))));
double tmp;
if (t < -1.3659085366310088e-271) {
tmp = t_1;
} else if (t < 3.036967103737246e-130) {
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 = 1.0d0 * ((x + ((y / t) * z)) * (1.0d0 / ((a + 1.0d0) + ((y / t) * b))))
if (t < (-1.3659085366310088d-271)) then
tmp = t_1
else if (t < 3.036967103737246d-130) 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 = 1.0 * ((x + ((y / t) * z)) * (1.0 / ((a + 1.0) + ((y / t) * b))));
double tmp;
if (t < -1.3659085366310088e-271) {
tmp = t_1;
} else if (t < 3.036967103737246e-130) {
tmp = z / b;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = 1.0 * ((x + ((y / t) * z)) * (1.0 / ((a + 1.0) + ((y / t) * b)))) tmp = 0 if t < -1.3659085366310088e-271: tmp = t_1 elif t < 3.036967103737246e-130: tmp = z / b else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(1.0 * Float64(Float64(x + Float64(Float64(y / t) * z)) * Float64(1.0 / Float64(Float64(a + 1.0) + Float64(Float64(y / t) * b))))) tmp = 0.0 if (t < -1.3659085366310088e-271) tmp = t_1; elseif (t < 3.036967103737246e-130) tmp = Float64(z / b); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = 1.0 * ((x + ((y / t) * z)) * (1.0 / ((a + 1.0) + ((y / t) * b)))); tmp = 0.0; if (t < -1.3659085366310088e-271) tmp = t_1; elseif (t < 3.036967103737246e-130) tmp = z / b; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(1.0 * N[(N[(x + N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(N[(a + 1.0), $MachinePrecision] + N[(N[(y / t), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t, -1.3659085366310088e-271], t$95$1, If[Less[t, 3.036967103737246e-130], N[(z / b), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 1 \cdot \left(\left(x + \frac{y}{t} \cdot z\right) \cdot \frac{1}{\left(a + 1\right) + \frac{y}{t} \cdot b}\right)\\
\mathbf{if}\;t < -1.3659085366310088 \cdot 10^{-271}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t < 3.036967103737246 \cdot 10^{-130}:\\
\;\;\;\;\frac{z}{b}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2025051
(FPCore (x y z t a b)
:name "Diagrams.Solve.Tridiagonal:solveCyclicTriDiagonal from diagrams-solve-0.1, B"
:precision binary64
:alt
(! :herbie-platform default (if (< t -1707385670788761/12500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (* 1 (* (+ x (* (/ y t) z)) (/ 1 (+ (+ a 1) (* (/ y t) b))))) (if (< t 1518483551868623/5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (/ z b) (* 1 (* (+ x (* (/ y t) z)) (/ 1 (+ (+ a 1) (* (/ y t) b))))))))
(/ (+ x (/ (* y z) t)) (+ (+ a 1.0) (/ (* y b) t))))