
(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 (<= z -10000000000000.0) (fma (- t) z (fma x z x)) (if (<= z 1.75e+70) (fma (- t x) y x) (* (- z) (- t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -10000000000000.0) {
tmp = fma(-t, z, fma(x, z, x));
} else if (z <= 1.75e+70) {
tmp = fma((t - x), y, x);
} else {
tmp = -z * (t - x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= -10000000000000.0) tmp = fma(Float64(-t), z, fma(x, z, x)); elseif (z <= 1.75e+70) tmp = fma(Float64(t - x), y, x); else tmp = Float64(Float64(-z) * Float64(t - x)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -10000000000000.0], N[((-t) * z + N[(x * z + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.75e+70], N[(N[(t - x), $MachinePrecision] * y + x), $MachinePrecision], N[((-z) * N[(t - x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -10000000000000:\\
\;\;\;\;\mathsf{fma}\left(-t, z, \mathsf{fma}\left(x, z, x\right)\right)\\
\mathbf{elif}\;z \leq 1.75 \cdot 10^{+70}:\\
\;\;\;\;\mathsf{fma}\left(t - x, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-z\right) \cdot \left(t - x\right)\\
\end{array}
\end{array}
if z < -1e13Initial program 100.0%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6498.2
Applied rewrites98.2%
Taylor expanded in z around -inf
associate-*r*N/A
mul-1-negN/A
lift-neg.f64N/A
mul-1-negN/A
sub-flipN/A
lower-*.f64N/A
lift--.f6444.5
Applied rewrites44.5%
Taylor expanded in y around 0
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
+-commutativeN/A
distribute-lft1-inN/A
*-commutativeN/A
lower-fma.f6458.5
Applied rewrites58.5%
if -1e13 < z < 1.75000000000000001e70Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6460.8
Applied rewrites60.8%
if 1.75000000000000001e70 < z Initial program 100.0%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6498.2
Applied rewrites98.2%
Taylor expanded in z around -inf
associate-*r*N/A
mul-1-negN/A
lift-neg.f64N/A
mul-1-negN/A
sub-flipN/A
lower-*.f64N/A
lift--.f6444.5
Applied rewrites44.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- z) (- t x))))
(if (<= z -10000000000000.0)
t_1
(if (<= z 1.75e+70) (fma (- t x) y x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = -z * (t - x);
double tmp;
if (z <= -10000000000000.0) {
tmp = t_1;
} else if (z <= 1.75e+70) {
tmp = fma((t - x), y, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(-z) * Float64(t - x)) tmp = 0.0 if (z <= -10000000000000.0) tmp = t_1; elseif (z <= 1.75e+70) 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[((-z) * N[(t - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -10000000000000.0], t$95$1, If[LessEqual[z, 1.75e+70], N[(N[(t - x), $MachinePrecision] * y + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-z\right) \cdot \left(t - x\right)\\
\mathbf{if}\;z \leq -10000000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.75 \cdot 10^{+70}:\\
\;\;\;\;\mathsf{fma}\left(t - x, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1e13 or 1.75000000000000001e70 < z Initial program 100.0%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6498.2
Applied rewrites98.2%
Taylor expanded in z around -inf
associate-*r*N/A
mul-1-negN/A
lift-neg.f64N/A
mul-1-negN/A
sub-flipN/A
lower-*.f64N/A
lift--.f6444.5
Applied rewrites44.5%
if -1e13 < z < 1.75000000000000001e70Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6460.8
Applied rewrites60.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- t x) y)))
(if (<= y -3.9e-8)
t_1
(if (<= y 1.7e-64)
(fma (- z) t x)
(if (<= y 2.7e+29) (* (- z) (- t x)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (t - x) * y;
double tmp;
if (y <= -3.9e-8) {
tmp = t_1;
} else if (y <= 1.7e-64) {
tmp = fma(-z, t, x);
} else if (y <= 2.7e+29) {
tmp = -z * (t - x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(t - x) * y) tmp = 0.0 if (y <= -3.9e-8) tmp = t_1; elseif (y <= 1.7e-64) tmp = fma(Float64(-z), t, x); elseif (y <= 2.7e+29) tmp = Float64(Float64(-z) * Float64(t - x)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -3.9e-8], t$95$1, If[LessEqual[y, 1.7e-64], N[((-z) * t + x), $MachinePrecision], If[LessEqual[y, 2.7e+29], N[((-z) * N[(t - x), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t - x\right) \cdot y\\
\mathbf{if}\;y \leq -3.9 \cdot 10^{-8}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.7 \cdot 10^{-64}:\\
\;\;\;\;\mathsf{fma}\left(-z, t, x\right)\\
\mathbf{elif}\;y \leq 2.7 \cdot 10^{+29}:\\
\;\;\;\;\left(-z\right) \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -3.89999999999999985e-8 or 2.7e29 < y Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift--.f6445.7
Applied rewrites45.7%
if -3.89999999999999985e-8 < y < 1.70000000000000006e-64Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites64.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift--.f64N/A
lower-fma.f64N/A
lift--.f6464.7
Applied rewrites64.7%
Taylor expanded in y around 0
mul-1-negN/A
lift-neg.f6441.8
Applied rewrites41.8%
if 1.70000000000000006e-64 < y < 2.7e29Initial program 100.0%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6498.2
Applied rewrites98.2%
Taylor expanded in z around -inf
associate-*r*N/A
mul-1-negN/A
lift-neg.f64N/A
mul-1-negN/A
sub-flipN/A
lower-*.f64N/A
lift--.f6444.5
Applied rewrites44.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- t x) y)))
(if (<= y -3.9e-8)
t_1
(if (<= y 1.36e-46)
(fma (- z) t x)
(if (<= y 4.6e+25) (* (- y z) t) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (t - x) * y;
double tmp;
if (y <= -3.9e-8) {
tmp = t_1;
} else if (y <= 1.36e-46) {
tmp = fma(-z, t, x);
} else if (y <= 4.6e+25) {
tmp = (y - z) * t;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(t - x) * y) tmp = 0.0 if (y <= -3.9e-8) tmp = t_1; elseif (y <= 1.36e-46) tmp = fma(Float64(-z), t, x); elseif (y <= 4.6e+25) tmp = Float64(Float64(y - z) * t); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -3.9e-8], t$95$1, If[LessEqual[y, 1.36e-46], N[((-z) * t + x), $MachinePrecision], If[LessEqual[y, 4.6e+25], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t - x\right) \cdot y\\
\mathbf{if}\;y \leq -3.9 \cdot 10^{-8}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.36 \cdot 10^{-46}:\\
\;\;\;\;\mathsf{fma}\left(-z, t, x\right)\\
\mathbf{elif}\;y \leq 4.6 \cdot 10^{+25}:\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -3.89999999999999985e-8 or 4.5999999999999996e25 < y Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift--.f6445.7
Applied rewrites45.7%
if -3.89999999999999985e-8 < y < 1.3600000000000001e-46Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites64.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift--.f64N/A
lower-fma.f64N/A
lift--.f6464.7
Applied rewrites64.7%
Taylor expanded in y around 0
mul-1-negN/A
lift-neg.f6441.8
Applied rewrites41.8%
if 1.3600000000000001e-46 < y < 4.5999999999999996e25Initial program 100.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lift--.f6449.6
Applied rewrites49.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- t x) y)))
(if (<= y -1.5e+50)
t_1
(if (<= y 3e-54) (fma z x x) (if (<= y 4.6e+25) (* (- y z) t) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (t - x) * y;
double tmp;
if (y <= -1.5e+50) {
tmp = t_1;
} else if (y <= 3e-54) {
tmp = fma(z, x, x);
} else if (y <= 4.6e+25) {
tmp = (y - z) * t;
} 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.5e+50) tmp = t_1; elseif (y <= 3e-54) tmp = fma(z, x, x); elseif (y <= 4.6e+25) tmp = Float64(Float64(y - z) * t); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -1.5e+50], t$95$1, If[LessEqual[y, 3e-54], N[(z * x + x), $MachinePrecision], If[LessEqual[y, 4.6e+25], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t - x\right) \cdot y\\
\mathbf{if}\;y \leq -1.5 \cdot 10^{+50}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 3 \cdot 10^{-54}:\\
\;\;\;\;\mathsf{fma}\left(z, x, x\right)\\
\mathbf{elif}\;y \leq 4.6 \cdot 10^{+25}:\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.4999999999999999e50 or 4.5999999999999996e25 < y Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift--.f6445.7
Applied rewrites45.7%
if -1.4999999999999999e50 < y < 3.00000000000000009e-54Initial program 100.0%
Taylor expanded in t around 0
+-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift--.f6455.7
Applied rewrites55.7%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6436.8
Applied rewrites36.8%
if 3.00000000000000009e-54 < y < 4.5999999999999996e25Initial program 100.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lift--.f6449.6
Applied rewrites49.6%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (- t x) y))) (if (<= y -1.5e+50) t_1 (if (<= y 2.4e+29) (fma z x x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (t - x) * y;
double tmp;
if (y <= -1.5e+50) {
tmp = t_1;
} else if (y <= 2.4e+29) {
tmp = fma(z, x, x);
} 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.5e+50) tmp = t_1; elseif (y <= 2.4e+29) tmp = fma(z, x, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -1.5e+50], t$95$1, If[LessEqual[y, 2.4e+29], N[(z * x + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t - x\right) \cdot y\\
\mathbf{if}\;y \leq -1.5 \cdot 10^{+50}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.4 \cdot 10^{+29}:\\
\;\;\;\;\mathsf{fma}\left(z, x, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.4999999999999999e50 or 2.4000000000000001e29 < y Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift--.f6445.7
Applied rewrites45.7%
if -1.4999999999999999e50 < y < 2.4000000000000001e29Initial program 100.0%
Taylor expanded in t around 0
+-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift--.f6455.7
Applied rewrites55.7%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6436.8
Applied rewrites36.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- z) t)))
(if (<= z -1.6e+140)
t_1
(if (<= z -14.5)
(fma z x x)
(if (<= z 7.7e-299)
(fma t y x)
(if (<= z 7.2e+75)
(* (- 1.0 y) x)
(if (<= z 4.05e+242) t_1 (* z x))))))))
double code(double x, double y, double z, double t) {
double t_1 = -z * t;
double tmp;
if (z <= -1.6e+140) {
tmp = t_1;
} else if (z <= -14.5) {
tmp = fma(z, x, x);
} else if (z <= 7.7e-299) {
tmp = fma(t, y, x);
} else if (z <= 7.2e+75) {
tmp = (1.0 - y) * x;
} else if (z <= 4.05e+242) {
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 <= -1.6e+140) tmp = t_1; elseif (z <= -14.5) tmp = fma(z, x, x); elseif (z <= 7.7e-299) tmp = fma(t, y, x); elseif (z <= 7.2e+75) tmp = Float64(Float64(1.0 - y) * x); elseif (z <= 4.05e+242) 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, -1.6e+140], t$95$1, If[LessEqual[z, -14.5], N[(z * x + x), $MachinePrecision], If[LessEqual[z, 7.7e-299], N[(t * y + x), $MachinePrecision], If[LessEqual[z, 7.2e+75], N[(N[(1.0 - y), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, 4.05e+242], t$95$1, N[(z * x), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-z\right) \cdot t\\
\mathbf{if}\;z \leq -1.6 \cdot 10^{+140}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -14.5:\\
\;\;\;\;\mathsf{fma}\left(z, x, x\right)\\
\mathbf{elif}\;z \leq 7.7 \cdot 10^{-299}:\\
\;\;\;\;\mathsf{fma}\left(t, y, x\right)\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{+75}:\\
\;\;\;\;\left(1 - y\right) \cdot x\\
\mathbf{elif}\;z \leq 4.05 \cdot 10^{+242}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if z < -1.60000000000000005e140 or 7.2e75 < z < 4.05e242Initial program 100.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lift--.f6449.6
Applied rewrites49.6%
Taylor expanded in y around 0
mul-1-negN/A
lower-neg.f6426.9
Applied rewrites26.9%
if -1.60000000000000005e140 < z < -14.5Initial program 100.0%
Taylor expanded in t around 0
+-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift--.f6455.7
Applied rewrites55.7%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6436.8
Applied rewrites36.8%
if -14.5 < z < 7.70000000000000011e-299Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6460.8
Applied rewrites60.8%
Taylor expanded in x around 0
Applied rewrites42.0%
if 7.70000000000000011e-299 < z < 7.2e75Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6460.8
Applied rewrites60.8%
Taylor expanded in x around inf
*-commutativeN/A
mul-1-negN/A
sub-flipN/A
lower-*.f64N/A
lower--.f6438.1
Applied rewrites38.1%
if 4.05e242 < z Initial program 100.0%
Taylor expanded in t around 0
+-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift--.f6455.7
Applied rewrites55.7%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f6421.8
Applied rewrites21.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- z) t)))
(if (<= z -1.6e+140)
t_1
(if (<= z -14.5)
(fma z x x)
(if (<= z 4600000.0) (fma t y x) (if (<= z 4.05e+242) t_1 (* z x)))))))
double code(double x, double y, double z, double t) {
double t_1 = -z * t;
double tmp;
if (z <= -1.6e+140) {
tmp = t_1;
} else if (z <= -14.5) {
tmp = fma(z, x, x);
} else if (z <= 4600000.0) {
tmp = fma(t, y, x);
} else if (z <= 4.05e+242) {
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 <= -1.6e+140) tmp = t_1; elseif (z <= -14.5) tmp = fma(z, x, x); elseif (z <= 4600000.0) tmp = fma(t, y, x); elseif (z <= 4.05e+242) 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, -1.6e+140], t$95$1, If[LessEqual[z, -14.5], N[(z * x + x), $MachinePrecision], If[LessEqual[z, 4600000.0], N[(t * y + x), $MachinePrecision], If[LessEqual[z, 4.05e+242], t$95$1, N[(z * x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-z\right) \cdot t\\
\mathbf{if}\;z \leq -1.6 \cdot 10^{+140}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -14.5:\\
\;\;\;\;\mathsf{fma}\left(z, x, x\right)\\
\mathbf{elif}\;z \leq 4600000:\\
\;\;\;\;\mathsf{fma}\left(t, y, x\right)\\
\mathbf{elif}\;z \leq 4.05 \cdot 10^{+242}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if z < -1.60000000000000005e140 or 4.6e6 < z < 4.05e242Initial program 100.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lift--.f6449.6
Applied rewrites49.6%
Taylor expanded in y around 0
mul-1-negN/A
lower-neg.f6426.9
Applied rewrites26.9%
if -1.60000000000000005e140 < z < -14.5Initial program 100.0%
Taylor expanded in t around 0
+-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift--.f6455.7
Applied rewrites55.7%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6436.8
Applied rewrites36.8%
if -14.5 < z < 4.6e6Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6460.8
Applied rewrites60.8%
Taylor expanded in x around 0
Applied rewrites42.0%
if 4.05e242 < z Initial program 100.0%
Taylor expanded in t around 0
+-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift--.f6455.7
Applied rewrites55.7%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f6421.8
Applied rewrites21.8%
(FPCore (x y z t) :precision binary64 (if (<= y -8.6e+66) (* t y) (if (<= y 2.4e+29) (fma z x x) (* (- x) y))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -8.6e+66) {
tmp = t * y;
} else if (y <= 2.4e+29) {
tmp = fma(z, x, x);
} else {
tmp = -x * y;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= -8.6e+66) tmp = Float64(t * y); elseif (y <= 2.4e+29) tmp = fma(z, x, x); else tmp = Float64(Float64(-x) * y); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, -8.6e+66], N[(t * y), $MachinePrecision], If[LessEqual[y, 2.4e+29], N[(z * x + x), $MachinePrecision], N[((-x) * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.6 \cdot 10^{+66}:\\
\;\;\;\;t \cdot y\\
\mathbf{elif}\;y \leq 2.4 \cdot 10^{+29}:\\
\;\;\;\;\mathsf{fma}\left(z, x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-x\right) \cdot y\\
\end{array}
\end{array}
if y < -8.60000000000000054e66Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift--.f6445.7
Applied rewrites45.7%
Taylor expanded in x around 0
Applied rewrites27.1%
if -8.60000000000000054e66 < y < 2.4000000000000001e29Initial program 100.0%
Taylor expanded in t around 0
+-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift--.f6455.7
Applied rewrites55.7%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6436.8
Applied rewrites36.8%
if 2.4000000000000001e29 < y Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift--.f6445.7
Applied rewrites45.7%
Taylor expanded in x around inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lift-neg.f6423.2
Applied rewrites23.2%
(FPCore (x y z t) :precision binary64 (if (<= y -7e-10) (* t y) (if (<= y 3.2e+58) (* (- z) t) (* (- x) y))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -7e-10) {
tmp = t * y;
} else if (y <= 3.2e+58) {
tmp = -z * t;
} else {
tmp = -x * y;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
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 <= (-7d-10)) then
tmp = t * y
else if (y <= 3.2d+58) then
tmp = -z * t
else
tmp = -x * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -7e-10) {
tmp = t * y;
} else if (y <= 3.2e+58) {
tmp = -z * t;
} else {
tmp = -x * y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -7e-10: tmp = t * y elif y <= 3.2e+58: tmp = -z * t else: tmp = -x * y return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -7e-10) tmp = Float64(t * y); elseif (y <= 3.2e+58) tmp = Float64(Float64(-z) * t); else tmp = Float64(Float64(-x) * y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -7e-10) tmp = t * y; elseif (y <= 3.2e+58) tmp = -z * t; else tmp = -x * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -7e-10], N[(t * y), $MachinePrecision], If[LessEqual[y, 3.2e+58], N[((-z) * t), $MachinePrecision], N[((-x) * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7 \cdot 10^{-10}:\\
\;\;\;\;t \cdot y\\
\mathbf{elif}\;y \leq 3.2 \cdot 10^{+58}:\\
\;\;\;\;\left(-z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;\left(-x\right) \cdot y\\
\end{array}
\end{array}
if y < -6.99999999999999961e-10Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift--.f6445.7
Applied rewrites45.7%
Taylor expanded in x around 0
Applied rewrites27.1%
if -6.99999999999999961e-10 < y < 3.20000000000000015e58Initial program 100.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lift--.f6449.6
Applied rewrites49.6%
Taylor expanded in y around 0
mul-1-negN/A
lower-neg.f6426.9
Applied rewrites26.9%
if 3.20000000000000015e58 < y Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift--.f6445.7
Applied rewrites45.7%
Taylor expanded in x around inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lift-neg.f6423.2
Applied rewrites23.2%
(FPCore (x y z t) :precision binary64 (if (<= z -1400000000000.0) (* z x) (if (<= z 2.9e-295) (* t y) (if (<= z 2.5e+72) (* (- x) y) (* z x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1400000000000.0) {
tmp = z * x;
} else if (z <= 2.9e-295) {
tmp = t * y;
} else if (z <= 2.5e+72) {
tmp = -x * 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 <= (-1400000000000.0d0)) then
tmp = z * x
else if (z <= 2.9d-295) then
tmp = t * y
else if (z <= 2.5d+72) then
tmp = -x * 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 <= -1400000000000.0) {
tmp = z * x;
} else if (z <= 2.9e-295) {
tmp = t * y;
} else if (z <= 2.5e+72) {
tmp = -x * y;
} else {
tmp = z * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1400000000000.0: tmp = z * x elif z <= 2.9e-295: tmp = t * y elif z <= 2.5e+72: tmp = -x * y else: tmp = z * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1400000000000.0) tmp = Float64(z * x); elseif (z <= 2.9e-295) tmp = Float64(t * y); elseif (z <= 2.5e+72) tmp = Float64(Float64(-x) * y); else tmp = Float64(z * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1400000000000.0) tmp = z * x; elseif (z <= 2.9e-295) tmp = t * y; elseif (z <= 2.5e+72) tmp = -x * y; else tmp = z * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1400000000000.0], N[(z * x), $MachinePrecision], If[LessEqual[z, 2.9e-295], N[(t * y), $MachinePrecision], If[LessEqual[z, 2.5e+72], N[((-x) * y), $MachinePrecision], N[(z * x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1400000000000:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;z \leq 2.9 \cdot 10^{-295}:\\
\;\;\;\;t \cdot y\\
\mathbf{elif}\;z \leq 2.5 \cdot 10^{+72}:\\
\;\;\;\;\left(-x\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if z < -1.4e12 or 2.49999999999999996e72 < z Initial program 100.0%
Taylor expanded in t around 0
+-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift--.f6455.7
Applied rewrites55.7%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f6421.8
Applied rewrites21.8%
if -1.4e12 < z < 2.90000000000000015e-295Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift--.f6445.7
Applied rewrites45.7%
Taylor expanded in x around 0
Applied rewrites27.1%
if 2.90000000000000015e-295 < z < 2.49999999999999996e72Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift--.f6445.7
Applied rewrites45.7%
Taylor expanded in x around inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lift-neg.f6423.2
Applied rewrites23.2%
(FPCore (x y z t) :precision binary64 (if (<= z -1400000000000.0) (* z x) (if (<= z 7.6e+48) (* t y) (* z x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1400000000000.0) {
tmp = z * x;
} else if (z <= 7.6e+48) {
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 <= (-1400000000000.0d0)) then
tmp = z * x
else if (z <= 7.6d+48) 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 <= -1400000000000.0) {
tmp = z * x;
} else if (z <= 7.6e+48) {
tmp = t * y;
} else {
tmp = z * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1400000000000.0: tmp = z * x elif z <= 7.6e+48: tmp = t * y else: tmp = z * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1400000000000.0) tmp = Float64(z * x); elseif (z <= 7.6e+48) 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 <= -1400000000000.0) tmp = z * x; elseif (z <= 7.6e+48) tmp = t * y; else tmp = z * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1400000000000.0], N[(z * x), $MachinePrecision], If[LessEqual[z, 7.6e+48], N[(t * y), $MachinePrecision], N[(z * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1400000000000:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;z \leq 7.6 \cdot 10^{+48}:\\
\;\;\;\;t \cdot y\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if z < -1.4e12 or 7.60000000000000001e48 < z Initial program 100.0%
Taylor expanded in t around 0
+-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift--.f6455.7
Applied rewrites55.7%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f6421.8
Applied rewrites21.8%
if -1.4e12 < z < 7.60000000000000001e48Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift--.f6445.7
Applied rewrites45.7%
Taylor expanded in x around 0
Applied rewrites27.1%
(FPCore (x y z t) :precision binary64 (* z x))
double code(double x, double y, double z, double t) {
return z * 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 = z * x
end function
public static double code(double x, double y, double z, double t) {
return z * x;
}
def code(x, y, z, t): return z * x
function code(x, y, z, t) return Float64(z * x) end
function tmp = code(x, y, z, t) tmp = z * x; end
code[x_, y_, z_, t_] := N[(z * x), $MachinePrecision]
\begin{array}{l}
\\
z \cdot x
\end{array}
Initial program 100.0%
Taylor expanded in t around 0
+-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift--.f6455.7
Applied rewrites55.7%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f6421.8
Applied rewrites21.8%
herbie shell --seed 2025136
(FPCore (x y z t)
:name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
:precision binary64
(+ x (* (- y z) (- t x))))