
(FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* (* z 9.0) t)) (* a 2.0)))
double code(double x, double y, double z, double t, double a) {
return ((x * y) - ((z * 9.0) * t)) / (a * 2.0);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
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
code = ((x * y) - ((z * 9.0d0) * t)) / (a * 2.0d0)
end function
public static double code(double x, double y, double z, double t, double a) {
return ((x * y) - ((z * 9.0) * t)) / (a * 2.0);
}
def code(x, y, z, t, a): return ((x * y) - ((z * 9.0) * t)) / (a * 2.0)
function code(x, y, z, t, a) return Float64(Float64(Float64(x * y) - Float64(Float64(z * 9.0) * t)) / Float64(a * 2.0)) end
function tmp = code(x, y, z, t, a) tmp = ((x * y) - ((z * 9.0) * t)) / (a * 2.0); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] - N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]
\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* (* z 9.0) t)) (* a 2.0)))
double code(double x, double y, double z, double t, double a) {
return ((x * y) - ((z * 9.0) * t)) / (a * 2.0);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
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
code = ((x * y) - ((z * 9.0d0) * t)) / (a * 2.0d0)
end function
public static double code(double x, double y, double z, double t, double a) {
return ((x * y) - ((z * 9.0) * t)) / (a * 2.0);
}
def code(x, y, z, t, a): return ((x * y) - ((z * 9.0) * t)) / (a * 2.0)
function code(x, y, z, t, a) return Float64(Float64(Float64(x * y) - Float64(Float64(z * 9.0) * t)) / Float64(a * 2.0)) end
function tmp = code(x, y, z, t, a) tmp = ((x * y) - ((z * 9.0) * t)) / (a * 2.0); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] - N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]
\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}
(FPCore (x y z t a)
:precision binary64
(if (<= (fmax x y) 7.2e-142)
(fma
(/ (fmax x y) (+ a a))
(fmin x y)
(* (/ (- (fmin z t)) a) (* (fmax z t) 4.5)))
(if (<= (fmax x y) 6e+231)
(/ (fma (* (fmax z t) (fmin z t)) -9.0 (* (fmax x y) (fmin x y))) (+ a a))
(fma
(- (fmax z t))
(* 4.5 (/ (fmin z t) a))
(* (/ (fmin x y) (+ a a)) (fmax x y))))))double code(double x, double y, double z, double t, double a) {
double tmp;
if (fmax(x, y) <= 7.2e-142) {
tmp = fma((fmax(x, y) / (a + a)), fmin(x, y), ((-fmin(z, t) / a) * (fmax(z, t) * 4.5)));
} else if (fmax(x, y) <= 6e+231) {
tmp = fma((fmax(z, t) * fmin(z, t)), -9.0, (fmax(x, y) * fmin(x, y))) / (a + a);
} else {
tmp = fma(-fmax(z, t), (4.5 * (fmin(z, t) / a)), ((fmin(x, y) / (a + a)) * fmax(x, y)));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (fmax(x, y) <= 7.2e-142) tmp = fma(Float64(fmax(x, y) / Float64(a + a)), fmin(x, y), Float64(Float64(Float64(-fmin(z, t)) / a) * Float64(fmax(z, t) * 4.5))); elseif (fmax(x, y) <= 6e+231) tmp = Float64(fma(Float64(fmax(z, t) * fmin(z, t)), -9.0, Float64(fmax(x, y) * fmin(x, y))) / Float64(a + a)); else tmp = fma(Float64(-fmax(z, t)), Float64(4.5 * Float64(fmin(z, t) / a)), Float64(Float64(fmin(x, y) / Float64(a + a)) * fmax(x, y))); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[Max[x, y], $MachinePrecision], 7.2e-142], N[(N[(N[Max[x, y], $MachinePrecision] / N[(a + a), $MachinePrecision]), $MachinePrecision] * N[Min[x, y], $MachinePrecision] + N[(N[((-N[Min[z, t], $MachinePrecision]) / a), $MachinePrecision] * N[(N[Max[z, t], $MachinePrecision] * 4.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Max[x, y], $MachinePrecision], 6e+231], N[(N[(N[(N[Max[z, t], $MachinePrecision] * N[Min[z, t], $MachinePrecision]), $MachinePrecision] * -9.0 + N[(N[Max[x, y], $MachinePrecision] * N[Min[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a + a), $MachinePrecision]), $MachinePrecision], N[((-N[Max[z, t], $MachinePrecision]) * N[(4.5 * N[(N[Min[z, t], $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Min[x, y], $MachinePrecision] / N[(a + a), $MachinePrecision]), $MachinePrecision] * N[Max[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;\mathsf{max}\left(x, y\right) \leq 7.2 \cdot 10^{-142}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\mathsf{max}\left(x, y\right)}{a + a}, \mathsf{min}\left(x, y\right), \frac{-\mathsf{min}\left(z, t\right)}{a} \cdot \left(\mathsf{max}\left(z, t\right) \cdot 4.5\right)\right)\\
\mathbf{elif}\;\mathsf{max}\left(x, y\right) \leq 6 \cdot 10^{+231}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{max}\left(z, t\right) \cdot \mathsf{min}\left(z, t\right), -9, \mathsf{max}\left(x, y\right) \cdot \mathsf{min}\left(x, y\right)\right)}{a + a}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-\mathsf{max}\left(z, t\right), 4.5 \cdot \frac{\mathsf{min}\left(z, t\right)}{a}, \frac{\mathsf{min}\left(x, y\right)}{a + a} \cdot \mathsf{max}\left(x, y\right)\right)\\
\end{array}
if y < 7.20000000000000001e-142Initial program 90.5%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
sub-flipN/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f64N/A
distribute-neg-fracN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-lft-neg-inN/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
Applied rewrites87.9%
if 7.20000000000000001e-142 < y < 6.0000000000000003e231Initial program 90.5%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-*.f64N/A
metadata-eval90.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.6%
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6490.6%
Applied rewrites90.6%
if 6.0000000000000003e231 < y Initial program 90.5%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
sub-flipN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites88.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (fmin z t) a)))
(if (<= (fmax x y) 2.4e-138)
(fma (/ (fmax x y) (+ a a)) (fmin x y) (* (* t_1 -4.5) (fmax z t)))
(if (<= (fmax x y) 6e+231)
(/
(fma (* (fmax z t) (fmin z t)) -9.0 (* (fmax x y) (fmin x y)))
(+ a a))
(fma
(- (fmax z t))
(* 4.5 t_1)
(* (/ (fmin x y) (+ a a)) (fmax x y)))))))double code(double x, double y, double z, double t, double a) {
double t_1 = fmin(z, t) / a;
double tmp;
if (fmax(x, y) <= 2.4e-138) {
tmp = fma((fmax(x, y) / (a + a)), fmin(x, y), ((t_1 * -4.5) * fmax(z, t)));
} else if (fmax(x, y) <= 6e+231) {
tmp = fma((fmax(z, t) * fmin(z, t)), -9.0, (fmax(x, y) * fmin(x, y))) / (a + a);
} else {
tmp = fma(-fmax(z, t), (4.5 * t_1), ((fmin(x, y) / (a + a)) * fmax(x, y)));
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(fmin(z, t) / a) tmp = 0.0 if (fmax(x, y) <= 2.4e-138) tmp = fma(Float64(fmax(x, y) / Float64(a + a)), fmin(x, y), Float64(Float64(t_1 * -4.5) * fmax(z, t))); elseif (fmax(x, y) <= 6e+231) tmp = Float64(fma(Float64(fmax(z, t) * fmin(z, t)), -9.0, Float64(fmax(x, y) * fmin(x, y))) / Float64(a + a)); else tmp = fma(Float64(-fmax(z, t)), Float64(4.5 * t_1), Float64(Float64(fmin(x, y) / Float64(a + a)) * fmax(x, y))); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Min[z, t], $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[N[Max[x, y], $MachinePrecision], 2.4e-138], N[(N[(N[Max[x, y], $MachinePrecision] / N[(a + a), $MachinePrecision]), $MachinePrecision] * N[Min[x, y], $MachinePrecision] + N[(N[(t$95$1 * -4.5), $MachinePrecision] * N[Max[z, t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Max[x, y], $MachinePrecision], 6e+231], N[(N[(N[(N[Max[z, t], $MachinePrecision] * N[Min[z, t], $MachinePrecision]), $MachinePrecision] * -9.0 + N[(N[Max[x, y], $MachinePrecision] * N[Min[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a + a), $MachinePrecision]), $MachinePrecision], N[((-N[Max[z, t], $MachinePrecision]) * N[(4.5 * t$95$1), $MachinePrecision] + N[(N[(N[Min[x, y], $MachinePrecision] / N[(a + a), $MachinePrecision]), $MachinePrecision] * N[Max[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \frac{\mathsf{min}\left(z, t\right)}{a}\\
\mathbf{if}\;\mathsf{max}\left(x, y\right) \leq 2.4 \cdot 10^{-138}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\mathsf{max}\left(x, y\right)}{a + a}, \mathsf{min}\left(x, y\right), \left(t\_1 \cdot -4.5\right) \cdot \mathsf{max}\left(z, t\right)\right)\\
\mathbf{elif}\;\mathsf{max}\left(x, y\right) \leq 6 \cdot 10^{+231}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{max}\left(z, t\right) \cdot \mathsf{min}\left(z, t\right), -9, \mathsf{max}\left(x, y\right) \cdot \mathsf{min}\left(x, y\right)\right)}{a + a}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-\mathsf{max}\left(z, t\right), 4.5 \cdot t\_1, \frac{\mathsf{min}\left(x, y\right)}{a + a} \cdot \mathsf{max}\left(x, y\right)\right)\\
\end{array}
if y < 2.3999999999999999e-138Initial program 90.5%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
sub-flipN/A
+-commutativeN/A
distribute-neg-fracN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lift-*.f64N/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites88.2%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6488.0%
Applied rewrites88.0%
Applied rewrites87.9%
if 2.3999999999999999e-138 < y < 6.0000000000000003e231Initial program 90.5%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-*.f64N/A
metadata-eval90.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.6%
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6490.6%
Applied rewrites90.6%
if 6.0000000000000003e231 < y Initial program 90.5%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
sub-flipN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites88.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (fmin z t) a)))
(if (<= (fmax x y) 2.4e-138)
(fma (/ (fmax x y) (+ a a)) (fmin x y) (* (* t_1 -4.5) (fmax z t)))
(if (<= (fmax x y) 6e+231)
(/
(fma (* (fmax z t) (fmin z t)) -9.0 (* (fmax x y) (fmin x y)))
(+ a a))
(fma (* -4.5 (fmax z t)) t_1 (* (fmax x y) (/ (fmin x y) (+ a a))))))))double code(double x, double y, double z, double t, double a) {
double t_1 = fmin(z, t) / a;
double tmp;
if (fmax(x, y) <= 2.4e-138) {
tmp = fma((fmax(x, y) / (a + a)), fmin(x, y), ((t_1 * -4.5) * fmax(z, t)));
} else if (fmax(x, y) <= 6e+231) {
tmp = fma((fmax(z, t) * fmin(z, t)), -9.0, (fmax(x, y) * fmin(x, y))) / (a + a);
} else {
tmp = fma((-4.5 * fmax(z, t)), t_1, (fmax(x, y) * (fmin(x, y) / (a + a))));
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(fmin(z, t) / a) tmp = 0.0 if (fmax(x, y) <= 2.4e-138) tmp = fma(Float64(fmax(x, y) / Float64(a + a)), fmin(x, y), Float64(Float64(t_1 * -4.5) * fmax(z, t))); elseif (fmax(x, y) <= 6e+231) tmp = Float64(fma(Float64(fmax(z, t) * fmin(z, t)), -9.0, Float64(fmax(x, y) * fmin(x, y))) / Float64(a + a)); else tmp = fma(Float64(-4.5 * fmax(z, t)), t_1, Float64(fmax(x, y) * Float64(fmin(x, y) / Float64(a + a)))); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Min[z, t], $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[N[Max[x, y], $MachinePrecision], 2.4e-138], N[(N[(N[Max[x, y], $MachinePrecision] / N[(a + a), $MachinePrecision]), $MachinePrecision] * N[Min[x, y], $MachinePrecision] + N[(N[(t$95$1 * -4.5), $MachinePrecision] * N[Max[z, t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Max[x, y], $MachinePrecision], 6e+231], N[(N[(N[(N[Max[z, t], $MachinePrecision] * N[Min[z, t], $MachinePrecision]), $MachinePrecision] * -9.0 + N[(N[Max[x, y], $MachinePrecision] * N[Min[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a + a), $MachinePrecision]), $MachinePrecision], N[(N[(-4.5 * N[Max[z, t], $MachinePrecision]), $MachinePrecision] * t$95$1 + N[(N[Max[x, y], $MachinePrecision] * N[(N[Min[x, y], $MachinePrecision] / N[(a + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \frac{\mathsf{min}\left(z, t\right)}{a}\\
\mathbf{if}\;\mathsf{max}\left(x, y\right) \leq 2.4 \cdot 10^{-138}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\mathsf{max}\left(x, y\right)}{a + a}, \mathsf{min}\left(x, y\right), \left(t\_1 \cdot -4.5\right) \cdot \mathsf{max}\left(z, t\right)\right)\\
\mathbf{elif}\;\mathsf{max}\left(x, y\right) \leq 6 \cdot 10^{+231}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{max}\left(z, t\right) \cdot \mathsf{min}\left(z, t\right), -9, \mathsf{max}\left(x, y\right) \cdot \mathsf{min}\left(x, y\right)\right)}{a + a}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-4.5 \cdot \mathsf{max}\left(z, t\right), t\_1, \mathsf{max}\left(x, y\right) \cdot \frac{\mathsf{min}\left(x, y\right)}{a + a}\right)\\
\end{array}
if y < 2.3999999999999999e-138Initial program 90.5%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
sub-flipN/A
+-commutativeN/A
distribute-neg-fracN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lift-*.f64N/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites88.2%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6488.0%
Applied rewrites88.0%
Applied rewrites87.9%
if 2.3999999999999999e-138 < y < 6.0000000000000003e231Initial program 90.5%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-*.f64N/A
metadata-eval90.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.6%
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6490.6%
Applied rewrites90.6%
if 6.0000000000000003e231 < y Initial program 90.5%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
sub-flipN/A
+-commutativeN/A
distribute-neg-fracN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lift-*.f64N/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites88.2%
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
Applied rewrites88.3%
(FPCore (x y z t a)
:precision binary64
(if (<= (fmax x y) 3e-118)
(fma
(/ (fmax x y) (+ a a))
(fmin x y)
(* (* (/ (fmin z t) a) -4.5) (fmax z t)))
(fma
(/ (- (fmax z t)) a)
(* (fmin z t) 4.5)
(* (/ (fmin x y) (+ a a)) (fmax x y)))))double code(double x, double y, double z, double t, double a) {
double tmp;
if (fmax(x, y) <= 3e-118) {
tmp = fma((fmax(x, y) / (a + a)), fmin(x, y), (((fmin(z, t) / a) * -4.5) * fmax(z, t)));
} else {
tmp = fma((-fmax(z, t) / a), (fmin(z, t) * 4.5), ((fmin(x, y) / (a + a)) * fmax(x, y)));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (fmax(x, y) <= 3e-118) tmp = fma(Float64(fmax(x, y) / Float64(a + a)), fmin(x, y), Float64(Float64(Float64(fmin(z, t) / a) * -4.5) * fmax(z, t))); else tmp = fma(Float64(Float64(-fmax(z, t)) / a), Float64(fmin(z, t) * 4.5), Float64(Float64(fmin(x, y) / Float64(a + a)) * fmax(x, y))); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[Max[x, y], $MachinePrecision], 3e-118], N[(N[(N[Max[x, y], $MachinePrecision] / N[(a + a), $MachinePrecision]), $MachinePrecision] * N[Min[x, y], $MachinePrecision] + N[(N[(N[(N[Min[z, t], $MachinePrecision] / a), $MachinePrecision] * -4.5), $MachinePrecision] * N[Max[z, t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[((-N[Max[z, t], $MachinePrecision]) / a), $MachinePrecision] * N[(N[Min[z, t], $MachinePrecision] * 4.5), $MachinePrecision] + N[(N[(N[Min[x, y], $MachinePrecision] / N[(a + a), $MachinePrecision]), $MachinePrecision] * N[Max[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\mathsf{max}\left(x, y\right) \leq 3 \cdot 10^{-118}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\mathsf{max}\left(x, y\right)}{a + a}, \mathsf{min}\left(x, y\right), \left(\frac{\mathsf{min}\left(z, t\right)}{a} \cdot -4.5\right) \cdot \mathsf{max}\left(z, t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-\mathsf{max}\left(z, t\right)}{a}, \mathsf{min}\left(z, t\right) \cdot 4.5, \frac{\mathsf{min}\left(x, y\right)}{a + a} \cdot \mathsf{max}\left(x, y\right)\right)\\
\end{array}
if y < 3.00000000000000018e-118Initial program 90.5%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
sub-flipN/A
+-commutativeN/A
distribute-neg-fracN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lift-*.f64N/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites88.2%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6488.0%
Applied rewrites88.0%
Applied rewrites87.9%
if 3.00000000000000018e-118 < y Initial program 90.5%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
sub-flipN/A
+-commutativeN/A
distribute-neg-fracN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lift-*.f64N/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites88.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (fmin x y) (fmax x y))))
(if (<= t_1 -4e+292)
(* (/ (fmin x y) (+ a a)) (fmax x y))
(if (<= t_1 1e+238)
(/ (fma (* -9.0 z) t (* (fmax x y) (fmin x y))) (* a 2.0))
(* (/ (fmax x y) (+ a a)) (fmin x y))))))double code(double x, double y, double z, double t, double a) {
double t_1 = fmin(x, y) * fmax(x, y);
double tmp;
if (t_1 <= -4e+292) {
tmp = (fmin(x, y) / (a + a)) * fmax(x, y);
} else if (t_1 <= 1e+238) {
tmp = fma((-9.0 * z), t, (fmax(x, y) * fmin(x, y))) / (a * 2.0);
} else {
tmp = (fmax(x, y) / (a + a)) * fmin(x, y);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(fmin(x, y) * fmax(x, y)) tmp = 0.0 if (t_1 <= -4e+292) tmp = Float64(Float64(fmin(x, y) / Float64(a + a)) * fmax(x, y)); elseif (t_1 <= 1e+238) tmp = Float64(fma(Float64(-9.0 * z), t, Float64(fmax(x, y) * fmin(x, y))) / Float64(a * 2.0)); else tmp = Float64(Float64(fmax(x, y) / Float64(a + a)) * fmin(x, y)); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Min[x, y], $MachinePrecision] * N[Max[x, y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+292], N[(N[(N[Min[x, y], $MachinePrecision] / N[(a + a), $MachinePrecision]), $MachinePrecision] * N[Max[x, y], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+238], N[(N[(N[(-9.0 * z), $MachinePrecision] * t + N[(N[Max[x, y], $MachinePrecision] * N[Min[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[Max[x, y], $MachinePrecision] / N[(a + a), $MachinePrecision]), $MachinePrecision] * N[Min[x, y], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \mathsf{min}\left(x, y\right) \cdot \mathsf{max}\left(x, y\right)\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{+292}:\\
\;\;\;\;\frac{\mathsf{min}\left(x, y\right)}{a + a} \cdot \mathsf{max}\left(x, y\right)\\
\mathbf{elif}\;t\_1 \leq 10^{+238}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-9 \cdot z, t, \mathsf{max}\left(x, y\right) \cdot \mathsf{min}\left(x, y\right)\right)}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{max}\left(x, y\right)}{a + a} \cdot \mathsf{min}\left(x, y\right)\\
\end{array}
if (*.f64 x y) < -4.0000000000000001e292Initial program 90.5%
Taylor expanded in x around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6449.7%
Applied rewrites49.7%
lift-*.f64N/A
*-commutativeN/A
metadata-evalN/A
mult-flip-revN/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
*-commutativeN/A
count-2N/A
lift-+.f64N/A
associate-*l/N/A
lift-/.f64N/A
lower-*.f6450.9%
Applied rewrites50.9%
if -4.0000000000000001e292 < (*.f64 x y) < 1e238Initial program 90.5%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-outN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval90.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.8%
Applied rewrites90.8%
if 1e238 < (*.f64 x y) Initial program 90.5%
Taylor expanded in x around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6449.7%
Applied rewrites49.7%
lift-*.f64N/A
*-commutativeN/A
metadata-evalN/A
mult-flip-revN/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
count-2N/A
lift-+.f64N/A
associate-*l/N/A
lift-/.f64N/A
lower-*.f6450.4%
Applied rewrites50.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (fmin x y) (fmax x y))))
(if (<= t_1 -4e+292)
(* (/ (fmin x y) (+ a a)) (fmax x y))
(if (<= t_1 1e+238)
(/ (- t_1 (* (* z 9.0) t)) (* a 2.0))
(* (/ (fmax x y) (+ a a)) (fmin x y))))))double code(double x, double y, double z, double t, double a) {
double t_1 = fmin(x, y) * fmax(x, y);
double tmp;
if (t_1 <= -4e+292) {
tmp = (fmin(x, y) / (a + a)) * fmax(x, y);
} else if (t_1 <= 1e+238) {
tmp = (t_1 - ((z * 9.0) * t)) / (a * 2.0);
} else {
tmp = (fmax(x, y) / (a + a)) * fmin(x, y);
}
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)
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) :: t_1
real(8) :: tmp
t_1 = fmin(x, y) * fmax(x, y)
if (t_1 <= (-4d+292)) then
tmp = (fmin(x, y) / (a + a)) * fmax(x, y)
else if (t_1 <= 1d+238) then
tmp = (t_1 - ((z * 9.0d0) * t)) / (a * 2.0d0)
else
tmp = (fmax(x, y) / (a + a)) * fmin(x, y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = fmin(x, y) * fmax(x, y);
double tmp;
if (t_1 <= -4e+292) {
tmp = (fmin(x, y) / (a + a)) * fmax(x, y);
} else if (t_1 <= 1e+238) {
tmp = (t_1 - ((z * 9.0) * t)) / (a * 2.0);
} else {
tmp = (fmax(x, y) / (a + a)) * fmin(x, y);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = fmin(x, y) * fmax(x, y) tmp = 0 if t_1 <= -4e+292: tmp = (fmin(x, y) / (a + a)) * fmax(x, y) elif t_1 <= 1e+238: tmp = (t_1 - ((z * 9.0) * t)) / (a * 2.0) else: tmp = (fmax(x, y) / (a + a)) * fmin(x, y) return tmp
function code(x, y, z, t, a) t_1 = Float64(fmin(x, y) * fmax(x, y)) tmp = 0.0 if (t_1 <= -4e+292) tmp = Float64(Float64(fmin(x, y) / Float64(a + a)) * fmax(x, y)); elseif (t_1 <= 1e+238) tmp = Float64(Float64(t_1 - Float64(Float64(z * 9.0) * t)) / Float64(a * 2.0)); else tmp = Float64(Float64(fmax(x, y) / Float64(a + a)) * fmin(x, y)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = min(x, y) * max(x, y); tmp = 0.0; if (t_1 <= -4e+292) tmp = (min(x, y) / (a + a)) * max(x, y); elseif (t_1 <= 1e+238) tmp = (t_1 - ((z * 9.0) * t)) / (a * 2.0); else tmp = (max(x, y) / (a + a)) * min(x, y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Min[x, y], $MachinePrecision] * N[Max[x, y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+292], N[(N[(N[Min[x, y], $MachinePrecision] / N[(a + a), $MachinePrecision]), $MachinePrecision] * N[Max[x, y], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+238], N[(N[(t$95$1 - N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[Max[x, y], $MachinePrecision] / N[(a + a), $MachinePrecision]), $MachinePrecision] * N[Min[x, y], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \mathsf{min}\left(x, y\right) \cdot \mathsf{max}\left(x, y\right)\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{+292}:\\
\;\;\;\;\frac{\mathsf{min}\left(x, y\right)}{a + a} \cdot \mathsf{max}\left(x, y\right)\\
\mathbf{elif}\;t\_1 \leq 10^{+238}:\\
\;\;\;\;\frac{t\_1 - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{max}\left(x, y\right)}{a + a} \cdot \mathsf{min}\left(x, y\right)\\
\end{array}
if (*.f64 x y) < -4.0000000000000001e292Initial program 90.5%
Taylor expanded in x around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6449.7%
Applied rewrites49.7%
lift-*.f64N/A
*-commutativeN/A
metadata-evalN/A
mult-flip-revN/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
*-commutativeN/A
count-2N/A
lift-+.f64N/A
associate-*l/N/A
lift-/.f64N/A
lower-*.f6450.9%
Applied rewrites50.9%
if -4.0000000000000001e292 < (*.f64 x y) < 1e238Initial program 90.5%
if 1e238 < (*.f64 x y) Initial program 90.5%
Taylor expanded in x around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6449.7%
Applied rewrites49.7%
lift-*.f64N/A
*-commutativeN/A
metadata-evalN/A
mult-flip-revN/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
count-2N/A
lift-+.f64N/A
associate-*l/N/A
lift-/.f64N/A
lower-*.f6450.4%
Applied rewrites50.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (fmin x y) (fmax x y))))
(if (<= t_1 -4e+292)
(* (/ (fmin x y) (+ a a)) (fmax x y))
(if (<= t_1 1e+238)
(/ (fma (* t z) -9.0 (* (fmax x y) (fmin x y))) (+ a a))
(* (/ (fmax x y) (+ a a)) (fmin x y))))))double code(double x, double y, double z, double t, double a) {
double t_1 = fmin(x, y) * fmax(x, y);
double tmp;
if (t_1 <= -4e+292) {
tmp = (fmin(x, y) / (a + a)) * fmax(x, y);
} else if (t_1 <= 1e+238) {
tmp = fma((t * z), -9.0, (fmax(x, y) * fmin(x, y))) / (a + a);
} else {
tmp = (fmax(x, y) / (a + a)) * fmin(x, y);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(fmin(x, y) * fmax(x, y)) tmp = 0.0 if (t_1 <= -4e+292) tmp = Float64(Float64(fmin(x, y) / Float64(a + a)) * fmax(x, y)); elseif (t_1 <= 1e+238) tmp = Float64(fma(Float64(t * z), -9.0, Float64(fmax(x, y) * fmin(x, y))) / Float64(a + a)); else tmp = Float64(Float64(fmax(x, y) / Float64(a + a)) * fmin(x, y)); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Min[x, y], $MachinePrecision] * N[Max[x, y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+292], N[(N[(N[Min[x, y], $MachinePrecision] / N[(a + a), $MachinePrecision]), $MachinePrecision] * N[Max[x, y], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+238], N[(N[(N[(t * z), $MachinePrecision] * -9.0 + N[(N[Max[x, y], $MachinePrecision] * N[Min[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a + a), $MachinePrecision]), $MachinePrecision], N[(N[(N[Max[x, y], $MachinePrecision] / N[(a + a), $MachinePrecision]), $MachinePrecision] * N[Min[x, y], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \mathsf{min}\left(x, y\right) \cdot \mathsf{max}\left(x, y\right)\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{+292}:\\
\;\;\;\;\frac{\mathsf{min}\left(x, y\right)}{a + a} \cdot \mathsf{max}\left(x, y\right)\\
\mathbf{elif}\;t\_1 \leq 10^{+238}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t \cdot z, -9, \mathsf{max}\left(x, y\right) \cdot \mathsf{min}\left(x, y\right)\right)}{a + a}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{max}\left(x, y\right)}{a + a} \cdot \mathsf{min}\left(x, y\right)\\
\end{array}
if (*.f64 x y) < -4.0000000000000001e292Initial program 90.5%
Taylor expanded in x around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6449.7%
Applied rewrites49.7%
lift-*.f64N/A
*-commutativeN/A
metadata-evalN/A
mult-flip-revN/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
*-commutativeN/A
count-2N/A
lift-+.f64N/A
associate-*l/N/A
lift-/.f64N/A
lower-*.f6450.9%
Applied rewrites50.9%
if -4.0000000000000001e292 < (*.f64 x y) < 1e238Initial program 90.5%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-*.f64N/A
metadata-eval90.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.6%
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6490.6%
Applied rewrites90.6%
if 1e238 < (*.f64 x y) Initial program 90.5%
Taylor expanded in x around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6449.7%
Applied rewrites49.7%
lift-*.f64N/A
*-commutativeN/A
metadata-evalN/A
mult-flip-revN/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
count-2N/A
lift-+.f64N/A
associate-*l/N/A
lift-/.f64N/A
lower-*.f6450.4%
Applied rewrites50.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (fabs a) (fabs a))))
(*
(copysign 1.0 a)
(if (<= (fabs a) 5e-35)
(/ (fma (* (fmax z t) (fmin z t)) -9.0 (* (fmax x y) (fmin x y))) t_1)
(fma
(* -4.5 (fmax z t))
(/ (fmin z t) (fabs a))
(* (fmax x y) (/ (fmin x y) t_1)))))))double code(double x, double y, double z, double t, double a) {
double t_1 = fabs(a) + fabs(a);
double tmp;
if (fabs(a) <= 5e-35) {
tmp = fma((fmax(z, t) * fmin(z, t)), -9.0, (fmax(x, y) * fmin(x, y))) / t_1;
} else {
tmp = fma((-4.5 * fmax(z, t)), (fmin(z, t) / fabs(a)), (fmax(x, y) * (fmin(x, y) / t_1)));
}
return copysign(1.0, a) * tmp;
}
function code(x, y, z, t, a) t_1 = Float64(abs(a) + abs(a)) tmp = 0.0 if (abs(a) <= 5e-35) tmp = Float64(fma(Float64(fmax(z, t) * fmin(z, t)), -9.0, Float64(fmax(x, y) * fmin(x, y))) / t_1); else tmp = fma(Float64(-4.5 * fmax(z, t)), Float64(fmin(z, t) / abs(a)), Float64(fmax(x, y) * Float64(fmin(x, y) / t_1))); end return Float64(copysign(1.0, a) * tmp) end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Abs[a], $MachinePrecision] + N[Abs[a], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[a], $MachinePrecision], 5e-35], N[(N[(N[(N[Max[z, t], $MachinePrecision] * N[Min[z, t], $MachinePrecision]), $MachinePrecision] * -9.0 + N[(N[Max[x, y], $MachinePrecision] * N[Min[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[(-4.5 * N[Max[z, t], $MachinePrecision]), $MachinePrecision] * N[(N[Min[z, t], $MachinePrecision] / N[Abs[a], $MachinePrecision]), $MachinePrecision] + N[(N[Max[x, y], $MachinePrecision] * N[(N[Min[x, y], $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
t_1 := \left|a\right| + \left|a\right|\\
\mathsf{copysign}\left(1, a\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|a\right| \leq 5 \cdot 10^{-35}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{max}\left(z, t\right) \cdot \mathsf{min}\left(z, t\right), -9, \mathsf{max}\left(x, y\right) \cdot \mathsf{min}\left(x, y\right)\right)}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-4.5 \cdot \mathsf{max}\left(z, t\right), \frac{\mathsf{min}\left(z, t\right)}{\left|a\right|}, \mathsf{max}\left(x, y\right) \cdot \frac{\mathsf{min}\left(x, y\right)}{t\_1}\right)\\
\end{array}
\end{array}
if a < 4.99999999999999964e-35Initial program 90.5%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-*.f64N/A
metadata-eval90.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.6%
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6490.6%
Applied rewrites90.6%
if 4.99999999999999964e-35 < a Initial program 90.5%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
sub-flipN/A
+-commutativeN/A
distribute-neg-fracN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lift-*.f64N/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites88.2%
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
Applied rewrites88.3%
(FPCore (x y z t a)
:precision binary64
(*
(copysign 1.0 a)
(if (<= (fabs a) 1e+113)
(/ (fma (* -9.0 z) t (* (fmax x y) (fmin x y))) (* (fabs a) 2.0))
(fma
(fmin x y)
(/ (fmax x y) (+ (fabs a) (fabs a)))
(* (/ (* z t) (fabs a)) -4.5)))))double code(double x, double y, double z, double t, double a) {
double tmp;
if (fabs(a) <= 1e+113) {
tmp = fma((-9.0 * z), t, (fmax(x, y) * fmin(x, y))) / (fabs(a) * 2.0);
} else {
tmp = fma(fmin(x, y), (fmax(x, y) / (fabs(a) + fabs(a))), (((z * t) / fabs(a)) * -4.5));
}
return copysign(1.0, a) * tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (abs(a) <= 1e+113) tmp = Float64(fma(Float64(-9.0 * z), t, Float64(fmax(x, y) * fmin(x, y))) / Float64(abs(a) * 2.0)); else tmp = fma(fmin(x, y), Float64(fmax(x, y) / Float64(abs(a) + abs(a))), Float64(Float64(Float64(z * t) / abs(a)) * -4.5)); end return Float64(copysign(1.0, a) * tmp) end
code[x_, y_, z_, t_, a_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[a], $MachinePrecision], 1e+113], N[(N[(N[(-9.0 * z), $MachinePrecision] * t + N[(N[Max[x, y], $MachinePrecision] * N[Min[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Abs[a], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[Min[x, y], $MachinePrecision] * N[(N[Max[x, y], $MachinePrecision] / N[(N[Abs[a], $MachinePrecision] + N[Abs[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(z * t), $MachinePrecision] / N[Abs[a], $MachinePrecision]), $MachinePrecision] * -4.5), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, a\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|a\right| \leq 10^{+113}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-9 \cdot z, t, \mathsf{max}\left(x, y\right) \cdot \mathsf{min}\left(x, y\right)\right)}{\left|a\right| \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{min}\left(x, y\right), \frac{\mathsf{max}\left(x, y\right)}{\left|a\right| + \left|a\right|}, \frac{z \cdot t}{\left|a\right|} \cdot -4.5\right)\\
\end{array}
if a < 1e113Initial program 90.5%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-outN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval90.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.8%
Applied rewrites90.8%
if 1e113 < a Initial program 90.5%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
sub-flipN/A
+-commutativeN/A
distribute-neg-fracN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lift-*.f64N/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites88.2%
lift-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-/.f64N/A
lift-neg.f64N/A
distribute-frac-negN/A
distribute-neg-frac2N/A
associate-*l/N/A
lift-*.f64N/A
metadata-evalN/A
times-fracN/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
*-commutativeN/A
Applied rewrites87.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (fmin x y) (fmax x y))))
(if (<= t_1 -5e+30)
(* (/ (fmin x y) (+ a a)) (fmax x y))
(if (<= t_1 1e+57)
(/ (* -9.0 (* t z)) (* a 2.0))
(* (/ (fmax x y) (+ a a)) (fmin x y))))))double code(double x, double y, double z, double t, double a) {
double t_1 = fmin(x, y) * fmax(x, y);
double tmp;
if (t_1 <= -5e+30) {
tmp = (fmin(x, y) / (a + a)) * fmax(x, y);
} else if (t_1 <= 1e+57) {
tmp = (-9.0 * (t * z)) / (a * 2.0);
} else {
tmp = (fmax(x, y) / (a + a)) * fmin(x, y);
}
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)
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) :: t_1
real(8) :: tmp
t_1 = fmin(x, y) * fmax(x, y)
if (t_1 <= (-5d+30)) then
tmp = (fmin(x, y) / (a + a)) * fmax(x, y)
else if (t_1 <= 1d+57) then
tmp = ((-9.0d0) * (t * z)) / (a * 2.0d0)
else
tmp = (fmax(x, y) / (a + a)) * fmin(x, y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = fmin(x, y) * fmax(x, y);
double tmp;
if (t_1 <= -5e+30) {
tmp = (fmin(x, y) / (a + a)) * fmax(x, y);
} else if (t_1 <= 1e+57) {
tmp = (-9.0 * (t * z)) / (a * 2.0);
} else {
tmp = (fmax(x, y) / (a + a)) * fmin(x, y);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = fmin(x, y) * fmax(x, y) tmp = 0 if t_1 <= -5e+30: tmp = (fmin(x, y) / (a + a)) * fmax(x, y) elif t_1 <= 1e+57: tmp = (-9.0 * (t * z)) / (a * 2.0) else: tmp = (fmax(x, y) / (a + a)) * fmin(x, y) return tmp
function code(x, y, z, t, a) t_1 = Float64(fmin(x, y) * fmax(x, y)) tmp = 0.0 if (t_1 <= -5e+30) tmp = Float64(Float64(fmin(x, y) / Float64(a + a)) * fmax(x, y)); elseif (t_1 <= 1e+57) tmp = Float64(Float64(-9.0 * Float64(t * z)) / Float64(a * 2.0)); else tmp = Float64(Float64(fmax(x, y) / Float64(a + a)) * fmin(x, y)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = min(x, y) * max(x, y); tmp = 0.0; if (t_1 <= -5e+30) tmp = (min(x, y) / (a + a)) * max(x, y); elseif (t_1 <= 1e+57) tmp = (-9.0 * (t * z)) / (a * 2.0); else tmp = (max(x, y) / (a + a)) * min(x, y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Min[x, y], $MachinePrecision] * N[Max[x, y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+30], N[(N[(N[Min[x, y], $MachinePrecision] / N[(a + a), $MachinePrecision]), $MachinePrecision] * N[Max[x, y], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+57], N[(N[(-9.0 * N[(t * z), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[Max[x, y], $MachinePrecision] / N[(a + a), $MachinePrecision]), $MachinePrecision] * N[Min[x, y], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \mathsf{min}\left(x, y\right) \cdot \mathsf{max}\left(x, y\right)\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+30}:\\
\;\;\;\;\frac{\mathsf{min}\left(x, y\right)}{a + a} \cdot \mathsf{max}\left(x, y\right)\\
\mathbf{elif}\;t\_1 \leq 10^{+57}:\\
\;\;\;\;\frac{-9 \cdot \left(t \cdot z\right)}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{max}\left(x, y\right)}{a + a} \cdot \mathsf{min}\left(x, y\right)\\
\end{array}
if (*.f64 x y) < -4.9999999999999998e30Initial program 90.5%
Taylor expanded in x around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6449.7%
Applied rewrites49.7%
lift-*.f64N/A
*-commutativeN/A
metadata-evalN/A
mult-flip-revN/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
*-commutativeN/A
count-2N/A
lift-+.f64N/A
associate-*l/N/A
lift-/.f64N/A
lower-*.f6450.9%
Applied rewrites50.9%
if -4.9999999999999998e30 < (*.f64 x y) < 1.00000000000000005e57Initial program 90.5%
Taylor expanded in x around 0
lower-*.f64N/A
lower-*.f6450.8%
Applied rewrites50.8%
if 1.00000000000000005e57 < (*.f64 x y) Initial program 90.5%
Taylor expanded in x around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6449.7%
Applied rewrites49.7%
lift-*.f64N/A
*-commutativeN/A
metadata-evalN/A
mult-flip-revN/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
count-2N/A
lift-+.f64N/A
associate-*l/N/A
lift-/.f64N/A
lower-*.f6450.4%
Applied rewrites50.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (fmin x y) (fmax x y))))
(if (<= t_1 -5e+30)
(* (/ (fmin x y) (+ a a)) (fmax x y))
(if (<= t_1 1e+57)
(/ (* (* z t) -4.5) a)
(* (/ (fmax x y) (+ a a)) (fmin x y))))))double code(double x, double y, double z, double t, double a) {
double t_1 = fmin(x, y) * fmax(x, y);
double tmp;
if (t_1 <= -5e+30) {
tmp = (fmin(x, y) / (a + a)) * fmax(x, y);
} else if (t_1 <= 1e+57) {
tmp = ((z * t) * -4.5) / a;
} else {
tmp = (fmax(x, y) / (a + a)) * fmin(x, y);
}
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)
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) :: t_1
real(8) :: tmp
t_1 = fmin(x, y) * fmax(x, y)
if (t_1 <= (-5d+30)) then
tmp = (fmin(x, y) / (a + a)) * fmax(x, y)
else if (t_1 <= 1d+57) then
tmp = ((z * t) * (-4.5d0)) / a
else
tmp = (fmax(x, y) / (a + a)) * fmin(x, y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = fmin(x, y) * fmax(x, y);
double tmp;
if (t_1 <= -5e+30) {
tmp = (fmin(x, y) / (a + a)) * fmax(x, y);
} else if (t_1 <= 1e+57) {
tmp = ((z * t) * -4.5) / a;
} else {
tmp = (fmax(x, y) / (a + a)) * fmin(x, y);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = fmin(x, y) * fmax(x, y) tmp = 0 if t_1 <= -5e+30: tmp = (fmin(x, y) / (a + a)) * fmax(x, y) elif t_1 <= 1e+57: tmp = ((z * t) * -4.5) / a else: tmp = (fmax(x, y) / (a + a)) * fmin(x, y) return tmp
function code(x, y, z, t, a) t_1 = Float64(fmin(x, y) * fmax(x, y)) tmp = 0.0 if (t_1 <= -5e+30) tmp = Float64(Float64(fmin(x, y) / Float64(a + a)) * fmax(x, y)); elseif (t_1 <= 1e+57) tmp = Float64(Float64(Float64(z * t) * -4.5) / a); else tmp = Float64(Float64(fmax(x, y) / Float64(a + a)) * fmin(x, y)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = min(x, y) * max(x, y); tmp = 0.0; if (t_1 <= -5e+30) tmp = (min(x, y) / (a + a)) * max(x, y); elseif (t_1 <= 1e+57) tmp = ((z * t) * -4.5) / a; else tmp = (max(x, y) / (a + a)) * min(x, y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Min[x, y], $MachinePrecision] * N[Max[x, y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+30], N[(N[(N[Min[x, y], $MachinePrecision] / N[(a + a), $MachinePrecision]), $MachinePrecision] * N[Max[x, y], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+57], N[(N[(N[(z * t), $MachinePrecision] * -4.5), $MachinePrecision] / a), $MachinePrecision], N[(N[(N[Max[x, y], $MachinePrecision] / N[(a + a), $MachinePrecision]), $MachinePrecision] * N[Min[x, y], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \mathsf{min}\left(x, y\right) \cdot \mathsf{max}\left(x, y\right)\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+30}:\\
\;\;\;\;\frac{\mathsf{min}\left(x, y\right)}{a + a} \cdot \mathsf{max}\left(x, y\right)\\
\mathbf{elif}\;t\_1 \leq 10^{+57}:\\
\;\;\;\;\frac{\left(z \cdot t\right) \cdot -4.5}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{max}\left(x, y\right)}{a + a} \cdot \mathsf{min}\left(x, y\right)\\
\end{array}
if (*.f64 x y) < -4.9999999999999998e30Initial program 90.5%
Taylor expanded in x around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6449.7%
Applied rewrites49.7%
lift-*.f64N/A
*-commutativeN/A
metadata-evalN/A
mult-flip-revN/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
*-commutativeN/A
count-2N/A
lift-+.f64N/A
associate-*l/N/A
lift-/.f64N/A
lower-*.f6450.9%
Applied rewrites50.9%
if -4.9999999999999998e30 < (*.f64 x y) < 1.00000000000000005e57Initial program 90.5%
Taylor expanded in x around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6450.8%
Applied rewrites50.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6450.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6450.8%
Applied rewrites50.8%
if 1.00000000000000005e57 < (*.f64 x y) Initial program 90.5%
Taylor expanded in x around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6449.7%
Applied rewrites49.7%
lift-*.f64N/A
*-commutativeN/A
metadata-evalN/A
mult-flip-revN/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
count-2N/A
lift-+.f64N/A
associate-*l/N/A
lift-/.f64N/A
lower-*.f6450.4%
Applied rewrites50.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (fmin x y) (fmax x y))))
(if (<= t_1 -5e+30)
(* (/ (fmin x y) (+ a a)) (fmax x y))
(if (<= t_1 1e+57)
(* -4.5 (/ (* t z) a))
(* (/ (fmax x y) (+ a a)) (fmin x y))))))double code(double x, double y, double z, double t, double a) {
double t_1 = fmin(x, y) * fmax(x, y);
double tmp;
if (t_1 <= -5e+30) {
tmp = (fmin(x, y) / (a + a)) * fmax(x, y);
} else if (t_1 <= 1e+57) {
tmp = -4.5 * ((t * z) / a);
} else {
tmp = (fmax(x, y) / (a + a)) * fmin(x, y);
}
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)
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) :: t_1
real(8) :: tmp
t_1 = fmin(x, y) * fmax(x, y)
if (t_1 <= (-5d+30)) then
tmp = (fmin(x, y) / (a + a)) * fmax(x, y)
else if (t_1 <= 1d+57) then
tmp = (-4.5d0) * ((t * z) / a)
else
tmp = (fmax(x, y) / (a + a)) * fmin(x, y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = fmin(x, y) * fmax(x, y);
double tmp;
if (t_1 <= -5e+30) {
tmp = (fmin(x, y) / (a + a)) * fmax(x, y);
} else if (t_1 <= 1e+57) {
tmp = -4.5 * ((t * z) / a);
} else {
tmp = (fmax(x, y) / (a + a)) * fmin(x, y);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = fmin(x, y) * fmax(x, y) tmp = 0 if t_1 <= -5e+30: tmp = (fmin(x, y) / (a + a)) * fmax(x, y) elif t_1 <= 1e+57: tmp = -4.5 * ((t * z) / a) else: tmp = (fmax(x, y) / (a + a)) * fmin(x, y) return tmp
function code(x, y, z, t, a) t_1 = Float64(fmin(x, y) * fmax(x, y)) tmp = 0.0 if (t_1 <= -5e+30) tmp = Float64(Float64(fmin(x, y) / Float64(a + a)) * fmax(x, y)); elseif (t_1 <= 1e+57) tmp = Float64(-4.5 * Float64(Float64(t * z) / a)); else tmp = Float64(Float64(fmax(x, y) / Float64(a + a)) * fmin(x, y)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = min(x, y) * max(x, y); tmp = 0.0; if (t_1 <= -5e+30) tmp = (min(x, y) / (a + a)) * max(x, y); elseif (t_1 <= 1e+57) tmp = -4.5 * ((t * z) / a); else tmp = (max(x, y) / (a + a)) * min(x, y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Min[x, y], $MachinePrecision] * N[Max[x, y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+30], N[(N[(N[Min[x, y], $MachinePrecision] / N[(a + a), $MachinePrecision]), $MachinePrecision] * N[Max[x, y], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+57], N[(-4.5 * N[(N[(t * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(N[Max[x, y], $MachinePrecision] / N[(a + a), $MachinePrecision]), $MachinePrecision] * N[Min[x, y], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \mathsf{min}\left(x, y\right) \cdot \mathsf{max}\left(x, y\right)\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+30}:\\
\;\;\;\;\frac{\mathsf{min}\left(x, y\right)}{a + a} \cdot \mathsf{max}\left(x, y\right)\\
\mathbf{elif}\;t\_1 \leq 10^{+57}:\\
\;\;\;\;-4.5 \cdot \frac{t \cdot z}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{max}\left(x, y\right)}{a + a} \cdot \mathsf{min}\left(x, y\right)\\
\end{array}
if (*.f64 x y) < -4.9999999999999998e30Initial program 90.5%
Taylor expanded in x around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6449.7%
Applied rewrites49.7%
lift-*.f64N/A
*-commutativeN/A
metadata-evalN/A
mult-flip-revN/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
*-commutativeN/A
count-2N/A
lift-+.f64N/A
associate-*l/N/A
lift-/.f64N/A
lower-*.f6450.9%
Applied rewrites50.9%
if -4.9999999999999998e30 < (*.f64 x y) < 1.00000000000000005e57Initial program 90.5%
Taylor expanded in x around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6450.8%
Applied rewrites50.8%
if 1.00000000000000005e57 < (*.f64 x y) Initial program 90.5%
Taylor expanded in x around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6449.7%
Applied rewrites49.7%
lift-*.f64N/A
*-commutativeN/A
metadata-evalN/A
mult-flip-revN/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
count-2N/A
lift-+.f64N/A
associate-*l/N/A
lift-/.f64N/A
lower-*.f6450.4%
Applied rewrites50.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (fmin x y) (fmax x y))))
(if (<= t_1 -5e+30)
(* (/ (fmin x y) (+ a a)) (fmax x y))
(if (<= t_1 2e+56)
(* -4.5 (* z (/ t a)))
(* (/ (fmax x y) (+ a a)) (fmin x y))))))double code(double x, double y, double z, double t, double a) {
double t_1 = fmin(x, y) * fmax(x, y);
double tmp;
if (t_1 <= -5e+30) {
tmp = (fmin(x, y) / (a + a)) * fmax(x, y);
} else if (t_1 <= 2e+56) {
tmp = -4.5 * (z * (t / a));
} else {
tmp = (fmax(x, y) / (a + a)) * fmin(x, y);
}
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)
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) :: t_1
real(8) :: tmp
t_1 = fmin(x, y) * fmax(x, y)
if (t_1 <= (-5d+30)) then
tmp = (fmin(x, y) / (a + a)) * fmax(x, y)
else if (t_1 <= 2d+56) then
tmp = (-4.5d0) * (z * (t / a))
else
tmp = (fmax(x, y) / (a + a)) * fmin(x, y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = fmin(x, y) * fmax(x, y);
double tmp;
if (t_1 <= -5e+30) {
tmp = (fmin(x, y) / (a + a)) * fmax(x, y);
} else if (t_1 <= 2e+56) {
tmp = -4.5 * (z * (t / a));
} else {
tmp = (fmax(x, y) / (a + a)) * fmin(x, y);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = fmin(x, y) * fmax(x, y) tmp = 0 if t_1 <= -5e+30: tmp = (fmin(x, y) / (a + a)) * fmax(x, y) elif t_1 <= 2e+56: tmp = -4.5 * (z * (t / a)) else: tmp = (fmax(x, y) / (a + a)) * fmin(x, y) return tmp
function code(x, y, z, t, a) t_1 = Float64(fmin(x, y) * fmax(x, y)) tmp = 0.0 if (t_1 <= -5e+30) tmp = Float64(Float64(fmin(x, y) / Float64(a + a)) * fmax(x, y)); elseif (t_1 <= 2e+56) tmp = Float64(-4.5 * Float64(z * Float64(t / a))); else tmp = Float64(Float64(fmax(x, y) / Float64(a + a)) * fmin(x, y)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = min(x, y) * max(x, y); tmp = 0.0; if (t_1 <= -5e+30) tmp = (min(x, y) / (a + a)) * max(x, y); elseif (t_1 <= 2e+56) tmp = -4.5 * (z * (t / a)); else tmp = (max(x, y) / (a + a)) * min(x, y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Min[x, y], $MachinePrecision] * N[Max[x, y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+30], N[(N[(N[Min[x, y], $MachinePrecision] / N[(a + a), $MachinePrecision]), $MachinePrecision] * N[Max[x, y], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+56], N[(-4.5 * N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Max[x, y], $MachinePrecision] / N[(a + a), $MachinePrecision]), $MachinePrecision] * N[Min[x, y], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \mathsf{min}\left(x, y\right) \cdot \mathsf{max}\left(x, y\right)\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+30}:\\
\;\;\;\;\frac{\mathsf{min}\left(x, y\right)}{a + a} \cdot \mathsf{max}\left(x, y\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+56}:\\
\;\;\;\;-4.5 \cdot \left(z \cdot \frac{t}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{max}\left(x, y\right)}{a + a} \cdot \mathsf{min}\left(x, y\right)\\
\end{array}
if (*.f64 x y) < -4.9999999999999998e30Initial program 90.5%
Taylor expanded in x around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6449.7%
Applied rewrites49.7%
lift-*.f64N/A
*-commutativeN/A
metadata-evalN/A
mult-flip-revN/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
*-commutativeN/A
count-2N/A
lift-+.f64N/A
associate-*l/N/A
lift-/.f64N/A
lower-*.f6450.9%
Applied rewrites50.9%
if -4.9999999999999998e30 < (*.f64 x y) < 2.00000000000000018e56Initial program 90.5%
Taylor expanded in x around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6450.8%
Applied rewrites50.8%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6452.6%
Applied rewrites52.6%
if 2.00000000000000018e56 < (*.f64 x y) Initial program 90.5%
Taylor expanded in x around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6449.7%
Applied rewrites49.7%
lift-*.f64N/A
*-commutativeN/A
metadata-evalN/A
mult-flip-revN/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
count-2N/A
lift-+.f64N/A
associate-*l/N/A
lift-/.f64N/A
lower-*.f6450.4%
Applied rewrites50.4%
(FPCore (x y z t a) :precision binary64 (* (/ x (+ a a)) y))
double code(double x, double y, double z, double t, double a) {
return (x / (a + a)) * y;
}
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)
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
code = (x / (a + a)) * y
end function
public static double code(double x, double y, double z, double t, double a) {
return (x / (a + a)) * y;
}
def code(x, y, z, t, a): return (x / (a + a)) * y
function code(x, y, z, t, a) return Float64(Float64(x / Float64(a + a)) * y) end
function tmp = code(x, y, z, t, a) tmp = (x / (a + a)) * y; end
code[x_, y_, z_, t_, a_] := N[(N[(x / N[(a + a), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]
\frac{x}{a + a} \cdot y
Initial program 90.5%
Taylor expanded in x around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6449.7%
Applied rewrites49.7%
lift-*.f64N/A
*-commutativeN/A
metadata-evalN/A
mult-flip-revN/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
*-commutativeN/A
count-2N/A
lift-+.f64N/A
associate-*l/N/A
lift-/.f64N/A
lower-*.f6450.9%
Applied rewrites50.9%
herbie shell --seed 2025183
(FPCore (x y z t a)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, I"
:precision binary64
(/ (- (* x y) (* (* z 9.0) t)) (* a 2.0)))