
(FPCore (x y z t a b c i) :precision binary64 (* 2.0 (- (+ (* x y) (* z t)) (* (* (+ a (* b c)) c) i))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i));
}
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, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
code = 2.0d0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i))
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i));
}
def code(x, y, z, t, a, b, c, i): return 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i))
function code(x, y, z, t, a, b, c, i) return Float64(2.0 * Float64(Float64(Float64(x * y) + Float64(z * t)) - Float64(Float64(Float64(a + Float64(b * c)) * c) * i))) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i)); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(2.0 * N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right)
\end{array}
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b c i) :precision binary64 (* 2.0 (- (+ (* x y) (* z t)) (* (* (+ a (* b c)) c) i))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i));
}
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, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
code = 2.0d0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i))
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i));
}
def code(x, y, z, t, a, b, c, i): return 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i))
function code(x, y, z, t, a, b, c, i) return Float64(2.0 * Float64(Float64(Float64(x * y) + Float64(z * t)) - Float64(Float64(Float64(a + Float64(b * c)) * c) * i))) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i)); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(2.0 * N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right)
\end{array}
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* 2.0 (- (+ (* x y) (* z t)) (* (* (+ a (* b c)) c) i))) INFINITY) (* (- (fma z t (* x y)) (* (fma c b a) (* c i))) 2.0) (* 2.0 (fma t z (* x y)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i))) <= ((double) INFINITY)) {
tmp = (fma(z, t, (x * y)) - (fma(c, b, a) * (c * i))) * 2.0;
} else {
tmp = 2.0 * fma(t, z, (x * y));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(2.0 * Float64(Float64(Float64(x * y) + Float64(z * t)) - Float64(Float64(Float64(a + Float64(b * c)) * c) * i))) <= Inf) tmp = Float64(Float64(fma(z, t, Float64(x * y)) - Float64(fma(c, b, a) * Float64(c * i))) * 2.0); else tmp = Float64(2.0 * fma(t, z, Float64(x * y))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(2.0 * N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(N[(z * t + N[(x * y), $MachinePrecision]), $MachinePrecision] - N[(N[(c * b + a), $MachinePrecision] * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision], N[(2.0 * N[(t * z + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right) \leq \infty:\\
\;\;\;\;\left(\mathsf{fma}\left(z, t, x \cdot y\right) - \mathsf{fma}\left(c, b, a\right) \cdot \left(c \cdot i\right)\right) \cdot 2\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(t, z, x \cdot y\right)\\
\end{array}
\end{array}
if (*.f64 #s(literal 2 binary64) (-.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i))) < +inf.0Initial program 89.8%
Applied rewrites94.4%
if +inf.0 < (*.f64 #s(literal 2 binary64) (-.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i))) Initial program 89.8%
Taylor expanded in c around 0
Applied rewrites54.7%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* 2.0 (- (* x y) (* c (* i (+ a (* b c))))))))
(if (<= c -2.9e+101)
t_1
(if (<= c -2.1e-121)
(* 2.0 (- (+ (* x y) (* z t)) (* (* (* b c) c) i)))
(if (<= c 1.4e+94) (* 2.0 (- (fma t z (* x y)) (* a (* c i)))) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = 2.0 * ((x * y) - (c * (i * (a + (b * c)))));
double tmp;
if (c <= -2.9e+101) {
tmp = t_1;
} else if (c <= -2.1e-121) {
tmp = 2.0 * (((x * y) + (z * t)) - (((b * c) * c) * i));
} else if (c <= 1.4e+94) {
tmp = 2.0 * (fma(t, z, (x * y)) - (a * (c * i)));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(2.0 * Float64(Float64(x * y) - Float64(c * Float64(i * Float64(a + Float64(b * c)))))) tmp = 0.0 if (c <= -2.9e+101) tmp = t_1; elseif (c <= -2.1e-121) tmp = Float64(2.0 * Float64(Float64(Float64(x * y) + Float64(z * t)) - Float64(Float64(Float64(b * c) * c) * i))); elseif (c <= 1.4e+94) tmp = Float64(2.0 * Float64(fma(t, z, Float64(x * y)) - Float64(a * Float64(c * i)))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(2.0 * N[(N[(x * y), $MachinePrecision] - N[(c * N[(i * N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -2.9e+101], t$95$1, If[LessEqual[c, -2.1e-121], N[(2.0 * N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(b * c), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 1.4e+94], N[(2.0 * N[(N[(t * z + N[(x * y), $MachinePrecision]), $MachinePrecision] - N[(a * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \left(x \cdot y - c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right)\\
\mathbf{if}\;c \leq -2.9 \cdot 10^{+101}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;c \leq -2.1 \cdot 10^{-121}:\\
\;\;\;\;2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(b \cdot c\right) \cdot c\right) \cdot i\right)\\
\mathbf{elif}\;c \leq 1.4 \cdot 10^{+94}:\\
\;\;\;\;2 \cdot \left(\mathsf{fma}\left(t, z, x \cdot y\right) - a \cdot \left(c \cdot i\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if c < -2.89999999999999987e101 or 1.39999999999999999e94 < c Initial program 89.8%
Taylor expanded in z around 0
Applied rewrites70.1%
if -2.89999999999999987e101 < c < -2.0999999999999999e-121Initial program 89.8%
Taylor expanded in a around 0
Applied rewrites76.5%
if -2.0999999999999999e-121 < c < 1.39999999999999999e94Initial program 89.8%
Taylor expanded in b around 0
Applied rewrites74.2%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* 2.0 (- (* x y) (* c (* i (+ a (* b c))))))))
(if (<= c -3.8e-113)
t_1
(if (<= c 1.4e+94) (* 2.0 (- (fma t z (* x y)) (* a (* c i)))) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = 2.0 * ((x * y) - (c * (i * (a + (b * c)))));
double tmp;
if (c <= -3.8e-113) {
tmp = t_1;
} else if (c <= 1.4e+94) {
tmp = 2.0 * (fma(t, z, (x * y)) - (a * (c * i)));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(2.0 * Float64(Float64(x * y) - Float64(c * Float64(i * Float64(a + Float64(b * c)))))) tmp = 0.0 if (c <= -3.8e-113) tmp = t_1; elseif (c <= 1.4e+94) tmp = Float64(2.0 * Float64(fma(t, z, Float64(x * y)) - Float64(a * Float64(c * i)))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(2.0 * N[(N[(x * y), $MachinePrecision] - N[(c * N[(i * N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -3.8e-113], t$95$1, If[LessEqual[c, 1.4e+94], N[(2.0 * N[(N[(t * z + N[(x * y), $MachinePrecision]), $MachinePrecision] - N[(a * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \left(x \cdot y - c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right)\\
\mathbf{if}\;c \leq -3.8 \cdot 10^{-113}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;c \leq 1.4 \cdot 10^{+94}:\\
\;\;\;\;2 \cdot \left(\mathsf{fma}\left(t, z, x \cdot y\right) - a \cdot \left(c \cdot i\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if c < -3.79999999999999983e-113 or 1.39999999999999999e94 < c Initial program 89.8%
Taylor expanded in z around 0
Applied rewrites70.1%
if -3.79999999999999983e-113 < c < 1.39999999999999999e94Initial program 89.8%
Taylor expanded in b around 0
Applied rewrites74.2%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ a (* b c)))
(t_2 (* -2.0 (* c (* i t_1))))
(t_3 (* (* t_1 c) i)))
(if (<= t_3 -5e+228)
t_2
(if (<= t_3 1e+243) (* 2.0 (- (fma t z (* x y)) (* a (* c i)))) t_2))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = a + (b * c);
double t_2 = -2.0 * (c * (i * t_1));
double t_3 = (t_1 * c) * i;
double tmp;
if (t_3 <= -5e+228) {
tmp = t_2;
} else if (t_3 <= 1e+243) {
tmp = 2.0 * (fma(t, z, (x * y)) - (a * (c * i)));
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(a + Float64(b * c)) t_2 = Float64(-2.0 * Float64(c * Float64(i * t_1))) t_3 = Float64(Float64(t_1 * c) * i) tmp = 0.0 if (t_3 <= -5e+228) tmp = t_2; elseif (t_3 <= 1e+243) tmp = Float64(2.0 * Float64(fma(t, z, Float64(x * y)) - Float64(a * Float64(c * i)))); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(-2.0 * N[(c * N[(i * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(t$95$1 * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$3, -5e+228], t$95$2, If[LessEqual[t$95$3, 1e+243], N[(2.0 * N[(N[(t * z + N[(x * y), $MachinePrecision]), $MachinePrecision] - N[(a * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a + b \cdot c\\
t_2 := -2 \cdot \left(c \cdot \left(i \cdot t\_1\right)\right)\\
t_3 := \left(t\_1 \cdot c\right) \cdot i\\
\mathbf{if}\;t\_3 \leq -5 \cdot 10^{+228}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_3 \leq 10^{+243}:\\
\;\;\;\;2 \cdot \left(\mathsf{fma}\left(t, z, x \cdot y\right) - a \cdot \left(c \cdot i\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -5e228 or 1.0000000000000001e243 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 89.8%
Taylor expanded in i around inf
Applied rewrites47.7%
if -5e228 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 1.0000000000000001e243Initial program 89.8%
Taylor expanded in b around 0
Applied rewrites74.2%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ a (* b c))) (t_2 (* (* t_1 c) i)))
(if (<= t_2 -1e+225)
(* -2.0 (* c (* i t_1)))
(if (<= t_2 2e+88)
(* 2.0 (fma t z (* x y)))
(* -2.0 (* (* (fma c b a) c) i))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = a + (b * c);
double t_2 = (t_1 * c) * i;
double tmp;
if (t_2 <= -1e+225) {
tmp = -2.0 * (c * (i * t_1));
} else if (t_2 <= 2e+88) {
tmp = 2.0 * fma(t, z, (x * y));
} else {
tmp = -2.0 * ((fma(c, b, a) * c) * i);
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(a + Float64(b * c)) t_2 = Float64(Float64(t_1 * c) * i) tmp = 0.0 if (t_2 <= -1e+225) tmp = Float64(-2.0 * Float64(c * Float64(i * t_1))); elseif (t_2 <= 2e+88) tmp = Float64(2.0 * fma(t, z, Float64(x * y))); else tmp = Float64(-2.0 * Float64(Float64(fma(c, b, a) * c) * i)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t$95$1 * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+225], N[(-2.0 * N[(c * N[(i * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+88], N[(2.0 * N[(t * z + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[(N[(c * b + a), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a + b \cdot c\\
t_2 := \left(t\_1 \cdot c\right) \cdot i\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+225}:\\
\;\;\;\;-2 \cdot \left(c \cdot \left(i \cdot t\_1\right)\right)\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+88}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(t, z, x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \left(\left(\mathsf{fma}\left(c, b, a\right) \cdot c\right) \cdot i\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -9.99999999999999928e224Initial program 89.8%
Taylor expanded in i around inf
Applied rewrites47.7%
if -9.99999999999999928e224 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 1.99999999999999992e88Initial program 89.8%
Taylor expanded in c around 0
Applied rewrites54.7%
if 1.99999999999999992e88 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 89.8%
Applied rewrites94.4%
Taylor expanded in i around inf
Applied rewrites47.7%
Applied rewrites46.8%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* -2.0 (* (* (fma c b a) c) i))) (t_2 (* (* (+ a (* b c)) c) i)))
(if (<= t_2 -2e+129)
t_1
(if (<= t_2 2e+88) (* 2.0 (fma t z (* x y))) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = -2.0 * ((fma(c, b, a) * c) * i);
double t_2 = ((a + (b * c)) * c) * i;
double tmp;
if (t_2 <= -2e+129) {
tmp = t_1;
} else if (t_2 <= 2e+88) {
tmp = 2.0 * fma(t, z, (x * y));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(-2.0 * Float64(Float64(fma(c, b, a) * c) * i)) t_2 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i) tmp = 0.0 if (t_2 <= -2e+129) tmp = t_1; elseif (t_2 <= 2e+88) tmp = Float64(2.0 * fma(t, z, Float64(x * y))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(-2.0 * N[(N[(N[(c * b + a), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+129], t$95$1, If[LessEqual[t$95$2, 2e+88], N[(2.0 * N[(t * z + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -2 \cdot \left(\left(\mathsf{fma}\left(c, b, a\right) \cdot c\right) \cdot i\right)\\
t_2 := \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+129}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+88}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(t, z, x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -2e129 or 1.99999999999999992e88 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 89.8%
Applied rewrites94.4%
Taylor expanded in i around inf
Applied rewrites47.7%
Applied rewrites46.8%
if -2e129 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 1.99999999999999992e88Initial program 89.8%
Taylor expanded in c around 0
Applied rewrites54.7%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* -2.0 b) (* (* c c) i))) (t_2 (* (* (+ a (* b c)) c) i)))
(if (<= t_2 -1e+225)
t_1
(if (<= t_2 1e+243) (* 2.0 (fma t z (* x y))) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (-2.0 * b) * ((c * c) * i);
double t_2 = ((a + (b * c)) * c) * i;
double tmp;
if (t_2 <= -1e+225) {
tmp = t_1;
} else if (t_2 <= 1e+243) {
tmp = 2.0 * fma(t, z, (x * y));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(-2.0 * b) * Float64(Float64(c * c) * i)) t_2 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i) tmp = 0.0 if (t_2 <= -1e+225) tmp = t_1; elseif (t_2 <= 1e+243) tmp = Float64(2.0 * fma(t, z, Float64(x * y))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(-2.0 * b), $MachinePrecision] * N[(N[(c * c), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+225], t$95$1, If[LessEqual[t$95$2, 1e+243], N[(2.0 * N[(t * z + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-2 \cdot b\right) \cdot \left(\left(c \cdot c\right) \cdot i\right)\\
t_2 := \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+225}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{+243}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(t, z, x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -9.99999999999999928e224 or 1.0000000000000001e243 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 89.8%
Taylor expanded in b around inf
Applied rewrites33.0%
Applied rewrites33.0%
if -9.99999999999999928e224 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 1.0000000000000001e243Initial program 89.8%
Taylor expanded in c around 0
Applied rewrites54.7%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* -2.0 (* (* b (* c c)) i))) (t_2 (* (+ a (* b c)) c)))
(if (<= t_2 -2e+214)
t_1
(if (<= t_2 5e+185) (* 2.0 (fma t z (* x y))) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = -2.0 * ((b * (c * c)) * i);
double t_2 = (a + (b * c)) * c;
double tmp;
if (t_2 <= -2e+214) {
tmp = t_1;
} else if (t_2 <= 5e+185) {
tmp = 2.0 * fma(t, z, (x * y));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(-2.0 * Float64(Float64(b * Float64(c * c)) * i)) t_2 = Float64(Float64(a + Float64(b * c)) * c) tmp = 0.0 if (t_2 <= -2e+214) tmp = t_1; elseif (t_2 <= 5e+185) tmp = Float64(2.0 * fma(t, z, Float64(x * y))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(-2.0 * N[(N[(b * N[(c * c), $MachinePrecision]), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+214], t$95$1, If[LessEqual[t$95$2, 5e+185], N[(2.0 * N[(t * z + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -2 \cdot \left(\left(b \cdot \left(c \cdot c\right)\right) \cdot i\right)\\
t_2 := \left(a + b \cdot c\right) \cdot c\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+214}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+185}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(t, z, x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (+.f64 a (*.f64 b c)) c) < -1.9999999999999999e214 or 4.9999999999999999e185 < (*.f64 (+.f64 a (*.f64 b c)) c) Initial program 89.8%
Taylor expanded in b around inf
Applied rewrites33.0%
Applied rewrites32.0%
if -1.9999999999999999e214 < (*.f64 (+.f64 a (*.f64 b c)) c) < 4.9999999999999999e185Initial program 89.8%
Taylor expanded in c around 0
Applied rewrites54.7%
(FPCore (x y z t a b c i) :precision binary64 (let* ((t_1 (* 2.0 (fma t z (* x y)))) (t_2 (+ (* x y) (* z t)))) (if (<= t_2 -5e+162) t_1 (if (<= t_2 0.2) (* -2.0 (* a (* c i))) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = 2.0 * fma(t, z, (x * y));
double t_2 = (x * y) + (z * t);
double tmp;
if (t_2 <= -5e+162) {
tmp = t_1;
} else if (t_2 <= 0.2) {
tmp = -2.0 * (a * (c * i));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(2.0 * fma(t, z, Float64(x * y))) t_2 = Float64(Float64(x * y) + Float64(z * t)) tmp = 0.0 if (t_2 <= -5e+162) tmp = t_1; elseif (t_2 <= 0.2) tmp = Float64(-2.0 * Float64(a * Float64(c * i))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(2.0 * N[(t * z + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+162], t$95$1, If[LessEqual[t$95$2, 0.2], N[(-2.0 * N[(a * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \mathsf{fma}\left(t, z, x \cdot y\right)\\
t_2 := x \cdot y + z \cdot t\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+162}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 0.2:\\
\;\;\;\;-2 \cdot \left(a \cdot \left(c \cdot i\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (*.f64 x y) (*.f64 z t)) < -4.9999999999999997e162 or 0.20000000000000001 < (+.f64 (*.f64 x y) (*.f64 z t)) Initial program 89.8%
Taylor expanded in c around 0
Applied rewrites54.7%
if -4.9999999999999997e162 < (+.f64 (*.f64 x y) (*.f64 z t)) < 0.20000000000000001Initial program 89.8%
Taylor expanded in a around inf
Applied rewrites25.9%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (+ t t) z)))
(if (<= (* z t) -5e+164)
t_1
(if (<= (* z t) -5e-227)
(* 2.0 (* x y))
(if (<= (* z t) 0.2) (* -2.0 (* a (* c i))) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (t + t) * z;
double tmp;
if ((z * t) <= -5e+164) {
tmp = t_1;
} else if ((z * t) <= -5e-227) {
tmp = 2.0 * (x * y);
} else if ((z * t) <= 0.2) {
tmp = -2.0 * (a * (c * i));
} 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, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
real(8) :: t_1
real(8) :: tmp
t_1 = (t + t) * z
if ((z * t) <= (-5d+164)) then
tmp = t_1
else if ((z * t) <= (-5d-227)) then
tmp = 2.0d0 * (x * y)
else if ((z * t) <= 0.2d0) then
tmp = (-2.0d0) * (a * (c * i))
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 c, double i) {
double t_1 = (t + t) * z;
double tmp;
if ((z * t) <= -5e+164) {
tmp = t_1;
} else if ((z * t) <= -5e-227) {
tmp = 2.0 * (x * y);
} else if ((z * t) <= 0.2) {
tmp = -2.0 * (a * (c * i));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = (t + t) * z tmp = 0 if (z * t) <= -5e+164: tmp = t_1 elif (z * t) <= -5e-227: tmp = 2.0 * (x * y) elif (z * t) <= 0.2: tmp = -2.0 * (a * (c * i)) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(t + t) * z) tmp = 0.0 if (Float64(z * t) <= -5e+164) tmp = t_1; elseif (Float64(z * t) <= -5e-227) tmp = Float64(2.0 * Float64(x * y)); elseif (Float64(z * t) <= 0.2) tmp = Float64(-2.0 * Float64(a * Float64(c * i))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = (t + t) * z; tmp = 0.0; if ((z * t) <= -5e+164) tmp = t_1; elseif ((z * t) <= -5e-227) tmp = 2.0 * (x * y); elseif ((z * t) <= 0.2) tmp = -2.0 * (a * (c * i)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(t + t), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -5e+164], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], -5e-227], N[(2.0 * N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 0.2], N[(-2.0 * N[(a * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t + t\right) \cdot z\\
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+164}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \cdot t \leq -5 \cdot 10^{-227}:\\
\;\;\;\;2 \cdot \left(x \cdot y\right)\\
\mathbf{elif}\;z \cdot t \leq 0.2:\\
\;\;\;\;-2 \cdot \left(a \cdot \left(c \cdot i\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 z t) < -4.9999999999999995e164 or 0.20000000000000001 < (*.f64 z t) Initial program 89.8%
Taylor expanded in z around inf
Applied rewrites28.5%
Applied rewrites28.5%
Applied rewrites28.5%
if -4.9999999999999995e164 < (*.f64 z t) < -4.99999999999999961e-227Initial program 89.8%
Taylor expanded in x around inf
Applied rewrites29.6%
if -4.99999999999999961e-227 < (*.f64 z t) < 0.20000000000000001Initial program 89.8%
Taylor expanded in a around inf
Applied rewrites25.9%
(FPCore (x y z t a b c i) :precision binary64 (let* ((t_1 (* (+ t t) z))) (if (<= (* z t) -5e+164) t_1 (if (<= (* z t) 2e+225) (* 2.0 (* x y)) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (t + t) * z;
double tmp;
if ((z * t) <= -5e+164) {
tmp = t_1;
} else if ((z * t) <= 2e+225) {
tmp = 2.0 * (x * y);
} 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, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
real(8) :: t_1
real(8) :: tmp
t_1 = (t + t) * z
if ((z * t) <= (-5d+164)) then
tmp = t_1
else if ((z * t) <= 2d+225) then
tmp = 2.0d0 * (x * y)
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 c, double i) {
double t_1 = (t + t) * z;
double tmp;
if ((z * t) <= -5e+164) {
tmp = t_1;
} else if ((z * t) <= 2e+225) {
tmp = 2.0 * (x * y);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = (t + t) * z tmp = 0 if (z * t) <= -5e+164: tmp = t_1 elif (z * t) <= 2e+225: tmp = 2.0 * (x * y) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(t + t) * z) tmp = 0.0 if (Float64(z * t) <= -5e+164) tmp = t_1; elseif (Float64(z * t) <= 2e+225) tmp = Float64(2.0 * Float64(x * y)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = (t + t) * z; tmp = 0.0; if ((z * t) <= -5e+164) tmp = t_1; elseif ((z * t) <= 2e+225) tmp = 2.0 * (x * y); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(t + t), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -5e+164], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 2e+225], N[(2.0 * N[(x * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t + t\right) \cdot z\\
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+164}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+225}:\\
\;\;\;\;2 \cdot \left(x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 z t) < -4.9999999999999995e164 or 1.99999999999999986e225 < (*.f64 z t) Initial program 89.8%
Taylor expanded in z around inf
Applied rewrites28.5%
Applied rewrites28.5%
Applied rewrites28.5%
if -4.9999999999999995e164 < (*.f64 z t) < 1.99999999999999986e225Initial program 89.8%
Taylor expanded in x around inf
Applied rewrites29.6%
(FPCore (x y z t a b c i) :precision binary64 (* (+ t t) z))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (t + t) * z;
}
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, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
code = (t + t) * z
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (t + t) * z;
}
def code(x, y, z, t, a, b, c, i): return (t + t) * z
function code(x, y, z, t, a, b, c, i) return Float64(Float64(t + t) * z) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = (t + t) * z; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(t + t), $MachinePrecision] * z), $MachinePrecision]
\begin{array}{l}
\\
\left(t + t\right) \cdot z
\end{array}
Initial program 89.8%
Taylor expanded in z around inf
Applied rewrites28.5%
Applied rewrites28.5%
Applied rewrites28.5%
herbie shell --seed 2025161
(FPCore (x y z t a b c i)
:name "Diagrams.ThreeD.Shapes:frustum from diagrams-lib-1.3.0.3, A"
:precision binary64
(* 2.0 (- (+ (* x y) (* z t)) (* (* (+ a (* b c)) c) i))))