
(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]
2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right)
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]
2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right)
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* 2.0 (- (+ (* x y) (* z t)) (* (* (+ a (* b c)) c) i))) INFINITY) (* 2.0 (fma (fma c b a) (* (- c) i) (fma t z (* y x)))) (* -2.0 (* c (fma (* i b) c (* i a))))))
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 = 2.0 * fma(fma(c, b, a), (-c * i), fma(t, z, (y * x)));
} else {
tmp = -2.0 * (c * fma((i * b), c, (i * a)));
}
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(2.0 * fma(fma(c, b, a), Float64(Float64(-c) * i), fma(t, z, Float64(y * x)))); else tmp = Float64(-2.0 * Float64(c * fma(Float64(i * b), c, Float64(i * a)))); 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[(2.0 * N[(N[(c * b + a), $MachinePrecision] * N[((-c) * i), $MachinePrecision] + N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(c * N[(N[(i * b), $MachinePrecision] * c + N[(i * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\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:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(c, b, a\right), \left(-c\right) \cdot i, \mathsf{fma}\left(t, z, y \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \left(c \cdot \mathsf{fma}\left(i \cdot b, c, i \cdot a\right)\right)\\
\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.6%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
lift-*.f64N/A
associate-*l*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f6494.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6495.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6495.2%
Applied rewrites95.2%
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.6%
Taylor expanded in i around inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6447.9%
Applied rewrites47.9%
lift-*.f64N/A
lift-+.f64N/A
distribute-lft-inN/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6445.2%
Applied rewrites45.2%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (- (* z t) (* (* i c) (fma b c a))) 2.0))
(t_2 (* (* (+ a (* b c)) c) i)))
(if (<= t_2 -1e+81)
t_1
(if (<= t_2 2e+144) (* 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 = ((z * t) - ((i * c) * fma(b, c, a))) * 2.0;
double t_2 = ((a + (b * c)) * c) * i;
double tmp;
if (t_2 <= -1e+81) {
tmp = t_1;
} else if (t_2 <= 2e+144) {
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(Float64(Float64(z * t) - Float64(Float64(i * c) * fma(b, c, a))) * 2.0) t_2 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i) tmp = 0.0 if (t_2 <= -1e+81) tmp = t_1; elseif (t_2 <= 2e+144) 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[(N[(N[(z * t), $MachinePrecision] - N[(N[(i * c), $MachinePrecision] * N[(b * c + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+81], t$95$1, If[LessEqual[t$95$2, 2e+144], 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}
t_1 := \left(z \cdot t - \left(i \cdot c\right) \cdot \mathsf{fma}\left(b, c, a\right)\right) \cdot 2\\
t_2 := \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+81}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+144}:\\
\;\;\;\;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}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -9.9999999999999992e80 or 2e144 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 89.6%
Taylor expanded in x around 0
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6470.3%
Applied rewrites70.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6470.3%
Applied rewrites72.9%
if -9.9999999999999992e80 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 2e144Initial program 89.6%
Taylor expanded in x around 0
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6470.3%
Applied rewrites70.3%
Taylor expanded in b around 0
lower--.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6473.2%
Applied rewrites73.2%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (fma c b a) i) (* -2.0 c))) (t_2 (* (* (+ a (* b c)) c) i)))
(if (<= t_2 -5e+256)
t_1
(if (<= t_2 5e+286) (* 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 = (fma(c, b, a) * i) * (-2.0 * c);
double t_2 = ((a + (b * c)) * c) * i;
double tmp;
if (t_2 <= -5e+256) {
tmp = t_1;
} else if (t_2 <= 5e+286) {
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(Float64(fma(c, b, a) * i) * Float64(-2.0 * c)) t_2 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i) tmp = 0.0 if (t_2 <= -5e+256) tmp = t_1; elseif (t_2 <= 5e+286) 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[(N[(N[(c * b + a), $MachinePrecision] * i), $MachinePrecision] * N[(-2.0 * c), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+256], t$95$1, If[LessEqual[t$95$2, 5e+286], 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}
t_1 := \left(\mathsf{fma}\left(c, b, a\right) \cdot i\right) \cdot \left(-2 \cdot c\right)\\
t_2 := \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+256}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+286}:\\
\;\;\;\;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}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -5.0000000000000002e256 or 5.0000000000000004e286 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 89.6%
Taylor expanded in i around inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6447.9%
Applied rewrites47.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-fma.f64N/A
lower-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
add-flipN/A
sub-flipN/A
lift-*.f64N/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f64N/A
lower-*.f6447.9%
Applied rewrites47.9%
if -5.0000000000000002e256 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 5.0000000000000004e286Initial program 89.6%
Taylor expanded in x around 0
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6470.3%
Applied rewrites70.3%
Taylor expanded in b around 0
lower--.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6473.2%
Applied rewrites73.2%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i))
(t_2 (* 2.0 (- (* t z) (* (* (fma b c a) c) i)))))
(if (<= t_1 -1e+277)
(* (* (fma c b a) i) (* -2.0 c))
(if (<= t_1 -1e+81)
t_2
(if (<= t_1 4e-38) (* 2.0 (fma t z (* x y))) 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)) * c) * i;
double t_2 = 2.0 * ((t * z) - ((fma(b, c, a) * c) * i));
double tmp;
if (t_1 <= -1e+277) {
tmp = (fma(c, b, a) * i) * (-2.0 * c);
} else if (t_1 <= -1e+81) {
tmp = t_2;
} else if (t_1 <= 4e-38) {
tmp = 2.0 * fma(t, z, (x * y));
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i) t_2 = Float64(2.0 * Float64(Float64(t * z) - Float64(Float64(fma(b, c, a) * c) * i))) tmp = 0.0 if (t_1 <= -1e+277) tmp = Float64(Float64(fma(c, b, a) * i) * Float64(-2.0 * c)); elseif (t_1 <= -1e+81) tmp = t_2; elseif (t_1 <= 4e-38) tmp = Float64(2.0 * fma(t, z, Float64(x * y))); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, Block[{t$95$2 = N[(2.0 * N[(N[(t * z), $MachinePrecision] - N[(N[(N[(b * c + a), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+277], N[(N[(N[(c * b + a), $MachinePrecision] * i), $MachinePrecision] * N[(-2.0 * c), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -1e+81], t$95$2, If[LessEqual[t$95$1, 4e-38], N[(2.0 * N[(t * z + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
t_1 := \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\\
t_2 := 2 \cdot \left(t \cdot z - \left(\mathsf{fma}\left(b, c, a\right) \cdot c\right) \cdot i\right)\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+277}:\\
\;\;\;\;\left(\mathsf{fma}\left(c, b, a\right) \cdot i\right) \cdot \left(-2 \cdot c\right)\\
\mathbf{elif}\;t\_1 \leq -1 \cdot 10^{+81}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{-38}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(t, z, x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -1e277Initial program 89.6%
Taylor expanded in i around inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6447.9%
Applied rewrites47.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-fma.f64N/A
lower-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
add-flipN/A
sub-flipN/A
lift-*.f64N/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f64N/A
lower-*.f6447.9%
Applied rewrites47.9%
if -1e277 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -9.9999999999999992e80 or 3.9999999999999998e-38 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 89.6%
Taylor expanded in x around 0
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6470.3%
Applied rewrites70.3%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lift-+.f64N/A
lift-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lower-*.f6469.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6469.6%
Applied rewrites69.6%
if -9.9999999999999992e80 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 3.9999999999999998e-38Initial program 89.6%
Taylor expanded in c around 0
lower-*.f64N/A
lower-fma.f64N/A
lower-*.f6454.4%
Applied rewrites54.4%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (fma c b a) (* (* -2.0 i) c))) (t_2 (* (* (+ a (* b c)) c) i)))
(if (<= t_2 -5e+151)
t_1
(if (<= t_2 5e+72) (* 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 = fma(c, b, a) * ((-2.0 * i) * c);
double t_2 = ((a + (b * c)) * c) * i;
double tmp;
if (t_2 <= -5e+151) {
tmp = t_1;
} else if (t_2 <= 5e+72) {
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(fma(c, b, a) * Float64(Float64(-2.0 * i) * c)) t_2 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i) tmp = 0.0 if (t_2 <= -5e+151) tmp = t_1; elseif (t_2 <= 5e+72) 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[(c * b + a), $MachinePrecision] * N[(N[(-2.0 * i), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+151], t$95$1, If[LessEqual[t$95$2, 5e+72], N[(2.0 * N[(t * z + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_1 := \mathsf{fma}\left(c, b, a\right) \cdot \left(\left(-2 \cdot i\right) \cdot c\right)\\
t_2 := \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+151}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+72}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(t, z, x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -5.0000000000000002e151 or 4.9999999999999999e72 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 89.6%
Taylor expanded in i around inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6447.9%
Applied rewrites47.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
add-flipN/A
sub-flipN/A
lift-*.f64N/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6449.6%
Applied rewrites49.6%
if -5.0000000000000002e151 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 4.9999999999999999e72Initial program 89.6%
Taylor expanded in c around 0
lower-*.f64N/A
lower-fma.f64N/A
lower-*.f6454.4%
Applied rewrites54.4%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (fma c b a) i) (* -2.0 c))) (t_2 (* (* (+ a (* b c)) c) i)))
(if (<= t_2 -5e+151)
t_1
(if (<= t_2 5e+192) (* 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 = (fma(c, b, a) * i) * (-2.0 * c);
double t_2 = ((a + (b * c)) * c) * i;
double tmp;
if (t_2 <= -5e+151) {
tmp = t_1;
} else if (t_2 <= 5e+192) {
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(fma(c, b, a) * i) * Float64(-2.0 * c)) t_2 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i) tmp = 0.0 if (t_2 <= -5e+151) tmp = t_1; elseif (t_2 <= 5e+192) 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[(N[(c * b + a), $MachinePrecision] * i), $MachinePrecision] * N[(-2.0 * c), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+151], t$95$1, If[LessEqual[t$95$2, 5e+192], N[(2.0 * N[(t * z + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_1 := \left(\mathsf{fma}\left(c, b, a\right) \cdot i\right) \cdot \left(-2 \cdot c\right)\\
t_2 := \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+151}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+192}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(t, z, x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -5.0000000000000002e151 or 5.0000000000000003e192 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 89.6%
Taylor expanded in i around inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6447.9%
Applied rewrites47.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-fma.f64N/A
lower-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
add-flipN/A
sub-flipN/A
lift-*.f64N/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f64N/A
lower-*.f6447.9%
Applied rewrites47.9%
if -5.0000000000000002e151 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 5.0000000000000003e192Initial program 89.6%
Taylor expanded in c around 0
lower-*.f64N/A
lower-fma.f64N/A
lower-*.f6454.4%
Applied rewrites54.4%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (fma c b a) c) (* -2.0 i))) (t_2 (* (* (+ a (* b c)) c) i)))
(if (<= t_2 -5e+151)
t_1
(if (<= t_2 5e+72) (* 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 = (fma(c, b, a) * c) * (-2.0 * i);
double t_2 = ((a + (b * c)) * c) * i;
double tmp;
if (t_2 <= -5e+151) {
tmp = t_1;
} else if (t_2 <= 5e+72) {
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(fma(c, b, a) * c) * Float64(-2.0 * i)) t_2 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i) tmp = 0.0 if (t_2 <= -5e+151) tmp = t_1; elseif (t_2 <= 5e+72) 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[(N[(c * b + a), $MachinePrecision] * c), $MachinePrecision] * N[(-2.0 * 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, -5e+151], t$95$1, If[LessEqual[t$95$2, 5e+72], N[(2.0 * N[(t * z + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_1 := \left(\mathsf{fma}\left(c, b, a\right) \cdot c\right) \cdot \left(-2 \cdot i\right)\\
t_2 := \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+151}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+72}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(t, z, x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -5.0000000000000002e151 or 4.9999999999999999e72 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 89.6%
Taylor expanded in i around inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6447.9%
Applied rewrites47.9%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-fma.f64N/A
associate-*r*N/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
add-flipN/A
sub-flipN/A
lift-*.f64N/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f64N/A
lower-*.f6447.4%
Applied rewrites47.4%
if -5.0000000000000002e151 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 4.9999999999999999e72Initial program 89.6%
Taylor expanded in c around 0
lower-*.f64N/A
lower-fma.f64N/A
lower-*.f6454.4%
Applied rewrites54.4%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* -2.0 (* c (* b (* c i))))) (t_2 (* (* (+ a (* b c)) c) i)))
(if (<= t_2 -5e+278)
t_1
(if (<= t_2 5e+286) (* 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 * (c * (b * (c * i)));
double t_2 = ((a + (b * c)) * c) * i;
double tmp;
if (t_2 <= -5e+278) {
tmp = t_1;
} else if (t_2 <= 5e+286) {
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(c * Float64(b * Float64(c * i)))) t_2 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i) tmp = 0.0 if (t_2 <= -5e+278) tmp = t_1; elseif (t_2 <= 5e+286) 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[(c * N[(b * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+278], t$95$1, If[LessEqual[t$95$2, 5e+286], N[(2.0 * N[(t * z + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_1 := -2 \cdot \left(c \cdot \left(b \cdot \left(c \cdot i\right)\right)\right)\\
t_2 := \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+278}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+286}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(t, z, x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -5.0000000000000003e278 or 5.0000000000000004e286 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 89.6%
Taylor expanded in i around inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6447.9%
Applied rewrites47.9%
Taylor expanded in a around 0
lower-*.f64N/A
lower-*.f6434.6%
Applied rewrites34.6%
if -5.0000000000000003e278 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 5.0000000000000004e286Initial program 89.6%
Taylor expanded in c around 0
lower-*.f64N/A
lower-fma.f64N/A
lower-*.f6454.4%
Applied rewrites54.4%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* -2.0 (* a (* c i)))) (t_2 (* (* (+ a (* b c)) c) i)))
(if (<= t_2 -5e+151)
t_1
(if (<= t_2 5e+286) (* 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 * (a * (c * i));
double t_2 = ((a + (b * c)) * c) * i;
double tmp;
if (t_2 <= -5e+151) {
tmp = t_1;
} else if (t_2 <= 5e+286) {
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(a * Float64(c * i))) t_2 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i) tmp = 0.0 if (t_2 <= -5e+151) tmp = t_1; elseif (t_2 <= 5e+286) 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[(a * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+151], t$95$1, If[LessEqual[t$95$2, 5e+286], N[(2.0 * N[(t * z + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_1 := -2 \cdot \left(a \cdot \left(c \cdot i\right)\right)\\
t_2 := \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+151}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+286}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(t, z, x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -5.0000000000000002e151 or 5.0000000000000004e286 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 89.6%
Taylor expanded in a around inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6425.2%
Applied rewrites25.2%
if -5.0000000000000002e151 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 5.0000000000000004e286Initial program 89.6%
Taylor expanded in c around 0
lower-*.f64N/A
lower-fma.f64N/A
lower-*.f6454.4%
Applied rewrites54.4%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (+ t t) z)))
(if (<= (* z t) -0.0002)
t_1
(if (<= (* z t) 2e-16)
(* 2.0 (* x y))
(if (<= (* z t) 5e+126) (* -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) <= -0.0002) {
tmp = t_1;
} else if ((z * t) <= 2e-16) {
tmp = 2.0 * (x * y);
} else if ((z * t) <= 5e+126) {
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) <= (-0.0002d0)) then
tmp = t_1
else if ((z * t) <= 2d-16) then
tmp = 2.0d0 * (x * y)
else if ((z * t) <= 5d+126) 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) <= -0.0002) {
tmp = t_1;
} else if ((z * t) <= 2e-16) {
tmp = 2.0 * (x * y);
} else if ((z * t) <= 5e+126) {
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) <= -0.0002: tmp = t_1 elif (z * t) <= 2e-16: tmp = 2.0 * (x * y) elif (z * t) <= 5e+126: 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) <= -0.0002) tmp = t_1; elseif (Float64(z * t) <= 2e-16) tmp = Float64(2.0 * Float64(x * y)); elseif (Float64(z * t) <= 5e+126) 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) <= -0.0002) tmp = t_1; elseif ((z * t) <= 2e-16) tmp = 2.0 * (x * y); elseif ((z * t) <= 5e+126) 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], -0.0002], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 2e-16], N[(2.0 * N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 5e+126], N[(-2.0 * N[(a * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_1 := \left(t + t\right) \cdot z\\
\mathbf{if}\;z \cdot t \leq -0.0002:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{-16}:\\
\;\;\;\;2 \cdot \left(x \cdot y\right)\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+126}:\\
\;\;\;\;-2 \cdot \left(a \cdot \left(c \cdot i\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (*.f64 z t) < -2.0000000000000001e-4 or 4.9999999999999998e126 < (*.f64 z t) Initial program 89.6%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6429.3%
Applied rewrites29.3%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lower-+.f6429.2%
Applied rewrites29.2%
if -2.0000000000000001e-4 < (*.f64 z t) < 2e-16Initial program 89.6%
Taylor expanded in x around inf
lower-*.f64N/A
lower-*.f6428.2%
Applied rewrites28.2%
if 2e-16 < (*.f64 z t) < 4.9999999999999998e126Initial program 89.6%
Taylor expanded in a around inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6425.2%
Applied rewrites25.2%
(FPCore (x y z t a b c i) :precision binary64 (let* ((t_1 (* 2.0 (* x y)))) (if (<= (* x y) -2.2e+92) t_1 (if (<= (* x y) 4.1e-35) (* (+ t t) z) 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);
double tmp;
if ((x * y) <= -2.2e+92) {
tmp = t_1;
} else if ((x * y) <= 4.1e-35) {
tmp = (t + t) * z;
} 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 = 2.0d0 * (x * y)
if ((x * y) <= (-2.2d+92)) then
tmp = t_1
else if ((x * y) <= 4.1d-35) then
tmp = (t + t) * z
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 = 2.0 * (x * y);
double tmp;
if ((x * y) <= -2.2e+92) {
tmp = t_1;
} else if ((x * y) <= 4.1e-35) {
tmp = (t + t) * z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = 2.0 * (x * y) tmp = 0 if (x * y) <= -2.2e+92: tmp = t_1 elif (x * y) <= 4.1e-35: tmp = (t + t) * z else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(2.0 * Float64(x * y)) tmp = 0.0 if (Float64(x * y) <= -2.2e+92) tmp = t_1; elseif (Float64(x * y) <= 4.1e-35) tmp = Float64(Float64(t + t) * z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = 2.0 * (x * y); tmp = 0.0; if ((x * y) <= -2.2e+92) tmp = t_1; elseif ((x * y) <= 4.1e-35) tmp = (t + t) * z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(2.0 * N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -2.2e+92], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 4.1e-35], N[(N[(t + t), $MachinePrecision] * z), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := 2 \cdot \left(x \cdot y\right)\\
\mathbf{if}\;x \cdot y \leq -2.2 \cdot 10^{+92}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 4.1 \cdot 10^{-35}:\\
\;\;\;\;\left(t + t\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (*.f64 x y) < -2.1999999999999999e92 or 4.1000000000000003e-35 < (*.f64 x y) Initial program 89.6%
Taylor expanded in x around inf
lower-*.f64N/A
lower-*.f6428.2%
Applied rewrites28.2%
if -2.1999999999999999e92 < (*.f64 x y) < 4.1000000000000003e-35Initial program 89.6%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6429.3%
Applied rewrites29.3%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lower-+.f6429.2%
Applied rewrites29.2%
(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]
\left(t + t\right) \cdot z
Initial program 89.6%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6429.3%
Applied rewrites29.3%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lower-+.f6429.2%
Applied rewrites29.2%
herbie shell --seed 2025204
(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))))