
(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 (* (- x t) z)))
(if (<= z -5.5e+99)
t_1
(if (<= z -2.7e-95)
(fma (- y z) t x)
(if (<= z 6.6e+27) (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 <= -5.5e+99) {
tmp = t_1;
} else if (z <= -2.7e-95) {
tmp = fma((y - z), t, x);
} else if (z <= 6.6e+27) {
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 <= -5.5e+99) tmp = t_1; elseif (z <= -2.7e-95) tmp = fma(Float64(y - z), t, x); elseif (z <= 6.6e+27) 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, -5.5e+99], t$95$1, If[LessEqual[z, -2.7e-95], N[(N[(y - z), $MachinePrecision] * t + x), $MachinePrecision], If[LessEqual[z, 6.6e+27], 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 -5.5 \cdot 10^{+99}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -2.7 \cdot 10^{-95}:\\
\;\;\;\;\mathsf{fma}\left(y - z, t, x\right)\\
\mathbf{elif}\;z \leq 6.6 \cdot 10^{+27}:\\
\;\;\;\;\mathsf{fma}\left(t - x, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -5.5000000000000002e99 or 6.5999999999999996e27 < z Initial program 100.0%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
+-commutativeN/A
*-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
distribute-rgt-outN/A
associate-*r*N/A
associate-+l+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
metadata-evalN/A
*-lft-identityN/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6496.0
Applied rewrites96.0%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6483.6
Applied rewrites83.6%
if -5.5000000000000002e99 < z < -2.7e-95Initial 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 x around 0
Applied rewrites61.3%
if -2.7e-95 < z < 6.5999999999999996e27Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6490.6
Applied rewrites90.6%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (- x t) z))) (if (<= z -8.2e+69) t_1 (if (<= z 6.6e+27) (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 <= -8.2e+69) {
tmp = t_1;
} else if (z <= 6.6e+27) {
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 <= -8.2e+69) tmp = t_1; elseif (z <= 6.6e+27) 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, -8.2e+69], t$95$1, If[LessEqual[z, 6.6e+27], 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 -8.2 \cdot 10^{+69}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 6.6 \cdot 10^{+27}:\\
\;\;\;\;\mathsf{fma}\left(t - x, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -8.1999999999999998e69 or 6.5999999999999996e27 < z Initial program 100.0%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
+-commutativeN/A
*-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
distribute-rgt-outN/A
associate-*r*N/A
associate-+l+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
metadata-evalN/A
*-lft-identityN/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6496.0
Applied rewrites96.0%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6482.7
Applied rewrites82.7%
if -8.1999999999999998e69 < z < 6.5999999999999996e27Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6485.1
Applied rewrites85.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- x t) z)))
(if (<= z -6.8e+93)
t_1
(if (<= z -2.6e-64)
(* (- y z) t)
(if (<= z 1.25e-272)
(* (- 1.0 y) x)
(if (<= z 6.6e+27) (* (- t x) y) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = (x - t) * z;
double tmp;
if (z <= -6.8e+93) {
tmp = t_1;
} else if (z <= -2.6e-64) {
tmp = (y - z) * t;
} else if (z <= 1.25e-272) {
tmp = (1.0 - y) * x;
} else if (z <= 6.6e+27) {
tmp = (t - x) * y;
} 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 = (x - t) * z
if (z <= (-6.8d+93)) then
tmp = t_1
else if (z <= (-2.6d-64)) then
tmp = (y - z) * t
else if (z <= 1.25d-272) then
tmp = (1.0d0 - y) * x
else if (z <= 6.6d+27) then
tmp = (t - x) * y
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x - t) * z;
double tmp;
if (z <= -6.8e+93) {
tmp = t_1;
} else if (z <= -2.6e-64) {
tmp = (y - z) * t;
} else if (z <= 1.25e-272) {
tmp = (1.0 - y) * x;
} else if (z <= 6.6e+27) {
tmp = (t - x) * y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x - t) * z tmp = 0 if z <= -6.8e+93: tmp = t_1 elif z <= -2.6e-64: tmp = (y - z) * t elif z <= 1.25e-272: tmp = (1.0 - y) * x elif z <= 6.6e+27: tmp = (t - x) * y else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x - t) * z) tmp = 0.0 if (z <= -6.8e+93) tmp = t_1; elseif (z <= -2.6e-64) tmp = Float64(Float64(y - z) * t); elseif (z <= 1.25e-272) tmp = Float64(Float64(1.0 - y) * x); elseif (z <= 6.6e+27) tmp = Float64(Float64(t - x) * y); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x - t) * z; tmp = 0.0; if (z <= -6.8e+93) tmp = t_1; elseif (z <= -2.6e-64) tmp = (y - z) * t; elseif (z <= 1.25e-272) tmp = (1.0 - y) * x; elseif (z <= 6.6e+27) tmp = (t - x) * y; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x - t), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -6.8e+93], t$95$1, If[LessEqual[z, -2.6e-64], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[z, 1.25e-272], N[(N[(1.0 - y), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, 6.6e+27], N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x - t\right) \cdot z\\
\mathbf{if}\;z \leq -6.8 \cdot 10^{+93}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -2.6 \cdot 10^{-64}:\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{elif}\;z \leq 1.25 \cdot 10^{-272}:\\
\;\;\;\;\left(1 - y\right) \cdot x\\
\mathbf{elif}\;z \leq 6.6 \cdot 10^{+27}:\\
\;\;\;\;\left(t - x\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -6.8000000000000001e93 or 6.5999999999999996e27 < z Initial program 100.0%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
+-commutativeN/A
*-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
distribute-rgt-outN/A
associate-*r*N/A
associate-+l+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
metadata-evalN/A
*-lft-identityN/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6496.0
Applied rewrites96.0%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6483.6
Applied rewrites83.6%
if -6.8000000000000001e93 < z < -2.6e-64Initial program 100.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lift--.f6450.8
Applied rewrites50.8%
if -2.6e-64 < z < 1.24999999999999995e-272Initial 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--.f6462.2
Applied rewrites62.2%
Taylor expanded in y around inf
Applied rewrites62.2%
if 1.24999999999999995e-272 < z < 6.5999999999999996e27Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift--.f6455.8
Applied rewrites55.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- t x) y)))
(if (<= y -4.7)
t_1
(if (<= y 4.7e-101)
(fma (- z) t x)
(if (<= y 3.4e+172) (* (- 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 <= -4.7) {
tmp = t_1;
} else if (y <= 4.7e-101) {
tmp = fma(-z, t, x);
} else if (y <= 3.4e+172) {
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 <= -4.7) tmp = t_1; elseif (y <= 4.7e-101) tmp = fma(Float64(-z), t, x); elseif (y <= 3.4e+172) tmp = Float64(Float64(x - t) * z); 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, -4.7], t$95$1, If[LessEqual[y, 4.7e-101], N[((-z) * t + x), $MachinePrecision], If[LessEqual[y, 3.4e+172], 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 -4.7:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 4.7 \cdot 10^{-101}:\\
\;\;\;\;\mathsf{fma}\left(-z, t, x\right)\\
\mathbf{elif}\;y \leq 3.4 \cdot 10^{+172}:\\
\;\;\;\;\left(x - t\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -4.70000000000000018 or 3.3999999999999998e172 < y Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift--.f6482.8
Applied rewrites82.8%
if -4.70000000000000018 < y < 4.6999999999999999e-101Initial 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 x around 0
Applied rewrites76.2%
Taylor expanded in y around 0
mul-1-negN/A
lower-neg.f6469.3
Applied rewrites69.3%
if 4.6999999999999999e-101 < y < 3.3999999999999998e172Initial program 100.0%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
+-commutativeN/A
*-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
distribute-rgt-outN/A
associate-*r*N/A
associate-+l+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
metadata-evalN/A
*-lft-identityN/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6499.5
Applied rewrites99.5%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6444.4
Applied rewrites44.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- y z) t)))
(if (<= t -8.8e-72)
t_1
(if (<= t -4.8e-287) (* z x) (if (<= t 2.4e-50) (* (- 1.0 y) x) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (y - z) * t;
double tmp;
if (t <= -8.8e-72) {
tmp = t_1;
} else if (t <= -4.8e-287) {
tmp = z * x;
} else if (t <= 2.4e-50) {
tmp = (1.0 - y) * 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 = (y - z) * t
if (t <= (-8.8d-72)) then
tmp = t_1
else if (t <= (-4.8d-287)) then
tmp = z * x
else if (t <= 2.4d-50) then
tmp = (1.0d0 - y) * 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 = (y - z) * t;
double tmp;
if (t <= -8.8e-72) {
tmp = t_1;
} else if (t <= -4.8e-287) {
tmp = z * x;
} else if (t <= 2.4e-50) {
tmp = (1.0 - y) * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y - z) * t tmp = 0 if t <= -8.8e-72: tmp = t_1 elif t <= -4.8e-287: tmp = z * x elif t <= 2.4e-50: tmp = (1.0 - y) * x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y - z) * t) tmp = 0.0 if (t <= -8.8e-72) tmp = t_1; elseif (t <= -4.8e-287) tmp = Float64(z * x); elseif (t <= 2.4e-50) tmp = Float64(Float64(1.0 - y) * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y - z) * t; tmp = 0.0; if (t <= -8.8e-72) tmp = t_1; elseif (t <= -4.8e-287) tmp = z * x; elseif (t <= 2.4e-50) tmp = (1.0 - y) * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -8.8e-72], t$95$1, If[LessEqual[t, -4.8e-287], N[(z * x), $MachinePrecision], If[LessEqual[t, 2.4e-50], N[(N[(1.0 - y), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y - z\right) \cdot t\\
\mathbf{if}\;t \leq -8.8 \cdot 10^{-72}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -4.8 \cdot 10^{-287}:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;t \leq 2.4 \cdot 10^{-50}:\\
\;\;\;\;\left(1 - y\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -8.8000000000000001e-72 or 2.40000000000000002e-50 < t Initial program 100.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lift--.f6468.4
Applied rewrites68.4%
if -8.8000000000000001e-72 < t < -4.79999999999999999e-287Initial 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--.f6482.3
Applied rewrites82.3%
Taylor expanded in z around inf
Applied rewrites32.6%
if -4.79999999999999999e-287 < t < 2.40000000000000002e-50Initial 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--.f6482.9
Applied rewrites82.9%
Taylor expanded in y around inf
Applied rewrites55.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- t x) y)))
(if (<= z -2.5e+124)
(* z x)
(if (<= z -2.1e-62)
t_1
(if (<= z 1.25e-272)
(* (- 1.0 y) x)
(if (<= z 2.5e+28) t_1 (* z x)))))))
double code(double x, double y, double z, double t) {
double t_1 = (t - x) * y;
double tmp;
if (z <= -2.5e+124) {
tmp = z * x;
} else if (z <= -2.1e-62) {
tmp = t_1;
} else if (z <= 1.25e-272) {
tmp = (1.0 - y) * x;
} else if (z <= 2.5e+28) {
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 = (t - x) * y
if (z <= (-2.5d+124)) then
tmp = z * x
else if (z <= (-2.1d-62)) then
tmp = t_1
else if (z <= 1.25d-272) then
tmp = (1.0d0 - y) * x
else if (z <= 2.5d+28) 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 = (t - x) * y;
double tmp;
if (z <= -2.5e+124) {
tmp = z * x;
} else if (z <= -2.1e-62) {
tmp = t_1;
} else if (z <= 1.25e-272) {
tmp = (1.0 - y) * x;
} else if (z <= 2.5e+28) {
tmp = t_1;
} else {
tmp = z * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = (t - x) * y tmp = 0 if z <= -2.5e+124: tmp = z * x elif z <= -2.1e-62: tmp = t_1 elif z <= 1.25e-272: tmp = (1.0 - y) * x elif z <= 2.5e+28: tmp = t_1 else: tmp = z * x return tmp
function code(x, y, z, t) t_1 = Float64(Float64(t - x) * y) tmp = 0.0 if (z <= -2.5e+124) tmp = Float64(z * x); elseif (z <= -2.1e-62) tmp = t_1; elseif (z <= 1.25e-272) tmp = Float64(Float64(1.0 - y) * x); elseif (z <= 2.5e+28) tmp = t_1; else tmp = Float64(z * x); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (t - x) * y; tmp = 0.0; if (z <= -2.5e+124) tmp = z * x; elseif (z <= -2.1e-62) tmp = t_1; elseif (z <= 1.25e-272) tmp = (1.0 - y) * x; elseif (z <= 2.5e+28) tmp = t_1; else tmp = z * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[z, -2.5e+124], N[(z * x), $MachinePrecision], If[LessEqual[z, -2.1e-62], t$95$1, If[LessEqual[z, 1.25e-272], N[(N[(1.0 - y), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, 2.5e+28], t$95$1, N[(z * x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t - x\right) \cdot y\\
\mathbf{if}\;z \leq -2.5 \cdot 10^{+124}:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;z \leq -2.1 \cdot 10^{-62}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.25 \cdot 10^{-272}:\\
\;\;\;\;\left(1 - y\right) \cdot x\\
\mathbf{elif}\;z \leq 2.5 \cdot 10^{+28}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if z < -2.4999999999999998e124 or 2.49999999999999979e28 < 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--.f6454.1
Applied rewrites54.1%
Taylor expanded in z around inf
Applied rewrites45.6%
if -2.4999999999999998e124 < z < -2.0999999999999999e-62 or 1.24999999999999995e-272 < z < 2.49999999999999979e28Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift--.f6452.5
Applied rewrites52.5%
if -2.0999999999999999e-62 < z < 1.24999999999999995e-272Initial 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--.f6462.1
Applied rewrites62.1%
Taylor expanded in y around inf
Applied rewrites62.1%
(FPCore (x y z t) :precision binary64 (if (<= z -1.2e+123) (* z x) (if (<= z 6e+27) (* (- 1.0 y) x) (* z x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.2e+123) {
tmp = z * x;
} else if (z <= 6e+27) {
tmp = (1.0 - y) * 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 (z <= (-1.2d+123)) then
tmp = z * x
else if (z <= 6d+27) then
tmp = (1.0d0 - y) * 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 (z <= -1.2e+123) {
tmp = z * x;
} else if (z <= 6e+27) {
tmp = (1.0 - y) * x;
} else {
tmp = z * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.2e+123: tmp = z * x elif z <= 6e+27: tmp = (1.0 - y) * x else: tmp = z * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.2e+123) tmp = Float64(z * x); elseif (z <= 6e+27) tmp = Float64(Float64(1.0 - y) * x); else tmp = Float64(z * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.2e+123) tmp = z * x; elseif (z <= 6e+27) tmp = (1.0 - y) * x; else tmp = z * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.2e+123], N[(z * x), $MachinePrecision], If[LessEqual[z, 6e+27], N[(N[(1.0 - y), $MachinePrecision] * x), $MachinePrecision], N[(z * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.2 \cdot 10^{+123}:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;z \leq 6 \cdot 10^{+27}:\\
\;\;\;\;\left(1 - y\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if z < -1.19999999999999994e123 or 5.99999999999999953e27 < 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--.f6454.1
Applied rewrites54.1%
Taylor expanded in z around inf
Applied rewrites45.5%
if -1.19999999999999994e123 < z < 5.99999999999999953e27Initial 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--.f6458.8
Applied rewrites58.8%
Taylor expanded in y around inf
Applied rewrites52.8%
(FPCore (x y z t)
:precision binary64
(if (<= z -5.5e+99)
(* z x)
(if (<= z -2.1e-62)
(* t y)
(if (<= z 8.2e-179) (* 1.0 x) (if (<= z 2.2e+27) (* t y) (* z x))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.5e+99) {
tmp = z * x;
} else if (z <= -2.1e-62) {
tmp = t * y;
} else if (z <= 8.2e-179) {
tmp = 1.0 * x;
} else if (z <= 2.2e+27) {
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 <= (-5.5d+99)) then
tmp = z * x
else if (z <= (-2.1d-62)) then
tmp = t * y
else if (z <= 8.2d-179) then
tmp = 1.0d0 * x
else if (z <= 2.2d+27) 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 <= -5.5e+99) {
tmp = z * x;
} else if (z <= -2.1e-62) {
tmp = t * y;
} else if (z <= 8.2e-179) {
tmp = 1.0 * x;
} else if (z <= 2.2e+27) {
tmp = t * y;
} else {
tmp = z * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -5.5e+99: tmp = z * x elif z <= -2.1e-62: tmp = t * y elif z <= 8.2e-179: tmp = 1.0 * x elif z <= 2.2e+27: tmp = t * y else: tmp = z * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -5.5e+99) tmp = Float64(z * x); elseif (z <= -2.1e-62) tmp = Float64(t * y); elseif (z <= 8.2e-179) tmp = Float64(1.0 * x); elseif (z <= 2.2e+27) 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 <= -5.5e+99) tmp = z * x; elseif (z <= -2.1e-62) tmp = t * y; elseif (z <= 8.2e-179) tmp = 1.0 * x; elseif (z <= 2.2e+27) tmp = t * y; else tmp = z * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -5.5e+99], N[(z * x), $MachinePrecision], If[LessEqual[z, -2.1e-62], N[(t * y), $MachinePrecision], If[LessEqual[z, 8.2e-179], N[(1.0 * x), $MachinePrecision], If[LessEqual[z, 2.2e+27], N[(t * y), $MachinePrecision], N[(z * x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \cdot 10^{+99}:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;z \leq -2.1 \cdot 10^{-62}:\\
\;\;\;\;t \cdot y\\
\mathbf{elif}\;z \leq 8.2 \cdot 10^{-179}:\\
\;\;\;\;1 \cdot x\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{+27}:\\
\;\;\;\;t \cdot y\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if z < -5.5000000000000002e99 or 2.1999999999999999e27 < 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--.f6454.0
Applied rewrites54.0%
Taylor expanded in z around inf
Applied rewrites45.1%
if -5.5000000000000002e99 < z < -2.0999999999999999e-62 or 8.2e-179 < z < 2.1999999999999999e27Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift--.f6452.3
Applied rewrites52.3%
Taylor expanded in x around 0
Applied rewrites29.4%
if -2.0999999999999999e-62 < z < 8.2e-179Initial 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--.f6463.0
Applied rewrites63.0%
Taylor expanded in y around 0
lower-+.f6438.7
Applied rewrites38.7%
Taylor expanded in z around 0
Applied rewrites38.7%
(FPCore (x y z t) :precision binary64 (if (<= z -3100000.0) (* z x) (if (<= z 3.7e-6) (* 1.0 x) (* z x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3100000.0) {
tmp = z * x;
} else if (z <= 3.7e-6) {
tmp = 1.0 * 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 (z <= (-3100000.0d0)) then
tmp = z * x
else if (z <= 3.7d-6) then
tmp = 1.0d0 * 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 (z <= -3100000.0) {
tmp = z * x;
} else if (z <= 3.7e-6) {
tmp = 1.0 * x;
} else {
tmp = z * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -3100000.0: tmp = z * x elif z <= 3.7e-6: tmp = 1.0 * x else: tmp = z * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -3100000.0) tmp = Float64(z * x); elseif (z <= 3.7e-6) tmp = Float64(1.0 * x); else tmp = Float64(z * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -3100000.0) tmp = z * x; elseif (z <= 3.7e-6) tmp = 1.0 * x; else tmp = z * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -3100000.0], N[(z * x), $MachinePrecision], If[LessEqual[z, 3.7e-6], N[(1.0 * x), $MachinePrecision], N[(z * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3100000:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;z \leq 3.7 \cdot 10^{-6}:\\
\;\;\;\;1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if z < -3.1e6 or 3.7000000000000002e-6 < 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--.f6453.4
Applied rewrites53.4%
Taylor expanded in z around inf
Applied rewrites41.8%
if -3.1e6 < z < 3.7000000000000002e-6Initial 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--.f6460.6
Applied rewrites60.6%
Taylor expanded in y around 0
lower-+.f6435.5
Applied rewrites35.5%
Taylor expanded in z around 0
Applied rewrites34.9%
(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 x around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lift--.f6457.0
Applied rewrites57.0%
Taylor expanded in z around inf
Applied rewrites22.4%
herbie shell --seed 2025111
(FPCore (x y z t)
:name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
:precision binary64
(+ x (* (- y z) (- t x))))