
(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 11 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 (fma (- y z) (- t x) x))
double code(double x, double y, double z, double t) {
return fma((y - z), (t - x), x);
}
function code(x, y, z, t) return fma(Float64(y - z), Float64(t - x), x) end
code[x_, y_, z_, t_] := N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y - z, t - x, x\right)
\end{array}
Initial program 100.0%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lift--.f64100.0
Applied rewrites100.0%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (- z) (- t x)))) (if (<= z -2.85e+26) t_1 (if (<= z 1.3e+57) (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 <= -2.85e+26) {
tmp = t_1;
} else if (z <= 1.3e+57) {
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 <= -2.85e+26) tmp = t_1; elseif (z <= 1.3e+57) 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, -2.85e+26], t$95$1, If[LessEqual[z, 1.3e+57], 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 -2.85 \cdot 10^{+26}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.3 \cdot 10^{+57}:\\
\;\;\;\;\mathsf{fma}\left(t - x, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.8500000000000002e26 or 1.3e57 < z Initial program 100.0%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lift--.f64100.0
Applied rewrites100.0%
Taylor expanded in z around inf
+-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
lift--.f6444.4
Applied rewrites44.4%
if -2.8500000000000002e26 < z < 1.3e57Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6460.7
Applied rewrites60.7%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (- z) (- t x)))) (if (<= z -2.5e+26) t_1 (if (<= z 5.8e-52) (fma t y x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = -z * (t - x);
double tmp;
if (z <= -2.5e+26) {
tmp = t_1;
} else if (z <= 5.8e-52) {
tmp = fma(t, 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 <= -2.5e+26) tmp = t_1; elseif (z <= 5.8e-52) tmp = fma(t, 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, -2.5e+26], t$95$1, If[LessEqual[z, 5.8e-52], N[(t * 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 -2.5 \cdot 10^{+26}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 5.8 \cdot 10^{-52}:\\
\;\;\;\;\mathsf{fma}\left(t, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.5e26 or 5.8000000000000003e-52 < z Initial program 100.0%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lift--.f64100.0
Applied rewrites100.0%
Taylor expanded in z around inf
+-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
lift--.f6444.4
Applied rewrites44.4%
if -2.5e26 < z < 5.8000000000000003e-52Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6460.7
Applied rewrites60.7%
Taylor expanded in x around 0
Applied rewrites42.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- t x) y)))
(if (<= y -1.05e+40)
t_1
(if (<= y -1.85e-51)
(* (- y z) t)
(if (<= y 0.0035) (* (+ 1.0 z) x) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (t - x) * y;
double tmp;
if (y <= -1.05e+40) {
tmp = t_1;
} else if (y <= -1.85e-51) {
tmp = (y - z) * t;
} else if (y <= 0.0035) {
tmp = (1.0 + z) * x;
} 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.05d+40)) then
tmp = t_1
else if (y <= (-1.85d-51)) then
tmp = (y - z) * t
else if (y <= 0.0035d0) then
tmp = (1.0d0 + z) * x
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.05e+40) {
tmp = t_1;
} else if (y <= -1.85e-51) {
tmp = (y - z) * t;
} else if (y <= 0.0035) {
tmp = (1.0 + z) * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (t - x) * y tmp = 0 if y <= -1.05e+40: tmp = t_1 elif y <= -1.85e-51: tmp = (y - z) * t elif y <= 0.0035: tmp = (1.0 + z) * 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.05e+40) tmp = t_1; elseif (y <= -1.85e-51) tmp = Float64(Float64(y - z) * t); elseif (y <= 0.0035) tmp = Float64(Float64(1.0 + z) * x); 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.05e+40) tmp = t_1; elseif (y <= -1.85e-51) tmp = (y - z) * t; elseif (y <= 0.0035) tmp = (1.0 + z) * x; 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.05e+40], t$95$1, If[LessEqual[y, -1.85e-51], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[y, 0.0035], N[(N[(1.0 + z), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t - x\right) \cdot y\\
\mathbf{if}\;y \leq -1.05 \cdot 10^{+40}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -1.85 \cdot 10^{-51}:\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{elif}\;y \leq 0.0035:\\
\;\;\;\;\left(1 + z\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.05000000000000005e40 or 0.00350000000000000007 < y Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift--.f6444.7
Applied rewrites44.7%
if -1.05000000000000005e40 < y < -1.84999999999999987e-51Initial program 100.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lift--.f6449.4
Applied rewrites49.4%
if -1.84999999999999987e-51 < y < 0.00350000000000000007Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lift--.f6455.9
Applied rewrites55.9%
Taylor expanded in y around 0
lower-+.f6437.9
Applied rewrites37.9%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (- 1.0 y) x))) (if (<= x -380.0) t_1 (if (<= x 6.6e+51) (* (- y z) t) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (1.0 - y) * x;
double tmp;
if (x <= -380.0) {
tmp = t_1;
} else if (x <= 6.6e+51) {
tmp = (y - z) * t;
} 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 = (1.0d0 - y) * x
if (x <= (-380.0d0)) then
tmp = t_1
else if (x <= 6.6d+51) then
tmp = (y - z) * t
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 = (1.0 - y) * x;
double tmp;
if (x <= -380.0) {
tmp = t_1;
} else if (x <= 6.6e+51) {
tmp = (y - z) * t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (1.0 - y) * x tmp = 0 if x <= -380.0: tmp = t_1 elif x <= 6.6e+51: tmp = (y - z) * t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(1.0 - y) * x) tmp = 0.0 if (x <= -380.0) tmp = t_1; elseif (x <= 6.6e+51) tmp = Float64(Float64(y - z) * t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (1.0 - y) * x; tmp = 0.0; if (x <= -380.0) tmp = t_1; elseif (x <= 6.6e+51) tmp = (y - z) * t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(1.0 - y), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -380.0], t$95$1, If[LessEqual[x, 6.6e+51], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(1 - y\right) \cdot x\\
\mathbf{if}\;x \leq -380:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 6.6 \cdot 10^{+51}:\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -380 or 6.5999999999999994e51 < x Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lift--.f6455.9
Applied rewrites55.9%
Taylor expanded in z around 0
lower--.f6438.3
Applied rewrites38.3%
if -380 < x < 6.5999999999999994e51Initial program 100.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lift--.f6449.4
Applied rewrites49.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- t x) y)))
(if (<= z -2.8e+93)
(* x z)
(if (<= z -1.6e-296)
t_1
(if (<= z 1.8e-64) (fma t y x) (if (<= z 1.14e+67) t_1 (* x z)))))))
double code(double x, double y, double z, double t) {
double t_1 = (t - x) * y;
double tmp;
if (z <= -2.8e+93) {
tmp = x * z;
} else if (z <= -1.6e-296) {
tmp = t_1;
} else if (z <= 1.8e-64) {
tmp = fma(t, y, x);
} else if (z <= 1.14e+67) {
tmp = t_1;
} else {
tmp = x * z;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(t - x) * y) tmp = 0.0 if (z <= -2.8e+93) tmp = Float64(x * z); elseif (z <= -1.6e-296) tmp = t_1; elseif (z <= 1.8e-64) tmp = fma(t, y, x); elseif (z <= 1.14e+67) tmp = t_1; else tmp = Float64(x * z); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[z, -2.8e+93], N[(x * z), $MachinePrecision], If[LessEqual[z, -1.6e-296], t$95$1, If[LessEqual[z, 1.8e-64], N[(t * y + x), $MachinePrecision], If[LessEqual[z, 1.14e+67], t$95$1, N[(x * z), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t - x\right) \cdot y\\
\mathbf{if}\;z \leq -2.8 \cdot 10^{+93}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq -1.6 \cdot 10^{-296}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{-64}:\\
\;\;\;\;\mathsf{fma}\left(t, y, x\right)\\
\mathbf{elif}\;z \leq 1.14 \cdot 10^{+67}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -2.79999999999999989e93 or 1.1400000000000001e67 < z Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lift--.f6455.9
Applied rewrites55.9%
Taylor expanded in z around inf
lower-*.f6422.0
Applied rewrites22.0%
if -2.79999999999999989e93 < z < -1.60000000000000006e-296 or 1.7999999999999999e-64 < z < 1.1400000000000001e67Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift--.f6444.7
Applied rewrites44.7%
if -1.60000000000000006e-296 < z < 1.7999999999999999e-64Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6460.7
Applied rewrites60.7%
Taylor expanded in x around 0
Applied rewrites42.4%
(FPCore (x y z t) :precision binary64 (if (<= z -7.2e+75) (* x z) (if (<= z 2.8e+66) (fma t y x) (* x z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7.2e+75) {
tmp = x * z;
} else if (z <= 2.8e+66) {
tmp = fma(t, y, x);
} else {
tmp = x * z;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= -7.2e+75) tmp = Float64(x * z); elseif (z <= 2.8e+66) tmp = fma(t, y, x); else tmp = Float64(x * z); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -7.2e+75], N[(x * z), $MachinePrecision], If[LessEqual[z, 2.8e+66], N[(t * y + x), $MachinePrecision], N[(x * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.2 \cdot 10^{+75}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{+66}:\\
\;\;\;\;\mathsf{fma}\left(t, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -7.2e75 or 2.8000000000000001e66 < z Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lift--.f6455.9
Applied rewrites55.9%
Taylor expanded in z around inf
lower-*.f6422.0
Applied rewrites22.0%
if -7.2e75 < z < 2.8000000000000001e66Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6460.7
Applied rewrites60.7%
Taylor expanded in x around 0
Applied rewrites42.4%
(FPCore (x y z t) :precision binary64 (if (<= z -7.2e+75) (* x z) (if (<= z 5.8e-52) (* t y) (if (<= z 3.6e+63) (* (- z) t) (* x z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7.2e+75) {
tmp = x * z;
} else if (z <= 5.8e-52) {
tmp = t * y;
} else if (z <= 3.6e+63) {
tmp = -z * t;
} else {
tmp = x * z;
}
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 <= (-7.2d+75)) then
tmp = x * z
else if (z <= 5.8d-52) then
tmp = t * y
else if (z <= 3.6d+63) then
tmp = -z * t
else
tmp = x * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7.2e+75) {
tmp = x * z;
} else if (z <= 5.8e-52) {
tmp = t * y;
} else if (z <= 3.6e+63) {
tmp = -z * t;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -7.2e+75: tmp = x * z elif z <= 5.8e-52: tmp = t * y elif z <= 3.6e+63: tmp = -z * t else: tmp = x * z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -7.2e+75) tmp = Float64(x * z); elseif (z <= 5.8e-52) tmp = Float64(t * y); elseif (z <= 3.6e+63) tmp = Float64(Float64(-z) * t); else tmp = Float64(x * z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -7.2e+75) tmp = x * z; elseif (z <= 5.8e-52) tmp = t * y; elseif (z <= 3.6e+63) tmp = -z * t; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -7.2e+75], N[(x * z), $MachinePrecision], If[LessEqual[z, 5.8e-52], N[(t * y), $MachinePrecision], If[LessEqual[z, 3.6e+63], N[((-z) * t), $MachinePrecision], N[(x * z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.2 \cdot 10^{+75}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq 5.8 \cdot 10^{-52}:\\
\;\;\;\;t \cdot y\\
\mathbf{elif}\;z \leq 3.6 \cdot 10^{+63}:\\
\;\;\;\;\left(-z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -7.2e75 or 3.59999999999999999e63 < z Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lift--.f6455.9
Applied rewrites55.9%
Taylor expanded in z around inf
lower-*.f6422.0
Applied rewrites22.0%
if -7.2e75 < z < 5.8000000000000003e-52Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift--.f6444.7
Applied rewrites44.7%
Taylor expanded in x around 0
Applied rewrites26.7%
if 5.8000000000000003e-52 < z < 3.59999999999999999e63Initial program 100.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lift--.f6449.4
Applied rewrites49.4%
Taylor expanded in y around 0
mul-1-negN/A
lower-neg.f6426.7
Applied rewrites26.7%
(FPCore (x y z t) :precision binary64 (if (<= z -7.2e+75) (* x z) (if (<= z 2.2e+66) (* t y) (* x z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7.2e+75) {
tmp = x * z;
} else if (z <= 2.2e+66) {
tmp = t * y;
} else {
tmp = x * z;
}
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 <= (-7.2d+75)) then
tmp = x * z
else if (z <= 2.2d+66) then
tmp = t * y
else
tmp = x * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7.2e+75) {
tmp = x * z;
} else if (z <= 2.2e+66) {
tmp = t * y;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -7.2e+75: tmp = x * z elif z <= 2.2e+66: tmp = t * y else: tmp = x * z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -7.2e+75) tmp = Float64(x * z); elseif (z <= 2.2e+66) tmp = Float64(t * y); else tmp = Float64(x * z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -7.2e+75) tmp = x * z; elseif (z <= 2.2e+66) tmp = t * y; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -7.2e+75], N[(x * z), $MachinePrecision], If[LessEqual[z, 2.2e+66], N[(t * y), $MachinePrecision], N[(x * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.2 \cdot 10^{+75}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{+66}:\\
\;\;\;\;t \cdot y\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -7.2e75 or 2.1999999999999998e66 < z Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lift--.f6455.9
Applied rewrites55.9%
Taylor expanded in z around inf
lower-*.f6422.0
Applied rewrites22.0%
if -7.2e75 < z < 2.1999999999999998e66Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift--.f6444.7
Applied rewrites44.7%
Taylor expanded in x around 0
Applied rewrites26.7%
(FPCore (x y z t) :precision binary64 (if (<= z -6.2e-11) (* x z) (if (<= z 2.7) (* 1.0 x) (* x z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -6.2e-11) {
tmp = x * z;
} else if (z <= 2.7) {
tmp = 1.0 * x;
} else {
tmp = x * z;
}
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 <= (-6.2d-11)) then
tmp = x * z
else if (z <= 2.7d0) then
tmp = 1.0d0 * x
else
tmp = x * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -6.2e-11) {
tmp = x * z;
} else if (z <= 2.7) {
tmp = 1.0 * x;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -6.2e-11: tmp = x * z elif z <= 2.7: tmp = 1.0 * x else: tmp = x * z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -6.2e-11) tmp = Float64(x * z); elseif (z <= 2.7) tmp = Float64(1.0 * x); else tmp = Float64(x * z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -6.2e-11) tmp = x * z; elseif (z <= 2.7) tmp = 1.0 * x; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -6.2e-11], N[(x * z), $MachinePrecision], If[LessEqual[z, 2.7], N[(1.0 * x), $MachinePrecision], N[(x * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.2 \cdot 10^{-11}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq 2.7:\\
\;\;\;\;1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -6.20000000000000056e-11 or 2.7000000000000002 < z Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lift--.f6455.9
Applied rewrites55.9%
Taylor expanded in z around inf
lower-*.f6422.0
Applied rewrites22.0%
if -6.20000000000000056e-11 < z < 2.7000000000000002Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lift--.f6455.9
Applied rewrites55.9%
Taylor expanded in y around 0
lower-+.f6437.9
Applied rewrites37.9%
Taylor expanded in z around 0
Applied rewrites18.2%
(FPCore (x y z t) :precision binary64 (* x z))
double code(double x, double y, double z, double t) {
return x * z;
}
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 * z
end function
public static double code(double x, double y, double z, double t) {
return x * z;
}
def code(x, y, z, t): return x * z
function code(x, y, z, t) return Float64(x * z) end
function tmp = code(x, y, z, t) tmp = x * z; end
code[x_, y_, z_, t_] := N[(x * z), $MachinePrecision]
\begin{array}{l}
\\
x \cdot z
\end{array}
Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lift--.f6455.9
Applied rewrites55.9%
Taylor expanded in z around inf
lower-*.f6422.0
Applied rewrites22.0%
herbie shell --seed 2025142
(FPCore (x y z t)
:name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
:precision binary64
(+ x (* (- y z) (- t x))))