
(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 (- (* (fmin x y) (fmax x y)) (* (fmin z t) (fmax z t)))))
(if (<= t_1 -5e+273)
(-
(* (/ (- (fmin z t)) a) (fmax z t))
(* (/ (fmin x y) a) (- (fmax x y))))
(if (<= t_1 1e+306)
(/ t_1 a)
(*
(/ (- (fmax x y) (* (fmax z t) (/ (fmin z t) (fmin x y)))) 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)) - (fmin(z, t) * fmax(z, t));
double tmp;
if (t_1 <= -5e+273) {
tmp = ((-fmin(z, t) / a) * fmax(z, t)) - ((fmin(x, y) / a) * -fmax(x, y));
} else if (t_1 <= 1e+306) {
tmp = t_1 / a;
} else {
tmp = ((fmax(x, y) - (fmax(z, t) * (fmin(z, t) / fmin(x, y)))) / 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)) - (fmin(z, t) * fmax(z, t))
if (t_1 <= (-5d+273)) then
tmp = ((-fmin(z, t) / a) * fmax(z, t)) - ((fmin(x, y) / a) * -fmax(x, y))
else if (t_1 <= 1d+306) then
tmp = t_1 / a
else
tmp = ((fmax(x, y) - (fmax(z, t) * (fmin(z, t) / fmin(x, y)))) / 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)) - (fmin(z, t) * fmax(z, t));
double tmp;
if (t_1 <= -5e+273) {
tmp = ((-fmin(z, t) / a) * fmax(z, t)) - ((fmin(x, y) / a) * -fmax(x, y));
} else if (t_1 <= 1e+306) {
tmp = t_1 / a;
} else {
tmp = ((fmax(x, y) - (fmax(z, t) * (fmin(z, t) / fmin(x, y)))) / a) * fmin(x, y);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (fmin(x, y) * fmax(x, y)) - (fmin(z, t) * fmax(z, t)) tmp = 0 if t_1 <= -5e+273: tmp = ((-fmin(z, t) / a) * fmax(z, t)) - ((fmin(x, y) / a) * -fmax(x, y)) elif t_1 <= 1e+306: tmp = t_1 / a else: tmp = ((fmax(x, y) - (fmax(z, t) * (fmin(z, t) / fmin(x, y)))) / a) * fmin(x, y) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(fmin(x, y) * fmax(x, y)) - Float64(fmin(z, t) * fmax(z, t))) tmp = 0.0 if (t_1 <= -5e+273) tmp = Float64(Float64(Float64(Float64(-fmin(z, t)) / a) * fmax(z, t)) - Float64(Float64(fmin(x, y) / a) * Float64(-fmax(x, y)))); elseif (t_1 <= 1e+306) tmp = Float64(t_1 / a); else tmp = Float64(Float64(Float64(fmax(x, y) - Float64(fmax(z, t) * Float64(fmin(z, t) / fmin(x, y)))) / 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)) - (min(z, t) * max(z, t)); tmp = 0.0; if (t_1 <= -5e+273) tmp = ((-min(z, t) / a) * max(z, t)) - ((min(x, y) / a) * -max(x, y)); elseif (t_1 <= 1e+306) tmp = t_1 / a; else tmp = ((max(x, y) - (max(z, t) * (min(z, t) / min(x, y)))) / a) * min(x, y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = 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$1, -5e+273], N[(N[(N[((-N[Min[z, t], $MachinePrecision]) / a), $MachinePrecision] * N[Max[z, t], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Min[x, y], $MachinePrecision] / a), $MachinePrecision] * (-N[Max[x, y], $MachinePrecision])), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+306], N[(t$95$1 / a), $MachinePrecision], N[(N[(N[(N[Max[x, y], $MachinePrecision] - N[(N[Max[z, t], $MachinePrecision] * N[(N[Min[z, t], $MachinePrecision] / N[Min[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $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) - \mathsf{min}\left(z, t\right) \cdot \mathsf{max}\left(z, t\right)\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+273}:\\
\;\;\;\;\frac{-\mathsf{min}\left(z, t\right)}{a} \cdot \mathsf{max}\left(z, t\right) - \frac{\mathsf{min}\left(x, y\right)}{a} \cdot \left(-\mathsf{max}\left(x, y\right)\right)\\
\mathbf{elif}\;t\_1 \leq 10^{+306}:\\
\;\;\;\;\frac{t\_1}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{max}\left(x, y\right) - \mathsf{max}\left(z, t\right) \cdot \frac{\mathsf{min}\left(z, t\right)}{\mathsf{min}\left(x, y\right)}}{a} \cdot \mathsf{min}\left(x, y\right)\\
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -4.9999999999999996e273Initial program 91.0%
lift-/.f64N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
div-subN/A
distribute-neg-frac2N/A
lower--.f64N/A
distribute-neg-fracN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
distribute-neg-frac2N/A
lift-*.f64N/A
associate-*l/N/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-/.f64N/A
lower-neg.f6487.1%
Applied rewrites87.1%
if -4.9999999999999996e273 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1e306Initial program 91.0%
if 1e306 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 91.0%
Taylor expanded in x around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6479.3%
Applied rewrites79.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6479.3%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
mul-1-negN/A
sub-flip-reverseN/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l/N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f6481.9%
Applied rewrites81.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (* (fmin x y) (fmax x y)) (* z t))))
(if (<= t_1 (- INFINITY))
(- (* (/ (fmax x y) a) (fmin x y)) (* z (/ t a)))
(if (<= t_1 1e+306)
(/ t_1 a)
(* (/ (- (fmax x y) (* t (/ z (fmin x y)))) 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)) - (z * t);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = ((fmax(x, y) / a) * fmin(x, y)) - (z * (t / a));
} else if (t_1 <= 1e+306) {
tmp = t_1 / a;
} else {
tmp = ((fmax(x, y) - (t * (z / fmin(x, y)))) / a) * fmin(x, y);
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (fmin(x, y) * fmax(x, y)) - (z * t);
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = ((fmax(x, y) / a) * fmin(x, y)) - (z * (t / a));
} else if (t_1 <= 1e+306) {
tmp = t_1 / a;
} else {
tmp = ((fmax(x, y) - (t * (z / fmin(x, y)))) / a) * fmin(x, y);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (fmin(x, y) * fmax(x, y)) - (z * t) tmp = 0 if t_1 <= -math.inf: tmp = ((fmax(x, y) / a) * fmin(x, y)) - (z * (t / a)) elif t_1 <= 1e+306: tmp = t_1 / a else: tmp = ((fmax(x, y) - (t * (z / fmin(x, y)))) / a) * fmin(x, y) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(fmin(x, y) * fmax(x, y)) - Float64(z * t)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(Float64(fmax(x, y) / a) * fmin(x, y)) - Float64(z * Float64(t / a))); elseif (t_1 <= 1e+306) tmp = Float64(t_1 / a); else tmp = Float64(Float64(Float64(fmax(x, y) - Float64(t * Float64(z / fmin(x, y)))) / 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)) - (z * t); tmp = 0.0; if (t_1 <= -Inf) tmp = ((max(x, y) / a) * min(x, y)) - (z * (t / a)); elseif (t_1 <= 1e+306) tmp = t_1 / a; else tmp = ((max(x, y) - (t * (z / min(x, y)))) / a) * min(x, y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[Min[x, y], $MachinePrecision] * N[Max[x, y], $MachinePrecision]), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(N[(N[Max[x, y], $MachinePrecision] / a), $MachinePrecision] * N[Min[x, y], $MachinePrecision]), $MachinePrecision] - N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+306], N[(t$95$1 / a), $MachinePrecision], N[(N[(N[(N[Max[x, y], $MachinePrecision] - N[(t * N[(z / N[Min[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $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) - z \cdot t\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\frac{\mathsf{max}\left(x, y\right)}{a} \cdot \mathsf{min}\left(x, y\right) - z \cdot \frac{t}{a}\\
\mathbf{elif}\;t\_1 \leq 10^{+306}:\\
\;\;\;\;\frac{t\_1}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{max}\left(x, y\right) - t \cdot \frac{z}{\mathsf{min}\left(x, y\right)}}{a} \cdot \mathsf{min}\left(x, y\right)\\
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0Initial program 91.0%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6488.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6488.9%
Applied rewrites88.9%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6487.9%
Applied rewrites87.9%
lift-/.f64N/A
lift-*.f64N/A
associate-*l/N/A
lift-/.f64N/A
lower-*.f6487.5%
Applied rewrites87.5%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1e306Initial program 91.0%
if 1e306 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 91.0%
Taylor expanded in x around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6479.3%
Applied rewrites79.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6479.3%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
mul-1-negN/A
sub-flip-reverseN/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l/N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f6481.9%
Applied rewrites81.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1
(* (/ (- (fmax x y) (* t (/ z (fmin x y)))) a) (fmin x y)))
(t_2 (- (* (fmin x y) (fmax x y)) (* z t))))
(if (<= t_2 -2e+263) t_1 (if (<= t_2 1e+306) (/ t_2 a) t_1))))double code(double x, double y, double z, double t, double a) {
double t_1 = ((fmax(x, y) - (t * (z / fmin(x, y)))) / a) * fmin(x, y);
double t_2 = (fmin(x, y) * fmax(x, y)) - (z * t);
double tmp;
if (t_2 <= -2e+263) {
tmp = t_1;
} else if (t_2 <= 1e+306) {
tmp = t_2 / a;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
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) :: t_2
real(8) :: tmp
t_1 = ((fmax(x, y) - (t * (z / fmin(x, y)))) / a) * fmin(x, y)
t_2 = (fmin(x, y) * fmax(x, y)) - (z * t)
if (t_2 <= (-2d+263)) then
tmp = t_1
else if (t_2 <= 1d+306) then
tmp = t_2 / a
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = ((fmax(x, y) - (t * (z / fmin(x, y)))) / a) * fmin(x, y);
double t_2 = (fmin(x, y) * fmax(x, y)) - (z * t);
double tmp;
if (t_2 <= -2e+263) {
tmp = t_1;
} else if (t_2 <= 1e+306) {
tmp = t_2 / a;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = ((fmax(x, y) - (t * (z / fmin(x, y)))) / a) * fmin(x, y) t_2 = (fmin(x, y) * fmax(x, y)) - (z * t) tmp = 0 if t_2 <= -2e+263: tmp = t_1 elif t_2 <= 1e+306: tmp = t_2 / a else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(fmax(x, y) - Float64(t * Float64(z / fmin(x, y)))) / a) * fmin(x, y)) t_2 = Float64(Float64(fmin(x, y) * fmax(x, y)) - Float64(z * t)) tmp = 0.0 if (t_2 <= -2e+263) tmp = t_1; elseif (t_2 <= 1e+306) tmp = Float64(t_2 / a); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = ((max(x, y) - (t * (z / min(x, y)))) / a) * min(x, y); t_2 = (min(x, y) * max(x, y)) - (z * t); tmp = 0.0; if (t_2 <= -2e+263) tmp = t_1; elseif (t_2 <= 1e+306) tmp = t_2 / a; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(N[Max[x, y], $MachinePrecision] - N[(t * N[(z / N[Min[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision] * N[Min[x, y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Min[x, y], $MachinePrecision] * N[Max[x, y], $MachinePrecision]), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+263], t$95$1, If[LessEqual[t$95$2, 1e+306], N[(t$95$2 / a), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_1 := \frac{\mathsf{max}\left(x, y\right) - t \cdot \frac{z}{\mathsf{min}\left(x, y\right)}}{a} \cdot \mathsf{min}\left(x, y\right)\\
t_2 := \mathsf{min}\left(x, y\right) \cdot \mathsf{max}\left(x, y\right) - z \cdot t\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+263}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{+306}:\\
\;\;\;\;\frac{t\_2}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -2e263 or 1e306 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 91.0%
Taylor expanded in x around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6479.3%
Applied rewrites79.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6479.3%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
mul-1-negN/A
sub-flip-reverseN/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l/N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f6481.9%
Applied rewrites81.9%
if -2e263 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1e306Initial program 91.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (fmin x y) (fmax x y))))
(if (<= t_1 -5e+273)
(* (/ (fmax x y) a) (fmin x y))
(if (<= t_1 1e+268)
(/ (- t_1 (* z t)) a)
(* (/ 1.0 (/ a (fmax x y))) (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+273) {
tmp = (fmax(x, y) / a) * fmin(x, y);
} else if (t_1 <= 1e+268) {
tmp = (t_1 - (z * t)) / a;
} else {
tmp = (1.0 / (a / fmax(x, y))) * 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+273)) then
tmp = (fmax(x, y) / a) * fmin(x, y)
else if (t_1 <= 1d+268) then
tmp = (t_1 - (z * t)) / a
else
tmp = (1.0d0 / (a / fmax(x, y))) * 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+273) {
tmp = (fmax(x, y) / a) * fmin(x, y);
} else if (t_1 <= 1e+268) {
tmp = (t_1 - (z * t)) / a;
} else {
tmp = (1.0 / (a / fmax(x, y))) * 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+273: tmp = (fmax(x, y) / a) * fmin(x, y) elif t_1 <= 1e+268: tmp = (t_1 - (z * t)) / a else: tmp = (1.0 / (a / fmax(x, y))) * 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+273) tmp = Float64(Float64(fmax(x, y) / a) * fmin(x, y)); elseif (t_1 <= 1e+268) tmp = Float64(Float64(t_1 - Float64(z * t)) / a); else tmp = Float64(Float64(1.0 / Float64(a / fmax(x, y))) * 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+273) tmp = (max(x, y) / a) * min(x, y); elseif (t_1 <= 1e+268) tmp = (t_1 - (z * t)) / a; else tmp = (1.0 / (a / max(x, y))) * 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+273], N[(N[(N[Max[x, y], $MachinePrecision] / a), $MachinePrecision] * N[Min[x, y], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+268], N[(N[(t$95$1 - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(1.0 / N[(a / N[Max[x, y], $MachinePrecision]), $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^{+273}:\\
\;\;\;\;\frac{\mathsf{max}\left(x, y\right)}{a} \cdot \mathsf{min}\left(x, y\right)\\
\mathbf{elif}\;t\_1 \leq 10^{+268}:\\
\;\;\;\;\frac{t\_1 - z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{a}{\mathsf{max}\left(x, y\right)}} \cdot \mathsf{min}\left(x, y\right)\\
\end{array}
if (*.f64 x y) < -4.9999999999999996e273Initial program 91.0%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6450.6%
Applied rewrites50.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6451.7%
Applied rewrites51.7%
if -4.9999999999999996e273 < (*.f64 x y) < 9.9999999999999997e267Initial program 91.0%
if 9.9999999999999997e267 < (*.f64 x y) Initial program 91.0%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6450.6%
Applied rewrites50.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6451.7%
Applied rewrites51.7%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6451.6%
Applied rewrites51.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (fmin x y) (fmax x y))))
(if (<= t_1 -5e+273)
(* (/ (fmax x y) a) (fmin x y))
(if (<= t_1 1e+268)
(/ (- 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 <= -5e+273) {
tmp = (fmax(x, y) / a) * fmin(x, y);
} else if (t_1 <= 1e+268) {
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 <= (-5d+273)) then
tmp = (fmax(x, y) / a) * fmin(x, y)
else if (t_1 <= 1d+268) 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 <= -5e+273) {
tmp = (fmax(x, y) / a) * fmin(x, y);
} else if (t_1 <= 1e+268) {
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 <= -5e+273: tmp = (fmax(x, y) / a) * fmin(x, y) elif t_1 <= 1e+268: 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 <= -5e+273) tmp = Float64(Float64(fmax(x, y) / a) * fmin(x, y)); elseif (t_1 <= 1e+268) 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 <= -5e+273) tmp = (max(x, y) / a) * min(x, y); elseif (t_1 <= 1e+268) 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, -5e+273], N[(N[(N[Max[x, y], $MachinePrecision] / a), $MachinePrecision] * N[Min[x, y], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+268], 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 -5 \cdot 10^{+273}:\\
\;\;\;\;\frac{\mathsf{max}\left(x, y\right)}{a} \cdot \mathsf{min}\left(x, y\right)\\
\mathbf{elif}\;t\_1 \leq 10^{+268}:\\
\;\;\;\;\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) < -4.9999999999999996e273Initial program 91.0%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6450.6%
Applied rewrites50.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6451.7%
Applied rewrites51.7%
if -4.9999999999999996e273 < (*.f64 x y) < 9.9999999999999997e267Initial program 91.0%
if 9.9999999999999997e267 < (*.f64 x y) Initial program 91.0%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6450.6%
Applied rewrites50.6%
lift-/.f64N/A
lift-*.f64N/A
associate-*l/N/A
lift-/.f64N/A
lower-*.f6451.1%
Applied rewrites51.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (fmin x y) (fmax x y)))
(t_2 (* (/ (fmin x y) a) (fmax x y))))
(if (<= t_1 -1e-67) t_2 (if (<= t_1 6e-10) (/ (* (- z) t) a) t_2))))double code(double x, double y, double z, double t, double a) {
double t_1 = fmin(x, y) * fmax(x, y);
double t_2 = (fmin(x, y) / a) * fmax(x, y);
double tmp;
if (t_1 <= -1e-67) {
tmp = t_2;
} else if (t_1 <= 6e-10) {
tmp = (-z * t) / a;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = fmin(x, y) * fmax(x, y)
t_2 = (fmin(x, y) / a) * fmax(x, y)
if (t_1 <= (-1d-67)) then
tmp = t_2
else if (t_1 <= 6d-10) then
tmp = (-z * t) / a
else
tmp = t_2
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 t_2 = (fmin(x, y) / a) * fmax(x, y);
double tmp;
if (t_1 <= -1e-67) {
tmp = t_2;
} else if (t_1 <= 6e-10) {
tmp = (-z * t) / a;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = fmin(x, y) * fmax(x, y) t_2 = (fmin(x, y) / a) * fmax(x, y) tmp = 0 if t_1 <= -1e-67: tmp = t_2 elif t_1 <= 6e-10: tmp = (-z * t) / a else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(fmin(x, y) * fmax(x, y)) t_2 = Float64(Float64(fmin(x, y) / a) * fmax(x, y)) tmp = 0.0 if (t_1 <= -1e-67) tmp = t_2; elseif (t_1 <= 6e-10) tmp = Float64(Float64(Float64(-z) * t) / a); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = min(x, y) * max(x, y); t_2 = (min(x, y) / a) * max(x, y); tmp = 0.0; if (t_1 <= -1e-67) tmp = t_2; elseif (t_1 <= 6e-10) tmp = (-z * t) / a; else tmp = t_2; 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]}, Block[{t$95$2 = N[(N[(N[Min[x, y], $MachinePrecision] / a), $MachinePrecision] * N[Max[x, y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-67], t$95$2, If[LessEqual[t$95$1, 6e-10], N[(N[((-z) * t), $MachinePrecision] / a), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
t_1 := \mathsf{min}\left(x, y\right) \cdot \mathsf{max}\left(x, y\right)\\
t_2 := \frac{\mathsf{min}\left(x, y\right)}{a} \cdot \mathsf{max}\left(x, y\right)\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-67}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 6 \cdot 10^{-10}:\\
\;\;\;\;\frac{\left(-z\right) \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
if (*.f64 x y) < -9.9999999999999994e-68 or 6e-10 < (*.f64 x y) Initial program 91.0%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6450.6%
Applied rewrites50.6%
lift-/.f64N/A
lift-*.f64N/A
associate-*l/N/A
lift-/.f64N/A
lower-*.f6451.1%
Applied rewrites51.1%
if -9.9999999999999994e-68 < (*.f64 x y) < 6e-10Initial program 91.0%
Taylor expanded in x around 0
lower-*.f64N/A
lower-*.f6450.2%
Applied rewrites50.2%
lift-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-outN/A
lower-*.f64N/A
lower-neg.f6450.2%
Applied rewrites50.2%
(FPCore (x y z t a) :precision binary64 (* (/ (fmin x y) a) (fmax x y)))
double code(double x, double y, double z, double t, double a) {
return (fmin(x, y) / a) * fmax(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 = (fmin(x, y) / a) * fmax(x, y)
end function
public static double code(double x, double y, double z, double t, double a) {
return (fmin(x, y) / a) * fmax(x, y);
}
def code(x, y, z, t, a): return (fmin(x, y) / a) * fmax(x, y)
function code(x, y, z, t, a) return Float64(Float64(fmin(x, y) / a) * fmax(x, y)) end
function tmp = code(x, y, z, t, a) tmp = (min(x, y) / a) * max(x, y); end
code[x_, y_, z_, t_, a_] := N[(N[(N[Min[x, y], $MachinePrecision] / a), $MachinePrecision] * N[Max[x, y], $MachinePrecision]), $MachinePrecision]
\frac{\mathsf{min}\left(x, y\right)}{a} \cdot \mathsf{max}\left(x, y\right)
Initial program 91.0%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6450.6%
Applied rewrites50.6%
lift-/.f64N/A
lift-*.f64N/A
associate-*l/N/A
lift-/.f64N/A
lower-*.f6451.1%
Applied rewrites51.1%
herbie shell --seed 2025258
(FPCore (x y z t a)
:name "Data.Colour.Matrix:inverse from colour-2.3.3, B"
:precision binary64
(/ (- (* x y) (* z t)) a))