
(FPCore (x y z t) :precision binary64 (+ (* (/ x y) (- z t)) t))
double code(double x, double y, double z, double t) {
return ((x / y) * (z - t)) + t;
}
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)) + t
end function
public static double code(double x, double y, double z, double t) {
return ((x / y) * (z - t)) + t;
}
def code(x, y, z, t): return ((x / y) * (z - t)) + t
function code(x, y, z, t) return Float64(Float64(Float64(x / y) * Float64(z - t)) + t) end
function tmp = code(x, y, z, t) tmp = ((x / y) * (z - t)) + t; end
code[x_, y_, z_, t_] := N[(N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y} \cdot \left(z - t\right) + t
\end{array}
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (* (/ x y) (- z t)) t))
double code(double x, double y, double z, double t) {
return ((x / y) * (z - t)) + t;
}
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)) + t
end function
public static double code(double x, double y, double z, double t) {
return ((x / y) * (z - t)) + t;
}
def code(x, y, z, t): return ((x / y) * (z - t)) + t
function code(x, y, z, t) return Float64(Float64(Float64(x / y) * Float64(z - t)) + t) end
function tmp = code(x, y, z, t) tmp = ((x / y) * (z - t)) + t; end
code[x_, y_, z_, t_] := N[(N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y} \cdot \left(z - t\right) + t
\end{array}
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) (- INFINITY)) (/ (* (- z t) x) y) (fma (/ x y) (- z t) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -((double) INFINITY)) {
tmp = ((z - t) * x) / y;
} else {
tmp = fma((x / y), (z - t), t);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= Float64(-Inf)) tmp = Float64(Float64(Float64(z - t) * x) / y); else tmp = fma(Float64(x / y), Float64(z - t), t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], (-Infinity)], N[(N[(N[(z - t), $MachinePrecision] * x), $MachinePrecision] / y), $MachinePrecision], N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision] + t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -\infty:\\
\;\;\;\;\frac{\left(z - t\right) \cdot x}{y}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{y}, z - t, t\right)\\
\end{array}
\end{array}
if (/.f64 x y) < -inf.0Initial program 97.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f6459.2
Applied rewrites59.2%
lift-*.f64N/A
lift--.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f6458.4
Applied rewrites58.4%
if -inf.0 < (/.f64 x y) Initial program 97.7%
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lower-fma.f64N/A
lift-/.f64N/A
lift--.f6497.7
Applied rewrites97.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ x y) (- z t))))
(if (<= (/ x y) (- INFINITY))
(/ (* (- z t) x) y)
(if (<= (/ x y) -5e-7)
t_1
(if (<= (/ x y) 2e-16) (+ (/ (* x z) y) t) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (x / y) * (z - t);
double tmp;
if ((x / y) <= -((double) INFINITY)) {
tmp = ((z - t) * x) / y;
} else if ((x / y) <= -5e-7) {
tmp = t_1;
} else if ((x / y) <= 2e-16) {
tmp = ((x * z) / y) + t;
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = (x / y) * (z - t);
double tmp;
if ((x / y) <= -Double.POSITIVE_INFINITY) {
tmp = ((z - t) * x) / y;
} else if ((x / y) <= -5e-7) {
tmp = t_1;
} else if ((x / y) <= 2e-16) {
tmp = ((x * z) / y) + t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) * (z - t) tmp = 0 if (x / y) <= -math.inf: tmp = ((z - t) * x) / y elif (x / y) <= -5e-7: tmp = t_1 elif (x / y) <= 2e-16: tmp = ((x * z) / y) + t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / y) * Float64(z - t)) tmp = 0.0 if (Float64(x / y) <= Float64(-Inf)) tmp = Float64(Float64(Float64(z - t) * x) / y); elseif (Float64(x / y) <= -5e-7) tmp = t_1; elseif (Float64(x / y) <= 2e-16) tmp = Float64(Float64(Float64(x * z) / y) + t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / y) * (z - t); tmp = 0.0; if ((x / y) <= -Inf) tmp = ((z - t) * x) / y; elseif ((x / y) <= -5e-7) tmp = t_1; elseif ((x / y) <= 2e-16) tmp = ((x * z) / y) + t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x / y), $MachinePrecision], (-Infinity)], N[(N[(N[(z - t), $MachinePrecision] * x), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], -5e-7], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], 2e-16], N[(N[(N[(x * z), $MachinePrecision] / y), $MachinePrecision] + t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} \cdot \left(z - t\right)\\
\mathbf{if}\;\frac{x}{y} \leq -\infty:\\
\;\;\;\;\frac{\left(z - t\right) \cdot x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq -5 \cdot 10^{-7}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{-16}:\\
\;\;\;\;\frac{x \cdot z}{y} + t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 x y) < -inf.0Initial program 97.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f6459.2
Applied rewrites59.2%
lift-*.f64N/A
lift--.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f6458.4
Applied rewrites58.4%
if -inf.0 < (/.f64 x y) < -4.99999999999999977e-7 or 2e-16 < (/.f64 x y) Initial program 97.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f6459.2
Applied rewrites59.2%
lift-*.f64N/A
lift--.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-/l*N/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6461.6
Applied rewrites61.6%
if -4.99999999999999977e-7 < (/.f64 x y) < 2e-16Initial program 97.7%
lift-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
associate-*l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6492.4
Applied rewrites92.4%
Taylor expanded in z around inf
lower-*.f6473.2
Applied rewrites73.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ x y) (- z t))))
(if (<= (/ x y) (- INFINITY))
(/ (* (- z t) x) y)
(if (<= (/ x y) -5e-5)
t_1
(if (<= (/ x y) 100000000000.0) (* (- 1.0 (/ x y)) t) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (x / y) * (z - t);
double tmp;
if ((x / y) <= -((double) INFINITY)) {
tmp = ((z - t) * x) / y;
} else if ((x / y) <= -5e-5) {
tmp = t_1;
} else if ((x / y) <= 100000000000.0) {
tmp = (1.0 - (x / y)) * t;
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = (x / y) * (z - t);
double tmp;
if ((x / y) <= -Double.POSITIVE_INFINITY) {
tmp = ((z - t) * x) / y;
} else if ((x / y) <= -5e-5) {
tmp = t_1;
} else if ((x / y) <= 100000000000.0) {
tmp = (1.0 - (x / y)) * t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) * (z - t) tmp = 0 if (x / y) <= -math.inf: tmp = ((z - t) * x) / y elif (x / y) <= -5e-5: tmp = t_1 elif (x / y) <= 100000000000.0: tmp = (1.0 - (x / y)) * t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / y) * Float64(z - t)) tmp = 0.0 if (Float64(x / y) <= Float64(-Inf)) tmp = Float64(Float64(Float64(z - t) * x) / y); elseif (Float64(x / y) <= -5e-5) tmp = t_1; elseif (Float64(x / y) <= 100000000000.0) tmp = Float64(Float64(1.0 - Float64(x / y)) * t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / y) * (z - t); tmp = 0.0; if ((x / y) <= -Inf) tmp = ((z - t) * x) / y; elseif ((x / y) <= -5e-5) tmp = t_1; elseif ((x / y) <= 100000000000.0) tmp = (1.0 - (x / y)) * t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x / y), $MachinePrecision], (-Infinity)], N[(N[(N[(z - t), $MachinePrecision] * x), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], -5e-5], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], 100000000000.0], N[(N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} \cdot \left(z - t\right)\\
\mathbf{if}\;\frac{x}{y} \leq -\infty:\\
\;\;\;\;\frac{\left(z - t\right) \cdot x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq -5 \cdot 10^{-5}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{x}{y} \leq 100000000000:\\
\;\;\;\;\left(1 - \frac{x}{y}\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 x y) < -inf.0Initial program 97.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f6459.2
Applied rewrites59.2%
lift-*.f64N/A
lift--.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f6458.4
Applied rewrites58.4%
if -inf.0 < (/.f64 x y) < -5.00000000000000024e-5 or 1e11 < (/.f64 x y) Initial program 97.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f6459.2
Applied rewrites59.2%
lift-*.f64N/A
lift--.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-/l*N/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6461.6
Applied rewrites61.6%
if -5.00000000000000024e-5 < (/.f64 x y) < 1e11Initial program 97.7%
Taylor expanded in z around 0
*-rgt-identityN/A
mul-1-negN/A
associate-/l*N/A
distribute-rgt-neg-outN/A
mul-1-negN/A
distribute-lft-outN/A
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lift-/.f6464.6
Applied rewrites64.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ x y) (- z t))))
(if (<= (/ x y) (- INFINITY))
(* (/ (- z t) y) x)
(if (<= (/ x y) -5e-5)
t_1
(if (<= (/ x y) 100000000000.0) (* (- 1.0 (/ x y)) t) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (x / y) * (z - t);
double tmp;
if ((x / y) <= -((double) INFINITY)) {
tmp = ((z - t) / y) * x;
} else if ((x / y) <= -5e-5) {
tmp = t_1;
} else if ((x / y) <= 100000000000.0) {
tmp = (1.0 - (x / y)) * t;
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = (x / y) * (z - t);
double tmp;
if ((x / y) <= -Double.POSITIVE_INFINITY) {
tmp = ((z - t) / y) * x;
} else if ((x / y) <= -5e-5) {
tmp = t_1;
} else if ((x / y) <= 100000000000.0) {
tmp = (1.0 - (x / y)) * t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) * (z - t) tmp = 0 if (x / y) <= -math.inf: tmp = ((z - t) / y) * x elif (x / y) <= -5e-5: tmp = t_1 elif (x / y) <= 100000000000.0: tmp = (1.0 - (x / y)) * t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / y) * Float64(z - t)) tmp = 0.0 if (Float64(x / y) <= Float64(-Inf)) tmp = Float64(Float64(Float64(z - t) / y) * x); elseif (Float64(x / y) <= -5e-5) tmp = t_1; elseif (Float64(x / y) <= 100000000000.0) tmp = Float64(Float64(1.0 - Float64(x / y)) * t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / y) * (z - t); tmp = 0.0; if ((x / y) <= -Inf) tmp = ((z - t) / y) * x; elseif ((x / y) <= -5e-5) tmp = t_1; elseif ((x / y) <= 100000000000.0) tmp = (1.0 - (x / y)) * t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x / y), $MachinePrecision], (-Infinity)], N[(N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], -5e-5], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], 100000000000.0], N[(N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} \cdot \left(z - t\right)\\
\mathbf{if}\;\frac{x}{y} \leq -\infty:\\
\;\;\;\;\frac{z - t}{y} \cdot x\\
\mathbf{elif}\;\frac{x}{y} \leq -5 \cdot 10^{-5}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{x}{y} \leq 100000000000:\\
\;\;\;\;\left(1 - \frac{x}{y}\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 x y) < -inf.0Initial program 97.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f6459.2
Applied rewrites59.2%
if -inf.0 < (/.f64 x y) < -5.00000000000000024e-5 or 1e11 < (/.f64 x y) Initial program 97.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f6459.2
Applied rewrites59.2%
lift-*.f64N/A
lift--.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-/l*N/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6461.6
Applied rewrites61.6%
if -5.00000000000000024e-5 < (/.f64 x y) < 1e11Initial program 97.7%
Taylor expanded in z around 0
*-rgt-identityN/A
mul-1-negN/A
associate-/l*N/A
distribute-rgt-neg-outN/A
mul-1-negN/A
distribute-lft-outN/A
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lift-/.f6464.6
Applied rewrites64.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ x y) (- z t))))
(if (<= (/ x y) -5e-5)
t_1
(if (<= (/ x y) 100000000000.0) (* (- 1.0 (/ x y)) t) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (x / y) * (z - t);
double tmp;
if ((x / y) <= -5e-5) {
tmp = t_1;
} else if ((x / y) <= 100000000000.0) {
tmp = (1.0 - (x / y)) * 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 = (x / y) * (z - t)
if ((x / y) <= (-5d-5)) then
tmp = t_1
else if ((x / y) <= 100000000000.0d0) then
tmp = (1.0d0 - (x / y)) * 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 = (x / y) * (z - t);
double tmp;
if ((x / y) <= -5e-5) {
tmp = t_1;
} else if ((x / y) <= 100000000000.0) {
tmp = (1.0 - (x / y)) * t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) * (z - t) tmp = 0 if (x / y) <= -5e-5: tmp = t_1 elif (x / y) <= 100000000000.0: tmp = (1.0 - (x / y)) * t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / y) * Float64(z - t)) tmp = 0.0 if (Float64(x / y) <= -5e-5) tmp = t_1; elseif (Float64(x / y) <= 100000000000.0) tmp = Float64(Float64(1.0 - Float64(x / y)) * t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / y) * (z - t); tmp = 0.0; if ((x / y) <= -5e-5) tmp = t_1; elseif ((x / y) <= 100000000000.0) tmp = (1.0 - (x / y)) * t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x / y), $MachinePrecision], -5e-5], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], 100000000000.0], N[(N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} \cdot \left(z - t\right)\\
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{-5}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{x}{y} \leq 100000000000:\\
\;\;\;\;\left(1 - \frac{x}{y}\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 x y) < -5.00000000000000024e-5 or 1e11 < (/.f64 x y) Initial program 97.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f6459.2
Applied rewrites59.2%
lift-*.f64N/A
lift--.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-/l*N/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6461.6
Applied rewrites61.6%
if -5.00000000000000024e-5 < (/.f64 x y) < 1e11Initial program 97.7%
Taylor expanded in z around 0
*-rgt-identityN/A
mul-1-negN/A
associate-/l*N/A
distribute-rgt-neg-outN/A
mul-1-negN/A
distribute-lft-outN/A
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lift-/.f6464.6
Applied rewrites64.6%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (- 1.0 (/ x y)) t))) (if (<= t -1.3e-114) t_1 (if (<= t 3.6e-134) (* (/ z y) x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (1.0 - (x / y)) * t;
double tmp;
if (t <= -1.3e-114) {
tmp = t_1;
} else if (t <= 3.6e-134) {
tmp = (z / 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 = (1.0d0 - (x / y)) * t
if (t <= (-1.3d-114)) then
tmp = t_1
else if (t <= 3.6d-134) then
tmp = (z / 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 = (1.0 - (x / y)) * t;
double tmp;
if (t <= -1.3e-114) {
tmp = t_1;
} else if (t <= 3.6e-134) {
tmp = (z / y) * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (1.0 - (x / y)) * t tmp = 0 if t <= -1.3e-114: tmp = t_1 elif t <= 3.6e-134: tmp = (z / y) * x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(1.0 - Float64(x / y)) * t) tmp = 0.0 if (t <= -1.3e-114) tmp = t_1; elseif (t <= 3.6e-134) tmp = Float64(Float64(z / y) * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (1.0 - (x / y)) * t; tmp = 0.0; if (t <= -1.3e-114) tmp = t_1; elseif (t <= 3.6e-134) tmp = (z / y) * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -1.3e-114], t$95$1, If[LessEqual[t, 3.6e-134], N[(N[(z / y), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(1 - \frac{x}{y}\right) \cdot t\\
\mathbf{if}\;t \leq -1.3 \cdot 10^{-114}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 3.6 \cdot 10^{-134}:\\
\;\;\;\;\frac{z}{y} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.30000000000000007e-114 or 3.5999999999999999e-134 < t Initial program 97.7%
Taylor expanded in z around 0
*-rgt-identityN/A
mul-1-negN/A
associate-/l*N/A
distribute-rgt-neg-outN/A
mul-1-negN/A
distribute-lft-outN/A
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lift-/.f6464.6
Applied rewrites64.6%
if -1.30000000000000007e-114 < t < 3.5999999999999999e-134Initial program 97.7%
Taylor expanded in z around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6438.6
Applied rewrites38.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ (- x) y) t)))
(if (<= (/ x y) -1e+199)
(* (/ z y) x)
(if (<= (/ x y) -2e+162)
t_1
(if (<= (/ x y) -5e-5) (/ (* x z) y) (if (<= (/ x y) 2e-16) t t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = (-x / y) * t;
double tmp;
if ((x / y) <= -1e+199) {
tmp = (z / y) * x;
} else if ((x / y) <= -2e+162) {
tmp = t_1;
} else if ((x / y) <= -5e-5) {
tmp = (x * z) / y;
} else if ((x / y) <= 2e-16) {
tmp = 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 = (-x / y) * t
if ((x / y) <= (-1d+199)) then
tmp = (z / y) * x
else if ((x / y) <= (-2d+162)) then
tmp = t_1
else if ((x / y) <= (-5d-5)) then
tmp = (x * z) / y
else if ((x / y) <= 2d-16) then
tmp = 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 = (-x / y) * t;
double tmp;
if ((x / y) <= -1e+199) {
tmp = (z / y) * x;
} else if ((x / y) <= -2e+162) {
tmp = t_1;
} else if ((x / y) <= -5e-5) {
tmp = (x * z) / y;
} else if ((x / y) <= 2e-16) {
tmp = t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (-x / y) * t tmp = 0 if (x / y) <= -1e+199: tmp = (z / y) * x elif (x / y) <= -2e+162: tmp = t_1 elif (x / y) <= -5e-5: tmp = (x * z) / y elif (x / y) <= 2e-16: tmp = t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(Float64(-x) / y) * t) tmp = 0.0 if (Float64(x / y) <= -1e+199) tmp = Float64(Float64(z / y) * x); elseif (Float64(x / y) <= -2e+162) tmp = t_1; elseif (Float64(x / y) <= -5e-5) tmp = Float64(Float64(x * z) / y); elseif (Float64(x / y) <= 2e-16) tmp = t; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (-x / y) * t; tmp = 0.0; if ((x / y) <= -1e+199) tmp = (z / y) * x; elseif ((x / y) <= -2e+162) tmp = t_1; elseif ((x / y) <= -5e-5) tmp = (x * z) / y; elseif ((x / y) <= 2e-16) tmp = t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[((-x) / y), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[N[(x / y), $MachinePrecision], -1e+199], N[(N[(z / y), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], -2e+162], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], -5e-5], N[(N[(x * z), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 2e-16], t, t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-x}{y} \cdot t\\
\mathbf{if}\;\frac{x}{y} \leq -1 \cdot 10^{+199}:\\
\;\;\;\;\frac{z}{y} \cdot x\\
\mathbf{elif}\;\frac{x}{y} \leq -2 \cdot 10^{+162}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{x}{y} \leq -5 \cdot 10^{-5}:\\
\;\;\;\;\frac{x \cdot z}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{-16}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 x y) < -1.0000000000000001e199Initial program 97.7%
Taylor expanded in z around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6438.6
Applied rewrites38.6%
if -1.0000000000000001e199 < (/.f64 x y) < -1.9999999999999999e162 or 2e-16 < (/.f64 x y) Initial program 97.7%
Taylor expanded in z around 0
*-rgt-identityN/A
mul-1-negN/A
associate-/l*N/A
distribute-rgt-neg-outN/A
mul-1-negN/A
distribute-lft-outN/A
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lift-/.f6464.6
Applied rewrites64.6%
Taylor expanded in x around inf
associate-*r/N/A
mul-1-negN/A
lift-neg.f64N/A
lower-/.f6429.1
Applied rewrites29.1%
if -1.9999999999999999e162 < (/.f64 x y) < -5.00000000000000024e-5Initial program 97.7%
Taylor expanded in z around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6438.6
Applied rewrites38.6%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-/.f64N/A
lower-*.f6438.2
Applied rewrites38.2%
if -5.00000000000000024e-5 < (/.f64 x y) < 2e-16Initial program 97.7%
Taylor expanded in x around 0
Applied rewrites37.9%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -5e-5) (/ (* x z) y) (if (<= (/ x y) 2e-16) t (/ (* (- t) x) y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -5e-5) {
tmp = (x * z) / y;
} else if ((x / y) <= 2e-16) {
tmp = t;
} else {
tmp = (-t * 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 ((x / y) <= (-5d-5)) then
tmp = (x * z) / y
else if ((x / y) <= 2d-16) then
tmp = t
else
tmp = (-t * x) / y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -5e-5) {
tmp = (x * z) / y;
} else if ((x / y) <= 2e-16) {
tmp = t;
} else {
tmp = (-t * x) / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -5e-5: tmp = (x * z) / y elif (x / y) <= 2e-16: tmp = t else: tmp = (-t * x) / y return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -5e-5) tmp = Float64(Float64(x * z) / y); elseif (Float64(x / y) <= 2e-16) tmp = t; else tmp = Float64(Float64(Float64(-t) * x) / y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -5e-5) tmp = (x * z) / y; elseif ((x / y) <= 2e-16) tmp = t; else tmp = (-t * x) / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -5e-5], N[(N[(x * z), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 2e-16], t, N[(N[((-t) * x), $MachinePrecision] / y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{-5}:\\
\;\;\;\;\frac{x \cdot z}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{-16}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-t\right) \cdot x}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -5.00000000000000024e-5Initial program 97.7%
Taylor expanded in z around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6438.6
Applied rewrites38.6%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-/.f64N/A
lower-*.f6438.2
Applied rewrites38.2%
if -5.00000000000000024e-5 < (/.f64 x y) < 2e-16Initial program 97.7%
Taylor expanded in x around 0
Applied rewrites37.9%
if 2e-16 < (/.f64 x y) Initial program 97.7%
Taylor expanded in z around 0
*-rgt-identityN/A
mul-1-negN/A
associate-/l*N/A
distribute-rgt-neg-outN/A
mul-1-negN/A
distribute-lft-outN/A
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lift-/.f6464.6
Applied rewrites64.6%
Taylor expanded in x around inf
associate-*r/N/A
lower-/.f64N/A
associate-*r*N/A
mul-1-negN/A
lift-neg.f64N/A
lower-*.f6427.2
Applied rewrites27.2%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -5e-5) (/ (* x z) y) (if (<= (/ x y) 2e-16) t (* (/ z y) x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -5e-5) {
tmp = (x * z) / y;
} else if ((x / y) <= 2e-16) {
tmp = t;
} else {
tmp = (z / y) * 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 ((x / y) <= (-5d-5)) then
tmp = (x * z) / y
else if ((x / y) <= 2d-16) then
tmp = t
else
tmp = (z / y) * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -5e-5) {
tmp = (x * z) / y;
} else if ((x / y) <= 2e-16) {
tmp = t;
} else {
tmp = (z / y) * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -5e-5: tmp = (x * z) / y elif (x / y) <= 2e-16: tmp = t else: tmp = (z / y) * x return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -5e-5) tmp = Float64(Float64(x * z) / y); elseif (Float64(x / y) <= 2e-16) tmp = t; else tmp = Float64(Float64(z / y) * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -5e-5) tmp = (x * z) / y; elseif ((x / y) <= 2e-16) tmp = t; else tmp = (z / y) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -5e-5], N[(N[(x * z), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 2e-16], t, N[(N[(z / y), $MachinePrecision] * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{-5}:\\
\;\;\;\;\frac{x \cdot z}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{-16}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{y} \cdot x\\
\end{array}
\end{array}
if (/.f64 x y) < -5.00000000000000024e-5Initial program 97.7%
Taylor expanded in z around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6438.6
Applied rewrites38.6%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-/.f64N/A
lower-*.f6438.2
Applied rewrites38.2%
if -5.00000000000000024e-5 < (/.f64 x y) < 2e-16Initial program 97.7%
Taylor expanded in x around 0
Applied rewrites37.9%
if 2e-16 < (/.f64 x y) Initial program 97.7%
Taylor expanded in z around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6438.6
Applied rewrites38.6%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (/ z y) x))) (if (<= (/ x y) -5e-5) t_1 (if (<= (/ x y) 2e-16) t t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (z / y) * x;
double tmp;
if ((x / y) <= -5e-5) {
tmp = t_1;
} else if ((x / y) <= 2e-16) {
tmp = 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 = (z / y) * x
if ((x / y) <= (-5d-5)) then
tmp = t_1
else if ((x / y) <= 2d-16) then
tmp = 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 = (z / y) * x;
double tmp;
if ((x / y) <= -5e-5) {
tmp = t_1;
} else if ((x / y) <= 2e-16) {
tmp = t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (z / y) * x tmp = 0 if (x / y) <= -5e-5: tmp = t_1 elif (x / y) <= 2e-16: tmp = t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z / y) * x) tmp = 0.0 if (Float64(x / y) <= -5e-5) tmp = t_1; elseif (Float64(x / y) <= 2e-16) tmp = t; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z / y) * x; tmp = 0.0; if ((x / y) <= -5e-5) tmp = t_1; elseif ((x / y) <= 2e-16) tmp = t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z / y), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[N[(x / y), $MachinePrecision], -5e-5], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], 2e-16], t, t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z}{y} \cdot x\\
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{-5}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{-16}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 x y) < -5.00000000000000024e-5 or 2e-16 < (/.f64 x y) Initial program 97.7%
Taylor expanded in z around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6438.6
Applied rewrites38.6%
if -5.00000000000000024e-5 < (/.f64 x y) < 2e-16Initial program 97.7%
Taylor expanded in x around 0
Applied rewrites37.9%
(FPCore (x y z t) :precision binary64 t)
double code(double x, double y, double z, double t) {
return t;
}
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 = t
end function
public static double code(double x, double y, double z, double t) {
return t;
}
def code(x, y, z, t): return t
function code(x, y, z, t) return t end
function tmp = code(x, y, z, t) tmp = t; end
code[x_, y_, z_, t_] := t
\begin{array}{l}
\\
t
\end{array}
Initial program 97.7%
Taylor expanded in x around 0
Applied rewrites37.9%
herbie shell --seed 2025139
(FPCore (x y z t)
:name "Numeric.Signal.Multichannel:$cget from hsignal-0.2.7.1"
:precision binary64
(+ (* (/ x y) (- z t)) t))