
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y z) (- t x)) (- a z))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * (t - x)) / (a - 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, a)
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), intent (in) :: a
code = x + (((y - z) * (t - x)) / (a - z))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * (t - x)) / (a - z));
}
def code(x, y, z, t, a): return x + (((y - z) * (t - x)) / (a - z))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - z) * Float64(t - x)) / Float64(a - z))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - z) * (t - x)) / (a - z)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\end{array}
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y z) (- t x)) (- a z))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * (t - x)) / (a - 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, a)
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), intent (in) :: a
code = x + (((y - z) * (t - x)) / (a - z))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * (t - x)) / (a - z));
}
def code(x, y, z, t, a): return x + (((y - z) * (t - x)) / (a - z))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - z) * Float64(t - x)) / Float64(a - z))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - z) * (t - x)) / (a - z)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (* (- y z) (/ (- t x) (- a z))) x))
(t_2 (+ x (/ (* (- y z) (- t x)) (- a z)))))
(if (<= t_2 -5e-248)
t_1
(if (<= t_2 0.0)
(+ (- (/ (* (- t x) (- y a)) z)) t)
(if (<= t_2 1e+302) t_2 t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((y - z) * ((t - x) / (a - z))) + x;
double t_2 = x + (((y - z) * (t - x)) / (a - z));
double tmp;
if (t_2 <= -5e-248) {
tmp = t_1;
} else if (t_2 <= 0.0) {
tmp = -(((t - x) * (y - a)) / z) + t;
} else if (t_2 <= 1e+302) {
tmp = t_2;
} 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, a)
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), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = ((y - z) * ((t - x) / (a - z))) + x
t_2 = x + (((y - z) * (t - x)) / (a - z))
if (t_2 <= (-5d-248)) then
tmp = t_1
else if (t_2 <= 0.0d0) then
tmp = -(((t - x) * (y - a)) / z) + t
else if (t_2 <= 1d+302) then
tmp = t_2
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = ((y - z) * ((t - x) / (a - z))) + x;
double t_2 = x + (((y - z) * (t - x)) / (a - z));
double tmp;
if (t_2 <= -5e-248) {
tmp = t_1;
} else if (t_2 <= 0.0) {
tmp = -(((t - x) * (y - a)) / z) + t;
} else if (t_2 <= 1e+302) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = ((y - z) * ((t - x) / (a - z))) + x t_2 = x + (((y - z) * (t - x)) / (a - z)) tmp = 0 if t_2 <= -5e-248: tmp = t_1 elif t_2 <= 0.0: tmp = -(((t - x) * (y - a)) / z) + t elif t_2 <= 1e+302: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z))) + x) t_2 = Float64(x + Float64(Float64(Float64(y - z) * Float64(t - x)) / Float64(a - z))) tmp = 0.0 if (t_2 <= -5e-248) tmp = t_1; elseif (t_2 <= 0.0) tmp = Float64(Float64(-Float64(Float64(Float64(t - x) * Float64(y - a)) / z)) + t); elseif (t_2 <= 1e+302) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = ((y - z) * ((t - x) / (a - z))) + x; t_2 = x + (((y - z) * (t - x)) / (a - z)); tmp = 0.0; if (t_2 <= -5e-248) tmp = t_1; elseif (t_2 <= 0.0) tmp = -(((t - x) * (y - a)) / z) + t; elseif (t_2 <= 1e+302) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e-248], t$95$1, If[LessEqual[t$95$2, 0.0], N[((-N[(N[(N[(t - x), $MachinePrecision] * N[(y - a), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]) + t), $MachinePrecision], If[LessEqual[t$95$2, 1e+302], t$95$2, t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y - z\right) \cdot \frac{t - x}{a - z} + x\\
t_2 := x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{-248}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\left(-\frac{\left(t - x\right) \cdot \left(y - a\right)}{z}\right) + t\\
\mathbf{elif}\;t\_2 \leq 10^{+302}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -5.0000000000000001e-248 or 1.0000000000000001e302 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) Initial program 62.9%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate-/l*N/A
sub-divN/A
lower-*.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6485.7
Applied rewrites85.7%
if -5.0000000000000001e-248 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 0.0Initial program 13.2%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites91.1%
if 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 1.0000000000000001e302Initial program 96.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- y z) (/ (- t x) (- a z)) x))
(t_2 (+ x (/ (* (- y z) (- t x)) (- a z)))))
(if (<= t_2 -5e-248)
t_1
(if (<= t_2 0.0)
(+ (- (/ (* (- t x) (- y a)) z)) t)
(if (<= t_2 1e+302) t_2 t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y - z), ((t - x) / (a - z)), x);
double t_2 = x + (((y - z) * (t - x)) / (a - z));
double tmp;
if (t_2 <= -5e-248) {
tmp = t_1;
} else if (t_2 <= 0.0) {
tmp = -(((t - x) * (y - a)) / z) + t;
} else if (t_2 <= 1e+302) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y - z), Float64(Float64(t - x) / Float64(a - z)), x) t_2 = Float64(x + Float64(Float64(Float64(y - z) * Float64(t - x)) / Float64(a - z))) tmp = 0.0 if (t_2 <= -5e-248) tmp = t_1; elseif (t_2 <= 0.0) tmp = Float64(Float64(-Float64(Float64(Float64(t - x) * Float64(y - a)) / z)) + t); elseif (t_2 <= 1e+302) tmp = t_2; else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e-248], t$95$1, If[LessEqual[t$95$2, 0.0], N[((-N[(N[(N[(t - x), $MachinePrecision] * N[(y - a), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]) + t), $MachinePrecision], If[LessEqual[t$95$2, 1e+302], t$95$2, t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)\\
t_2 := x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{-248}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\left(-\frac{\left(t - x\right) \cdot \left(y - a\right)}{z}\right) + t\\
\mathbf{elif}\;t\_2 \leq 10^{+302}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -5.0000000000000001e-248 or 1.0000000000000001e302 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) Initial program 62.9%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6485.7
Applied rewrites85.7%
if -5.0000000000000001e-248 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 0.0Initial program 13.2%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites91.1%
if 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 1.0000000000000001e302Initial program 96.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- y z) (/ (- t x) (- a z)) x))
(t_2 (+ x (/ (* (- y z) (- t x)) (- a z)))))
(if (<= t_2 -5e-248)
t_1
(if (<= t_2 0.0) (+ (- (/ (* (- t x) (- y a)) z)) t) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y - z), ((t - x) / (a - z)), x);
double t_2 = x + (((y - z) * (t - x)) / (a - z));
double tmp;
if (t_2 <= -5e-248) {
tmp = t_1;
} else if (t_2 <= 0.0) {
tmp = -(((t - x) * (y - a)) / z) + t;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y - z), Float64(Float64(t - x) / Float64(a - z)), x) t_2 = Float64(x + Float64(Float64(Float64(y - z) * Float64(t - x)) / Float64(a - z))) tmp = 0.0 if (t_2 <= -5e-248) tmp = t_1; elseif (t_2 <= 0.0) tmp = Float64(Float64(-Float64(Float64(Float64(t - x) * Float64(y - a)) / z)) + t); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e-248], t$95$1, If[LessEqual[t$95$2, 0.0], N[((-N[(N[(N[(t - x), $MachinePrecision] * N[(y - a), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]) + t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)\\
t_2 := x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{-248}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\left(-\frac{\left(t - x\right) \cdot \left(y - a\right)}{z}\right) + t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -5.0000000000000001e-248 or 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) Initial program 73.2%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6486.5
Applied rewrites86.5%
if -5.0000000000000001e-248 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 0.0Initial program 13.2%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites91.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- y z) (/ (- t x) (- a z)) x))
(t_2 (+ x (/ (* (- y z) (- t x)) (- a z)))))
(if (<= t_2 -5e-248) t_1 (if (<= t_2 0.0) (- t (/ (- (* x y)) z)) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y - z), ((t - x) / (a - z)), x);
double t_2 = x + (((y - z) * (t - x)) / (a - z));
double tmp;
if (t_2 <= -5e-248) {
tmp = t_1;
} else if (t_2 <= 0.0) {
tmp = t - (-(x * y) / z);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y - z), Float64(Float64(t - x) / Float64(a - z)), x) t_2 = Float64(x + Float64(Float64(Float64(y - z) * Float64(t - x)) / Float64(a - z))) tmp = 0.0 if (t_2 <= -5e-248) tmp = t_1; elseif (t_2 <= 0.0) tmp = Float64(t - Float64(Float64(-Float64(x * y)) / z)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e-248], t$95$1, If[LessEqual[t$95$2, 0.0], N[(t - N[((-N[(x * y), $MachinePrecision]) / z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)\\
t_2 := x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{-248}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;t - \frac{-x \cdot y}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -5.0000000000000001e-248 or 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) Initial program 73.2%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6486.5
Applied rewrites86.5%
if -5.0000000000000001e-248 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 0.0Initial program 13.2%
Taylor expanded in z around -inf
+-commutativeN/A
lower-+.f64N/A
Applied rewrites91.1%
Taylor expanded in a around 0
lower--.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f6463.8
Applied rewrites63.8%
Taylor expanded in x around inf
mul-1-negN/A
lower-neg.f64N/A
lower-*.f6463.8
Applied rewrites63.8%
(FPCore (x y z t a)
:precision binary64
(if (<= a -1.48e-8)
(fma (- t x) (/ (- y z) a) x)
(if (<= a 3.7e-174)
(- t (/ (* y (- t x)) z))
(fma (- y z) (/ t (- a z)) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.48e-8) {
tmp = fma((t - x), ((y - z) / a), x);
} else if (a <= 3.7e-174) {
tmp = t - ((y * (t - x)) / z);
} else {
tmp = fma((y - z), (t / (a - z)), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.48e-8) tmp = fma(Float64(t - x), Float64(Float64(y - z) / a), x); elseif (a <= 3.7e-174) tmp = Float64(t - Float64(Float64(y * Float64(t - x)) / z)); else tmp = fma(Float64(y - z), Float64(t / Float64(a - z)), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.48e-8], N[(N[(t - x), $MachinePrecision] * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[a, 3.7e-174], N[(t - N[(N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] * N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.48 \cdot 10^{-8}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y - z}{a}, x\right)\\
\mathbf{elif}\;a \leq 3.7 \cdot 10^{-174}:\\
\;\;\;\;t - \frac{y \cdot \left(t - x\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{t}{a - z}, x\right)\\
\end{array}
\end{array}
if a < -1.48e-8Initial program 68.7%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6474.7
Applied rewrites74.7%
if -1.48e-8 < a < 3.7000000000000001e-174Initial program 67.4%
Taylor expanded in z around -inf
+-commutativeN/A
lower-+.f64N/A
Applied rewrites64.4%
Taylor expanded in a around 0
lower--.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f6473.2
Applied rewrites73.2%
if 3.7000000000000001e-174 < a Initial program 68.7%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6483.5
Applied rewrites83.5%
Taylor expanded in x around 0
Applied rewrites69.6%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma (- t x) (/ (- y z) a) x))) (if (<= a -1.48e-8) t_1 (if (<= a 1.7e-83) (- t (/ (* y (- t x)) z)) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((t - x), ((y - z) / a), x);
double tmp;
if (a <= -1.48e-8) {
tmp = t_1;
} else if (a <= 1.7e-83) {
tmp = t - ((y * (t - x)) / z);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(t - x), Float64(Float64(y - z) / a), x) tmp = 0.0 if (a <= -1.48e-8) tmp = t_1; elseif (a <= 1.7e-83) tmp = Float64(t - Float64(Float64(y * Float64(t - x)) / z)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -1.48e-8], t$95$1, If[LessEqual[a, 1.7e-83], N[(t - N[(N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(t - x, \frac{y - z}{a}, x\right)\\
\mathbf{if}\;a \leq -1.48 \cdot 10^{-8}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 1.7 \cdot 10^{-83}:\\
\;\;\;\;t - \frac{y \cdot \left(t - x\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.48e-8 or 1.6999999999999999e-83 < a Initial program 68.8%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6471.3
Applied rewrites71.3%
if -1.48e-8 < a < 1.6999999999999999e-83Initial program 67.5%
Taylor expanded in z around -inf
+-commutativeN/A
lower-+.f64N/A
Applied rewrites63.4%
Taylor expanded in a around 0
lower--.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f6471.6
Applied rewrites71.6%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma y (/ (- t x) a) x))) (if (<= a -1.48e-8) t_1 (if (<= a 2.1e-74) (- t (/ (* y (- t x)) z)) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(y, ((t - x) / a), x);
double tmp;
if (a <= -1.48e-8) {
tmp = t_1;
} else if (a <= 2.1e-74) {
tmp = t - ((y * (t - x)) / z);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(y, Float64(Float64(t - x) / a), x) tmp = 0.0 if (a <= -1.48e-8) tmp = t_1; elseif (a <= 2.1e-74) tmp = Float64(t - Float64(Float64(y * Float64(t - x)) / z)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -1.48e-8], t$95$1, If[LessEqual[a, 2.1e-74], N[(t - N[(N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\mathbf{if}\;a \leq -1.48 \cdot 10^{-8}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 2.1 \cdot 10^{-74}:\\
\;\;\;\;t - \frac{y \cdot \left(t - x\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.48e-8 or 2.1e-74 < a Initial program 68.8%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6463.3
Applied rewrites63.3%
if -1.48e-8 < a < 2.1e-74Initial program 67.5%
Taylor expanded in z around -inf
+-commutativeN/A
lower-+.f64N/A
Applied rewrites63.2%
Taylor expanded in a around 0
lower--.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f6471.4
Applied rewrites71.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma y (/ (- t x) a) x)))
(if (<= a -5.2e-12)
t_1
(if (<= a -3.6e-267)
(- t (/ (- (* x y)) z))
(if (<= a 1.8e-74) (- t (/ (* t y) z)) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(y, ((t - x) / a), x);
double tmp;
if (a <= -5.2e-12) {
tmp = t_1;
} else if (a <= -3.6e-267) {
tmp = t - (-(x * y) / z);
} else if (a <= 1.8e-74) {
tmp = t - ((t * y) / z);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(y, Float64(Float64(t - x) / a), x) tmp = 0.0 if (a <= -5.2e-12) tmp = t_1; elseif (a <= -3.6e-267) tmp = Float64(t - Float64(Float64(-Float64(x * y)) / z)); elseif (a <= 1.8e-74) tmp = Float64(t - Float64(Float64(t * y) / z)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -5.2e-12], t$95$1, If[LessEqual[a, -3.6e-267], N[(t - N[((-N[(x * y), $MachinePrecision]) / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.8e-74], N[(t - N[(N[(t * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\mathbf{if}\;a \leq -5.2 \cdot 10^{-12}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq -3.6 \cdot 10^{-267}:\\
\;\;\;\;t - \frac{-x \cdot y}{z}\\
\mathbf{elif}\;a \leq 1.8 \cdot 10^{-74}:\\
\;\;\;\;t - \frac{t \cdot y}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -5.19999999999999965e-12 or 1.8000000000000001e-74 < a Initial program 68.9%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6463.2
Applied rewrites63.2%
if -5.19999999999999965e-12 < a < -3.6000000000000001e-267Initial program 69.7%
Taylor expanded in z around -inf
+-commutativeN/A
lower-+.f64N/A
Applied rewrites59.7%
Taylor expanded in a around 0
lower--.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f6466.6
Applied rewrites66.6%
Taylor expanded in x around inf
mul-1-negN/A
lower-neg.f64N/A
lower-*.f6453.8
Applied rewrites53.8%
if -3.6000000000000001e-267 < a < 1.8000000000000001e-74Initial program 65.2%
Taylor expanded in z around -inf
+-commutativeN/A
lower-+.f64N/A
Applied rewrites66.9%
Taylor expanded in a around 0
lower--.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f6476.0
Applied rewrites76.0%
Taylor expanded in x around 0
lower-*.f6453.3
Applied rewrites53.3%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma y (/ (- t x) a) x))) (if (<= a -2.55e-15) t_1 (if (<= a 1.8e-74) (- t (/ (* t y) z)) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(y, ((t - x) / a), x);
double tmp;
if (a <= -2.55e-15) {
tmp = t_1;
} else if (a <= 1.8e-74) {
tmp = t - ((t * y) / z);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(y, Float64(Float64(t - x) / a), x) tmp = 0.0 if (a <= -2.55e-15) tmp = t_1; elseif (a <= 1.8e-74) tmp = Float64(t - Float64(Float64(t * y) / z)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -2.55e-15], t$95$1, If[LessEqual[a, 1.8e-74], N[(t - N[(N[(t * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\mathbf{if}\;a \leq -2.55 \cdot 10^{-15}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 1.8 \cdot 10^{-74}:\\
\;\;\;\;t - \frac{t \cdot y}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -2.55e-15 or 1.8000000000000001e-74 < a Initial program 68.9%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6463.1
Applied rewrites63.1%
if -2.55e-15 < a < 1.8000000000000001e-74Initial program 67.3%
Taylor expanded in z around -inf
+-commutativeN/A
lower-+.f64N/A
Applied rewrites63.5%
Taylor expanded in a around 0
lower--.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f6471.6
Applied rewrites71.6%
Taylor expanded in x around 0
lower-*.f6451.3
Applied rewrites51.3%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma x (/ (- z y) a) x))) (if (<= a -1.56e-12) t_1 (if (<= a 1.7e-83) (- t (/ (* t y) z)) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(x, ((z - y) / a), x);
double tmp;
if (a <= -1.56e-12) {
tmp = t_1;
} else if (a <= 1.7e-83) {
tmp = t - ((t * y) / z);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(x, Float64(Float64(z - y) / a), x) tmp = 0.0 if (a <= -1.56e-12) tmp = t_1; elseif (a <= 1.7e-83) tmp = Float64(t - Float64(Float64(t * y) / z)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x * N[(N[(z - y), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -1.56e-12], t$95$1, If[LessEqual[a, 1.7e-83], N[(t - N[(N[(t * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(x, \frac{z - y}{a}, x\right)\\
\mathbf{if}\;a \leq -1.56 \cdot 10^{-12}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 1.7 \cdot 10^{-83}:\\
\;\;\;\;t - \frac{t \cdot y}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.56000000000000002e-12 or 1.6999999999999999e-83 < a Initial program 68.9%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift--.f64N/A
lift--.f6450.8
Applied rewrites50.8%
Taylor expanded in z around 0
lower--.f64N/A
lower-/.f6447.6
Applied rewrites47.6%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6447.6
Applied rewrites47.6%
if -1.56000000000000002e-12 < a < 1.6999999999999999e-83Initial program 67.4%
Taylor expanded in z around -inf
+-commutativeN/A
lower-+.f64N/A
Applied rewrites63.6%
Taylor expanded in a around 0
lower--.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f6471.7
Applied rewrites71.7%
Taylor expanded in x around 0
lower-*.f6451.4
Applied rewrites51.4%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* (- 1.0 (/ y a)) x))) (if (<= a -2.55e-15) t_1 (if (<= a 1.7e-83) (- t (/ (* t y) z)) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (1.0 - (y / a)) * x;
double tmp;
if (a <= -2.55e-15) {
tmp = t_1;
} else if (a <= 1.7e-83) {
tmp = t - ((t * y) / z);
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
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), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = (1.0d0 - (y / a)) * x
if (a <= (-2.55d-15)) then
tmp = t_1
else if (a <= 1.7d-83) then
tmp = t - ((t * y) / z)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (1.0 - (y / a)) * x;
double tmp;
if (a <= -2.55e-15) {
tmp = t_1;
} else if (a <= 1.7e-83) {
tmp = t - ((t * y) / z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (1.0 - (y / a)) * x tmp = 0 if a <= -2.55e-15: tmp = t_1 elif a <= 1.7e-83: tmp = t - ((t * y) / z) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(1.0 - Float64(y / a)) * x) tmp = 0.0 if (a <= -2.55e-15) tmp = t_1; elseif (a <= 1.7e-83) tmp = Float64(t - Float64(Float64(t * y) / z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (1.0 - (y / a)) * x; tmp = 0.0; if (a <= -2.55e-15) tmp = t_1; elseif (a <= 1.7e-83) tmp = t - ((t * y) / z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(1.0 - N[(y / a), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[a, -2.55e-15], t$95$1, If[LessEqual[a, 1.7e-83], N[(t - N[(N[(t * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(1 - \frac{y}{a}\right) \cdot x\\
\mathbf{if}\;a \leq -2.55 \cdot 10^{-15}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 1.7 \cdot 10^{-83}:\\
\;\;\;\;t - \frac{t \cdot y}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -2.55e-15 or 1.6999999999999999e-83 < a Initial program 68.9%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift--.f64N/A
lift--.f6450.8
Applied rewrites50.8%
Taylor expanded in z around 0
lower--.f64N/A
lower-/.f6447.5
Applied rewrites47.5%
if -2.55e-15 < a < 1.6999999999999999e-83Initial program 67.3%
Taylor expanded in z around -inf
+-commutativeN/A
lower-+.f64N/A
Applied rewrites63.6%
Taylor expanded in a around 0
lower--.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f6471.8
Applied rewrites71.8%
Taylor expanded in x around 0
lower-*.f6451.5
Applied rewrites51.5%
(FPCore (x y z t a)
:precision binary64
(if (<= a -7e+48)
x
(if (<= a -8e-213)
(* y (/ (- x t) z))
(if (<= a 2.4e-74) (- t (/ (* t y) z)) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -7e+48) {
tmp = x;
} else if (a <= -8e-213) {
tmp = y * ((x - t) / z);
} else if (a <= 2.4e-74) {
tmp = t - ((t * y) / z);
} else {
tmp = 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, a)
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), intent (in) :: a
real(8) :: tmp
if (a <= (-7d+48)) then
tmp = x
else if (a <= (-8d-213)) then
tmp = y * ((x - t) / z)
else if (a <= 2.4d-74) then
tmp = t - ((t * y) / z)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -7e+48) {
tmp = x;
} else if (a <= -8e-213) {
tmp = y * ((x - t) / z);
} else if (a <= 2.4e-74) {
tmp = t - ((t * y) / z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -7e+48: tmp = x elif a <= -8e-213: tmp = y * ((x - t) / z) elif a <= 2.4e-74: tmp = t - ((t * y) / z) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -7e+48) tmp = x; elseif (a <= -8e-213) tmp = Float64(y * Float64(Float64(x - t) / z)); elseif (a <= 2.4e-74) tmp = Float64(t - Float64(Float64(t * y) / z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -7e+48) tmp = x; elseif (a <= -8e-213) tmp = y * ((x - t) / z); elseif (a <= 2.4e-74) tmp = t - ((t * y) / z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -7e+48], x, If[LessEqual[a, -8e-213], N[(y * N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 2.4e-74], N[(t - N[(N[(t * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -7 \cdot 10^{+48}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq -8 \cdot 10^{-213}:\\
\;\;\;\;y \cdot \frac{x - t}{z}\\
\mathbf{elif}\;a \leq 2.4 \cdot 10^{-74}:\\
\;\;\;\;t - \frac{t \cdot y}{z}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -6.9999999999999995e48 or 2.3999999999999999e-74 < a Initial program 68.4%
Taylor expanded in a around inf
Applied rewrites40.4%
if -6.9999999999999995e48 < a < -7.9999999999999996e-213Initial program 71.1%
Taylor expanded in z around -inf
+-commutativeN/A
lower-+.f64N/A
Applied rewrites51.5%
Taylor expanded in a around 0
lower--.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f6456.5
Applied rewrites56.5%
Taylor expanded in y around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6432.4
Applied rewrites32.4%
if -7.9999999999999996e-213 < a < 2.3999999999999999e-74Initial program 65.7%
Taylor expanded in z around -inf
+-commutativeN/A
lower-+.f64N/A
Applied rewrites67.5%
Taylor expanded in a around 0
lower--.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f6476.9
Applied rewrites76.9%
Taylor expanded in x around 0
lower-*.f6453.8
Applied rewrites53.8%
(FPCore (x y z t a) :precision binary64 (if (<= a -7e+48) x (if (<= a 3.5e-231) (* y (/ (- x t) z)) (if (<= a 2.4e-74) t x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -7e+48) {
tmp = x;
} else if (a <= 3.5e-231) {
tmp = y * ((x - t) / z);
} else if (a <= 2.4e-74) {
tmp = t;
} else {
tmp = 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, a)
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), intent (in) :: a
real(8) :: tmp
if (a <= (-7d+48)) then
tmp = x
else if (a <= 3.5d-231) then
tmp = y * ((x - t) / z)
else if (a <= 2.4d-74) then
tmp = t
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -7e+48) {
tmp = x;
} else if (a <= 3.5e-231) {
tmp = y * ((x - t) / z);
} else if (a <= 2.4e-74) {
tmp = t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -7e+48: tmp = x elif a <= 3.5e-231: tmp = y * ((x - t) / z) elif a <= 2.4e-74: tmp = t else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -7e+48) tmp = x; elseif (a <= 3.5e-231) tmp = Float64(y * Float64(Float64(x - t) / z)); elseif (a <= 2.4e-74) tmp = t; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -7e+48) tmp = x; elseif (a <= 3.5e-231) tmp = y * ((x - t) / z); elseif (a <= 2.4e-74) tmp = t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -7e+48], x, If[LessEqual[a, 3.5e-231], N[(y * N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 2.4e-74], t, x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -7 \cdot 10^{+48}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 3.5 \cdot 10^{-231}:\\
\;\;\;\;y \cdot \frac{x - t}{z}\\
\mathbf{elif}\;a \leq 2.4 \cdot 10^{-74}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -6.9999999999999995e48 or 2.3999999999999999e-74 < a Initial program 68.4%
Taylor expanded in a around inf
Applied rewrites40.4%
if -6.9999999999999995e48 < a < 3.5000000000000001e-231Initial program 68.6%
Taylor expanded in z around -inf
+-commutativeN/A
lower-+.f64N/A
Applied rewrites59.9%
Taylor expanded in a around 0
lower--.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f6467.6
Applied rewrites67.6%
Taylor expanded in y around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6440.8
Applied rewrites40.8%
if 3.5000000000000001e-231 < a < 2.3999999999999999e-74Initial program 66.7%
Taylor expanded in z around inf
Applied rewrites35.0%
(FPCore (x y z t a) :precision binary64 (if (<= a -5e+50) x (if (<= a -7.6e-213) (* (/ y z) x) (if (<= a 2.4e-74) t x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -5e+50) {
tmp = x;
} else if (a <= -7.6e-213) {
tmp = (y / z) * x;
} else if (a <= 2.4e-74) {
tmp = t;
} else {
tmp = 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, a)
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), intent (in) :: a
real(8) :: tmp
if (a <= (-5d+50)) then
tmp = x
else if (a <= (-7.6d-213)) then
tmp = (y / z) * x
else if (a <= 2.4d-74) then
tmp = t
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -5e+50) {
tmp = x;
} else if (a <= -7.6e-213) {
tmp = (y / z) * x;
} else if (a <= 2.4e-74) {
tmp = t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -5e+50: tmp = x elif a <= -7.6e-213: tmp = (y / z) * x elif a <= 2.4e-74: tmp = t else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -5e+50) tmp = x; elseif (a <= -7.6e-213) tmp = Float64(Float64(y / z) * x); elseif (a <= 2.4e-74) tmp = t; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -5e+50) tmp = x; elseif (a <= -7.6e-213) tmp = (y / z) * x; elseif (a <= 2.4e-74) tmp = t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -5e+50], x, If[LessEqual[a, -7.6e-213], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[a, 2.4e-74], t, x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5 \cdot 10^{+50}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq -7.6 \cdot 10^{-213}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\mathbf{elif}\;a \leq 2.4 \cdot 10^{-74}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -5e50 or 2.3999999999999999e-74 < a Initial program 68.4%
Taylor expanded in a around inf
Applied rewrites40.4%
if -5e50 < a < -7.5999999999999999e-213Initial program 71.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift--.f64N/A
lift--.f6434.8
Applied rewrites34.8%
Taylor expanded in a around 0
lower-/.f6422.1
Applied rewrites22.1%
if -7.5999999999999999e-213 < a < 2.3999999999999999e-74Initial program 65.7%
Taylor expanded in z around inf
Applied rewrites36.5%
(FPCore (x y z t a) :precision binary64 (if (<= a -5e+50) x (if (<= a -4.3e-228) (/ (* x y) z) (if (<= a 2.4e-74) t x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -5e+50) {
tmp = x;
} else if (a <= -4.3e-228) {
tmp = (x * y) / z;
} else if (a <= 2.4e-74) {
tmp = t;
} else {
tmp = 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, a)
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), intent (in) :: a
real(8) :: tmp
if (a <= (-5d+50)) then
tmp = x
else if (a <= (-4.3d-228)) then
tmp = (x * y) / z
else if (a <= 2.4d-74) then
tmp = t
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -5e+50) {
tmp = x;
} else if (a <= -4.3e-228) {
tmp = (x * y) / z;
} else if (a <= 2.4e-74) {
tmp = t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -5e+50: tmp = x elif a <= -4.3e-228: tmp = (x * y) / z elif a <= 2.4e-74: tmp = t else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -5e+50) tmp = x; elseif (a <= -4.3e-228) tmp = Float64(Float64(x * y) / z); elseif (a <= 2.4e-74) tmp = t; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -5e+50) tmp = x; elseif (a <= -4.3e-228) tmp = (x * y) / z; elseif (a <= 2.4e-74) tmp = t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -5e+50], x, If[LessEqual[a, -4.3e-228], N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[a, 2.4e-74], t, x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5 \cdot 10^{+50}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq -4.3 \cdot 10^{-228}:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\mathbf{elif}\;a \leq 2.4 \cdot 10^{-74}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -5e50 or 2.3999999999999999e-74 < a Initial program 68.4%
Taylor expanded in a around inf
Applied rewrites40.4%
if -5e50 < a < -4.3e-228Initial program 70.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift--.f64N/A
lift--.f6434.6
Applied rewrites34.6%
Taylor expanded in a around 0
lower-/.f64N/A
lower-*.f6420.1
Applied rewrites20.1%
if -4.3e-228 < a < 2.3999999999999999e-74Initial program 65.6%
Taylor expanded in z around inf
Applied rewrites36.8%
(FPCore (x y z t a) :precision binary64 (if (<= a -3.6e-15) x (if (<= a 2.4e-74) t x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -3.6e-15) {
tmp = x;
} else if (a <= 2.4e-74) {
tmp = t;
} else {
tmp = 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, a)
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), intent (in) :: a
real(8) :: tmp
if (a <= (-3.6d-15)) then
tmp = x
else if (a <= 2.4d-74) then
tmp = t
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -3.6e-15) {
tmp = x;
} else if (a <= 2.4e-74) {
tmp = t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -3.6e-15: tmp = x elif a <= 2.4e-74: tmp = t else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -3.6e-15) tmp = x; elseif (a <= 2.4e-74) tmp = t; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -3.6e-15) tmp = x; elseif (a <= 2.4e-74) tmp = t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -3.6e-15], x, If[LessEqual[a, 2.4e-74], t, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.6 \cdot 10^{-15}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 2.4 \cdot 10^{-74}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -3.6000000000000001e-15 or 2.3999999999999999e-74 < a Initial program 69.0%
Taylor expanded in a around inf
Applied rewrites38.7%
if -3.6000000000000001e-15 < a < 2.3999999999999999e-74Initial program 67.3%
Taylor expanded in z around inf
Applied rewrites35.0%
(FPCore (x y z t a) :precision binary64 t)
double code(double x, double y, double z, double t, double a) {
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, a)
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), intent (in) :: a
code = t
end function
public static double code(double x, double y, double z, double t, double a) {
return t;
}
def code(x, y, z, t, a): return t
function code(x, y, z, t, a) return t end
function tmp = code(x, y, z, t, a) tmp = t; end
code[x_, y_, z_, t_, a_] := t
\begin{array}{l}
\\
t
\end{array}
Initial program 68.3%
Taylor expanded in z around inf
Applied rewrites25.2%
herbie shell --seed 2025101
(FPCore (x y z t a)
:name "Graphics.Rendering.Chart.Axis.Types:invLinMap from Chart-1.5.3"
:precision binary64
(+ x (/ (* (- y z) (- t x)) (- a z))))