
(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]
\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}
Herbie found 16 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]
\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (+ x (/ (* y z) t)) (+ (+ a 1.0) (/ (* y b) t))))
(t_2 (fma a t (fma b y t))))
(if (<= t_1 (- INFINITY))
(fma z (/ y t_2) (/ x a))
(if (<= t_1 -1e-315)
t_1
(if (<= t_1 0.0)
(/ (fma t x (* z y)) t_2)
(if (<= t_1 2e+222)
t_1
(fma z (/ 1.0 b) (/ x (fma (/ y t) b (- a -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 t_2 = fma(a, t, fma(b, y, t));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = fma(z, (y / t_2), (x / a));
} else if (t_1 <= -1e-315) {
tmp = t_1;
} else if (t_1 <= 0.0) {
tmp = fma(t, x, (z * y)) / t_2;
} else if (t_1 <= 2e+222) {
tmp = t_1;
} else {
tmp = fma(z, (1.0 / b), (x / fma((y / t), b, (a - -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))) t_2 = fma(a, t, fma(b, y, t)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = fma(z, Float64(y / t_2), Float64(x / a)); elseif (t_1 <= -1e-315) tmp = t_1; elseif (t_1 <= 0.0) tmp = Float64(fma(t, x, Float64(z * y)) / t_2); elseif (t_1 <= 2e+222) tmp = t_1; else tmp = fma(z, Float64(1.0 / b), Float64(x / fma(Float64(y / t), b, Float64(a - -1.0)))); 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[(a * t + N[(b * y + t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(z * N[(y / t$95$2), $MachinePrecision] + N[(x / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -1e-315], t$95$1, If[LessEqual[t$95$1, 0.0], N[(N[(t * x + N[(z * y), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision], If[LessEqual[t$95$1, 2e+222], t$95$1, N[(z * N[(1.0 / b), $MachinePrecision] + N[(x / N[(N[(y / t), $MachinePrecision] * b + N[(a - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
t_1 := \frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}\\
t_2 := \mathsf{fma}\left(a, t, \mathsf{fma}\left(b, y, t\right)\right)\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{y}{t\_2}, \frac{x}{a}\right)\\
\mathbf{elif}\;t\_1 \leq -1 \cdot 10^{-315}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\frac{\mathsf{fma}\left(t, x, z \cdot y\right)}{t\_2}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+222}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{1}{b}, \frac{x}{\mathsf{fma}\left(\frac{y}{t}, b, a - -1\right)}\right)\\
\end{array}
if (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < -inf.0Initial program 75.5%
Applied rewrites88.0%
Taylor expanded in a around inf
lower-/.f6447.6%
Applied rewrites47.6%
if -inf.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < -9.9999999848168381e-316 or -0.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < 2.0000000000000001e222Initial program 75.5%
if -9.9999999848168381e-316 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < -0.0Initial program 75.5%
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
associate-/l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
distribute-rgt-inN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-+.f6464.6%
lower-unsound-/.f64N/A
*-lft-identityN/A
lower-unsound-+.f64N/A
Applied rewrites70.3%
if 2.0000000000000001e222 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) Initial program 75.5%
Applied rewrites88.0%
Taylor expanded in y around inf
lower-/.f6459.1%
Applied rewrites59.1%
(FPCore (x y z t a b) :precision binary64 (if (<= (/ (+ x (/ (* y z) t)) (+ (+ a 1.0) (/ (* y b) t))) INFINITY) (fma z (/ y (fma a t (fma b y t))) (/ x (fma (/ y t) b (- a -1.0)))) (/ 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(z, (y / fma(a, t, fma(b, y, t))), (x / fma((y / t), b, (a - -1.0))));
} 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(z, Float64(y / fma(a, t, fma(b, y, t))), Float64(x / fma(Float64(y / t), b, Float64(a - -1.0)))); 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[(z * N[(y / N[(a * t + N[(b * y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x / N[(N[(y / t), $MachinePrecision] * b + N[(a - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z / b), $MachinePrecision]]
\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(z, \frac{y}{\mathsf{fma}\left(a, t, \mathsf{fma}\left(b, y, t\right)\right)}, \frac{x}{\mathsf{fma}\left(\frac{y}{t}, b, a - -1\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{b}\\
\end{array}
if (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < +inf.0Initial program 75.5%
Applied rewrites88.0%
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.5%
Taylor expanded in y around inf
lower-/.f6434.3%
Applied rewrites34.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (fma (/ y t) z x) (fma (/ y t) b (- a -1.0)))))
(if (<= t -7e-16)
t_1
(if (<= t 7.5e-58) (/ (fma t x (* z y)) (fma a t (fma b y t))) t_1))))double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma((y / t), z, x) / fma((y / t), b, (a - -1.0));
double tmp;
if (t <= -7e-16) {
tmp = t_1;
} else if (t <= 7.5e-58) {
tmp = fma(t, x, (z * y)) / fma(a, t, fma(b, y, t));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(fma(Float64(y / t), z, x) / fma(Float64(y / t), b, Float64(a - -1.0))) tmp = 0.0 if (t <= -7e-16) tmp = t_1; elseif (t <= 7.5e-58) tmp = Float64(fma(t, x, Float64(z * y)) / fma(a, t, fma(b, y, t))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(y / t), $MachinePrecision] * z + x), $MachinePrecision] / N[(N[(y / t), $MachinePrecision] * b + N[(a - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -7e-16], t$95$1, If[LessEqual[t, 7.5e-58], N[(N[(t * x + N[(z * y), $MachinePrecision]), $MachinePrecision] / N[(a * t + N[(b * y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \frac{\mathsf{fma}\left(\frac{y}{t}, z, x\right)}{\mathsf{fma}\left(\frac{y}{t}, b, a - -1\right)}\\
\mathbf{if}\;t \leq -7 \cdot 10^{-16}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 7.5 \cdot 10^{-58}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t, x, z \cdot y\right)}{\mathsf{fma}\left(a, t, \mathsf{fma}\left(b, y, t\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if t < -7.0000000000000003e-16 or 7.5e-58 < t Initial program 75.5%
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.7%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6477.5%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval77.5%
Applied rewrites77.5%
if -7.0000000000000003e-16 < t < 7.5e-58Initial program 75.5%
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
associate-/l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
distribute-rgt-inN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-+.f6464.6%
lower-unsound-/.f64N/A
*-lft-identityN/A
lower-unsound-+.f64N/A
Applied rewrites70.3%
(FPCore (x y z t a b)
:precision binary64
(if (<= t -2.4e+45)
(/ (fma (/ z t) y x) (+ 1.0 a))
(if (<= t 1.45e+27)
(/ (fma t x (* z y)) (fma a t (fma b y 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 <= -2.4e+45) {
tmp = fma((z / t), y, x) / (1.0 + a);
} else if (t <= 1.45e+27) {
tmp = fma(t, x, (z * y)) / fma(a, t, fma(b, y, 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 <= -2.4e+45) tmp = Float64(fma(Float64(z / t), y, x) / Float64(1.0 + a)); elseif (t <= 1.45e+27) tmp = Float64(fma(t, x, Float64(z * y)) / fma(a, t, fma(b, y, 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, -2.4e+45], N[(N[(N[(z / t), $MachinePrecision] * y + x), $MachinePrecision] / N[(1.0 + a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.45e+27], N[(N[(t * x + N[(z * y), $MachinePrecision]), $MachinePrecision] / N[(a * t + N[(b * y + 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}
\mathbf{if}\;t \leq -2.4 \cdot 10^{+45}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{z}{t}, y, x\right)}{1 + a}\\
\mathbf{elif}\;t \leq 1.45 \cdot 10^{+27}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t, x, z \cdot y\right)}{\mathsf{fma}\left(a, t, \mathsf{fma}\left(b, y, t\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t}, \frac{y}{a - -1}, \frac{x}{a - -1}\right)\\
\end{array}
if t < -2.3999999999999999e45Initial program 75.5%
Taylor expanded in y around 0
lower-+.f6456.5%
Applied rewrites56.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6456.6%
Applied rewrites56.6%
if -2.3999999999999999e45 < t < 1.4500000000000001e27Initial program 75.5%
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
associate-/l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
distribute-rgt-inN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-+.f6464.6%
lower-unsound-/.f64N/A
*-lft-identityN/A
lower-unsound-+.f64N/A
Applied rewrites70.3%
if 1.4500000000000001e27 < t Initial program 75.5%
Taylor expanded in y around 0
lower-+.f6456.5%
Applied rewrites56.5%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6456.5%
lift-/.f64N/A
lift-*.f64N/A
associate-*l/N/A
lift-/.f64N/A
lower-*.f6458.5%
Applied rewrites58.5%
lift-/.f64N/A
lift-+.f64N/A
div-addN/A
lift-*.f64N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f64N/A
lower--.f64N/A
Applied rewrites59.4%
lift-fma.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6456.1%
Applied rewrites56.1%
(FPCore (x y z t a b)
:precision binary64
(if (<= t -9e-42)
(/ (fma (/ z t) y x) (+ 1.0 a))
(if (<= t 39.0)
(/ (fma t x (* z y)) (fma a t (* b y)))
(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 <= -9e-42) {
tmp = fma((z / t), y, x) / (1.0 + a);
} else if (t <= 39.0) {
tmp = fma(t, x, (z * y)) / fma(a, t, (b * y));
} 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 <= -9e-42) tmp = Float64(fma(Float64(z / t), y, x) / Float64(1.0 + a)); elseif (t <= 39.0) tmp = Float64(fma(t, x, Float64(z * y)) / fma(a, t, Float64(b * y))); 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, -9e-42], N[(N[(N[(z / t), $MachinePrecision] * y + x), $MachinePrecision] / N[(1.0 + a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 39.0], N[(N[(t * x + N[(z * y), $MachinePrecision]), $MachinePrecision] / N[(a * t + N[(b * y), $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}
\mathbf{if}\;t \leq -9 \cdot 10^{-42}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{z}{t}, y, x\right)}{1 + a}\\
\mathbf{elif}\;t \leq 39:\\
\;\;\;\;\frac{\mathsf{fma}\left(t, x, z \cdot y\right)}{\mathsf{fma}\left(a, t, b \cdot y\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t}, \frac{y}{a - -1}, \frac{x}{a - -1}\right)\\
\end{array}
if t < -9.0000000000000002e-42Initial program 75.5%
Taylor expanded in y around 0
lower-+.f6456.5%
Applied rewrites56.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6456.6%
Applied rewrites56.6%
if -9.0000000000000002e-42 < t < 39Initial program 75.5%
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
associate-/l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
distribute-rgt-inN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-+.f6464.6%
lower-unsound-/.f64N/A
*-lft-identityN/A
lower-unsound-+.f64N/A
Applied rewrites70.3%
Taylor expanded in y around inf
lower-*.f6451.7%
Applied rewrites51.7%
if 39 < t Initial program 75.5%
Taylor expanded in y around 0
lower-+.f6456.5%
Applied rewrites56.5%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6456.5%
lift-/.f64N/A
lift-*.f64N/A
associate-*l/N/A
lift-/.f64N/A
lower-*.f6458.5%
Applied rewrites58.5%
lift-/.f64N/A
lift-+.f64N/A
div-addN/A
lift-*.f64N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f64N/A
lower--.f64N/A
Applied rewrites59.4%
lift-fma.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6456.1%
Applied rewrites56.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (fma (/ z t) y x) (+ 1.0 a))))
(if (<= t -9e-42)
t_1
(if (<= t 39.0) (/ (fma t x (* z y)) (fma a t (* b y))) t_1))))double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma((z / t), y, x) / (1.0 + a);
double tmp;
if (t <= -9e-42) {
tmp = t_1;
} else if (t <= 39.0) {
tmp = fma(t, x, (z * y)) / fma(a, t, (b * y));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(fma(Float64(z / t), y, x) / Float64(1.0 + a)) tmp = 0.0 if (t <= -9e-42) tmp = t_1; elseif (t <= 39.0) tmp = Float64(fma(t, x, Float64(z * y)) / fma(a, t, Float64(b * y))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(z / t), $MachinePrecision] * y + x), $MachinePrecision] / N[(1.0 + a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -9e-42], t$95$1, If[LessEqual[t, 39.0], N[(N[(t * x + N[(z * y), $MachinePrecision]), $MachinePrecision] / N[(a * t + N[(b * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \frac{\mathsf{fma}\left(\frac{z}{t}, y, x\right)}{1 + a}\\
\mathbf{if}\;t \leq -9 \cdot 10^{-42}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 39:\\
\;\;\;\;\frac{\mathsf{fma}\left(t, x, z \cdot y\right)}{\mathsf{fma}\left(a, t, b \cdot y\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if t < -9.0000000000000002e-42 or 39 < t Initial program 75.5%
Taylor expanded in y around 0
lower-+.f6456.5%
Applied rewrites56.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6456.6%
Applied rewrites56.6%
if -9.0000000000000002e-42 < t < 39Initial program 75.5%
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
associate-/l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
distribute-rgt-inN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-+.f6464.6%
lower-unsound-/.f64N/A
*-lft-identityN/A
lower-unsound-+.f64N/A
Applied rewrites70.3%
Taylor expanded in y around inf
lower-*.f6451.7%
Applied rewrites51.7%
(FPCore (x y z t a b)
:precision binary64
(if (<= b -3.8e+85)
(/ (fma x (/ t y) z) b)
(if (<= b 1.9e+34)
(/ (fma (/ y t) z x) (- a -1.0))
(fma x (/ t (* b y)) (/ z b)))))double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -3.8e+85) {
tmp = fma(x, (t / y), z) / b;
} else if (b <= 1.9e+34) {
tmp = fma((y / t), z, x) / (a - -1.0);
} else {
tmp = fma(x, (t / (b * y)), (z / b));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -3.8e+85) tmp = Float64(fma(x, Float64(t / y), z) / b); elseif (b <= 1.9e+34) tmp = Float64(fma(Float64(y / t), z, x) / Float64(a - -1.0)); else tmp = fma(x, Float64(t / Float64(b * y)), Float64(z / b)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -3.8e+85], N[(N[(x * N[(t / y), $MachinePrecision] + z), $MachinePrecision] / b), $MachinePrecision], If[LessEqual[b, 1.9e+34], N[(N[(N[(y / t), $MachinePrecision] * z + x), $MachinePrecision] / N[(a - -1.0), $MachinePrecision]), $MachinePrecision], N[(x * N[(t / N[(b * y), $MachinePrecision]), $MachinePrecision] + N[(z / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;b \leq -3.8 \cdot 10^{+85}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, \frac{t}{y}, z\right)}{b}\\
\mathbf{elif}\;b \leq 1.9 \cdot 10^{+34}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{y}{t}, z, x\right)}{a - -1}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{t}{b \cdot y}, \frac{z}{b}\right)\\
\end{array}
if b < -3.7999999999999999e85Initial program 75.5%
Applied rewrites88.0%
Taylor expanded in b around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6440.4%
Applied rewrites40.4%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6441.5%
Applied rewrites41.5%
if -3.7999999999999999e85 < b < 1.9000000000000001e34Initial program 75.5%
Taylor expanded in y around 0
lower-+.f6456.5%
Applied rewrites56.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-*l/N/A
lift-/.f64N/A
lift-fma.f6458.5%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lift--.f6458.5%
Applied rewrites58.5%
if 1.9000000000000001e34 < b Initial program 75.5%
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
associate-/l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
distribute-rgt-inN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-+.f6464.6%
lower-unsound-/.f64N/A
*-lft-identityN/A
lower-unsound-+.f64N/A
Applied rewrites70.3%
Taylor expanded in b around inf
lower-/.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6430.8%
Applied rewrites30.8%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lift-fma.f64N/A
+-commutativeN/A
fp-cancel-sign-sub-invN/A
lift-neg.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
sub-to-fractionN/A
lift-/.f64N/A
sub-divN/A
lift-/.f64N/A
lift-/.f64N/A
sub-flipN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
*-commutativeN/A
lift-*.f64N/A
Applied rewrites39.7%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (fma x (/ t y) z) b)))
(if (<= b -3.8e+85)
t_1
(if (<= b 1.9e+34) (/ (fma (/ y t) z x) (- a -1.0)) t_1))))double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(x, (t / y), z) / b;
double tmp;
if (b <= -3.8e+85) {
tmp = t_1;
} else if (b <= 1.9e+34) {
tmp = fma((y / t), z, x) / (a - -1.0);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(fma(x, Float64(t / y), z) / b) tmp = 0.0 if (b <= -3.8e+85) tmp = t_1; elseif (b <= 1.9e+34) tmp = Float64(fma(Float64(y / t), z, 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[(x * N[(t / y), $MachinePrecision] + z), $MachinePrecision] / b), $MachinePrecision]}, If[LessEqual[b, -3.8e+85], t$95$1, If[LessEqual[b, 1.9e+34], N[(N[(N[(y / t), $MachinePrecision] * z + x), $MachinePrecision] / N[(a - -1.0), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \frac{\mathsf{fma}\left(x, \frac{t}{y}, z\right)}{b}\\
\mathbf{if}\;b \leq -3.8 \cdot 10^{+85}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 1.9 \cdot 10^{+34}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{y}{t}, z, x\right)}{a - -1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if b < -3.7999999999999999e85 or 1.9000000000000001e34 < b Initial program 75.5%
Applied rewrites88.0%
Taylor expanded in b around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6440.4%
Applied rewrites40.4%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6441.5%
Applied rewrites41.5%
if -3.7999999999999999e85 < b < 1.9000000000000001e34Initial program 75.5%
Taylor expanded in y around 0
lower-+.f6456.5%
Applied rewrites56.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-*l/N/A
lift-/.f64N/A
lift-fma.f6458.5%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lift--.f6458.5%
Applied rewrites58.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (+ x (/ (* y z) t)) a)))
(if (<= a -5e+27)
t_1
(if (<= a -7e-192)
(/ (+ z (/ (* t x) y)) b)
(if (<= a 2.4e-33)
(/ (+ (* (/ y t) z) x) 1.0)
(if (<= a 1.25e+56) (/ (fma x (/ t y) z) b) t_1))))))double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + ((y * z) / t)) / a;
double tmp;
if (a <= -5e+27) {
tmp = t_1;
} else if (a <= -7e-192) {
tmp = (z + ((t * x) / y)) / b;
} else if (a <= 2.4e-33) {
tmp = (((y / t) * z) + x) / 1.0;
} else if (a <= 1.25e+56) {
tmp = fma(x, (t / y), z) / b;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + Float64(Float64(y * z) / t)) / a) tmp = 0.0 if (a <= -5e+27) tmp = t_1; elseif (a <= -7e-192) tmp = Float64(Float64(z + Float64(Float64(t * x) / y)) / b); elseif (a <= 2.4e-33) tmp = Float64(Float64(Float64(Float64(y / t) * z) + x) / 1.0); elseif (a <= 1.25e+56) tmp = Float64(fma(x, Float64(t / y), z) / b); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[a, -5e+27], t$95$1, If[LessEqual[a, -7e-192], N[(N[(z + N[(N[(t * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision], If[LessEqual[a, 2.4e-33], N[(N[(N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision] + x), $MachinePrecision] / 1.0), $MachinePrecision], If[LessEqual[a, 1.25e+56], N[(N[(x * N[(t / y), $MachinePrecision] + z), $MachinePrecision] / b), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
t_1 := \frac{x + \frac{y \cdot z}{t}}{a}\\
\mathbf{if}\;a \leq -5 \cdot 10^{+27}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq -7 \cdot 10^{-192}:\\
\;\;\;\;\frac{z + \frac{t \cdot x}{y}}{b}\\
\mathbf{elif}\;a \leq 2.4 \cdot 10^{-33}:\\
\;\;\;\;\frac{\frac{y}{t} \cdot z + x}{1}\\
\mathbf{elif}\;a \leq 1.25 \cdot 10^{+56}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, \frac{t}{y}, z\right)}{b}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if a < -4.9999999999999998e27 or 1.2500000000000001e56 < a Initial program 75.5%
Taylor expanded in a around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6433.8%
Applied rewrites33.8%
if -4.9999999999999998e27 < a < -7.0000000000000003e-192Initial program 75.5%
Applied rewrites88.0%
Taylor expanded in b around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6440.4%
Applied rewrites40.4%
if -7.0000000000000003e-192 < a < 2.4e-33Initial program 75.5%
Taylor expanded in y around 0
lower-+.f6456.5%
Applied rewrites56.5%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6456.5%
lift-/.f64N/A
lift-*.f64N/A
associate-*l/N/A
lift-/.f64N/A
lower-*.f6458.5%
Applied rewrites58.5%
Taylor expanded in a around 0
Applied rewrites27.4%
if 2.4e-33 < a < 1.2500000000000001e56Initial program 75.5%
Applied rewrites88.0%
Taylor expanded in b around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6440.4%
Applied rewrites40.4%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6441.5%
Applied rewrites41.5%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (/ x (+ 1.0 a)))) (if (<= t -8.5e+38) t_1 (if (<= t 0.46) (/ (+ z (/ (* t x) y)) b) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x / (1.0 + a);
double tmp;
if (t <= -8.5e+38) {
tmp = t_1;
} else if (t <= 0.46) {
tmp = (z + ((t * x) / y)) / b;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = x / (1.0d0 + a)
if (t <= (-8.5d+38)) then
tmp = t_1
else if (t <= 0.46d0) then
tmp = (z + ((t * x) / y)) / b
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x / (1.0 + a);
double tmp;
if (t <= -8.5e+38) {
tmp = t_1;
} else if (t <= 0.46) {
tmp = (z + ((t * x) / y)) / b;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x / (1.0 + a) tmp = 0 if t <= -8.5e+38: tmp = t_1 elif t <= 0.46: tmp = (z + ((t * x) / y)) / b else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x / Float64(1.0 + a)) tmp = 0.0 if (t <= -8.5e+38) tmp = t_1; elseif (t <= 0.46) tmp = Float64(Float64(z + Float64(Float64(t * x) / y)) / b); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = x / (1.0 + a); tmp = 0.0; if (t <= -8.5e+38) tmp = t_1; elseif (t <= 0.46) tmp = (z + ((t * x) / y)) / b; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x / N[(1.0 + a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -8.5e+38], t$95$1, If[LessEqual[t, 0.46], N[(N[(z + N[(N[(t * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \frac{x}{1 + a}\\
\mathbf{if}\;t \leq -8.5 \cdot 10^{+38}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 0.46:\\
\;\;\;\;\frac{z + \frac{t \cdot x}{y}}{b}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if t < -8.4999999999999997e38 or 0.46000000000000002 < t Initial program 75.5%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6441.8%
Applied rewrites41.8%
if -8.4999999999999997e38 < t < 0.46000000000000002Initial program 75.5%
Applied rewrites88.0%
Taylor expanded in b around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6440.4%
Applied rewrites40.4%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (/ x (+ 1.0 a)))) (if (<= t -8.5e+38) t_1 (if (<= t 0.46) (/ (fma x (/ t y) z) b) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x / (1.0 + a);
double tmp;
if (t <= -8.5e+38) {
tmp = t_1;
} else if (t <= 0.46) {
tmp = fma(x, (t / y), z) / b;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(x / Float64(1.0 + a)) tmp = 0.0 if (t <= -8.5e+38) tmp = t_1; elseif (t <= 0.46) tmp = Float64(fma(x, Float64(t / y), z) / b); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x / N[(1.0 + a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -8.5e+38], t$95$1, If[LessEqual[t, 0.46], N[(N[(x * N[(t / y), $MachinePrecision] + z), $MachinePrecision] / b), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \frac{x}{1 + a}\\
\mathbf{if}\;t \leq -8.5 \cdot 10^{+38}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 0.46:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, \frac{t}{y}, z\right)}{b}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if t < -8.4999999999999997e38 or 0.46000000000000002 < t Initial program 75.5%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6441.8%
Applied rewrites41.8%
if -8.4999999999999997e38 < t < 0.46000000000000002Initial program 75.5%
Applied rewrites88.0%
Taylor expanded in b around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6440.4%
Applied rewrites40.4%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6441.5%
Applied rewrites41.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))
(/ z b)
(if (<= t_1 -1e-315)
t_2
(if (<= t_1 2e-310)
(* (/ z (* b t)) t)
(if (<= t_1 1e+291) t_2 (/ z b)))))))double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t));
double t_2 = x / (1.0 + a);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = z / b;
} else if (t_1 <= -1e-315) {
tmp = t_2;
} else if (t_1 <= 2e-310) {
tmp = (z / (b * t)) * t;
} else if (t_1 <= 1e+291) {
tmp = t_2;
} 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 t_2 = x / (1.0 + a);
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = z / b;
} else if (t_1 <= -1e-315) {
tmp = t_2;
} else if (t_1 <= 2e-310) {
tmp = (z / (b * t)) * t;
} else if (t_1 <= 1e+291) {
tmp = t_2;
} 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)) t_2 = x / (1.0 + a) tmp = 0 if t_1 <= -math.inf: tmp = z / b elif t_1 <= -1e-315: tmp = t_2 elif t_1 <= 2e-310: tmp = (z / (b * t)) * t elif t_1 <= 1e+291: tmp = t_2 else: tmp = z / b return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + Float64(Float64(y * z) / t)) / Float64(Float64(a + 1.0) + Float64(Float64(y * b) / t))) t_2 = Float64(x / Float64(1.0 + a)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(z / b); elseif (t_1 <= -1e-315) tmp = t_2; elseif (t_1 <= 2e-310) tmp = Float64(Float64(z / Float64(b * t)) * t); elseif (t_1 <= 1e+291) tmp = t_2; 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)); t_2 = x / (1.0 + a); tmp = 0.0; if (t_1 <= -Inf) tmp = z / b; elseif (t_1 <= -1e-315) tmp = t_2; elseif (t_1 <= 2e-310) tmp = (z / (b * t)) * t; elseif (t_1 <= 1e+291) tmp = t_2; 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]}, Block[{t$95$2 = N[(x / N[(1.0 + a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(z / b), $MachinePrecision], If[LessEqual[t$95$1, -1e-315], t$95$2, If[LessEqual[t$95$1, 2e-310], N[(N[(z / N[(b * t), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[t$95$1, 1e+291], t$95$2, N[(z / b), $MachinePrecision]]]]]]]
\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{z}{b}\\
\mathbf{elif}\;t\_1 \leq -1 \cdot 10^{-315}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-310}:\\
\;\;\;\;\frac{z}{b \cdot t} \cdot t\\
\mathbf{elif}\;t\_1 \leq 10^{+291}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{b}\\
\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 9.9999999999999996e290 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) Initial program 75.5%
Taylor expanded in y around inf
lower-/.f6434.3%
Applied rewrites34.3%
if -inf.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < -9.9999999848168381e-316 or 1.9999999999999939e-310 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < 9.9999999999999996e290Initial program 75.5%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6441.8%
Applied rewrites41.8%
if -9.9999999848168381e-316 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < 1.9999999999999939e-310Initial program 75.5%
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
Applied rewrites62.2%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f6428.3%
Applied rewrites28.3%
(FPCore (x y z t a b) :precision binary64 (if (<= y -1.65e+15) (/ z b) (if (<= y 2.4e-48) (/ x (+ 1.0 a)) (/ z b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -1.65e+15) {
tmp = z / b;
} else if (y <= 2.4e-48) {
tmp = x / (1.0 + 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.65d+15)) then
tmp = z / b
else if (y <= 2.4d-48) then
tmp = x / (1.0d0 + 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.65e+15) {
tmp = z / b;
} else if (y <= 2.4e-48) {
tmp = x / (1.0 + a);
} else {
tmp = z / b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y <= -1.65e+15: tmp = z / b elif y <= 2.4e-48: tmp = x / (1.0 + a) else: tmp = z / b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -1.65e+15) tmp = Float64(z / b); elseif (y <= 2.4e-48) 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) tmp = 0.0; if (y <= -1.65e+15) tmp = z / b; elseif (y <= 2.4e-48) tmp = x / (1.0 + a); else tmp = z / b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -1.65e+15], N[(z / b), $MachinePrecision], If[LessEqual[y, 2.4e-48], N[(x / N[(1.0 + a), $MachinePrecision]), $MachinePrecision], N[(z / b), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;y \leq -1.65 \cdot 10^{+15}:\\
\;\;\;\;\frac{z}{b}\\
\mathbf{elif}\;y \leq 2.4 \cdot 10^{-48}:\\
\;\;\;\;\frac{x}{1 + a}\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{b}\\
\end{array}
if y < -1.65e15 or 2.4e-48 < y Initial program 75.5%
Taylor expanded in y around inf
lower-/.f6434.3%
Applied rewrites34.3%
if -1.65e15 < y < 2.4e-48Initial program 75.5%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6441.8%
Applied rewrites41.8%
(FPCore (x y z t a b)
:precision binary64
(if (<= a -3.3e+125)
(/ x a)
(if (<= a -1.6e-193)
(/ z b)
(if (<= a 2.4e-33)
(/ x 1.0)
(if (<= a 245000000000.0) (/ z b) (/ x a))))))double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -3.3e+125) {
tmp = x / a;
} else if (a <= -1.6e-193) {
tmp = z / b;
} else if (a <= 2.4e-33) {
tmp = x / 1.0;
} else if (a <= 245000000000.0) {
tmp = z / b;
} else {
tmp = x / a;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (a <= (-3.3d+125)) then
tmp = x / a
else if (a <= (-1.6d-193)) then
tmp = z / b
else if (a <= 2.4d-33) then
tmp = x / 1.0d0
else if (a <= 245000000000.0d0) then
tmp = z / b
else
tmp = x / a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -3.3e+125) {
tmp = x / a;
} else if (a <= -1.6e-193) {
tmp = z / b;
} else if (a <= 2.4e-33) {
tmp = x / 1.0;
} else if (a <= 245000000000.0) {
tmp = z / b;
} else {
tmp = x / a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if a <= -3.3e+125: tmp = x / a elif a <= -1.6e-193: tmp = z / b elif a <= 2.4e-33: tmp = x / 1.0 elif a <= 245000000000.0: tmp = z / b else: tmp = x / a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -3.3e+125) tmp = Float64(x / a); elseif (a <= -1.6e-193) tmp = Float64(z / b); elseif (a <= 2.4e-33) tmp = Float64(x / 1.0); elseif (a <= 245000000000.0) tmp = Float64(z / b); else tmp = Float64(x / a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (a <= -3.3e+125) tmp = x / a; elseif (a <= -1.6e-193) tmp = z / b; elseif (a <= 2.4e-33) tmp = x / 1.0; elseif (a <= 245000000000.0) tmp = z / b; else tmp = x / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -3.3e+125], N[(x / a), $MachinePrecision], If[LessEqual[a, -1.6e-193], N[(z / b), $MachinePrecision], If[LessEqual[a, 2.4e-33], N[(x / 1.0), $MachinePrecision], If[LessEqual[a, 245000000000.0], N[(z / b), $MachinePrecision], N[(x / a), $MachinePrecision]]]]]
\begin{array}{l}
\mathbf{if}\;a \leq -3.3 \cdot 10^{+125}:\\
\;\;\;\;\frac{x}{a}\\
\mathbf{elif}\;a \leq -1.6 \cdot 10^{-193}:\\
\;\;\;\;\frac{z}{b}\\
\mathbf{elif}\;a \leq 2.4 \cdot 10^{-33}:\\
\;\;\;\;\frac{x}{1}\\
\mathbf{elif}\;a \leq 245000000000:\\
\;\;\;\;\frac{z}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{a}\\
\end{array}
if a < -3.3000000000000001e125 or 2.45e11 < a Initial program 75.5%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6441.8%
Applied rewrites41.8%
Taylor expanded in a around inf
lower-/.f6425.5%
Applied rewrites25.5%
if -3.3000000000000001e125 < a < -1.6e-193 or 2.4e-33 < a < 2.45e11Initial program 75.5%
Taylor expanded in y around inf
lower-/.f6434.3%
Applied rewrites34.3%
if -1.6e-193 < a < 2.4e-33Initial program 75.5%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6441.8%
Applied rewrites41.8%
Taylor expanded in a around 0
Applied rewrites19.5%
(FPCore (x y z t a b) :precision binary64 (if (<= (+ a 1.0) -50000000.0) (/ x a) (if (<= (+ a 1.0) 2.0) (/ x 1.0) (/ x a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a + 1.0) <= -50000000.0) {
tmp = x / a;
} else if ((a + 1.0) <= 2.0) {
tmp = x / 1.0;
} else {
tmp = x / a;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((a + 1.0d0) <= (-50000000.0d0)) then
tmp = x / a
else if ((a + 1.0d0) <= 2.0d0) then
tmp = x / 1.0d0
else
tmp = x / a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a + 1.0) <= -50000000.0) {
tmp = x / a;
} else if ((a + 1.0) <= 2.0) {
tmp = x / 1.0;
} else {
tmp = x / a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a + 1.0) <= -50000000.0: tmp = x / a elif (a + 1.0) <= 2.0: tmp = x / 1.0 else: tmp = x / a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(a + 1.0) <= -50000000.0) tmp = Float64(x / a); elseif (Float64(a + 1.0) <= 2.0) tmp = Float64(x / 1.0); else tmp = Float64(x / a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((a + 1.0) <= -50000000.0) tmp = x / a; elseif ((a + 1.0) <= 2.0) tmp = x / 1.0; else tmp = x / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(a + 1.0), $MachinePrecision], -50000000.0], N[(x / a), $MachinePrecision], If[LessEqual[N[(a + 1.0), $MachinePrecision], 2.0], N[(x / 1.0), $MachinePrecision], N[(x / a), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;a + 1 \leq -50000000:\\
\;\;\;\;\frac{x}{a}\\
\mathbf{elif}\;a + 1 \leq 2:\\
\;\;\;\;\frac{x}{1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{a}\\
\end{array}
if (+.f64 a #s(literal 1 binary64)) < -5e7 or 2 < (+.f64 a #s(literal 1 binary64)) Initial program 75.5%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6441.8%
Applied rewrites41.8%
Taylor expanded in a around inf
lower-/.f6425.5%
Applied rewrites25.5%
if -5e7 < (+.f64 a #s(literal 1 binary64)) < 2Initial program 75.5%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6441.8%
Applied rewrites41.8%
Taylor expanded in a around 0
Applied rewrites19.5%
(FPCore (x y z t a b) :precision binary64 (/ x a))
double code(double x, double y, double z, double t, double a, double b) {
return x / a;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = x / a
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x / a;
}
def code(x, y, z, t, a, b): return x / a
function code(x, y, z, t, a, b) return Float64(x / a) end
function tmp = code(x, y, z, t, a, b) tmp = x / a; end
code[x_, y_, z_, t_, a_, b_] := N[(x / a), $MachinePrecision]
\frac{x}{a}
Initial program 75.5%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6441.8%
Applied rewrites41.8%
Taylor expanded in a around inf
lower-/.f6425.5%
Applied rewrites25.5%
herbie shell --seed 2025206
(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))))