
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
Initial program 100.0%
(FPCore (x y z t) :precision binary64 (if (<= z -0.6) (- x (* (- t x) z)) (if (<= z 3.6e+49) (fma (- t x) y x) (fma (- t) z (* z x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.6) {
tmp = x - ((t - x) * z);
} else if (z <= 3.6e+49) {
tmp = fma((t - x), y, x);
} else {
tmp = fma(-t, z, (z * x));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= -0.6) tmp = Float64(x - Float64(Float64(t - x) * z)); elseif (z <= 3.6e+49) tmp = fma(Float64(t - x), y, x); else tmp = fma(Float64(-t), z, Float64(z * x)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -0.6], N[(x - N[(N[(t - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.6e+49], N[(N[(t - x), $MachinePrecision] * y + x), $MachinePrecision], N[((-t) * z + N[(z * x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.6:\\
\;\;\;\;x - \left(t - x\right) \cdot z\\
\mathbf{elif}\;z \leq 3.6 \cdot 10^{+49}:\\
\;\;\;\;\mathsf{fma}\left(t - x, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-t, z, z \cdot x\right)\\
\end{array}
\end{array}
if z < -0.599999999999999978Initial program 100.0%
Taylor expanded in y around 0
associate-*r*N/A
mul-1-negN/A
fp-cancel-sub-signN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6476.9
Applied rewrites76.9%
if -0.599999999999999978 < z < 3.59999999999999996e49Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6487.5
Applied rewrites87.5%
if 3.59999999999999996e49 < z Initial program 100.0%
Taylor expanded in z around inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
lift--.f6481.9
Applied rewrites81.9%
Taylor expanded in x around 0
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6479.3
Applied rewrites79.3%
(FPCore (x y z t) :precision binary64 (if (<= z -0.6) (- x (* (- t x) z)) (if (<= z 3.6e+49) (fma (- t x) y x) (* (- x t) z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.6) {
tmp = x - ((t - x) * z);
} else if (z <= 3.6e+49) {
tmp = fma((t - x), y, x);
} else {
tmp = (x - t) * z;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= -0.6) tmp = Float64(x - Float64(Float64(t - x) * z)); elseif (z <= 3.6e+49) tmp = fma(Float64(t - x), y, x); else tmp = Float64(Float64(x - t) * z); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -0.6], N[(x - N[(N[(t - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.6e+49], N[(N[(t - x), $MachinePrecision] * y + x), $MachinePrecision], N[(N[(x - t), $MachinePrecision] * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.6:\\
\;\;\;\;x - \left(t - x\right) \cdot z\\
\mathbf{elif}\;z \leq 3.6 \cdot 10^{+49}:\\
\;\;\;\;\mathsf{fma}\left(t - x, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x - t\right) \cdot z\\
\end{array}
\end{array}
if z < -0.599999999999999978Initial program 100.0%
Taylor expanded in y around 0
associate-*r*N/A
mul-1-negN/A
fp-cancel-sub-signN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6476.9
Applied rewrites76.9%
if -0.599999999999999978 < z < 3.59999999999999996e49Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6487.5
Applied rewrites87.5%
if 3.59999999999999996e49 < z Initial program 100.0%
Taylor expanded in y around 0
associate-+r+N/A
*-commutativeN/A
negate-sub2N/A
fp-cancel-sub-signN/A
lower--.f64N/A
associate-*r*N/A
mul-1-negN/A
fp-cancel-sub-signN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lower-*.f64N/A
lower--.f6493.1
Applied rewrites93.1%
Taylor expanded in z around inf
negate-sub2N/A
mul-1-negN/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
negate-sub2N/A
lift--.f6481.9
Applied rewrites81.9%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (- x t) z))) (if (<= z -2150000000.0) t_1 (if (<= z 3.6e+49) (fma (- t x) y x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (x - t) * z;
double tmp;
if (z <= -2150000000.0) {
tmp = t_1;
} else if (z <= 3.6e+49) {
tmp = fma((t - x), y, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(x - t) * z) tmp = 0.0 if (z <= -2150000000.0) tmp = t_1; elseif (z <= 3.6e+49) tmp = fma(Float64(t - x), y, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x - t), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -2150000000.0], t$95$1, If[LessEqual[z, 3.6e+49], N[(N[(t - x), $MachinePrecision] * y + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x - t\right) \cdot z\\
\mathbf{if}\;z \leq -2150000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.6 \cdot 10^{+49}:\\
\;\;\;\;\mathsf{fma}\left(t - x, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.15e9 or 3.59999999999999996e49 < z Initial program 100.0%
Taylor expanded in y around 0
associate-+r+N/A
*-commutativeN/A
negate-sub2N/A
fp-cancel-sub-signN/A
lower--.f64N/A
associate-*r*N/A
mul-1-negN/A
fp-cancel-sub-signN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lower-*.f64N/A
lower--.f6492.4
Applied rewrites92.4%
Taylor expanded in z around inf
negate-sub2N/A
mul-1-negN/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
negate-sub2N/A
lift--.f6479.5
Applied rewrites79.5%
if -2.15e9 < z < 3.59999999999999996e49Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6486.9
Applied rewrites86.9%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (- t x) y))) (if (<= y -1.35e+18) t_1 (if (<= y 5e+51) (* (- x t) z) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (t - x) * y;
double tmp;
if (y <= -1.35e+18) {
tmp = t_1;
} else if (y <= 5e+51) {
tmp = (x - t) * z;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
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) :: t_1
real(8) :: tmp
t_1 = (t - x) * y
if (y <= (-1.35d+18)) then
tmp = t_1
else if (y <= 5d+51) then
tmp = (x - t) * z
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (t - x) * y;
double tmp;
if (y <= -1.35e+18) {
tmp = t_1;
} else if (y <= 5e+51) {
tmp = (x - t) * z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (t - x) * y tmp = 0 if y <= -1.35e+18: tmp = t_1 elif y <= 5e+51: tmp = (x - t) * z else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(t - x) * y) tmp = 0.0 if (y <= -1.35e+18) tmp = t_1; elseif (y <= 5e+51) tmp = Float64(Float64(x - t) * z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (t - x) * y; tmp = 0.0; if (y <= -1.35e+18) tmp = t_1; elseif (y <= 5e+51) tmp = (x - t) * z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -1.35e+18], t$95$1, If[LessEqual[y, 5e+51], N[(N[(x - t), $MachinePrecision] * z), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t - x\right) \cdot y\\
\mathbf{if}\;y \leq -1.35 \cdot 10^{+18}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 5 \cdot 10^{+51}:\\
\;\;\;\;\left(x - t\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.35e18 or 5e51 < y Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift--.f6481.9
Applied rewrites81.9%
if -1.35e18 < y < 5e51Initial program 100.0%
Taylor expanded in y around 0
associate-+r+N/A
*-commutativeN/A
negate-sub2N/A
fp-cancel-sub-signN/A
lower--.f64N/A
associate-*r*N/A
mul-1-negN/A
fp-cancel-sub-signN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lower-*.f64N/A
lower--.f6499.9
Applied rewrites99.9%
Taylor expanded in z around inf
negate-sub2N/A
mul-1-negN/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
negate-sub2N/A
lift--.f6457.6
Applied rewrites57.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- x t) z)) (t_2 (* (- 1.0 y) x)))
(if (<= z -1.25)
t_1
(if (<= z 3.8e-271)
t_2
(if (<= z 6e-95) (* t y) (if (<= z 9.2e+48) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = (x - t) * z;
double t_2 = (1.0 - y) * x;
double tmp;
if (z <= -1.25) {
tmp = t_1;
} else if (z <= 3.8e-271) {
tmp = t_2;
} else if (z <= 6e-95) {
tmp = t * y;
} else if (z <= 9.2e+48) {
tmp = t_2;
} 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)
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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (x - t) * z
t_2 = (1.0d0 - y) * x
if (z <= (-1.25d0)) then
tmp = t_1
else if (z <= 3.8d-271) then
tmp = t_2
else if (z <= 6d-95) then
tmp = t * y
else if (z <= 9.2d+48) then
tmp = t_2
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x - t) * z;
double t_2 = (1.0 - y) * x;
double tmp;
if (z <= -1.25) {
tmp = t_1;
} else if (z <= 3.8e-271) {
tmp = t_2;
} else if (z <= 6e-95) {
tmp = t * y;
} else if (z <= 9.2e+48) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x - t) * z t_2 = (1.0 - y) * x tmp = 0 if z <= -1.25: tmp = t_1 elif z <= 3.8e-271: tmp = t_2 elif z <= 6e-95: tmp = t * y elif z <= 9.2e+48: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x - t) * z) t_2 = Float64(Float64(1.0 - y) * x) tmp = 0.0 if (z <= -1.25) tmp = t_1; elseif (z <= 3.8e-271) tmp = t_2; elseif (z <= 6e-95) tmp = Float64(t * y); elseif (z <= 9.2e+48) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x - t) * z; t_2 = (1.0 - y) * x; tmp = 0.0; if (z <= -1.25) tmp = t_1; elseif (z <= 3.8e-271) tmp = t_2; elseif (z <= 6e-95) tmp = t * y; elseif (z <= 9.2e+48) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x - t), $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$2 = N[(N[(1.0 - y), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[z, -1.25], t$95$1, If[LessEqual[z, 3.8e-271], t$95$2, If[LessEqual[z, 6e-95], N[(t * y), $MachinePrecision], If[LessEqual[z, 9.2e+48], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x - t\right) \cdot z\\
t_2 := \left(1 - y\right) \cdot x\\
\mathbf{if}\;z \leq -1.25:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.8 \cdot 10^{-271}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq 6 \cdot 10^{-95}:\\
\;\;\;\;t \cdot y\\
\mathbf{elif}\;z \leq 9.2 \cdot 10^{+48}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.25 or 9.2000000000000001e48 < z Initial program 100.0%
Taylor expanded in y around 0
associate-+r+N/A
*-commutativeN/A
negate-sub2N/A
fp-cancel-sub-signN/A
lower--.f64N/A
associate-*r*N/A
mul-1-negN/A
fp-cancel-sub-signN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lower-*.f64N/A
lower--.f6492.6
Applied rewrites92.6%
Taylor expanded in z around inf
negate-sub2N/A
mul-1-negN/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
negate-sub2N/A
lift--.f6478.9
Applied rewrites78.9%
if -1.25 < z < 3.8000000000000001e-271 or 6e-95 < z < 9.2000000000000001e48Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift--.f6458.4
Applied rewrites58.4%
Taylor expanded in z around 0
lower--.f6455.3
Applied rewrites55.3%
if 3.8000000000000001e-271 < z < 6e-95Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift--.f6461.1
Applied rewrites61.1%
Taylor expanded in x around 0
Applied rewrites37.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- y) x)) (t_2 (* (- x t) z)))
(if (<= z -400.0)
t_2
(if (<= z -2.2e-167)
(fma z x x)
(if (<= z -3e-290)
t_1
(if (<= z 4e-90) (* t y) (if (<= z 1.36e-56) t_1 t_2)))))))
double code(double x, double y, double z, double t) {
double t_1 = -y * x;
double t_2 = (x - t) * z;
double tmp;
if (z <= -400.0) {
tmp = t_2;
} else if (z <= -2.2e-167) {
tmp = fma(z, x, x);
} else if (z <= -3e-290) {
tmp = t_1;
} else if (z <= 4e-90) {
tmp = t * y;
} else if (z <= 1.36e-56) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(-y) * x) t_2 = Float64(Float64(x - t) * z) tmp = 0.0 if (z <= -400.0) tmp = t_2; elseif (z <= -2.2e-167) tmp = fma(z, x, x); elseif (z <= -3e-290) tmp = t_1; elseif (z <= 4e-90) tmp = Float64(t * y); elseif (z <= 1.36e-56) tmp = t_1; else tmp = t_2; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[((-y) * x), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x - t), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -400.0], t$95$2, If[LessEqual[z, -2.2e-167], N[(z * x + x), $MachinePrecision], If[LessEqual[z, -3e-290], t$95$1, If[LessEqual[z, 4e-90], N[(t * y), $MachinePrecision], If[LessEqual[z, 1.36e-56], t$95$1, t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-y\right) \cdot x\\
t_2 := \left(x - t\right) \cdot z\\
\mathbf{if}\;z \leq -400:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq -2.2 \cdot 10^{-167}:\\
\;\;\;\;\mathsf{fma}\left(z, x, x\right)\\
\mathbf{elif}\;z \leq -3 \cdot 10^{-290}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4 \cdot 10^{-90}:\\
\;\;\;\;t \cdot y\\
\mathbf{elif}\;z \leq 1.36 \cdot 10^{-56}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if z < -400 or 1.36000000000000006e-56 < z Initial program 100.0%
Taylor expanded in y around 0
associate-+r+N/A
*-commutativeN/A
negate-sub2N/A
fp-cancel-sub-signN/A
lower--.f64N/A
associate-*r*N/A
mul-1-negN/A
fp-cancel-sub-signN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lower-*.f64N/A
lower--.f6493.5
Applied rewrites93.5%
Taylor expanded in z around inf
negate-sub2N/A
mul-1-negN/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
negate-sub2N/A
lift--.f6472.0
Applied rewrites72.0%
if -400 < z < -2.2e-167Initial program 100.0%
Taylor expanded in t around 0
associate-*r*N/A
mul-1-negN/A
fp-cancel-sub-signN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6456.1
Applied rewrites56.1%
Taylor expanded in y around 0
associate-*r*N/A
mul-1-negN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6429.5
Applied rewrites29.5%
if -2.2e-167 < z < -2.99999999999999992e-290 or 3.99999999999999998e-90 < z < 1.36000000000000006e-56Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift--.f6461.1
Applied rewrites61.1%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6427.7
Applied rewrites27.7%
if -2.99999999999999992e-290 < z < 3.99999999999999998e-90Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift--.f6462.0
Applied rewrites62.0%
Taylor expanded in x around 0
Applied rewrites38.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- y) x)))
(if (<= y -2.9e+174)
(* t y)
(if (<= y -9e+16) t_1 (if (<= y 3.5e+51) (fma z x x) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = -y * x;
double tmp;
if (y <= -2.9e+174) {
tmp = t * y;
} else if (y <= -9e+16) {
tmp = t_1;
} else if (y <= 3.5e+51) {
tmp = fma(z, x, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(-y) * x) tmp = 0.0 if (y <= -2.9e+174) tmp = Float64(t * y); elseif (y <= -9e+16) tmp = t_1; elseif (y <= 3.5e+51) tmp = fma(z, x, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[((-y) * x), $MachinePrecision]}, If[LessEqual[y, -2.9e+174], N[(t * y), $MachinePrecision], If[LessEqual[y, -9e+16], t$95$1, If[LessEqual[y, 3.5e+51], N[(z * x + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-y\right) \cdot x\\
\mathbf{if}\;y \leq -2.9 \cdot 10^{+174}:\\
\;\;\;\;t \cdot y\\
\mathbf{elif}\;y \leq -9 \cdot 10^{+16}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 3.5 \cdot 10^{+51}:\\
\;\;\;\;\mathsf{fma}\left(z, x, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -2.9e174Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift--.f6492.5
Applied rewrites92.5%
Taylor expanded in x around 0
Applied rewrites50.3%
if -2.9e174 < y < -9e16 or 3.5e51 < y Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift--.f6452.8
Applied rewrites52.8%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6441.6
Applied rewrites41.6%
if -9e16 < y < 3.5e51Initial program 100.0%
Taylor expanded in t around 0
associate-*r*N/A
mul-1-negN/A
fp-cancel-sub-signN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6459.1
Applied rewrites59.1%
Taylor expanded in y around 0
associate-*r*N/A
mul-1-negN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6455.7
Applied rewrites55.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- y) x)))
(if (<= z -3.8e+125)
(* (- z) t)
(if (<= z -2800000000.0)
(* z x)
(if (<= z -3e-290)
t_1
(if (<= z 4e-90) (* t y) (if (<= z 4.2e+49) t_1 (* z x))))))))
double code(double x, double y, double z, double t) {
double t_1 = -y * x;
double tmp;
if (z <= -3.8e+125) {
tmp = -z * t;
} else if (z <= -2800000000.0) {
tmp = z * x;
} else if (z <= -3e-290) {
tmp = t_1;
} else if (z <= 4e-90) {
tmp = t * y;
} else if (z <= 4.2e+49) {
tmp = t_1;
} else {
tmp = z * 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)
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) :: t_1
real(8) :: tmp
t_1 = -y * x
if (z <= (-3.8d+125)) then
tmp = -z * t
else if (z <= (-2800000000.0d0)) then
tmp = z * x
else if (z <= (-3d-290)) then
tmp = t_1
else if (z <= 4d-90) then
tmp = t * y
else if (z <= 4.2d+49) then
tmp = t_1
else
tmp = z * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = -y * x;
double tmp;
if (z <= -3.8e+125) {
tmp = -z * t;
} else if (z <= -2800000000.0) {
tmp = z * x;
} else if (z <= -3e-290) {
tmp = t_1;
} else if (z <= 4e-90) {
tmp = t * y;
} else if (z <= 4.2e+49) {
tmp = t_1;
} else {
tmp = z * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = -y * x tmp = 0 if z <= -3.8e+125: tmp = -z * t elif z <= -2800000000.0: tmp = z * x elif z <= -3e-290: tmp = t_1 elif z <= 4e-90: tmp = t * y elif z <= 4.2e+49: tmp = t_1 else: tmp = z * x return tmp
function code(x, y, z, t) t_1 = Float64(Float64(-y) * x) tmp = 0.0 if (z <= -3.8e+125) tmp = Float64(Float64(-z) * t); elseif (z <= -2800000000.0) tmp = Float64(z * x); elseif (z <= -3e-290) tmp = t_1; elseif (z <= 4e-90) tmp = Float64(t * y); elseif (z <= 4.2e+49) tmp = t_1; else tmp = Float64(z * x); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = -y * x; tmp = 0.0; if (z <= -3.8e+125) tmp = -z * t; elseif (z <= -2800000000.0) tmp = z * x; elseif (z <= -3e-290) tmp = t_1; elseif (z <= 4e-90) tmp = t * y; elseif (z <= 4.2e+49) tmp = t_1; else tmp = z * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[((-y) * x), $MachinePrecision]}, If[LessEqual[z, -3.8e+125], N[((-z) * t), $MachinePrecision], If[LessEqual[z, -2800000000.0], N[(z * x), $MachinePrecision], If[LessEqual[z, -3e-290], t$95$1, If[LessEqual[z, 4e-90], N[(t * y), $MachinePrecision], If[LessEqual[z, 4.2e+49], t$95$1, N[(z * x), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-y\right) \cdot x\\
\mathbf{if}\;z \leq -3.8 \cdot 10^{+125}:\\
\;\;\;\;\left(-z\right) \cdot t\\
\mathbf{elif}\;z \leq -2800000000:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;z \leq -3 \cdot 10^{-290}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4 \cdot 10^{-90}:\\
\;\;\;\;t \cdot y\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{+49}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if z < -3.80000000000000002e125Initial program 100.0%
Taylor expanded in z around inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
lift--.f6488.2
Applied rewrites88.2%
Taylor expanded in x around 0
Applied rewrites47.3%
if -3.80000000000000002e125 < z < -2.8e9 or 4.20000000000000022e49 < z Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift--.f6453.0
Applied rewrites53.0%
Taylor expanded in z around inf
Applied rewrites40.6%
if -2.8e9 < z < -2.99999999999999992e-290 or 3.99999999999999998e-90 < z < 4.20000000000000022e49Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift--.f6457.5
Applied rewrites57.5%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6427.9
Applied rewrites27.9%
if -2.99999999999999992e-290 < z < 3.99999999999999998e-90Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift--.f6462.0
Applied rewrites62.0%
Taylor expanded in x around 0
Applied rewrites38.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- y) x)))
(if (<= z -2800000000.0)
(* z x)
(if (<= z -3e-290)
t_1
(if (<= z 4e-90) (* t y) (if (<= z 4.2e+49) t_1 (* z x)))))))
double code(double x, double y, double z, double t) {
double t_1 = -y * x;
double tmp;
if (z <= -2800000000.0) {
tmp = z * x;
} else if (z <= -3e-290) {
tmp = t_1;
} else if (z <= 4e-90) {
tmp = t * y;
} else if (z <= 4.2e+49) {
tmp = t_1;
} else {
tmp = z * 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)
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) :: t_1
real(8) :: tmp
t_1 = -y * x
if (z <= (-2800000000.0d0)) then
tmp = z * x
else if (z <= (-3d-290)) then
tmp = t_1
else if (z <= 4d-90) then
tmp = t * y
else if (z <= 4.2d+49) then
tmp = t_1
else
tmp = z * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = -y * x;
double tmp;
if (z <= -2800000000.0) {
tmp = z * x;
} else if (z <= -3e-290) {
tmp = t_1;
} else if (z <= 4e-90) {
tmp = t * y;
} else if (z <= 4.2e+49) {
tmp = t_1;
} else {
tmp = z * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = -y * x tmp = 0 if z <= -2800000000.0: tmp = z * x elif z <= -3e-290: tmp = t_1 elif z <= 4e-90: tmp = t * y elif z <= 4.2e+49: tmp = t_1 else: tmp = z * x return tmp
function code(x, y, z, t) t_1 = Float64(Float64(-y) * x) tmp = 0.0 if (z <= -2800000000.0) tmp = Float64(z * x); elseif (z <= -3e-290) tmp = t_1; elseif (z <= 4e-90) tmp = Float64(t * y); elseif (z <= 4.2e+49) tmp = t_1; else tmp = Float64(z * x); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = -y * x; tmp = 0.0; if (z <= -2800000000.0) tmp = z * x; elseif (z <= -3e-290) tmp = t_1; elseif (z <= 4e-90) tmp = t * y; elseif (z <= 4.2e+49) tmp = t_1; else tmp = z * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[((-y) * x), $MachinePrecision]}, If[LessEqual[z, -2800000000.0], N[(z * x), $MachinePrecision], If[LessEqual[z, -3e-290], t$95$1, If[LessEqual[z, 4e-90], N[(t * y), $MachinePrecision], If[LessEqual[z, 4.2e+49], t$95$1, N[(z * x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-y\right) \cdot x\\
\mathbf{if}\;z \leq -2800000000:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;z \leq -3 \cdot 10^{-290}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4 \cdot 10^{-90}:\\
\;\;\;\;t \cdot y\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{+49}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if z < -2.8e9 or 4.20000000000000022e49 < z Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift--.f6453.5
Applied rewrites53.5%
Taylor expanded in z around inf
Applied rewrites43.1%
if -2.8e9 < z < -2.99999999999999992e-290 or 3.99999999999999998e-90 < z < 4.20000000000000022e49Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift--.f6457.5
Applied rewrites57.5%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6427.9
Applied rewrites27.9%
if -2.99999999999999992e-290 < z < 3.99999999999999998e-90Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift--.f6462.0
Applied rewrites62.0%
Taylor expanded in x around 0
Applied rewrites38.0%
(FPCore (x y z t) :precision binary64 (if (<= z -2800000000.0) (* z x) (if (<= z 2500000000000.0) (* t y) (* z x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2800000000.0) {
tmp = z * x;
} else if (z <= 2500000000000.0) {
tmp = t * y;
} else {
tmp = z * 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)
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) :: tmp
if (z <= (-2800000000.0d0)) then
tmp = z * x
else if (z <= 2500000000000.0d0) then
tmp = t * y
else
tmp = z * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2800000000.0) {
tmp = z * x;
} else if (z <= 2500000000000.0) {
tmp = t * y;
} else {
tmp = z * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2800000000.0: tmp = z * x elif z <= 2500000000000.0: tmp = t * y else: tmp = z * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2800000000.0) tmp = Float64(z * x); elseif (z <= 2500000000000.0) tmp = Float64(t * y); else tmp = Float64(z * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -2800000000.0) tmp = z * x; elseif (z <= 2500000000000.0) tmp = t * y; else tmp = z * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2800000000.0], N[(z * x), $MachinePrecision], If[LessEqual[z, 2500000000000.0], N[(t * y), $MachinePrecision], N[(z * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2800000000:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;z \leq 2500000000000:\\
\;\;\;\;t \cdot y\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if z < -2.8e9 or 2.5e12 < z Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift--.f6453.5
Applied rewrites53.5%
Taylor expanded in z around inf
Applied rewrites42.2%
if -2.8e9 < z < 2.5e12Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift--.f6459.3
Applied rewrites59.3%
Taylor expanded in x around 0
Applied rewrites35.2%
(FPCore (x y z t) :precision binary64 (if (<= y -9e-63) (* t y) (if (<= y 6.2e-76) x (* t y))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -9e-63) {
tmp = t * y;
} else if (y <= 6.2e-76) {
tmp = x;
} else {
tmp = t * 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)
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) :: tmp
if (y <= (-9d-63)) then
tmp = t * y
else if (y <= 6.2d-76) then
tmp = x
else
tmp = t * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -9e-63) {
tmp = t * y;
} else if (y <= 6.2e-76) {
tmp = x;
} else {
tmp = t * y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -9e-63: tmp = t * y elif y <= 6.2e-76: tmp = x else: tmp = t * y return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -9e-63) tmp = Float64(t * y); elseif (y <= 6.2e-76) tmp = x; else tmp = Float64(t * y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -9e-63) tmp = t * y; elseif (y <= 6.2e-76) tmp = x; else tmp = t * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -9e-63], N[(t * y), $MachinePrecision], If[LessEqual[y, 6.2e-76], x, N[(t * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9 \cdot 10^{-63}:\\
\;\;\;\;t \cdot y\\
\mathbf{elif}\;y \leq 6.2 \cdot 10^{-76}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t \cdot y\\
\end{array}
\end{array}
if y < -8.9999999999999999e-63 or 6.19999999999999939e-76 < y Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift--.f6468.5
Applied rewrites68.5%
Taylor expanded in x around 0
Applied rewrites37.9%
if -8.9999999999999999e-63 < y < 6.19999999999999939e-76Initial program 100.0%
Taylor expanded in y around 0
associate-*r*N/A
mul-1-negN/A
fp-cancel-sub-signN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6494.0
Applied rewrites94.0%
Taylor expanded in z around 0
Applied rewrites35.3%
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
return x;
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x
end function
public static double code(double x, double y, double z, double t) {
return x;
}
def code(x, y, z, t): return x
function code(x, y, z, t) return x end
function tmp = code(x, y, z, t) tmp = x; end
code[x_, y_, z_, t_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 100.0%
Taylor expanded in y around 0
associate-*r*N/A
mul-1-negN/A
fp-cancel-sub-signN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6459.4
Applied rewrites59.4%
Taylor expanded in z around 0
Applied rewrites17.8%
herbie shell --seed 2025119
(FPCore (x y z t)
:name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
:precision binary64
(+ x (* (- y z) (- t x))))