
(FPCore (x y z t a b) :precision binary64 (+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* (* a 27.0) b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * 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 = ((x * 2.0d0) - (((y * 9.0d0) * z) * t)) + ((a * 27.0d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
}
def code(x, y, z, t, a, b): return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x * 2.0) - Float64(Float64(Float64(y * 9.0) * z) * t)) + Float64(Float64(a * 27.0) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* (* a 27.0) b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * 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 = ((x * 2.0d0) - (((y * 9.0d0) * z) * t)) + ((a * 27.0d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
}
def code(x, y, z, t, a, b): return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x * 2.0) - Float64(Float64(Float64(y * 9.0) * z) * t)) + Float64(Float64(a * 27.0) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fmin (fmin y z) t))
(t_2 (fmax (fmin y z) t))
(t_3 (fmin (fmax y z) t_2))
(t_4 (fmax (fmax y z) t_2)))
(if (<= t_3 1.7e+92)
(+ (fma (* b a) 27.0 (fma (* -9.0 (* t_4 t_3)) t_1 x)) x)
(fma -9.0 (* t_4 (* t_1 t_3)) (* 2.0 x)))))double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fmin(fmin(y, z), t);
double t_2 = fmax(fmin(y, z), t);
double t_3 = fmin(fmax(y, z), t_2);
double t_4 = fmax(fmax(y, z), t_2);
double tmp;
if (t_3 <= 1.7e+92) {
tmp = fma((b * a), 27.0, fma((-9.0 * (t_4 * t_3)), t_1, x)) + x;
} else {
tmp = fma(-9.0, (t_4 * (t_1 * t_3)), (2.0 * x));
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fmin(fmin(y, z), t) t_2 = fmax(fmin(y, z), t) t_3 = fmin(fmax(y, z), t_2) t_4 = fmax(fmax(y, z), t_2) tmp = 0.0 if (t_3 <= 1.7e+92) tmp = Float64(fma(Float64(b * a), 27.0, fma(Float64(-9.0 * Float64(t_4 * t_3)), t_1, x)) + x); else tmp = fma(-9.0, Float64(t_4 * Float64(t_1 * t_3)), Float64(2.0 * x)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Min[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]}, Block[{t$95$2 = N[Max[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]}, Block[{t$95$3 = N[Min[N[Max[y, z], $MachinePrecision], t$95$2], $MachinePrecision]}, Block[{t$95$4 = N[Max[N[Max[y, z], $MachinePrecision], t$95$2], $MachinePrecision]}, If[LessEqual[t$95$3, 1.7e+92], N[(N[(N[(b * a), $MachinePrecision] * 27.0 + N[(N[(-9.0 * N[(t$95$4 * t$95$3), $MachinePrecision]), $MachinePrecision] * t$95$1 + x), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(-9.0 * N[(t$95$4 * N[(t$95$1 * t$95$3), $MachinePrecision]), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_1 := \mathsf{min}\left(\mathsf{min}\left(y, z\right), t\right)\\
t_2 := \mathsf{max}\left(\mathsf{min}\left(y, z\right), t\right)\\
t_3 := \mathsf{min}\left(\mathsf{max}\left(y, z\right), t\_2\right)\\
t_4 := \mathsf{max}\left(\mathsf{max}\left(y, z\right), t\_2\right)\\
\mathbf{if}\;t\_3 \leq 1.7 \cdot 10^{+92}:\\
\;\;\;\;\mathsf{fma}\left(b \cdot a, 27, \mathsf{fma}\left(-9 \cdot \left(t\_4 \cdot t\_3\right), t\_1, x\right)\right) + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-9, t\_4 \cdot \left(t\_1 \cdot t\_3\right), 2 \cdot x\right)\\
\end{array}
if z < 1.6999999999999999e92Initial program 94.7%
lift-+.f64N/A
+-commutativeN/A
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
associate-+r+N/A
associate-+r+N/A
lower-+.f64N/A
Applied rewrites94.5%
if 1.6999999999999999e92 < z Initial program 94.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6495.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6495.4%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
add-flipN/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
fp-cancel-sub-sign-invN/A
Applied rewrites95.4%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6466.2%
Applied rewrites66.2%
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6466.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
Applied rewrites66.4%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6464.2%
Applied rewrites64.2%
(FPCore (x y z t a b) :precision binary64 (fma (* 27.0 (fmin a b)) (fmax a b) (fma (* (fmax z (fmax y t)) -9.0) (* (fmin z (fmax y t)) (fmin y t)) (+ x x))))
double code(double x, double y, double z, double t, double a, double b) {
return fma((27.0 * fmin(a, b)), fmax(a, b), fma((fmax(z, fmax(y, t)) * -9.0), (fmin(z, fmax(y, t)) * fmin(y, t)), (x + x)));
}
function code(x, y, z, t, a, b) return fma(Float64(27.0 * fmin(a, b)), fmax(a, b), fma(Float64(fmax(z, fmax(y, t)) * -9.0), Float64(fmin(z, fmax(y, t)) * fmin(y, t)), Float64(x + x))) end
code[x_, y_, z_, t_, a_, b_] := N[(N[(27.0 * N[Min[a, b], $MachinePrecision]), $MachinePrecision] * N[Max[a, b], $MachinePrecision] + N[(N[(N[Max[z, N[Max[y, t], $MachinePrecision]], $MachinePrecision] * -9.0), $MachinePrecision] * N[(N[Min[z, N[Max[y, t], $MachinePrecision]], $MachinePrecision] * N[Min[y, t], $MachinePrecision]), $MachinePrecision] + N[(x + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\mathsf{fma}\left(27 \cdot \mathsf{min}\left(a, b\right), \mathsf{max}\left(a, b\right), \mathsf{fma}\left(\mathsf{max}\left(z, \mathsf{max}\left(y, t\right)\right) \cdot -9, \mathsf{min}\left(z, \mathsf{max}\left(y, t\right)\right) \cdot \mathsf{min}\left(y, t\right), x + x\right)\right)
Initial program 94.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6495.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6495.4%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
add-flipN/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
fp-cancel-sub-sign-invN/A
Applied rewrites95.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fmax (fmin y z) t))
(t_2 (fmin (fmax y z) t_1))
(t_3 (fmax (fmax y z) t_1))
(t_4 (fmin (fmin y z) t))
(t_5 (* (* (* t_4 9.0) t_2) t_3)))
(if (<= t_5 -2e+135)
(fma (* 27.0 (fmin a b)) (fmax a b) (* t_4 (* (* t_2 t_3) -9.0)))
(if (<= t_5 1e+111)
(fma (* (fmin a b) 27.0) (fmax a b) (+ x x))
(fma -9.0 (* t_3 (* t_4 t_2)) (* 2.0 x))))))double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fmax(fmin(y, z), t);
double t_2 = fmin(fmax(y, z), t_1);
double t_3 = fmax(fmax(y, z), t_1);
double t_4 = fmin(fmin(y, z), t);
double t_5 = ((t_4 * 9.0) * t_2) * t_3;
double tmp;
if (t_5 <= -2e+135) {
tmp = fma((27.0 * fmin(a, b)), fmax(a, b), (t_4 * ((t_2 * t_3) * -9.0)));
} else if (t_5 <= 1e+111) {
tmp = fma((fmin(a, b) * 27.0), fmax(a, b), (x + x));
} else {
tmp = fma(-9.0, (t_3 * (t_4 * t_2)), (2.0 * x));
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fmax(fmin(y, z), t) t_2 = fmin(fmax(y, z), t_1) t_3 = fmax(fmax(y, z), t_1) t_4 = fmin(fmin(y, z), t) t_5 = Float64(Float64(Float64(t_4 * 9.0) * t_2) * t_3) tmp = 0.0 if (t_5 <= -2e+135) tmp = fma(Float64(27.0 * fmin(a, b)), fmax(a, b), Float64(t_4 * Float64(Float64(t_2 * t_3) * -9.0))); elseif (t_5 <= 1e+111) tmp = fma(Float64(fmin(a, b) * 27.0), fmax(a, b), Float64(x + x)); else tmp = fma(-9.0, Float64(t_3 * Float64(t_4 * t_2)), Float64(2.0 * x)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Max[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]}, Block[{t$95$2 = N[Min[N[Max[y, z], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[Max[N[Max[y, z], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$4 = N[Min[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]}, Block[{t$95$5 = N[(N[(N[(t$95$4 * 9.0), $MachinePrecision] * t$95$2), $MachinePrecision] * t$95$3), $MachinePrecision]}, If[LessEqual[t$95$5, -2e+135], N[(N[(27.0 * N[Min[a, b], $MachinePrecision]), $MachinePrecision] * N[Max[a, b], $MachinePrecision] + N[(t$95$4 * N[(N[(t$95$2 * t$95$3), $MachinePrecision] * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, 1e+111], N[(N[(N[Min[a, b], $MachinePrecision] * 27.0), $MachinePrecision] * N[Max[a, b], $MachinePrecision] + N[(x + x), $MachinePrecision]), $MachinePrecision], N[(-9.0 * N[(t$95$3 * N[(t$95$4 * t$95$2), $MachinePrecision]), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
t_1 := \mathsf{max}\left(\mathsf{min}\left(y, z\right), t\right)\\
t_2 := \mathsf{min}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\
t_3 := \mathsf{max}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\
t_4 := \mathsf{min}\left(\mathsf{min}\left(y, z\right), t\right)\\
t_5 := \left(\left(t\_4 \cdot 9\right) \cdot t\_2\right) \cdot t\_3\\
\mathbf{if}\;t\_5 \leq -2 \cdot 10^{+135}:\\
\;\;\;\;\mathsf{fma}\left(27 \cdot \mathsf{min}\left(a, b\right), \mathsf{max}\left(a, b\right), t\_4 \cdot \left(\left(t\_2 \cdot t\_3\right) \cdot -9\right)\right)\\
\mathbf{elif}\;t\_5 \leq 10^{+111}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{min}\left(a, b\right) \cdot 27, \mathsf{max}\left(a, b\right), x + x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-9, t\_3 \cdot \left(t\_4 \cdot t\_2\right), 2 \cdot x\right)\\
\end{array}
if (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < -1.99999999999999992e135Initial program 94.7%
Taylor expanded in x around 0
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6466.2%
Applied rewrites66.2%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6466.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.3%
Applied rewrites66.3%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6467.0%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6467.0%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
lift-*.f64N/A
lower-*.f6466.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.7%
Applied rewrites66.7%
if -1.99999999999999992e135 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 9.99999999999999957e110Initial program 94.7%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6464.1%
Applied rewrites64.1%
lift-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
count-2-revN/A
lift-+.f6464.1%
Applied rewrites64.1%
if 9.99999999999999957e110 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) Initial program 94.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6495.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6495.4%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
add-flipN/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
fp-cancel-sub-sign-invN/A
Applied rewrites95.4%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6466.2%
Applied rewrites66.2%
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6466.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
Applied rewrites66.4%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6464.2%
Applied rewrites64.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fmax (fmax y z) t))
(t_2 (fmin (fmax y z) t))
(t_3 (* (* (* (fmin y z) 9.0) t_2) t_1)))
(if (<= t_3 -2e+135)
(fma (* t_2 t_1) (* -9.0 (fmin y z)) (* (* 27.0 (fmin a b)) (fmax a b)))
(if (<= t_3 1e+111)
(fma (* (fmin a b) 27.0) (fmax a b) (+ x x))
(fma -9.0 (* t_1 (* (fmin y z) t_2)) (* 2.0 x))))))double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fmax(fmax(y, z), t);
double t_2 = fmin(fmax(y, z), t);
double t_3 = ((fmin(y, z) * 9.0) * t_2) * t_1;
double tmp;
if (t_3 <= -2e+135) {
tmp = fma((t_2 * t_1), (-9.0 * fmin(y, z)), ((27.0 * fmin(a, b)) * fmax(a, b)));
} else if (t_3 <= 1e+111) {
tmp = fma((fmin(a, b) * 27.0), fmax(a, b), (x + x));
} else {
tmp = fma(-9.0, (t_1 * (fmin(y, z) * t_2)), (2.0 * x));
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fmax(fmax(y, z), t) t_2 = fmin(fmax(y, z), t) t_3 = Float64(Float64(Float64(fmin(y, z) * 9.0) * t_2) * t_1) tmp = 0.0 if (t_3 <= -2e+135) tmp = fma(Float64(t_2 * t_1), Float64(-9.0 * fmin(y, z)), Float64(Float64(27.0 * fmin(a, b)) * fmax(a, b))); elseif (t_3 <= 1e+111) tmp = fma(Float64(fmin(a, b) * 27.0), fmax(a, b), Float64(x + x)); else tmp = fma(-9.0, Float64(t_1 * Float64(fmin(y, z) * t_2)), Float64(2.0 * x)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Max[N[Max[y, z], $MachinePrecision], t], $MachinePrecision]}, Block[{t$95$2 = N[Min[N[Max[y, z], $MachinePrecision], t], $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(N[Min[y, z], $MachinePrecision] * 9.0), $MachinePrecision] * t$95$2), $MachinePrecision] * t$95$1), $MachinePrecision]}, If[LessEqual[t$95$3, -2e+135], N[(N[(t$95$2 * t$95$1), $MachinePrecision] * N[(-9.0 * N[Min[y, z], $MachinePrecision]), $MachinePrecision] + N[(N[(27.0 * N[Min[a, b], $MachinePrecision]), $MachinePrecision] * N[Max[a, b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 1e+111], N[(N[(N[Min[a, b], $MachinePrecision] * 27.0), $MachinePrecision] * N[Max[a, b], $MachinePrecision] + N[(x + x), $MachinePrecision]), $MachinePrecision], N[(-9.0 * N[(t$95$1 * N[(N[Min[y, z], $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_1 := \mathsf{max}\left(\mathsf{max}\left(y, z\right), t\right)\\
t_2 := \mathsf{min}\left(\mathsf{max}\left(y, z\right), t\right)\\
t_3 := \left(\left(\mathsf{min}\left(y, z\right) \cdot 9\right) \cdot t\_2\right) \cdot t\_1\\
\mathbf{if}\;t\_3 \leq -2 \cdot 10^{+135}:\\
\;\;\;\;\mathsf{fma}\left(t\_2 \cdot t\_1, -9 \cdot \mathsf{min}\left(y, z\right), \left(27 \cdot \mathsf{min}\left(a, b\right)\right) \cdot \mathsf{max}\left(a, b\right)\right)\\
\mathbf{elif}\;t\_3 \leq 10^{+111}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{min}\left(a, b\right) \cdot 27, \mathsf{max}\left(a, b\right), x + x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-9, t\_1 \cdot \left(\mathsf{min}\left(y, z\right) \cdot t\_2\right), 2 \cdot x\right)\\
\end{array}
if (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < -1.99999999999999992e135Initial program 94.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6495.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6495.4%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
add-flipN/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
fp-cancel-sub-sign-invN/A
Applied rewrites95.4%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6466.2%
Applied rewrites66.2%
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6466.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
Applied rewrites66.4%
if -1.99999999999999992e135 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 9.99999999999999957e110Initial program 94.7%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6464.1%
Applied rewrites64.1%
lift-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
count-2-revN/A
lift-+.f6464.1%
Applied rewrites64.1%
if 9.99999999999999957e110 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) Initial program 94.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6495.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6495.4%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
add-flipN/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
fp-cancel-sub-sign-invN/A
Applied rewrites95.4%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6466.2%
Applied rewrites66.2%
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6466.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
Applied rewrites66.4%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6464.2%
Applied rewrites64.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fmax z (fmax y t)))
(t_2 (fmin z (fmax y t)))
(t_3 (fma -9.0 (* t_1 (* (fmin y t) t_2)) (* 2.0 x)))
(t_4 (* (* (* (fmin y t) 9.0) t_2) t_1)))
(if (<= t_4 -1e+72)
t_3
(if (<= t_4 1e+111) (fma (* (fmin a b) 27.0) (fmax a b) (+ x x)) t_3))))double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fmax(z, fmax(y, t));
double t_2 = fmin(z, fmax(y, t));
double t_3 = fma(-9.0, (t_1 * (fmin(y, t) * t_2)), (2.0 * x));
double t_4 = ((fmin(y, t) * 9.0) * t_2) * t_1;
double tmp;
if (t_4 <= -1e+72) {
tmp = t_3;
} else if (t_4 <= 1e+111) {
tmp = fma((fmin(a, b) * 27.0), fmax(a, b), (x + x));
} else {
tmp = t_3;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fmax(z, fmax(y, t)) t_2 = fmin(z, fmax(y, t)) t_3 = fma(-9.0, Float64(t_1 * Float64(fmin(y, t) * t_2)), Float64(2.0 * x)) t_4 = Float64(Float64(Float64(fmin(y, t) * 9.0) * t_2) * t_1) tmp = 0.0 if (t_4 <= -1e+72) tmp = t_3; elseif (t_4 <= 1e+111) tmp = fma(Float64(fmin(a, b) * 27.0), fmax(a, b), Float64(x + x)); else tmp = t_3; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Max[z, N[Max[y, t], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Min[z, N[Max[y, t], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(-9.0 * N[(t$95$1 * N[(N[Min[y, t], $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(N[(N[Min[y, t], $MachinePrecision] * 9.0), $MachinePrecision] * t$95$2), $MachinePrecision] * t$95$1), $MachinePrecision]}, If[LessEqual[t$95$4, -1e+72], t$95$3, If[LessEqual[t$95$4, 1e+111], N[(N[(N[Min[a, b], $MachinePrecision] * 27.0), $MachinePrecision] * N[Max[a, b], $MachinePrecision] + N[(x + x), $MachinePrecision]), $MachinePrecision], t$95$3]]]]]]
\begin{array}{l}
t_1 := \mathsf{max}\left(z, \mathsf{max}\left(y, t\right)\right)\\
t_2 := \mathsf{min}\left(z, \mathsf{max}\left(y, t\right)\right)\\
t_3 := \mathsf{fma}\left(-9, t\_1 \cdot \left(\mathsf{min}\left(y, t\right) \cdot t\_2\right), 2 \cdot x\right)\\
t_4 := \left(\left(\mathsf{min}\left(y, t\right) \cdot 9\right) \cdot t\_2\right) \cdot t\_1\\
\mathbf{if}\;t\_4 \leq -1 \cdot 10^{+72}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_4 \leq 10^{+111}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{min}\left(a, b\right) \cdot 27, \mathsf{max}\left(a, b\right), x + x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
if (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < -9.99999999999999944e71 or 9.99999999999999957e110 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) Initial program 94.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6495.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6495.4%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
add-flipN/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
fp-cancel-sub-sign-invN/A
Applied rewrites95.4%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6466.2%
Applied rewrites66.2%
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6466.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
Applied rewrites66.4%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6464.2%
Applied rewrites64.2%
if -9.99999999999999944e71 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 9.99999999999999957e110Initial program 94.7%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6464.1%
Applied rewrites64.1%
lift-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
count-2-revN/A
lift-+.f6464.1%
Applied rewrites64.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fmax z (fmax y t)))
(t_2 (fmin z (fmax y t)))
(t_3 (* -9.0 (* t_1 (* (fmin y t) t_2))))
(t_4 (* (* (* (fmin y t) 9.0) t_2) t_1)))
(if (<= t_4 -1e+191)
t_3
(if (<= t_4 1e+217) (fma (* (fmin a b) 27.0) (fmax a b) (+ x x)) t_3))))double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fmax(z, fmax(y, t));
double t_2 = fmin(z, fmax(y, t));
double t_3 = -9.0 * (t_1 * (fmin(y, t) * t_2));
double t_4 = ((fmin(y, t) * 9.0) * t_2) * t_1;
double tmp;
if (t_4 <= -1e+191) {
tmp = t_3;
} else if (t_4 <= 1e+217) {
tmp = fma((fmin(a, b) * 27.0), fmax(a, b), (x + x));
} else {
tmp = t_3;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fmax(z, fmax(y, t)) t_2 = fmin(z, fmax(y, t)) t_3 = Float64(-9.0 * Float64(t_1 * Float64(fmin(y, t) * t_2))) t_4 = Float64(Float64(Float64(fmin(y, t) * 9.0) * t_2) * t_1) tmp = 0.0 if (t_4 <= -1e+191) tmp = t_3; elseif (t_4 <= 1e+217) tmp = fma(Float64(fmin(a, b) * 27.0), fmax(a, b), Float64(x + x)); else tmp = t_3; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Max[z, N[Max[y, t], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Min[z, N[Max[y, t], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(-9.0 * N[(t$95$1 * N[(N[Min[y, t], $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(N[(N[Min[y, t], $MachinePrecision] * 9.0), $MachinePrecision] * t$95$2), $MachinePrecision] * t$95$1), $MachinePrecision]}, If[LessEqual[t$95$4, -1e+191], t$95$3, If[LessEqual[t$95$4, 1e+217], N[(N[(N[Min[a, b], $MachinePrecision] * 27.0), $MachinePrecision] * N[Max[a, b], $MachinePrecision] + N[(x + x), $MachinePrecision]), $MachinePrecision], t$95$3]]]]]]
\begin{array}{l}
t_1 := \mathsf{max}\left(z, \mathsf{max}\left(y, t\right)\right)\\
t_2 := \mathsf{min}\left(z, \mathsf{max}\left(y, t\right)\right)\\
t_3 := -9 \cdot \left(t\_1 \cdot \left(\mathsf{min}\left(y, t\right) \cdot t\_2\right)\right)\\
t_4 := \left(\left(\mathsf{min}\left(y, t\right) \cdot 9\right) \cdot t\_2\right) \cdot t\_1\\
\mathbf{if}\;t\_4 \leq -1 \cdot 10^{+191}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_4 \leq 10^{+217}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{min}\left(a, b\right) \cdot 27, \mathsf{max}\left(a, b\right), x + x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
if (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < -1.00000000000000007e191 or 9.9999999999999996e216 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) Initial program 94.7%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6464.1%
Applied rewrites64.1%
lift-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
count-2-revN/A
lift-+.f6464.1%
Applied rewrites64.1%
Taylor expanded in y around inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6436.1%
Applied rewrites36.1%
if -1.00000000000000007e191 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 9.9999999999999996e216Initial program 94.7%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6464.1%
Applied rewrites64.1%
lift-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
count-2-revN/A
lift-+.f6464.1%
Applied rewrites64.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* -9.0 (* (fmax y t) (* (fmin y t) z))))
(t_2 (- (* x 2.0) (* (* (* (fmin y t) 9.0) z) (fmax y t)))))
(if (<= t_2 -2e+238)
t_1
(if (<= t_2 -5e+45)
(* x 2.0)
(if (<= t_2 1e+147)
(* (* 27.0 (fmin a b)) (fmax a b))
(if (<= t_2 4e+300) (* x 2.0) t_1))))))double code(double x, double y, double z, double t, double a, double b) {
double t_1 = -9.0 * (fmax(y, t) * (fmin(y, t) * z));
double t_2 = (x * 2.0) - (((fmin(y, t) * 9.0) * z) * fmax(y, t));
double tmp;
if (t_2 <= -2e+238) {
tmp = t_1;
} else if (t_2 <= -5e+45) {
tmp = x * 2.0;
} else if (t_2 <= 1e+147) {
tmp = (27.0 * fmin(a, b)) * fmax(a, b);
} else if (t_2 <= 4e+300) {
tmp = x * 2.0;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (-9.0d0) * (fmax(y, t) * (fmin(y, t) * z))
t_2 = (x * 2.0d0) - (((fmin(y, t) * 9.0d0) * z) * fmax(y, t))
if (t_2 <= (-2d+238)) then
tmp = t_1
else if (t_2 <= (-5d+45)) then
tmp = x * 2.0d0
else if (t_2 <= 1d+147) then
tmp = (27.0d0 * fmin(a, b)) * fmax(a, b)
else if (t_2 <= 4d+300) then
tmp = x * 2.0d0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = -9.0 * (fmax(y, t) * (fmin(y, t) * z));
double t_2 = (x * 2.0) - (((fmin(y, t) * 9.0) * z) * fmax(y, t));
double tmp;
if (t_2 <= -2e+238) {
tmp = t_1;
} else if (t_2 <= -5e+45) {
tmp = x * 2.0;
} else if (t_2 <= 1e+147) {
tmp = (27.0 * fmin(a, b)) * fmax(a, b);
} else if (t_2 <= 4e+300) {
tmp = x * 2.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = -9.0 * (fmax(y, t) * (fmin(y, t) * z)) t_2 = (x * 2.0) - (((fmin(y, t) * 9.0) * z) * fmax(y, t)) tmp = 0 if t_2 <= -2e+238: tmp = t_1 elif t_2 <= -5e+45: tmp = x * 2.0 elif t_2 <= 1e+147: tmp = (27.0 * fmin(a, b)) * fmax(a, b) elif t_2 <= 4e+300: tmp = x * 2.0 else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(-9.0 * Float64(fmax(y, t) * Float64(fmin(y, t) * z))) t_2 = Float64(Float64(x * 2.0) - Float64(Float64(Float64(fmin(y, t) * 9.0) * z) * fmax(y, t))) tmp = 0.0 if (t_2 <= -2e+238) tmp = t_1; elseif (t_2 <= -5e+45) tmp = Float64(x * 2.0); elseif (t_2 <= 1e+147) tmp = Float64(Float64(27.0 * fmin(a, b)) * fmax(a, b)); elseif (t_2 <= 4e+300) tmp = Float64(x * 2.0); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = -9.0 * (max(y, t) * (min(y, t) * z)); t_2 = (x * 2.0) - (((min(y, t) * 9.0) * z) * max(y, t)); tmp = 0.0; if (t_2 <= -2e+238) tmp = t_1; elseif (t_2 <= -5e+45) tmp = x * 2.0; elseif (t_2 <= 1e+147) tmp = (27.0 * min(a, b)) * max(a, b); elseif (t_2 <= 4e+300) tmp = x * 2.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(-9.0 * N[(N[Max[y, t], $MachinePrecision] * N[(N[Min[y, t], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * 2.0), $MachinePrecision] - N[(N[(N[(N[Min[y, t], $MachinePrecision] * 9.0), $MachinePrecision] * z), $MachinePrecision] * N[Max[y, t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+238], t$95$1, If[LessEqual[t$95$2, -5e+45], N[(x * 2.0), $MachinePrecision], If[LessEqual[t$95$2, 1e+147], N[(N[(27.0 * N[Min[a, b], $MachinePrecision]), $MachinePrecision] * N[Max[a, b], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 4e+300], N[(x * 2.0), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
t_1 := -9 \cdot \left(\mathsf{max}\left(y, t\right) \cdot \left(\mathsf{min}\left(y, t\right) \cdot z\right)\right)\\
t_2 := x \cdot 2 - \left(\left(\mathsf{min}\left(y, t\right) \cdot 9\right) \cdot z\right) \cdot \mathsf{max}\left(y, t\right)\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+238}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -5 \cdot 10^{+45}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;t\_2 \leq 10^{+147}:\\
\;\;\;\;\left(27 \cdot \mathsf{min}\left(a, b\right)\right) \cdot \mathsf{max}\left(a, b\right)\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{+300}:\\
\;\;\;\;x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (-.f64 (*.f64 x #s(literal 2 binary64)) (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t)) < -2.0000000000000001e238 or 4.0000000000000002e300 < (-.f64 (*.f64 x #s(literal 2 binary64)) (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t)) Initial program 94.7%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6464.1%
Applied rewrites64.1%
lift-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
count-2-revN/A
lift-+.f6464.1%
Applied rewrites64.1%
Taylor expanded in y around inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6436.1%
Applied rewrites36.1%
if -2.0000000000000001e238 < (-.f64 (*.f64 x #s(literal 2 binary64)) (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t)) < -5e45 or 9.9999999999999998e146 < (-.f64 (*.f64 x #s(literal 2 binary64)) (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t)) < 4.0000000000000002e300Initial program 94.7%
Taylor expanded in x around inf
lower-*.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6484.0%
Applied rewrites84.0%
Taylor expanded in x around inf
Applied rewrites30.6%
if -5e45 < (-.f64 (*.f64 x #s(literal 2 binary64)) (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t)) < 9.9999999999999998e146Initial program 94.7%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6464.1%
Applied rewrites64.1%
Taylor expanded in x around 0
lower-*.f64N/A
lower-*.f6435.4%
Applied rewrites35.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f6435.4%
Applied rewrites35.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (* (fmin a b) 27.0) (fmax a b))))
(if (<= t_1 -2e+132)
(* 27.0 (* (fmin a b) (fmax a b)))
(if (<= t_1 4e+29) (* x 2.0) (* (* 27.0 (fmin a b)) (fmax a b))))))double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (fmin(a, b) * 27.0) * fmax(a, b);
double tmp;
if (t_1 <= -2e+132) {
tmp = 27.0 * (fmin(a, b) * fmax(a, b));
} else if (t_1 <= 4e+29) {
tmp = x * 2.0;
} else {
tmp = (27.0 * fmin(a, b)) * fmax(a, 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) :: t_1
real(8) :: tmp
t_1 = (fmin(a, b) * 27.0d0) * fmax(a, b)
if (t_1 <= (-2d+132)) then
tmp = 27.0d0 * (fmin(a, b) * fmax(a, b))
else if (t_1 <= 4d+29) then
tmp = x * 2.0d0
else
tmp = (27.0d0 * fmin(a, b)) * fmax(a, b)
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 = (fmin(a, b) * 27.0) * fmax(a, b);
double tmp;
if (t_1 <= -2e+132) {
tmp = 27.0 * (fmin(a, b) * fmax(a, b));
} else if (t_1 <= 4e+29) {
tmp = x * 2.0;
} else {
tmp = (27.0 * fmin(a, b)) * fmax(a, b);
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (fmin(a, b) * 27.0) * fmax(a, b) tmp = 0 if t_1 <= -2e+132: tmp = 27.0 * (fmin(a, b) * fmax(a, b)) elif t_1 <= 4e+29: tmp = x * 2.0 else: tmp = (27.0 * fmin(a, b)) * fmax(a, b) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(fmin(a, b) * 27.0) * fmax(a, b)) tmp = 0.0 if (t_1 <= -2e+132) tmp = Float64(27.0 * Float64(fmin(a, b) * fmax(a, b))); elseif (t_1 <= 4e+29) tmp = Float64(x * 2.0); else tmp = Float64(Float64(27.0 * fmin(a, b)) * fmax(a, b)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (min(a, b) * 27.0) * max(a, b); tmp = 0.0; if (t_1 <= -2e+132) tmp = 27.0 * (min(a, b) * max(a, b)); elseif (t_1 <= 4e+29) tmp = x * 2.0; else tmp = (27.0 * min(a, b)) * max(a, b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[Min[a, b], $MachinePrecision] * 27.0), $MachinePrecision] * N[Max[a, b], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+132], N[(27.0 * N[(N[Min[a, b], $MachinePrecision] * N[Max[a, b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 4e+29], N[(x * 2.0), $MachinePrecision], N[(N[(27.0 * N[Min[a, b], $MachinePrecision]), $MachinePrecision] * N[Max[a, b], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \left(\mathsf{min}\left(a, b\right) \cdot 27\right) \cdot \mathsf{max}\left(a, b\right)\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+132}:\\
\;\;\;\;27 \cdot \left(\mathsf{min}\left(a, b\right) \cdot \mathsf{max}\left(a, b\right)\right)\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+29}:\\
\;\;\;\;x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;\left(27 \cdot \mathsf{min}\left(a, b\right)\right) \cdot \mathsf{max}\left(a, b\right)\\
\end{array}
if (*.f64 (*.f64 a #s(literal 27 binary64)) b) < -1.99999999999999998e132Initial program 94.7%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6464.1%
Applied rewrites64.1%
Taylor expanded in x around 0
lower-*.f64N/A
lower-*.f6435.4%
Applied rewrites35.4%
if -1.99999999999999998e132 < (*.f64 (*.f64 a #s(literal 27 binary64)) b) < 3.99999999999999966e29Initial program 94.7%
Taylor expanded in x around inf
lower-*.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6484.0%
Applied rewrites84.0%
Taylor expanded in x around inf
Applied rewrites30.6%
if 3.99999999999999966e29 < (*.f64 (*.f64 a #s(literal 27 binary64)) b) Initial program 94.7%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6464.1%
Applied rewrites64.1%
Taylor expanded in x around 0
lower-*.f64N/A
lower-*.f6435.4%
Applied rewrites35.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f6435.4%
Applied rewrites35.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (* a 27.0) b)))
(if (<= t_1 -2e+132)
(* 27.0 (* a b))
(if (<= t_1 4e+29) (* x 2.0) (* a (* 27.0 b))))))double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a * 27.0) * b;
double tmp;
if (t_1 <= -2e+132) {
tmp = 27.0 * (a * b);
} else if (t_1 <= 4e+29) {
tmp = x * 2.0;
} else {
tmp = a * (27.0 * 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) :: t_1
real(8) :: tmp
t_1 = (a * 27.0d0) * b
if (t_1 <= (-2d+132)) then
tmp = 27.0d0 * (a * b)
else if (t_1 <= 4d+29) then
tmp = x * 2.0d0
else
tmp = a * (27.0d0 * b)
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 = (a * 27.0) * b;
double tmp;
if (t_1 <= -2e+132) {
tmp = 27.0 * (a * b);
} else if (t_1 <= 4e+29) {
tmp = x * 2.0;
} else {
tmp = a * (27.0 * b);
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (a * 27.0) * b tmp = 0 if t_1 <= -2e+132: tmp = 27.0 * (a * b) elif t_1 <= 4e+29: tmp = x * 2.0 else: tmp = a * (27.0 * b) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a * 27.0) * b) tmp = 0.0 if (t_1 <= -2e+132) tmp = Float64(27.0 * Float64(a * b)); elseif (t_1 <= 4e+29) tmp = Float64(x * 2.0); else tmp = Float64(a * Float64(27.0 * b)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (a * 27.0) * b; tmp = 0.0; if (t_1 <= -2e+132) tmp = 27.0 * (a * b); elseif (t_1 <= 4e+29) tmp = x * 2.0; else tmp = a * (27.0 * b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+132], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 4e+29], N[(x * 2.0), $MachinePrecision], N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \left(a \cdot 27\right) \cdot b\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+132}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+29}:\\
\;\;\;\;x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right)\\
\end{array}
if (*.f64 (*.f64 a #s(literal 27 binary64)) b) < -1.99999999999999998e132Initial program 94.7%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6464.1%
Applied rewrites64.1%
Taylor expanded in x around 0
lower-*.f64N/A
lower-*.f6435.4%
Applied rewrites35.4%
if -1.99999999999999998e132 < (*.f64 (*.f64 a #s(literal 27 binary64)) b) < 3.99999999999999966e29Initial program 94.7%
Taylor expanded in x around inf
lower-*.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6484.0%
Applied rewrites84.0%
Taylor expanded in x around inf
Applied rewrites30.6%
if 3.99999999999999966e29 < (*.f64 (*.f64 a #s(literal 27 binary64)) b) Initial program 94.7%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6464.1%
Applied rewrites64.1%
Taylor expanded in a around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f6456.7%
Applied rewrites56.7%
Taylor expanded in x around 0
lower-*.f6435.4%
Applied rewrites35.4%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (* a 27.0) b)) (t_2 (* 27.0 (* a b)))) (if (<= t_1 -2e+132) t_2 (if (<= t_1 4e+29) (* x 2.0) t_2))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a * 27.0) * b;
double t_2 = 27.0 * (a * b);
double tmp;
if (t_1 <= -2e+132) {
tmp = t_2;
} else if (t_1 <= 4e+29) {
tmp = x * 2.0;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = (a * 27.0d0) * b
t_2 = 27.0d0 * (a * b)
if (t_1 <= (-2d+132)) then
tmp = t_2
else if (t_1 <= 4d+29) then
tmp = x * 2.0d0
else
tmp = t_2
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 = (a * 27.0) * b;
double t_2 = 27.0 * (a * b);
double tmp;
if (t_1 <= -2e+132) {
tmp = t_2;
} else if (t_1 <= 4e+29) {
tmp = x * 2.0;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (a * 27.0) * b t_2 = 27.0 * (a * b) tmp = 0 if t_1 <= -2e+132: tmp = t_2 elif t_1 <= 4e+29: tmp = x * 2.0 else: tmp = t_2 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a * 27.0) * b) t_2 = Float64(27.0 * Float64(a * b)) tmp = 0.0 if (t_1 <= -2e+132) tmp = t_2; elseif (t_1 <= 4e+29) tmp = Float64(x * 2.0); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (a * 27.0) * b; t_2 = 27.0 * (a * b); tmp = 0.0; if (t_1 <= -2e+132) tmp = t_2; elseif (t_1 <= 4e+29) tmp = x * 2.0; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]}, Block[{t$95$2 = N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+132], t$95$2, If[LessEqual[t$95$1, 4e+29], N[(x * 2.0), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
t_1 := \left(a \cdot 27\right) \cdot b\\
t_2 := 27 \cdot \left(a \cdot b\right)\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+132}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+29}:\\
\;\;\;\;x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
if (*.f64 (*.f64 a #s(literal 27 binary64)) b) < -1.99999999999999998e132 or 3.99999999999999966e29 < (*.f64 (*.f64 a #s(literal 27 binary64)) b) Initial program 94.7%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6464.1%
Applied rewrites64.1%
Taylor expanded in x around 0
lower-*.f64N/A
lower-*.f6435.4%
Applied rewrites35.4%
if -1.99999999999999998e132 < (*.f64 (*.f64 a #s(literal 27 binary64)) b) < 3.99999999999999966e29Initial program 94.7%
Taylor expanded in x around inf
lower-*.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6484.0%
Applied rewrites84.0%
Taylor expanded in x around inf
Applied rewrites30.6%
(FPCore (x y z t a b) :precision binary64 (* x 2.0))
double code(double x, double y, double z, double t, double a, double b) {
return x * 2.0;
}
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 * 2.0d0
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x * 2.0;
}
def code(x, y, z, t, a, b): return x * 2.0
function code(x, y, z, t, a, b) return Float64(x * 2.0) end
function tmp = code(x, y, z, t, a, b) tmp = x * 2.0; end
code[x_, y_, z_, t_, a_, b_] := N[(x * 2.0), $MachinePrecision]
x \cdot 2
Initial program 94.7%
Taylor expanded in x around inf
lower-*.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6484.0%
Applied rewrites84.0%
Taylor expanded in x around inf
Applied rewrites30.6%
herbie shell --seed 2025183
(FPCore (x y z t a b)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, A"
:precision binary64
(+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* (* a 27.0) b)))