
(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 14 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 (<= y -1.6e+102) (* (- t x) y) (if (<= y 0.0036) (fma (- x t) z x) (fma (- t x) y x))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.6e+102) {
tmp = (t - x) * y;
} else if (y <= 0.0036) {
tmp = fma((x - t), z, x);
} else {
tmp = fma((t - x), y, x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= -1.6e+102) tmp = Float64(Float64(t - x) * y); elseif (y <= 0.0036) tmp = fma(Float64(x - t), z, x); else tmp = fma(Float64(t - x), y, x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.6e+102], N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[y, 0.0036], N[(N[(x - t), $MachinePrecision] * z + x), $MachinePrecision], N[(N[(t - x), $MachinePrecision] * y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.6 \cdot 10^{+102}:\\
\;\;\;\;\left(t - x\right) \cdot y\\
\mathbf{elif}\;y \leq 0.0036:\\
\;\;\;\;\mathsf{fma}\left(x - t, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t - x, y, x\right)\\
\end{array}
\end{array}
if y < -1.6e102Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift--.f6486.6
Applied rewrites86.6%
if -1.6e102 < y < 0.0035999999999999999Initial 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--.f6483.8
Applied rewrites83.8%
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
*-commutativeN/A
mul-1-negN/A
negate-sub2N/A
+-commutativeN/A
negate-sub2N/A
mul-1-negN/A
*-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
negate-sub2N/A
lower--.f6483.8
Applied rewrites83.8%
if 0.0035999999999999999 < y Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6478.7
Applied rewrites78.7%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (- x t) z))) (if (<= z -3e-7) t_1 (if (<= z 1.2e+46) (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 <= -3e-7) {
tmp = t_1;
} else if (z <= 1.2e+46) {
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 <= -3e-7) tmp = t_1; elseif (z <= 1.2e+46) 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, -3e-7], t$95$1, If[LessEqual[z, 1.2e+46], 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 -3 \cdot 10^{-7}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{+46}:\\
\;\;\;\;\mathsf{fma}\left(t - x, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.9999999999999999e-7 or 1.20000000000000004e46 < z 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--.f6480.3
Applied rewrites80.3%
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
lower--.f6479.8
Applied rewrites79.8%
if -2.9999999999999999e-7 < z < 1.20000000000000004e46Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6486.6
Applied rewrites86.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- t x) y)))
(if (<= y -1.6e+102)
t_1
(if (<= y 2.75e-247)
(* (- x t) z)
(if (<= y 19000000000000.0) (- 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.6e+102) {
tmp = t_1;
} else if (y <= 2.75e-247) {
tmp = (x - t) * z;
} else if (y <= 19000000000000.0) {
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.6d+102)) then
tmp = t_1
else if (y <= 2.75d-247) then
tmp = (x - t) * z
else if (y <= 19000000000000.0d0) 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.6e+102) {
tmp = t_1;
} else if (y <= 2.75e-247) {
tmp = (x - t) * z;
} else if (y <= 19000000000000.0) {
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.6e+102: tmp = t_1 elif y <= 2.75e-247: tmp = (x - t) * z elif y <= 19000000000000.0: 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.6e+102) tmp = t_1; elseif (y <= 2.75e-247) tmp = Float64(Float64(x - t) * z); elseif (y <= 19000000000000.0) tmp = Float64(x - Float64(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.6e+102) tmp = t_1; elseif (y <= 2.75e-247) tmp = (x - t) * z; elseif (y <= 19000000000000.0) 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.6e+102], t$95$1, If[LessEqual[y, 2.75e-247], N[(N[(x - t), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[y, 19000000000000.0], N[(x - N[(t * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t - x\right) \cdot y\\
\mathbf{if}\;y \leq -1.6 \cdot 10^{+102}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.75 \cdot 10^{-247}:\\
\;\;\;\;\left(x - t\right) \cdot z\\
\mathbf{elif}\;y \leq 19000000000000:\\
\;\;\;\;x - t \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.6e102 or 1.9e13 < y Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift--.f6482.8
Applied rewrites82.8%
if -1.6e102 < y < 2.74999999999999997e-247Initial 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--.f6481.9
Applied rewrites81.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
lower--.f6456.8
Applied rewrites56.8%
if 2.74999999999999997e-247 < y < 1.9e13Initial 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--.f6485.3
Applied rewrites85.3%
Taylor expanded in x around 0
lower-*.f6462.8
Applied rewrites62.8%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (- t x) y))) (if (<= y -1.6e+102) t_1 (if (<= y 48000000000000.0) (* (- 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.6e+102) {
tmp = t_1;
} else if (y <= 48000000000000.0) {
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.6d+102)) then
tmp = t_1
else if (y <= 48000000000000.0d0) 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.6e+102) {
tmp = t_1;
} else if (y <= 48000000000000.0) {
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.6e+102: tmp = t_1 elif y <= 48000000000000.0: 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.6e+102) tmp = t_1; elseif (y <= 48000000000000.0) 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.6e+102) tmp = t_1; elseif (y <= 48000000000000.0) 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.6e+102], t$95$1, If[LessEqual[y, 48000000000000.0], 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.6 \cdot 10^{+102}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 48000000000000:\\
\;\;\;\;\left(x - t\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.6e102 or 4.8e13 < y Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift--.f6482.9
Applied rewrites82.9%
if -1.6e102 < y < 4.8e13Initial 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--.f6483.1
Applied rewrites83.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
lower--.f6456.6
Applied rewrites56.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- x t) z)))
(if (<= z -1.15e-37)
t_1
(if (<= z -3.7e-109)
(* (- 1.0 y) x)
(if (<= z 7.5e+32) (fma t y x) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (x - t) * z;
double tmp;
if (z <= -1.15e-37) {
tmp = t_1;
} else if (z <= -3.7e-109) {
tmp = (1.0 - y) * x;
} else if (z <= 7.5e+32) {
tmp = fma(t, 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 <= -1.15e-37) tmp = t_1; elseif (z <= -3.7e-109) tmp = Float64(Float64(1.0 - y) * x); elseif (z <= 7.5e+32) tmp = fma(t, 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, -1.15e-37], t$95$1, If[LessEqual[z, -3.7e-109], N[(N[(1.0 - y), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, 7.5e+32], N[(t * y + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x - t\right) \cdot z\\
\mathbf{if}\;z \leq -1.15 \cdot 10^{-37}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -3.7 \cdot 10^{-109}:\\
\;\;\;\;\left(1 - y\right) \cdot x\\
\mathbf{elif}\;z \leq 7.5 \cdot 10^{+32}:\\
\;\;\;\;\mathsf{fma}\left(t, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.15e-37 or 7.49999999999999959e32 < z 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--.f6478.5
Applied rewrites78.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
lower--.f6476.6
Applied rewrites76.6%
if -1.15e-37 < z < -3.69999999999999981e-109Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6483.0
Applied rewrites83.0%
Taylor expanded in y around 0
Applied rewrites29.9%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
negate-subN/A
lower--.f6453.0
Applied rewrites53.0%
if -3.69999999999999981e-109 < z < 7.49999999999999959e32Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6488.9
Applied rewrites88.9%
Taylor expanded in x around 0
Applied rewrites65.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- z) t)))
(if (<= z -5.1e+191)
t_1
(if (<= z -3.8e-10)
(fma x z x)
(if (<= z -3.7e-109)
(* (- 1.0 y) x)
(if (<= z 2e+38) (fma t y x) (if (<= z 1.5e+190) t_1 (* z x))))))))
double code(double x, double y, double z, double t) {
double t_1 = -z * t;
double tmp;
if (z <= -5.1e+191) {
tmp = t_1;
} else if (z <= -3.8e-10) {
tmp = fma(x, z, x);
} else if (z <= -3.7e-109) {
tmp = (1.0 - y) * x;
} else if (z <= 2e+38) {
tmp = fma(t, y, x);
} else if (z <= 1.5e+190) {
tmp = t_1;
} else {
tmp = z * x;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(-z) * t) tmp = 0.0 if (z <= -5.1e+191) tmp = t_1; elseif (z <= -3.8e-10) tmp = fma(x, z, x); elseif (z <= -3.7e-109) tmp = Float64(Float64(1.0 - y) * x); elseif (z <= 2e+38) tmp = fma(t, y, x); elseif (z <= 1.5e+190) tmp = t_1; else tmp = Float64(z * x); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[((-z) * t), $MachinePrecision]}, If[LessEqual[z, -5.1e+191], t$95$1, If[LessEqual[z, -3.8e-10], N[(x * z + x), $MachinePrecision], If[LessEqual[z, -3.7e-109], N[(N[(1.0 - y), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, 2e+38], N[(t * y + x), $MachinePrecision], If[LessEqual[z, 1.5e+190], t$95$1, N[(z * x), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-z\right) \cdot t\\
\mathbf{if}\;z \leq -5.1 \cdot 10^{+191}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -3.8 \cdot 10^{-10}:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\mathbf{elif}\;z \leq -3.7 \cdot 10^{-109}:\\
\;\;\;\;\left(1 - y\right) \cdot x\\
\mathbf{elif}\;z \leq 2 \cdot 10^{+38}:\\
\;\;\;\;\mathsf{fma}\left(t, y, x\right)\\
\mathbf{elif}\;z \leq 1.5 \cdot 10^{+190}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if z < -5.09999999999999982e191 or 1.99999999999999995e38 < z < 1.49999999999999991e190Initial 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--.f6482.2
Applied rewrites82.2%
Taylor expanded in x around 0
Applied rewrites44.1%
if -5.09999999999999982e191 < z < -3.7999999999999998e-10Initial 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--.f6469.7
Applied rewrites69.7%
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
*-commutativeN/A
mul-1-negN/A
negate-sub2N/A
+-commutativeN/A
negate-sub2N/A
mul-1-negN/A
*-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
negate-sub2N/A
lower--.f6469.8
Applied rewrites69.8%
Taylor expanded in x around inf
Applied rewrites36.9%
if -3.7999999999999998e-10 < z < -3.69999999999999981e-109Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6480.9
Applied rewrites80.9%
Taylor expanded in y around 0
Applied rewrites29.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
negate-subN/A
lower--.f6452.3
Applied rewrites52.3%
if -3.69999999999999981e-109 < z < 1.99999999999999995e38Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6488.5
Applied rewrites88.5%
Taylor expanded in x around 0
Applied rewrites65.7%
if 1.49999999999999991e190 < 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--.f6491.6
Applied rewrites91.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6447.7
Applied rewrites47.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- z) t)))
(if (<= z -5.1e+191)
t_1
(if (<= z -2.7e-16)
(fma x z x)
(if (<= z -8.8e-108)
(* (- x) y)
(if (<= z 2e+38) (fma t y x) (if (<= z 1.5e+190) t_1 (* z x))))))))
double code(double x, double y, double z, double t) {
double t_1 = -z * t;
double tmp;
if (z <= -5.1e+191) {
tmp = t_1;
} else if (z <= -2.7e-16) {
tmp = fma(x, z, x);
} else if (z <= -8.8e-108) {
tmp = -x * y;
} else if (z <= 2e+38) {
tmp = fma(t, y, x);
} else if (z <= 1.5e+190) {
tmp = t_1;
} else {
tmp = z * x;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(-z) * t) tmp = 0.0 if (z <= -5.1e+191) tmp = t_1; elseif (z <= -2.7e-16) tmp = fma(x, z, x); elseif (z <= -8.8e-108) tmp = Float64(Float64(-x) * y); elseif (z <= 2e+38) tmp = fma(t, y, x); elseif (z <= 1.5e+190) tmp = t_1; else tmp = Float64(z * x); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[((-z) * t), $MachinePrecision]}, If[LessEqual[z, -5.1e+191], t$95$1, If[LessEqual[z, -2.7e-16], N[(x * z + x), $MachinePrecision], If[LessEqual[z, -8.8e-108], N[((-x) * y), $MachinePrecision], If[LessEqual[z, 2e+38], N[(t * y + x), $MachinePrecision], If[LessEqual[z, 1.5e+190], t$95$1, N[(z * x), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-z\right) \cdot t\\
\mathbf{if}\;z \leq -5.1 \cdot 10^{+191}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -2.7 \cdot 10^{-16}:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\mathbf{elif}\;z \leq -8.8 \cdot 10^{-108}:\\
\;\;\;\;\left(-x\right) \cdot y\\
\mathbf{elif}\;z \leq 2 \cdot 10^{+38}:\\
\;\;\;\;\mathsf{fma}\left(t, y, x\right)\\
\mathbf{elif}\;z \leq 1.5 \cdot 10^{+190}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if z < -5.09999999999999982e191 or 1.99999999999999995e38 < z < 1.49999999999999991e190Initial 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--.f6482.2
Applied rewrites82.2%
Taylor expanded in x around 0
Applied rewrites44.1%
if -5.09999999999999982e191 < z < -2.69999999999999999e-16Initial 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--.f6469.5
Applied rewrites69.5%
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
*-commutativeN/A
mul-1-negN/A
negate-sub2N/A
+-commutativeN/A
negate-sub2N/A
mul-1-negN/A
*-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
negate-sub2N/A
lower--.f6469.5
Applied rewrites69.5%
Taylor expanded in x around inf
Applied rewrites36.8%
if -2.69999999999999999e-16 < z < -8.8000000000000005e-108Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift--.f6453.8
Applied rewrites53.8%
Taylor expanded in x around inf
mul-1-negN/A
lower-neg.f6425.3
Applied rewrites25.3%
if -8.8000000000000005e-108 < z < 1.99999999999999995e38Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6488.5
Applied rewrites88.5%
Taylor expanded in x around 0
Applied rewrites65.7%
if 1.49999999999999991e190 < 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--.f6491.6
Applied rewrites91.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6447.7
Applied rewrites47.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- z) t)))
(if (<= z -5.1e+191)
t_1
(if (<= z -2.6e+26)
(* z x)
(if (<= z -8.8e-108)
(* (- x) y)
(if (<= z 2e+38) (fma t y x) (if (<= z 1.5e+190) t_1 (* z x))))))))
double code(double x, double y, double z, double t) {
double t_1 = -z * t;
double tmp;
if (z <= -5.1e+191) {
tmp = t_1;
} else if (z <= -2.6e+26) {
tmp = z * x;
} else if (z <= -8.8e-108) {
tmp = -x * y;
} else if (z <= 2e+38) {
tmp = fma(t, y, x);
} else if (z <= 1.5e+190) {
tmp = t_1;
} else {
tmp = z * x;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(-z) * t) tmp = 0.0 if (z <= -5.1e+191) tmp = t_1; elseif (z <= -2.6e+26) tmp = Float64(z * x); elseif (z <= -8.8e-108) tmp = Float64(Float64(-x) * y); elseif (z <= 2e+38) tmp = fma(t, y, x); elseif (z <= 1.5e+190) tmp = t_1; else tmp = Float64(z * x); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[((-z) * t), $MachinePrecision]}, If[LessEqual[z, -5.1e+191], t$95$1, If[LessEqual[z, -2.6e+26], N[(z * x), $MachinePrecision], If[LessEqual[z, -8.8e-108], N[((-x) * y), $MachinePrecision], If[LessEqual[z, 2e+38], N[(t * y + x), $MachinePrecision], If[LessEqual[z, 1.5e+190], t$95$1, N[(z * x), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-z\right) \cdot t\\
\mathbf{if}\;z \leq -5.1 \cdot 10^{+191}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -2.6 \cdot 10^{+26}:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;z \leq -8.8 \cdot 10^{-108}:\\
\;\;\;\;\left(-x\right) \cdot y\\
\mathbf{elif}\;z \leq 2 \cdot 10^{+38}:\\
\;\;\;\;\mathsf{fma}\left(t, y, x\right)\\
\mathbf{elif}\;z \leq 1.5 \cdot 10^{+190}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if z < -5.09999999999999982e191 or 1.99999999999999995e38 < z < 1.49999999999999991e190Initial 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--.f6482.2
Applied rewrites82.2%
Taylor expanded in x around 0
Applied rewrites44.1%
if -5.09999999999999982e191 < z < -2.60000000000000002e26 or 1.49999999999999991e190 < 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.1
Applied rewrites81.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6443.1
Applied rewrites43.1%
if -2.60000000000000002e26 < z < -8.8000000000000005e-108Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift--.f6451.9
Applied rewrites51.9%
Taylor expanded in x around inf
mul-1-negN/A
lower-neg.f6425.5
Applied rewrites25.5%
if -8.8000000000000005e-108 < z < 1.99999999999999995e38Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6488.5
Applied rewrites88.5%
Taylor expanded in x around 0
Applied rewrites65.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- z) t)))
(if (<= z -5.1e+191)
t_1
(if (<= z -2.6e+26)
(* z x)
(if (<= z -3.9e-109)
(* (- x) y)
(if (<= z -1.76e-214)
x
(if (<= z 2e+38) (* y t) (if (<= z 1.5e+190) t_1 (* z x)))))))))
double code(double x, double y, double z, double t) {
double t_1 = -z * t;
double tmp;
if (z <= -5.1e+191) {
tmp = t_1;
} else if (z <= -2.6e+26) {
tmp = z * x;
} else if (z <= -3.9e-109) {
tmp = -x * y;
} else if (z <= -1.76e-214) {
tmp = x;
} else if (z <= 2e+38) {
tmp = y * t;
} else if (z <= 1.5e+190) {
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 = -z * t
if (z <= (-5.1d+191)) then
tmp = t_1
else if (z <= (-2.6d+26)) then
tmp = z * x
else if (z <= (-3.9d-109)) then
tmp = -x * y
else if (z <= (-1.76d-214)) then
tmp = x
else if (z <= 2d+38) then
tmp = y * t
else if (z <= 1.5d+190) 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 = -z * t;
double tmp;
if (z <= -5.1e+191) {
tmp = t_1;
} else if (z <= -2.6e+26) {
tmp = z * x;
} else if (z <= -3.9e-109) {
tmp = -x * y;
} else if (z <= -1.76e-214) {
tmp = x;
} else if (z <= 2e+38) {
tmp = y * t;
} else if (z <= 1.5e+190) {
tmp = t_1;
} else {
tmp = z * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = -z * t tmp = 0 if z <= -5.1e+191: tmp = t_1 elif z <= -2.6e+26: tmp = z * x elif z <= -3.9e-109: tmp = -x * y elif z <= -1.76e-214: tmp = x elif z <= 2e+38: tmp = y * t elif z <= 1.5e+190: tmp = t_1 else: tmp = z * x return tmp
function code(x, y, z, t) t_1 = Float64(Float64(-z) * t) tmp = 0.0 if (z <= -5.1e+191) tmp = t_1; elseif (z <= -2.6e+26) tmp = Float64(z * x); elseif (z <= -3.9e-109) tmp = Float64(Float64(-x) * y); elseif (z <= -1.76e-214) tmp = x; elseif (z <= 2e+38) tmp = Float64(y * t); elseif (z <= 1.5e+190) tmp = t_1; else tmp = Float64(z * x); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = -z * t; tmp = 0.0; if (z <= -5.1e+191) tmp = t_1; elseif (z <= -2.6e+26) tmp = z * x; elseif (z <= -3.9e-109) tmp = -x * y; elseif (z <= -1.76e-214) tmp = x; elseif (z <= 2e+38) tmp = y * t; elseif (z <= 1.5e+190) tmp = t_1; else tmp = z * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[((-z) * t), $MachinePrecision]}, If[LessEqual[z, -5.1e+191], t$95$1, If[LessEqual[z, -2.6e+26], N[(z * x), $MachinePrecision], If[LessEqual[z, -3.9e-109], N[((-x) * y), $MachinePrecision], If[LessEqual[z, -1.76e-214], x, If[LessEqual[z, 2e+38], N[(y * t), $MachinePrecision], If[LessEqual[z, 1.5e+190], t$95$1, N[(z * x), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-z\right) \cdot t\\
\mathbf{if}\;z \leq -5.1 \cdot 10^{+191}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -2.6 \cdot 10^{+26}:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;z \leq -3.9 \cdot 10^{-109}:\\
\;\;\;\;\left(-x\right) \cdot y\\
\mathbf{elif}\;z \leq -1.76 \cdot 10^{-214}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2 \cdot 10^{+38}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;z \leq 1.5 \cdot 10^{+190}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if z < -5.09999999999999982e191 or 1.99999999999999995e38 < z < 1.49999999999999991e190Initial 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--.f6482.2
Applied rewrites82.2%
Taylor expanded in x around 0
Applied rewrites44.1%
if -5.09999999999999982e191 < z < -2.60000000000000002e26 or 1.49999999999999991e190 < 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.1
Applied rewrites81.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6443.1
Applied rewrites43.1%
if -2.60000000000000002e26 < z < -3.90000000000000023e-109Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift--.f6451.9
Applied rewrites51.9%
Taylor expanded in x around inf
mul-1-negN/A
lower-neg.f6425.4
Applied rewrites25.4%
if -3.90000000000000023e-109 < z < -1.75999999999999997e-214Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6493.3
Applied rewrites93.3%
Taylor expanded in y around 0
Applied rewrites34.9%
if -1.75999999999999997e-214 < z < 1.99999999999999995e38Initial program 100.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lift--.f6445.5
Applied rewrites45.5%
Taylor expanded in y around inf
Applied rewrites35.8%
(FPCore (x y z t)
:precision binary64
(if (<= z -2.6e+26)
(* z x)
(if (<= z -3.9e-109)
(* (- x) y)
(if (<= z -1.76e-214) x (if (<= z 1.2e+33) (* y t) (* z x))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.6e+26) {
tmp = z * x;
} else if (z <= -3.9e-109) {
tmp = -x * y;
} else if (z <= -1.76e-214) {
tmp = x;
} else if (z <= 1.2e+33) {
tmp = y * t;
} 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 <= (-2.6d+26)) then
tmp = z * x
else if (z <= (-3.9d-109)) then
tmp = -x * y
else if (z <= (-1.76d-214)) then
tmp = x
else if (z <= 1.2d+33) then
tmp = y * t
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 <= -2.6e+26) {
tmp = z * x;
} else if (z <= -3.9e-109) {
tmp = -x * y;
} else if (z <= -1.76e-214) {
tmp = x;
} else if (z <= 1.2e+33) {
tmp = y * t;
} else {
tmp = z * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.6e+26: tmp = z * x elif z <= -3.9e-109: tmp = -x * y elif z <= -1.76e-214: tmp = x elif z <= 1.2e+33: tmp = y * t else: tmp = z * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.6e+26) tmp = Float64(z * x); elseif (z <= -3.9e-109) tmp = Float64(Float64(-x) * y); elseif (z <= -1.76e-214) tmp = x; elseif (z <= 1.2e+33) tmp = Float64(y * t); else tmp = Float64(z * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -2.6e+26) tmp = z * x; elseif (z <= -3.9e-109) tmp = -x * y; elseif (z <= -1.76e-214) tmp = x; elseif (z <= 1.2e+33) tmp = y * t; else tmp = z * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.6e+26], N[(z * x), $MachinePrecision], If[LessEqual[z, -3.9e-109], N[((-x) * y), $MachinePrecision], If[LessEqual[z, -1.76e-214], x, If[LessEqual[z, 1.2e+33], N[(y * t), $MachinePrecision], N[(z * x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.6 \cdot 10^{+26}:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;z \leq -3.9 \cdot 10^{-109}:\\
\;\;\;\;\left(-x\right) \cdot y\\
\mathbf{elif}\;z \leq -1.76 \cdot 10^{-214}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{+33}:\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if z < -2.60000000000000002e26 or 1.2e33 < 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.3
Applied rewrites81.3%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6443.6
Applied rewrites43.6%
if -2.60000000000000002e26 < z < -3.90000000000000023e-109Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift--.f6451.9
Applied rewrites51.9%
Taylor expanded in x around inf
mul-1-negN/A
lower-neg.f6425.4
Applied rewrites25.4%
if -3.90000000000000023e-109 < z < -1.75999999999999997e-214Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6493.3
Applied rewrites93.3%
Taylor expanded in y around 0
Applied rewrites34.9%
if -1.75999999999999997e-214 < z < 1.2e33Initial program 100.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lift--.f6445.2
Applied rewrites45.2%
Taylor expanded in y around inf
Applied rewrites35.7%
(FPCore (x y z t) :precision binary64 (if (<= z -1.0) (* z x) (if (<= z -1.76e-214) x (if (<= z 1.2e+33) (* y t) (* z x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.0) {
tmp = z * x;
} else if (z <= -1.76e-214) {
tmp = x;
} else if (z <= 1.2e+33) {
tmp = y * t;
} 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 <= (-1.0d0)) then
tmp = z * x
else if (z <= (-1.76d-214)) then
tmp = x
else if (z <= 1.2d+33) then
tmp = y * t
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 <= -1.0) {
tmp = z * x;
} else if (z <= -1.76e-214) {
tmp = x;
} else if (z <= 1.2e+33) {
tmp = y * t;
} else {
tmp = z * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.0: tmp = z * x elif z <= -1.76e-214: tmp = x elif z <= 1.2e+33: tmp = y * t else: tmp = z * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.0) tmp = Float64(z * x); elseif (z <= -1.76e-214) tmp = x; elseif (z <= 1.2e+33) tmp = Float64(y * t); else tmp = Float64(z * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.0) tmp = z * x; elseif (z <= -1.76e-214) tmp = x; elseif (z <= 1.2e+33) tmp = y * t; else tmp = z * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.0], N[(z * x), $MachinePrecision], If[LessEqual[z, -1.76e-214], x, If[LessEqual[z, 1.2e+33], N[(y * t), $MachinePrecision], N[(z * x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;z \leq -1.76 \cdot 10^{-214}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{+33}:\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if z < -1 or 1.2e33 < 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--.f6479.6
Applied rewrites79.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6442.4
Applied rewrites42.4%
if -1 < z < -1.75999999999999997e-214Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6485.9
Applied rewrites85.9%
Taylor expanded in y around 0
Applied rewrites31.5%
if -1.75999999999999997e-214 < z < 1.2e33Initial program 100.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lift--.f6445.2
Applied rewrites45.2%
Taylor expanded in y around inf
Applied rewrites35.7%
(FPCore (x y z t) :precision binary64 (if (<= (- y z) -2e+37) (* z x) (if (<= (- y z) 0.0002) x (* z x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y - z) <= -2e+37) {
tmp = z * x;
} else if ((y - z) <= 0.0002) {
tmp = x;
} 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 ((y - z) <= (-2d+37)) then
tmp = z * x
else if ((y - z) <= 0.0002d0) then
tmp = x
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 ((y - z) <= -2e+37) {
tmp = z * x;
} else if ((y - z) <= 0.0002) {
tmp = x;
} else {
tmp = z * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y - z) <= -2e+37: tmp = z * x elif (y - z) <= 0.0002: tmp = x else: tmp = z * x return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(y - z) <= -2e+37) tmp = Float64(z * x); elseif (Float64(y - z) <= 0.0002) tmp = x; else tmp = Float64(z * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y - z) <= -2e+37) tmp = z * x; elseif ((y - z) <= 0.0002) tmp = x; else tmp = z * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(y - z), $MachinePrecision], -2e+37], N[(z * x), $MachinePrecision], If[LessEqual[N[(y - z), $MachinePrecision], 0.0002], x, N[(z * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y - z \leq -2 \cdot 10^{+37}:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;y - z \leq 0.0002:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if (-.f64 y z) < -1.99999999999999991e37 or 2.0000000000000001e-4 < (-.f64 y 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--.f6453.4
Applied rewrites53.4%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6428.8
Applied rewrites28.8%
if -1.99999999999999991e37 < (-.f64 y z) < 2.0000000000000001e-4Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6476.3
Applied rewrites76.3%
Taylor expanded in y around 0
Applied rewrites55.8%
(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 z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6460.3
Applied rewrites60.3%
Taylor expanded in y around 0
Applied rewrites18.1%
herbie shell --seed 2025110
(FPCore (x y z t)
:name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
:precision binary64
(+ x (* (- y z) (- t x))))