
(FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* z t)) a))
double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * t)) / a;
}
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 * t)) / a
end function
public static double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * t)) / a;
}
def code(x, y, z, t, a): return ((x * y) - (z * t)) / a
function code(x, y, z, t, a) return Float64(Float64(Float64(x * y) - Float64(z * t)) / a) end
function tmp = code(x, y, z, t, a) tmp = ((x * y) - (z * t)) / a; end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]
\frac{x \cdot y - z \cdot t}{a}
Herbie found 7 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* z t)) a))
double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * t)) / a;
}
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 * t)) / a
end function
public static double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * t)) / a;
}
def code(x, y, z, t, a): return ((x * y) - (z * t)) / a
function code(x, y, z, t, a) return Float64(Float64(Float64(x * y) - Float64(z * t)) / a) end
function tmp = code(x, y, z, t, a) tmp = ((x * y) - (z * t)) / a; end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]
\frac{x \cdot y - z \cdot t}{a}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1
(fma (/ (fmin x y) a) (fmax x y) (* (/ (- (fmin z t)) a) (fmax z t))))
(t_2 (- (* (fmin x y) (fmax x y)) (* (fmin z t) (fmax z t)))))
(if (<= t_2 (- INFINITY)) t_1 (if (<= t_2 4e+305) (/ t_2 a) t_1))))double code(double x, double y, double z, double t, double a) {
double t_1 = fma((fmin(x, y) / a), fmax(x, y), ((-fmin(z, t) / a) * fmax(z, t)));
double t_2 = (fmin(x, y) * fmax(x, y)) - (fmin(z, t) * fmax(z, t));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= 4e+305) {
tmp = t_2 / a;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(fmin(x, y) / a), fmax(x, y), Float64(Float64(Float64(-fmin(z, t)) / a) * fmax(z, t))) t_2 = Float64(Float64(fmin(x, y) * fmax(x, y)) - Float64(fmin(z, t) * fmax(z, t))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= 4e+305) tmp = Float64(t_2 / a); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[Min[x, y], $MachinePrecision] / a), $MachinePrecision] * N[Max[x, y], $MachinePrecision] + N[(N[((-N[Min[z, t], $MachinePrecision]) / a), $MachinePrecision] * N[Max[z, t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Min[x, y], $MachinePrecision] * N[Max[x, y], $MachinePrecision]), $MachinePrecision] - N[(N[Min[z, t], $MachinePrecision] * N[Max[z, t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, 4e+305], N[(t$95$2 / a), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{\mathsf{min}\left(x, y\right)}{a}, \mathsf{max}\left(x, y\right), \frac{-\mathsf{min}\left(z, t\right)}{a} \cdot \mathsf{max}\left(z, t\right)\right)\\
t_2 := \mathsf{min}\left(x, y\right) \cdot \mathsf{max}\left(x, y\right) - \mathsf{min}\left(z, t\right) \cdot \mathsf{max}\left(z, t\right)\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{+305}:\\
\;\;\;\;\frac{t\_2}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0 or 3.9999999999999998e305 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 91.8%
lift-/.f64N/A
lift--.f64N/A
sub-flipN/A
div-addN/A
add-to-fractionN/A
div-addN/A
remove-double-negN/A
distribute-frac-neg2N/A
*-commutativeN/A
mult-flipN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lft-mult-inverseN/A
*-commutativeN/A
*-rgt-identityN/A
distribute-neg-frac2N/A
remove-double-negN/A
lift-*.f64N/A
associate-*l/N/A
distribute-neg-fracN/A
Applied rewrites88.4%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 3.9999999999999998e305Initial program 91.8%
(FPCore (x y z t a)
:precision binary64
(*
(copysign 1.0 a)
(if (<= (fabs a) 1.15e-66)
(/ (fma (- z) t (* (fmax x y) (fmin x y))) (fabs a))
(- (* (/ (fmax x y) (fabs a)) (fmin x y)) (* (/ z (fabs a)) t)))))double code(double x, double y, double z, double t, double a) {
double tmp;
if (fabs(a) <= 1.15e-66) {
tmp = fma(-z, t, (fmax(x, y) * fmin(x, y))) / fabs(a);
} else {
tmp = ((fmax(x, y) / fabs(a)) * fmin(x, y)) - ((z / fabs(a)) * t);
}
return copysign(1.0, a) * tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (abs(a) <= 1.15e-66) tmp = Float64(fma(Float64(-z), t, Float64(fmax(x, y) * fmin(x, y))) / abs(a)); else tmp = Float64(Float64(Float64(fmax(x, y) / abs(a)) * fmin(x, y)) - Float64(Float64(z / abs(a)) * t)); 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], 1.15e-66], N[(N[((-z) * t + N[(N[Max[x, y], $MachinePrecision] * N[Min[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Abs[a], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Max[x, y], $MachinePrecision] / N[Abs[a], $MachinePrecision]), $MachinePrecision] * N[Min[x, y], $MachinePrecision]), $MachinePrecision] - N[(N[(z / N[Abs[a], $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, a\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|a\right| \leq 1.15 \cdot 10^{-66}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-z, t, \mathsf{max}\left(x, y\right) \cdot \mathsf{min}\left(x, y\right)\right)}{\left|a\right|}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{max}\left(x, y\right)}{\left|a\right|} \cdot \mathsf{min}\left(x, y\right) - \frac{z}{\left|a\right|} \cdot t\\
\end{array}
if a < 1.14999999999999996e-66Initial program 91.8%
*-lft-identityN/A
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
distribute-rgt-inN/A
metadata-evalN/A
metadata-evalN/A
pow-plusN/A
inv-powN/A
associate-*l*N/A
mult-flipN/A
frac-2negN/A
distribute-rgt-neg-outN/A
mult-flipN/A
associate-*l*N/A
lft-mult-inverseN/A
*-rgt-identityN/A
remove-double-negN/A
remove-double-negN/A
lift-*.f64N/A
distribute-lft-neg-outN/A
*-rgt-identityN/A
Applied rewrites92.1%
if 1.14999999999999996e-66 < a Initial program 91.8%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6491.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6491.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6491.5%
Applied rewrites91.5%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
frac-2negN/A
metadata-evalN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
sub-negate-revN/A
lower--.f6491.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6491.4%
Applied rewrites91.4%
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
div-flip-revN/A
mul-1-negN/A
distribute-frac-neg2N/A
lift--.f64N/A
sub-divN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l/N/A
associate-/r/N/A
lift-/.f64N/A
lift-/.f64N/A
sub-negate-revN/A
lower--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
lift-/.f64N/A
lift-*.f64N/A
Applied rewrites87.7%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* (fmin x y) (fmax x y)))) (if (<= t_1 1e+246) (/ (- t_1 (* z t)) a) (* (/ (fmin x y) a) (fmax 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 <= 1e+246) {
tmp = (t_1 - (z * t)) / a;
} else {
tmp = (fmin(x, y) / a) * fmax(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 <= 1d+246) then
tmp = (t_1 - (z * t)) / a
else
tmp = (fmin(x, y) / a) * fmax(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 <= 1e+246) {
tmp = (t_1 - (z * t)) / a;
} else {
tmp = (fmin(x, y) / a) * fmax(x, y);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = fmin(x, y) * fmax(x, y) tmp = 0 if t_1 <= 1e+246: tmp = (t_1 - (z * t)) / a else: tmp = (fmin(x, y) / a) * fmax(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 <= 1e+246) tmp = Float64(Float64(t_1 - Float64(z * t)) / a); else tmp = Float64(Float64(fmin(x, y) / a) * fmax(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 <= 1e+246) tmp = (t_1 - (z * t)) / a; else tmp = (min(x, y) / a) * max(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, 1e+246], N[(N[(t$95$1 - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(N[Min[x, y], $MachinePrecision] / a), $MachinePrecision] * N[Max[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 10^{+246}:\\
\;\;\;\;\frac{t\_1 - z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{min}\left(x, y\right)}{a} \cdot \mathsf{max}\left(x, y\right)\\
\end{array}
if (*.f64 x y) < 1.00000000000000007e246Initial program 91.8%
if 1.00000000000000007e246 < (*.f64 x y) Initial program 91.8%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6450.5%
Applied rewrites50.5%
lift-/.f64N/A
lift-*.f64N/A
associate-*l/N/A
lift-/.f64N/A
lower-*.f6451.5%
Applied rewrites51.5%
(FPCore (x y z t a) :precision binary64 (if (<= (* x y) -5e-63) (/ (* x y) a) (if (<= (* x y) 5e+28) (/ (* (- z) t) a) (* (/ y a) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -5e-63) {
tmp = (x * y) / a;
} else if ((x * y) <= 5e+28) {
tmp = (-z * t) / a;
} else {
tmp = (y / a) * x;
}
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) :: tmp
if ((x * y) <= (-5d-63)) then
tmp = (x * y) / a
else if ((x * y) <= 5d+28) then
tmp = (-z * t) / a
else
tmp = (y / a) * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -5e-63) {
tmp = (x * y) / a;
} else if ((x * y) <= 5e+28) {
tmp = (-z * t) / a;
} else {
tmp = (y / a) * x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (x * y) <= -5e-63: tmp = (x * y) / a elif (x * y) <= 5e+28: tmp = (-z * t) / a else: tmp = (y / a) * x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= -5e-63) tmp = Float64(Float64(x * y) / a); elseif (Float64(x * y) <= 5e+28) tmp = Float64(Float64(Float64(-z) * t) / a); else tmp = Float64(Float64(y / a) * x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((x * y) <= -5e-63) tmp = (x * y) / a; elseif ((x * y) <= 5e+28) tmp = (-z * t) / a; else tmp = (y / a) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], -5e-63], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+28], N[(N[((-z) * t), $MachinePrecision] / a), $MachinePrecision], N[(N[(y / a), $MachinePrecision] * x), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{-63}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+28}:\\
\;\;\;\;\frac{\left(-z\right) \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a} \cdot x\\
\end{array}
if (*.f64 x y) < -5.0000000000000002e-63Initial program 91.8%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6450.5%
Applied rewrites50.5%
if -5.0000000000000002e-63 < (*.f64 x y) < 4.99999999999999957e28Initial program 91.8%
Taylor expanded in x around 0
lower-*.f64N/A
lower-*.f6451.1%
Applied rewrites51.1%
lift-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
distribute-lft-neg-outN/A
lower-*.f64N/A
lower-neg.f6451.1%
Applied rewrites51.1%
if 4.99999999999999957e28 < (*.f64 x y) Initial program 91.8%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6450.5%
Applied rewrites50.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6451.5%
Applied rewrites51.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (fmin x y) (fmax x y))))
(*
(copysign 1.0 a)
(if (<= (/ (- t_1 (* z t)) (fabs a)) 2e+301)
(/ t_1 (fabs a))
(* (/ (fmin x y) (fabs a)) (fmax 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 - (z * t)) / fabs(a)) <= 2e+301) {
tmp = t_1 / fabs(a);
} else {
tmp = (fmin(x, y) / fabs(a)) * fmax(x, y);
}
return copysign(1.0, a) * tmp;
}
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 - (z * t)) / Math.abs(a)) <= 2e+301) {
tmp = t_1 / Math.abs(a);
} else {
tmp = (fmin(x, y) / Math.abs(a)) * fmax(x, y);
}
return Math.copySign(1.0, a) * tmp;
}
def code(x, y, z, t, a): t_1 = fmin(x, y) * fmax(x, y) tmp = 0 if ((t_1 - (z * t)) / math.fabs(a)) <= 2e+301: tmp = t_1 / math.fabs(a) else: tmp = (fmin(x, y) / math.fabs(a)) * fmax(x, y) return math.copysign(1.0, a) * tmp
function code(x, y, z, t, a) t_1 = Float64(fmin(x, y) * fmax(x, y)) tmp = 0.0 if (Float64(Float64(t_1 - Float64(z * t)) / abs(a)) <= 2e+301) tmp = Float64(t_1 / abs(a)); else tmp = Float64(Float64(fmin(x, y) / abs(a)) * fmax(x, y)); end return Float64(copysign(1.0, a) * 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 - (z * t)) / abs(a)) <= 2e+301) tmp = t_1 / abs(a); else tmp = (min(x, y) / abs(a)) * max(x, y); end tmp_2 = (sign(a) * abs(1.0)) * tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Min[x, y], $MachinePrecision] * N[Max[x, y], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[(N[(t$95$1 - N[(z * t), $MachinePrecision]), $MachinePrecision] / N[Abs[a], $MachinePrecision]), $MachinePrecision], 2e+301], N[(t$95$1 / N[Abs[a], $MachinePrecision]), $MachinePrecision], N[(N[(N[Min[x, y], $MachinePrecision] / N[Abs[a], $MachinePrecision]), $MachinePrecision] * N[Max[x, y], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
t_1 := \mathsf{min}\left(x, y\right) \cdot \mathsf{max}\left(x, y\right)\\
\mathsf{copysign}\left(1, a\right) \cdot \begin{array}{l}
\mathbf{if}\;\frac{t\_1 - z \cdot t}{\left|a\right|} \leq 2 \cdot 10^{+301}:\\
\;\;\;\;\frac{t\_1}{\left|a\right|}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{min}\left(x, y\right)}{\left|a\right|} \cdot \mathsf{max}\left(x, y\right)\\
\end{array}
\end{array}
if (/.f64 (-.f64 (*.f64 x y) (*.f64 z t)) a) < 2.00000000000000011e301Initial program 91.8%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6450.5%
Applied rewrites50.5%
if 2.00000000000000011e301 < (/.f64 (-.f64 (*.f64 x y) (*.f64 z t)) a) Initial program 91.8%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6450.5%
Applied rewrites50.5%
lift-/.f64N/A
lift-*.f64N/A
associate-*l/N/A
lift-/.f64N/A
lower-*.f6451.5%
Applied rewrites51.5%
(FPCore (x y z t a) :precision binary64 (* (/ (fmax x y) a) (fmin x y)))
double code(double x, double y, double z, double t, double a) {
return (fmax(x, y) / a) * fmin(x, 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 = (fmax(x, y) / a) * fmin(x, y)
end function
public static double code(double x, double y, double z, double t, double a) {
return (fmax(x, y) / a) * fmin(x, y);
}
def code(x, y, z, t, a): return (fmax(x, y) / a) * fmin(x, y)
function code(x, y, z, t, a) return Float64(Float64(fmax(x, y) / a) * fmin(x, y)) end
function tmp = code(x, y, z, t, a) tmp = (max(x, y) / a) * min(x, y); end
code[x_, y_, z_, t_, a_] := N[(N[(N[Max[x, y], $MachinePrecision] / a), $MachinePrecision] * N[Min[x, y], $MachinePrecision]), $MachinePrecision]
\frac{\mathsf{max}\left(x, y\right)}{a} \cdot \mathsf{min}\left(x, y\right)
Initial program 91.8%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6450.5%
Applied rewrites50.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6451.5%
Applied rewrites51.5%
(FPCore (x y z t a) :precision binary64 (* (/ x a) y))
double code(double x, double y, double z, double t, double a) {
return (x / 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) * y
end function
public static double code(double x, double y, double z, double t, double a) {
return (x / a) * y;
}
def code(x, y, z, t, a): return (x / a) * y
function code(x, y, z, t, a) return Float64(Float64(x / a) * y) end
function tmp = code(x, y, z, t, a) tmp = (x / a) * y; end
code[x_, y_, z_, t_, a_] := N[(N[(x / a), $MachinePrecision] * y), $MachinePrecision]
\frac{x}{a} \cdot y
Initial program 91.8%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6450.5%
Applied rewrites50.5%
lift-/.f64N/A
lift-*.f64N/A
associate-*l/N/A
lift-/.f64N/A
lower-*.f6451.5%
Applied rewrites51.5%
herbie shell --seed 2025179
(FPCore (x y z t a)
:name "Data.Colour.Matrix:inverse from colour-2.3.3, B"
:precision binary64
(/ (- (* x y) (* z t)) a))