
(FPCore (x y z t) :precision binary64 (* x (- (/ y z) (/ t (- 1.0 z)))))
double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - z)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x * ((y / z) - (t / (1.0d0 - z)))
end function
public static double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - z)));
}
def code(x, y, z, t): return x * ((y / z) - (t / (1.0 - z)))
function code(x, y, z, t) return Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z)))) end
function tmp = code(x, y, z, t) tmp = x * ((y / z) - (t / (1.0 - z))); end
code[x_, y_, z_, t_] := N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)
\end{array}
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (* x (- (/ y z) (/ t (- 1.0 z)))))
double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - z)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x * ((y / z) - (t / (1.0d0 - z)))
end function
public static double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - z)));
}
def code(x, y, z, t): return x * ((y / z) - (t / (1.0 - z)))
function code(x, y, z, t) return Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z)))) end
function tmp = code(x, y, z, t) tmp = x * ((y / z) - (t / (1.0 - z))); end
code[x_, y_, z_, t_] := N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)
\end{array}
(FPCore (x y z t) :precision binary64 (let* ((t_1 (- (/ y z) (/ t (- 1.0 z))))) (if (<= t_1 (- INFINITY)) (/ y (/ z x)) (* x t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (y / z) - (t / (1.0 - z));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = y / (z / x);
} else {
tmp = x * t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = (y / z) - (t / (1.0 - z));
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = y / (z / x);
} else {
tmp = x * t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y / z) - (t / (1.0 - z)) tmp = 0 if t_1 <= -math.inf: tmp = y / (z / x) else: tmp = x * t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y / z) - Float64(t / Float64(1.0 - z))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(y / Float64(z / x)); else tmp = Float64(x * t_1); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y / z) - (t / (1.0 - z)); tmp = 0.0; if (t_1 <= -Inf) tmp = y / (z / x); else tmp = x * t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision], N[(x * t$95$1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{z} - \frac{t}{1 - z}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\frac{y}{\frac{z}{x}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\_1\\
\end{array}
\end{array}
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < -inf.0Initial program 94.9%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f6460.7
Applied rewrites60.7%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6461.3
Applied rewrites61.3%
lift-*.f64N/A
lift-/.f64N/A
div-flipN/A
mult-flip-revN/A
lower-/.f64N/A
lower-/.f6461.1
Applied rewrites61.1%
if -inf.0 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) Initial program 94.9%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (/ x (/ z (+ t y))))) (if (<= z -1.0) t_1 (if (<= z 1.0) (* x (- (/ y z) t)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x / (z / (t + y));
double tmp;
if (z <= -1.0) {
tmp = t_1;
} else if (z <= 1.0) {
tmp = x * ((y / z) - t);
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x / (z / (t + y))
if (z <= (-1.0d0)) then
tmp = t_1
else if (z <= 1.0d0) then
tmp = x * ((y / z) - t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x / (z / (t + y));
double tmp;
if (z <= -1.0) {
tmp = t_1;
} else if (z <= 1.0) {
tmp = x * ((y / z) - t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x / (z / (t + y)) tmp = 0 if z <= -1.0: tmp = t_1 elif z <= 1.0: tmp = x * ((y / z) - t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x / Float64(z / Float64(t + y))) tmp = 0.0 if (z <= -1.0) tmp = t_1; elseif (z <= 1.0) tmp = Float64(x * Float64(Float64(y / z) - t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x / (z / (t + y)); tmp = 0.0; if (z <= -1.0) tmp = t_1; elseif (z <= 1.0) tmp = x * ((y / z) - t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x / N[(z / N[(t + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.0], t$95$1, If[LessEqual[z, 1.0], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{\frac{z}{t + y}}\\
\mathbf{if}\;z \leq -1:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1 or 1 < z Initial program 94.9%
Taylor expanded in z around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6471.3
Applied rewrites71.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
div-flipN/A
mult-flip-revN/A
lower-/.f64N/A
lower-/.f6474.2
lift--.f64N/A
lift-*.f64N/A
mul-1-negN/A
add-flip-revN/A
+-commutativeN/A
lower-+.f6474.2
Applied rewrites74.2%
if -1 < z < 1Initial program 94.9%
Taylor expanded in z around 0
Applied rewrites65.4%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (+ t y) (/ x z)))) (if (<= z -0.95) t_1 (if (<= z 1.0) (* x (- (/ y z) t)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (t + y) * (x / z);
double tmp;
if (z <= -0.95) {
tmp = t_1;
} else if (z <= 1.0) {
tmp = x * ((y / z) - t);
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (t + y) * (x / z)
if (z <= (-0.95d0)) then
tmp = t_1
else if (z <= 1.0d0) then
tmp = x * ((y / z) - t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (t + y) * (x / z);
double tmp;
if (z <= -0.95) {
tmp = t_1;
} else if (z <= 1.0) {
tmp = x * ((y / z) - t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (t + y) * (x / z) tmp = 0 if z <= -0.95: tmp = t_1 elif z <= 1.0: tmp = x * ((y / z) - t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(t + y) * Float64(x / z)) tmp = 0.0 if (z <= -0.95) tmp = t_1; elseif (z <= 1.0) tmp = Float64(x * Float64(Float64(y / z) - t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (t + y) * (x / z); tmp = 0.0; if (z <= -0.95) tmp = t_1; elseif (z <= 1.0) tmp = x * ((y / z) - t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(t + y), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -0.95], t$95$1, If[LessEqual[z, 1.0], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t + y\right) \cdot \frac{x}{z}\\
\mathbf{if}\;z \leq -0.95:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -0.94999999999999996 or 1 < z Initial program 94.9%
Taylor expanded in z around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6471.3
Applied rewrites71.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
mul-1-negN/A
add-flip-revN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f6471.7
Applied rewrites71.7%
if -0.94999999999999996 < z < 1Initial program 94.9%
Taylor expanded in z around 0
Applied rewrites65.4%
(FPCore (x y z t) :precision binary64 (if (<= z -14500000000.0) (/ x (/ z y)) (if (<= z 2.7e+17) (* x (- (/ y z) t)) (* x (/ t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -14500000000.0) {
tmp = x / (z / y);
} else if (z <= 2.7e+17) {
tmp = x * ((y / z) - t);
} else {
tmp = x * (t / z);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-14500000000.0d0)) then
tmp = x / (z / y)
else if (z <= 2.7d+17) then
tmp = x * ((y / z) - t)
else
tmp = x * (t / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -14500000000.0) {
tmp = x / (z / y);
} else if (z <= 2.7e+17) {
tmp = x * ((y / z) - t);
} else {
tmp = x * (t / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -14500000000.0: tmp = x / (z / y) elif z <= 2.7e+17: tmp = x * ((y / z) - t) else: tmp = x * (t / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -14500000000.0) tmp = Float64(x / Float64(z / y)); elseif (z <= 2.7e+17) tmp = Float64(x * Float64(Float64(y / z) - t)); else tmp = Float64(x * Float64(t / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -14500000000.0) tmp = x / (z / y); elseif (z <= 2.7e+17) tmp = x * ((y / z) - t); else tmp = x * (t / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -14500000000.0], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.7e+17], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -14500000000:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{+17}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\end{array}
\end{array}
if z < -1.45e10Initial program 94.9%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f6460.7
Applied rewrites60.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
div-flip-revN/A
lift-/.f64N/A
mult-flip-revN/A
lower-/.f6461.4
Applied rewrites61.4%
if -1.45e10 < z < 2.7e17Initial program 94.9%
Taylor expanded in z around 0
Applied rewrites65.4%
if 2.7e17 < z Initial program 94.9%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower-*.f6474.0
Applied rewrites74.0%
Taylor expanded in y around 0
Applied rewrites35.6%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (/ t (- z 1.0))))) (if (<= t -9.5e+76) t_1 (if (<= t 8.5e+68) (/ y (/ z x)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t / (z - 1.0));
double tmp;
if (t <= -9.5e+76) {
tmp = t_1;
} else if (t <= 8.5e+68) {
tmp = y / (z / x);
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x * (t / (z - 1.0d0))
if (t <= (-9.5d+76)) then
tmp = t_1
else if (t <= 8.5d+68) then
tmp = y / (z / x)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (t / (z - 1.0));
double tmp;
if (t <= -9.5e+76) {
tmp = t_1;
} else if (t <= 8.5e+68) {
tmp = y / (z / x);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t / (z - 1.0)) tmp = 0 if t <= -9.5e+76: tmp = t_1 elif t <= 8.5e+68: tmp = y / (z / x) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t / Float64(z - 1.0))) tmp = 0.0 if (t <= -9.5e+76) tmp = t_1; elseif (t <= 8.5e+68) tmp = Float64(y / Float64(z / x)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t / (z - 1.0)); tmp = 0.0; if (t <= -9.5e+76) tmp = t_1; elseif (t <= 8.5e+68) tmp = y / (z / x); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t / N[(z - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -9.5e+76], t$95$1, If[LessEqual[t, 8.5e+68], N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{t}{z - 1}\\
\mathbf{if}\;t \leq -9.5 \cdot 10^{+76}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 8.5 \cdot 10^{+68}:\\
\;\;\;\;\frac{y}{\frac{z}{x}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -9.5000000000000003e76 or 8.49999999999999966e68 < t Initial program 94.9%
lift-/.f64N/A
div-flipN/A
associate-/r/N/A
lower-*.f64N/A
frac-2negN/A
metadata-evalN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6494.8
Applied rewrites94.8%
Taylor expanded in y around 0
lower-/.f64N/A
lower--.f6446.1
Applied rewrites46.1%
if -9.5000000000000003e76 < t < 8.49999999999999966e68Initial program 94.9%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f6460.7
Applied rewrites60.7%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6461.3
Applied rewrites61.3%
lift-*.f64N/A
lift-/.f64N/A
div-flipN/A
mult-flip-revN/A
lower-/.f64N/A
lower-/.f6461.1
Applied rewrites61.1%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (/ t z)))) (if (<= z -1.95e+139) t_1 (if (<= z 2.7e+17) (* y (/ x z)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t / z);
double tmp;
if (z <= -1.95e+139) {
tmp = t_1;
} else if (z <= 2.7e+17) {
tmp = y * (x / 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x * (t / z)
if (z <= (-1.95d+139)) then
tmp = t_1
else if (z <= 2.7d+17) then
tmp = y * (x / z)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (t / z);
double tmp;
if (z <= -1.95e+139) {
tmp = t_1;
} else if (z <= 2.7e+17) {
tmp = y * (x / z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t / z) tmp = 0 if z <= -1.95e+139: tmp = t_1 elif z <= 2.7e+17: tmp = y * (x / z) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t / z)) tmp = 0.0 if (z <= -1.95e+139) tmp = t_1; elseif (z <= 2.7e+17) tmp = Float64(y * Float64(x / z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t / z); tmp = 0.0; if (z <= -1.95e+139) tmp = t_1; elseif (z <= 2.7e+17) tmp = y * (x / z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.95e+139], t$95$1, If[LessEqual[z, 2.7e+17], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{t}{z}\\
\mathbf{if}\;z \leq -1.95 \cdot 10^{+139}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{+17}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.95000000000000003e139 or 2.7e17 < z Initial program 94.9%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower-*.f6474.0
Applied rewrites74.0%
Taylor expanded in y around 0
Applied rewrites35.6%
if -1.95000000000000003e139 < z < 2.7e17Initial program 94.9%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f6460.7
Applied rewrites60.7%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6461.3
Applied rewrites61.3%
(FPCore (x y z t) :precision binary64 (if (<= y -5.2e-227) (* (/ y z) x) (if (<= y 7e-276) (* (/ x z) t) (* y (/ x z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -5.2e-227) {
tmp = (y / z) * x;
} else if (y <= 7e-276) {
tmp = (x / z) * t;
} else {
tmp = y * (x / z);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-5.2d-227)) then
tmp = (y / z) * x
else if (y <= 7d-276) then
tmp = (x / z) * t
else
tmp = y * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -5.2e-227) {
tmp = (y / z) * x;
} else if (y <= 7e-276) {
tmp = (x / z) * t;
} else {
tmp = y * (x / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -5.2e-227: tmp = (y / z) * x elif y <= 7e-276: tmp = (x / z) * t else: tmp = y * (x / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -5.2e-227) tmp = Float64(Float64(y / z) * x); elseif (y <= 7e-276) tmp = Float64(Float64(x / z) * t); else tmp = Float64(y * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -5.2e-227) tmp = (y / z) * x; elseif (y <= 7e-276) tmp = (x / z) * t; else tmp = y * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -5.2e-227], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[y, 7e-276], N[(N[(x / z), $MachinePrecision] * t), $MachinePrecision], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.2 \cdot 10^{-227}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\mathbf{elif}\;y \leq 7 \cdot 10^{-276}:\\
\;\;\;\;\frac{x}{z} \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if y < -5.20000000000000023e-227Initial program 94.9%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f6460.7
Applied rewrites60.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6461.2
Applied rewrites61.2%
if -5.20000000000000023e-227 < y < 6.99999999999999986e-276Initial program 94.9%
Taylor expanded in z around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6471.3
Applied rewrites71.3%
lift-/.f64N/A
div-flipN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f6471.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6471.2
lift--.f64N/A
lift-*.f64N/A
mul-1-negN/A
add-flip-revN/A
+-commutativeN/A
lower-+.f6471.2
Applied rewrites71.2%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lift-/.f64N/A
associate-/r/N/A
div-flipN/A
lift-/.f64N/A
lower-*.f6471.7
Applied rewrites71.7%
Taylor expanded in y around 0
Applied rewrites34.5%
if 6.99999999999999986e-276 < y Initial program 94.9%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f6460.7
Applied rewrites60.7%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6461.3
Applied rewrites61.3%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (/ x z) t))) (if (<= z -1.95e+139) t_1 (if (<= z 2.7e+17) (* y (/ x z)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (x / z) * t;
double tmp;
if (z <= -1.95e+139) {
tmp = t_1;
} else if (z <= 2.7e+17) {
tmp = y * (x / 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)
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 / z) * t
if (z <= (-1.95d+139)) then
tmp = t_1
else if (z <= 2.7d+17) then
tmp = y * (x / z)
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 / z) * t;
double tmp;
if (z <= -1.95e+139) {
tmp = t_1;
} else if (z <= 2.7e+17) {
tmp = y * (x / z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / z) * t tmp = 0 if z <= -1.95e+139: tmp = t_1 elif z <= 2.7e+17: tmp = y * (x / z) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / z) * t) tmp = 0.0 if (z <= -1.95e+139) tmp = t_1; elseif (z <= 2.7e+17) tmp = Float64(y * Float64(x / z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / z) * t; tmp = 0.0; if (z <= -1.95e+139) tmp = t_1; elseif (z <= 2.7e+17) tmp = y * (x / z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / z), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[z, -1.95e+139], t$95$1, If[LessEqual[z, 2.7e+17], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{z} \cdot t\\
\mathbf{if}\;z \leq -1.95 \cdot 10^{+139}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{+17}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.95000000000000003e139 or 2.7e17 < z Initial program 94.9%
Taylor expanded in z around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6471.3
Applied rewrites71.3%
lift-/.f64N/A
div-flipN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f6471.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6471.2
lift--.f64N/A
lift-*.f64N/A
mul-1-negN/A
add-flip-revN/A
+-commutativeN/A
lower-+.f6471.2
Applied rewrites71.2%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lift-/.f64N/A
associate-/r/N/A
div-flipN/A
lift-/.f64N/A
lower-*.f6471.7
Applied rewrites71.7%
Taylor expanded in y around 0
Applied rewrites34.5%
if -1.95000000000000003e139 < z < 2.7e17Initial program 94.9%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f6460.7
Applied rewrites60.7%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6461.3
Applied rewrites61.3%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* y (/ x z)))) (if (<= y -5.5e-294) t_1 (if (<= y 1.35e-264) (* x (* -1.0 t)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = y * (x / z);
double tmp;
if (y <= -5.5e-294) {
tmp = t_1;
} else if (y <= 1.35e-264) {
tmp = x * (-1.0 * 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 = y * (x / z)
if (y <= (-5.5d-294)) then
tmp = t_1
else if (y <= 1.35d-264) then
tmp = x * ((-1.0d0) * 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 = y * (x / z);
double tmp;
if (y <= -5.5e-294) {
tmp = t_1;
} else if (y <= 1.35e-264) {
tmp = x * (-1.0 * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (x / z) tmp = 0 if y <= -5.5e-294: tmp = t_1 elif y <= 1.35e-264: tmp = x * (-1.0 * t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(x / z)) tmp = 0.0 if (y <= -5.5e-294) tmp = t_1; elseif (y <= 1.35e-264) tmp = Float64(x * Float64(-1.0 * t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (x / z); tmp = 0.0; if (y <= -5.5e-294) tmp = t_1; elseif (y <= 1.35e-264) tmp = x * (-1.0 * t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5.5e-294], t$95$1, If[LessEqual[y, 1.35e-264], N[(x * N[(-1.0 * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{x}{z}\\
\mathbf{if}\;y \leq -5.5 \cdot 10^{-294}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{-264}:\\
\;\;\;\;x \cdot \left(-1 \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -5.5e-294 or 1.34999999999999997e-264 < y Initial program 94.9%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f6460.7
Applied rewrites60.7%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6461.3
Applied rewrites61.3%
if -5.5e-294 < y < 1.34999999999999997e-264Initial program 94.9%
lift-/.f64N/A
div-flipN/A
associate-/r/N/A
lower-*.f64N/A
frac-2negN/A
metadata-evalN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6494.8
Applied rewrites94.8%
Taylor expanded in y around 0
lower-/.f64N/A
lower--.f6446.1
Applied rewrites46.1%
Taylor expanded in z around 0
lower-*.f6423.9
Applied rewrites23.9%
(FPCore (x y z t) :precision binary64 (* x (* -1.0 t)))
double code(double x, double y, double z, double t) {
return x * (-1.0 * 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 * ((-1.0d0) * t)
end function
public static double code(double x, double y, double z, double t) {
return x * (-1.0 * t);
}
def code(x, y, z, t): return x * (-1.0 * t)
function code(x, y, z, t) return Float64(x * Float64(-1.0 * t)) end
function tmp = code(x, y, z, t) tmp = x * (-1.0 * t); end
code[x_, y_, z_, t_] := N[(x * N[(-1.0 * t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(-1 \cdot t\right)
\end{array}
Initial program 94.9%
lift-/.f64N/A
div-flipN/A
associate-/r/N/A
lower-*.f64N/A
frac-2negN/A
metadata-evalN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6494.8
Applied rewrites94.8%
Taylor expanded in y around 0
lower-/.f64N/A
lower--.f6446.1
Applied rewrites46.1%
Taylor expanded in z around 0
lower-*.f6423.9
Applied rewrites23.9%
herbie shell --seed 2025156
(FPCore (x y z t)
:name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, C"
:precision binary64
(* x (- (/ y z) (/ t (- 1.0 z)))))