
(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 (* 2.0 (fma (fma c b a) (- (* i c)) (fma t z (* y x)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return 2.0 * fma(fma(c, b, a), -(i * c), fma(t, z, (y * x)));
}
function code(x, y, z, t, a, b, c, i) return Float64(2.0 * fma(fma(c, b, a), Float64(-Float64(i * c)), fma(t, z, Float64(y * x)))) end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(2.0 * N[(N[(c * b + a), $MachinePrecision] * (-N[(i * c), $MachinePrecision]) + N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(c, b, a\right), -i \cdot c, \mathsf{fma}\left(t, z, y \cdot x\right)\right)
\end{array}
Initial program 90.2%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-*.f64N/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
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6494.9
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6495.4
lift-*.f64N/A
*-commutativeN/A
lower-*.f6495.4
Applied rewrites95.4%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (- (* i c))) (t_2 (* (* (+ a (* b c)) c) i)))
(if (<= t_2 (- INFINITY))
(* 2.0 (fma (fma c b a) t_1 (* t z)))
(if (<= t_2 2e+232)
(* 2.0 (fma y x (- (* t z) (* i (* (fma c b a) c)))))
(* 2.0 (fma (fma c b a) t_1 (* x y)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = -(i * c);
double t_2 = ((a + (b * c)) * c) * i;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = 2.0 * fma(fma(c, b, a), t_1, (t * z));
} else if (t_2 <= 2e+232) {
tmp = 2.0 * fma(y, x, ((t * z) - (i * (fma(c, b, a) * c))));
} else {
tmp = 2.0 * fma(fma(c, b, a), t_1, (x * y));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(-Float64(i * c)) t_2 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = Float64(2.0 * fma(fma(c, b, a), t_1, Float64(t * z))); elseif (t_2 <= 2e+232) tmp = Float64(2.0 * fma(y, x, Float64(Float64(t * z) - Float64(i * Float64(fma(c, b, a) * c))))); else tmp = Float64(2.0 * fma(fma(c, b, a), t_1, Float64(x * y))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = (-N[(i * c), $MachinePrecision])}, Block[{t$95$2 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(2.0 * N[(N[(c * b + a), $MachinePrecision] * t$95$1 + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+232], N[(2.0 * N[(y * x + N[(N[(t * z), $MachinePrecision] - N[(i * N[(N[(c * b + a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(c * b + a), $MachinePrecision] * t$95$1 + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -i \cdot c\\
t_2 := \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(c, b, a\right), t\_1, t \cdot z\right)\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+232}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(y, x, t \cdot z - i \cdot \left(\mathsf{fma}\left(c, b, a\right) \cdot c\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(c, b, a\right), t\_1, x \cdot y\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -inf.0Initial program 90.2%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-*.f64N/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
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6494.9
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6495.4
lift-*.f64N/A
*-commutativeN/A
lower-*.f6495.4
Applied rewrites95.4%
Taylor expanded in x around 0
lower-*.f6472.1
Applied rewrites72.1%
if -inf.0 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 2.00000000000000011e232Initial program 90.2%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6491.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6491.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6491.8
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6491.8
Applied rewrites91.8%
if 2.00000000000000011e232 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 90.2%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-*.f64N/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
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6494.9
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6495.4
lift-*.f64N/A
*-commutativeN/A
lower-*.f6495.4
Applied rewrites95.4%
Taylor expanded in x around inf
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6489.0
Applied rewrites89.0%
Taylor expanded in x around inf
Applied rewrites72.7%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* 2.0 (fma (fma c b a) (- (* i c)) (* t z))))
(t_2 (* (* (+ a (* b c)) c) i)))
(if (<= t_2 -5e+30)
t_1
(if (<= t_2 2e+74) (* 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 * fma(fma(c, b, a), -(i * c), (t * z));
double t_2 = ((a + (b * c)) * c) * i;
double tmp;
if (t_2 <= -5e+30) {
tmp = t_1;
} else if (t_2 <= 2e+74) {
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 * fma(fma(c, b, a), Float64(-Float64(i * c)), Float64(t * z))) t_2 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i) tmp = 0.0 if (t_2 <= -5e+30) tmp = t_1; elseif (t_2 <= 2e+74) 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[(c * b + a), $MachinePrecision] * (-N[(i * c), $MachinePrecision]) + N[(t * z), $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+30], t$95$1, If[LessEqual[t$95$2, 2e+74], 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 \mathsf{fma}\left(\mathsf{fma}\left(c, b, a\right), -i \cdot c, t \cdot z\right)\\
t_2 := \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+30}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+74}:\\
\;\;\;\;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 (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -4.9999999999999998e30 or 1.9999999999999999e74 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 90.2%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-*.f64N/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
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6494.9
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6495.4
lift-*.f64N/A
*-commutativeN/A
lower-*.f6495.4
Applied rewrites95.4%
Taylor expanded in x around 0
lower-*.f6472.1
Applied rewrites72.1%
if -4.9999999999999998e30 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 1.9999999999999999e74Initial program 90.2%
Taylor expanded in b around 0
lower--.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6474.0
Applied rewrites74.0%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (+ a (* b c)) c)))
(if (<= t_1 -5e+87)
(* 2.0 (fma (* (fma b c a) (- i)) c (* z t)))
(if (<= t_1 5e+131)
(* 2.0 (- (fma t z (* x y)) (* a (* c i))))
(* (* (* -2.0 c) i) (fma b c a))))))
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;
double tmp;
if (t_1 <= -5e+87) {
tmp = 2.0 * fma((fma(b, c, a) * -i), c, (z * t));
} else if (t_1 <= 5e+131) {
tmp = 2.0 * (fma(t, z, (x * y)) - (a * (c * i)));
} else {
tmp = ((-2.0 * c) * i) * fma(b, c, a);
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(a + Float64(b * c)) * c) tmp = 0.0 if (t_1 <= -5e+87) tmp = Float64(2.0 * fma(Float64(fma(b, c, a) * Float64(-i)), c, Float64(z * t))); elseif (t_1 <= 5e+131) tmp = Float64(2.0 * Float64(fma(t, z, Float64(x * y)) - Float64(a * Float64(c * i)))); else tmp = Float64(Float64(Float64(-2.0 * c) * i) * fma(b, c, a)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+87], N[(2.0 * N[(N[(N[(b * c + a), $MachinePrecision] * (-i)), $MachinePrecision] * c + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+131], N[(2.0 * N[(N[(t * z + N[(x * y), $MachinePrecision]), $MachinePrecision] - N[(a * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-2.0 * c), $MachinePrecision] * i), $MachinePrecision] * N[(b * c + a), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a + b \cdot c\right) \cdot c\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+87}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right) \cdot \left(-i\right), c, z \cdot t\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+131}:\\
\;\;\;\;2 \cdot \left(\mathsf{fma}\left(t, z, x \cdot y\right) - a \cdot \left(c \cdot i\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-2 \cdot c\right) \cdot i\right) \cdot \mathsf{fma}\left(b, c, a\right)\\
\end{array}
\end{array}
if (*.f64 (+.f64 a (*.f64 b c)) c) < -4.9999999999999998e87Initial program 90.2%
Taylor expanded in x around 0
lower-*.f6468.6
Applied rewrites68.6%
lift--.f64N/A
sub-flipN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-fma.f64N/A
*-commutativeN/A
lift-*.f64N/A
distribute-rgt-neg-outN/A
lift-neg.f64N/A
+-commutativeN/A
Applied rewrites69.4%
if -4.9999999999999998e87 < (*.f64 (+.f64 a (*.f64 b c)) c) < 4.99999999999999995e131Initial program 90.2%
Taylor expanded in b around 0
lower--.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6474.0
Applied rewrites74.0%
if 4.99999999999999995e131 < (*.f64 (+.f64 a (*.f64 b c)) c) Initial program 90.2%
Taylor expanded in i around inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6447.4
Applied rewrites47.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6448.9
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
lower-fma.f6448.9
Applied rewrites48.9%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (+ a (* b c)) c)))
(if (<= t_1 -5e+228)
(* (- (* z t) (* (* (fma b c a) i) c)) 2.0)
(if (<= t_1 5e+131)
(* 2.0 (- (fma t z (* x y)) (* a (* c i))))
(* (* (* -2.0 c) i) (fma b c a))))))
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;
double tmp;
if (t_1 <= -5e+228) {
tmp = ((z * t) - ((fma(b, c, a) * i) * c)) * 2.0;
} else if (t_1 <= 5e+131) {
tmp = 2.0 * (fma(t, z, (x * y)) - (a * (c * i)));
} else {
tmp = ((-2.0 * c) * i) * fma(b, c, a);
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(a + Float64(b * c)) * c) tmp = 0.0 if (t_1 <= -5e+228) tmp = Float64(Float64(Float64(z * t) - Float64(Float64(fma(b, c, a) * i) * c)) * 2.0); elseif (t_1 <= 5e+131) tmp = Float64(2.0 * Float64(fma(t, z, Float64(x * y)) - Float64(a * Float64(c * i)))); else tmp = Float64(Float64(Float64(-2.0 * c) * i) * fma(b, c, a)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+228], N[(N[(N[(z * t), $MachinePrecision] - N[(N[(N[(b * c + a), $MachinePrecision] * i), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision], If[LessEqual[t$95$1, 5e+131], N[(2.0 * N[(N[(t * z + N[(x * y), $MachinePrecision]), $MachinePrecision] - N[(a * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-2.0 * c), $MachinePrecision] * i), $MachinePrecision] * N[(b * c + a), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a + b \cdot c\right) \cdot c\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+228}:\\
\;\;\;\;\left(z \cdot t - \left(\mathsf{fma}\left(b, c, a\right) \cdot i\right) \cdot c\right) \cdot 2\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+131}:\\
\;\;\;\;2 \cdot \left(\mathsf{fma}\left(t, z, x \cdot y\right) - a \cdot \left(c \cdot i\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-2 \cdot c\right) \cdot i\right) \cdot \mathsf{fma}\left(b, c, a\right)\\
\end{array}
\end{array}
if (*.f64 (+.f64 a (*.f64 b c)) c) < -5e228Initial program 90.2%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-*.f64N/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
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6494.9
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6495.4
lift-*.f64N/A
*-commutativeN/A
lower-*.f6495.4
Applied rewrites95.4%
Taylor expanded in x around 0
lower-*.f6472.1
Applied rewrites72.1%
Applied rewrites69.2%
if -5e228 < (*.f64 (+.f64 a (*.f64 b c)) c) < 4.99999999999999995e131Initial program 90.2%
Taylor expanded in b around 0
lower--.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6474.0
Applied rewrites74.0%
if 4.99999999999999995e131 < (*.f64 (+.f64 a (*.f64 b c)) c) Initial program 90.2%
Taylor expanded in i around inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6447.4
Applied rewrites47.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6448.9
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
lower-fma.f6448.9
Applied rewrites48.9%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (* -2.0 c) i) (fma b c a))) (t_2 (* (+ a (* b c)) c)))
(if (<= t_2 -5e+228)
t_1
(if (<= t_2 5e+131) (* 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 * c) * i) * fma(b, c, a);
double t_2 = (a + (b * c)) * c;
double tmp;
if (t_2 <= -5e+228) {
tmp = t_1;
} else if (t_2 <= 5e+131) {
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(-2.0 * c) * i) * fma(b, c, a)) t_2 = Float64(Float64(a + Float64(b * c)) * c) tmp = 0.0 if (t_2 <= -5e+228) tmp = t_1; elseif (t_2 <= 5e+131) 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[(-2.0 * c), $MachinePrecision] * i), $MachinePrecision] * N[(b * c + a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+228], t$95$1, If[LessEqual[t$95$2, 5e+131], 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 := \left(\left(-2 \cdot c\right) \cdot i\right) \cdot \mathsf{fma}\left(b, c, a\right)\\
t_2 := \left(a + b \cdot c\right) \cdot c\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+228}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+131}:\\
\;\;\;\;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 (*.f64 (+.f64 a (*.f64 b c)) c) < -5e228 or 4.99999999999999995e131 < (*.f64 (+.f64 a (*.f64 b c)) c) Initial program 90.2%
Taylor expanded in i around inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6447.4
Applied rewrites47.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6448.9
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
lower-fma.f6448.9
Applied rewrites48.9%
if -5e228 < (*.f64 (+.f64 a (*.f64 b c)) c) < 4.99999999999999995e131Initial program 90.2%
Taylor expanded in b around 0
lower--.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6474.0
Applied rewrites74.0%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (* -2.0 c) i) (fma b c a))) (t_2 (* (+ a (* b c)) c)))
(if (<= t_2 -5e+162)
t_1
(if (<= t_2 5e+131) (* 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) * i) * fma(b, c, a);
double t_2 = (a + (b * c)) * c;
double tmp;
if (t_2 <= -5e+162) {
tmp = t_1;
} else if (t_2 <= 5e+131) {
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(Float64(-2.0 * c) * i) * fma(b, c, a)) t_2 = Float64(Float64(a + Float64(b * c)) * c) tmp = 0.0 if (t_2 <= -5e+162) tmp = t_1; elseif (t_2 <= 5e+131) 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[(-2.0 * c), $MachinePrecision] * i), $MachinePrecision] * N[(b * c + a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+162], t$95$1, If[LessEqual[t$95$2, 5e+131], N[(2.0 * N[(t * z + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(-2 \cdot c\right) \cdot i\right) \cdot \mathsf{fma}\left(b, c, a\right)\\
t_2 := \left(a + b \cdot c\right) \cdot c\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+162}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+131}:\\
\;\;\;\;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) < -4.9999999999999997e162 or 4.99999999999999995e131 < (*.f64 (+.f64 a (*.f64 b c)) c) Initial program 90.2%
Taylor expanded in i around inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6447.4
Applied rewrites47.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6448.9
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
lower-fma.f6448.9
Applied rewrites48.9%
if -4.9999999999999997e162 < (*.f64 (+.f64 a (*.f64 b c)) c) < 4.99999999999999995e131Initial program 90.2%
Taylor expanded in c around 0
lower-*.f64N/A
lower-fma.f64N/A
lower-*.f6455.2
Applied rewrites55.2%
(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)))
(if (<= t_2 -5e+228)
t_1
(if (<= t_2 5e+131) (* 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;
double tmp;
if (t_2 <= -5e+228) {
tmp = t_1;
} else if (t_2 <= 5e+131) {
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(a + Float64(b * c)) * c) tmp = 0.0 if (t_2 <= -5e+228) tmp = t_1; elseif (t_2 <= 5e+131) 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[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+228], t$95$1, If[LessEqual[t$95$2, 5e+131], 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(c \cdot \left(b \cdot \left(c \cdot i\right)\right)\right)\\
t_2 := \left(a + b \cdot c\right) \cdot c\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+228}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+131}:\\
\;\;\;\;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) < -5e228 or 4.99999999999999995e131 < (*.f64 (+.f64 a (*.f64 b c)) c) Initial program 90.2%
Taylor expanded in i around inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6447.4
Applied rewrites47.4%
Taylor expanded in a around 0
lower-*.f64N/A
lower-*.f6434.1
Applied rewrites34.1%
if -5e228 < (*.f64 (+.f64 a (*.f64 b c)) c) < 4.99999999999999995e131Initial program 90.2%
Taylor expanded in c around 0
lower-*.f64N/A
lower-fma.f64N/A
lower-*.f6455.2
Applied rewrites55.2%
(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)))
(if (<= t_2 -5e+162)
t_1
(if (<= t_2 5e+131) (* 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;
double tmp;
if (t_2 <= -5e+162) {
tmp = t_1;
} else if (t_2 <= 5e+131) {
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(a + Float64(b * c)) * c) tmp = 0.0 if (t_2 <= -5e+162) tmp = t_1; elseif (t_2 <= 5e+131) 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[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+162], t$95$1, If[LessEqual[t$95$2, 5e+131], 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(a \cdot \left(c \cdot i\right)\right)\\
t_2 := \left(a + b \cdot c\right) \cdot c\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+162}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+131}:\\
\;\;\;\;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) < -4.9999999999999997e162 or 4.99999999999999995e131 < (*.f64 (+.f64 a (*.f64 b c)) c) Initial program 90.2%
Taylor expanded in a around inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6425.3
Applied rewrites25.3%
if -4.9999999999999997e162 < (*.f64 (+.f64 a (*.f64 b c)) c) < 4.99999999999999995e131Initial program 90.2%
Taylor expanded in c around 0
lower-*.f64N/A
lower-fma.f64N/A
lower-*.f6455.2
Applied rewrites55.2%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (+ t t) z)))
(if (<= (* z t) -2e+77)
t_1
(if (<= (* z t) -2e-315)
(* (+ x x) y)
(if (<= (* z t) 5e+112) (* -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) <= -2e+77) {
tmp = t_1;
} else if ((z * t) <= -2e-315) {
tmp = (x + x) * y;
} else if ((z * t) <= 5e+112) {
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) <= (-2d+77)) then
tmp = t_1
else if ((z * t) <= (-2d-315)) then
tmp = (x + x) * y
else if ((z * t) <= 5d+112) 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) <= -2e+77) {
tmp = t_1;
} else if ((z * t) <= -2e-315) {
tmp = (x + x) * y;
} else if ((z * t) <= 5e+112) {
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) <= -2e+77: tmp = t_1 elif (z * t) <= -2e-315: tmp = (x + x) * y elif (z * t) <= 5e+112: 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) <= -2e+77) tmp = t_1; elseif (Float64(z * t) <= -2e-315) tmp = Float64(Float64(x + x) * y); elseif (Float64(z * t) <= 5e+112) 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) <= -2e+77) tmp = t_1; elseif ((z * t) <= -2e-315) tmp = (x + x) * y; elseif ((z * t) <= 5e+112) 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], -2e+77], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], -2e-315], N[(N[(x + x), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 5e+112], 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 -2 \cdot 10^{+77}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \cdot t \leq -2 \cdot 10^{-315}:\\
\;\;\;\;\left(x + x\right) \cdot y\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+112}:\\
\;\;\;\;-2 \cdot \left(a \cdot \left(c \cdot i\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 z t) < -1.99999999999999997e77 or 5e112 < (*.f64 z t) Initial program 90.2%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6428.7
Applied rewrites28.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lower-+.f6428.7
Applied rewrites28.7%
if -1.99999999999999997e77 < (*.f64 z t) < -2.0000000019e-315Initial program 90.2%
Taylor expanded in x around inf
lower-*.f64N/A
lower-*.f6429.8
Applied rewrites29.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lower-+.f6429.8
Applied rewrites29.8%
if -2.0000000019e-315 < (*.f64 z t) < 5e112Initial program 90.2%
Taylor expanded in a around inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6425.3
Applied rewrites25.3%
(FPCore (x y z t a b c i) :precision binary64 (let* ((t_1 (* (+ t t) z))) (if (<= (* z t) -2e+77) t_1 (if (<= (* z t) 5e+112) (* (+ x 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) <= -2e+77) {
tmp = t_1;
} else if ((z * t) <= 5e+112) {
tmp = (x + 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) <= (-2d+77)) then
tmp = t_1
else if ((z * t) <= 5d+112) then
tmp = (x + 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) <= -2e+77) {
tmp = t_1;
} else if ((z * t) <= 5e+112) {
tmp = (x + 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) <= -2e+77: tmp = t_1 elif (z * t) <= 5e+112: tmp = (x + 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) <= -2e+77) tmp = t_1; elseif (Float64(z * t) <= 5e+112) tmp = Float64(Float64(x + 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) <= -2e+77) tmp = t_1; elseif ((z * t) <= 5e+112) tmp = (x + 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], -2e+77], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 5e+112], N[(N[(x + x), $MachinePrecision] * y), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t + t\right) \cdot z\\
\mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+77}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+112}:\\
\;\;\;\;\left(x + x\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 z t) < -1.99999999999999997e77 or 5e112 < (*.f64 z t) Initial program 90.2%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6428.7
Applied rewrites28.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lower-+.f6428.7
Applied rewrites28.7%
if -1.99999999999999997e77 < (*.f64 z t) < 5e112Initial program 90.2%
Taylor expanded in x around inf
lower-*.f64N/A
lower-*.f6429.8
Applied rewrites29.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lower-+.f6429.8
Applied rewrites29.8%
(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 90.2%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6428.7
Applied rewrites28.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lower-+.f6428.7
Applied rewrites28.7%
herbie shell --seed 2025148
(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))))