
(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 13 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 4e+171)
(* x t_1)
(* (/ x z) (/ (fma (- t) z (* (- 1.0 z) y)) (- 1.0 z))))))
double code(double x, double y, double z, double t) {
double t_1 = (y / z) - (t / (1.0 - z));
double tmp;
if (t_1 <= 4e+171) {
tmp = x * t_1;
} else {
tmp = (x / z) * (fma(-t, z, ((1.0 - z) * y)) / (1.0 - z));
}
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 <= 4e+171) tmp = Float64(x * t_1); else tmp = Float64(Float64(x / z) * Float64(fma(Float64(-t), z, Float64(Float64(1.0 - z) * y)) / Float64(1.0 - z))); end return 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, 4e+171], N[(x * t$95$1), $MachinePrecision], N[(N[(x / z), $MachinePrecision] * N[(N[((-t) * z + N[(N[(1.0 - z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision] / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{z} - \frac{t}{1 - z}\\
\mathbf{if}\;t\_1 \leq 4 \cdot 10^{+171}:\\
\;\;\;\;x \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} \cdot \frac{\mathsf{fma}\left(-t, z, \left(1 - z\right) \cdot y\right)}{1 - z}\\
\end{array}
\end{array}
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < 3.99999999999999982e171Initial program 96.1%
if 3.99999999999999982e171 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) Initial program 88.1%
lift-/.f64N/A
frac-2negN/A
mul-1-negN/A
*-commutativeN/A
mul-1-negN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6488.1
Applied rewrites88.1%
lift--.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
mul-1-negN/A
mul-1-negN/A
frac-2negN/A
lower-*.f64N/A
frac-subN/A
*-commutativeN/A
associate-/l*N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
Applied rewrites94.4%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (- (/ y z) (/ t (- 1.0 z))))) (if (<= t_1 1e+305) (* x t_1) (* y (/ x z)))))
double code(double x, double y, double z, double t) {
double t_1 = (y / z) - (t / (1.0 - z));
double tmp;
if (t_1 <= 1e+305) {
tmp = x * t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = (y / z) - (t / (1.0d0 - z))
if (t_1 <= 1d+305) then
tmp = x * t_1
else
tmp = y * (x / z)
end if
code = tmp
end function
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 <= 1e+305) {
tmp = x * t_1;
} else {
tmp = y * (x / z);
}
return tmp;
}
def code(x, y, z, t): t_1 = (y / z) - (t / (1.0 - z)) tmp = 0 if t_1 <= 1e+305: tmp = x * t_1 else: tmp = y * (x / z) 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 <= 1e+305) tmp = Float64(x * t_1); else tmp = Float64(y * Float64(x / z)); 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 <= 1e+305) tmp = x * t_1; else tmp = y * (x / z); 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, 1e+305], N[(x * t$95$1), $MachinePrecision], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{z} - \frac{t}{1 - z}\\
\mathbf{if}\;t\_1 \leq 10^{+305}:\\
\;\;\;\;x \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < 9.9999999999999994e304Initial program 96.5%
if 9.9999999999999994e304 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) Initial program 69.6%
Taylor expanded in z around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6487.5
Applied rewrites87.5%
Taylor expanded in y around 0
Applied rewrites19.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6423.7
Applied rewrites23.7%
Taylor expanded in y around inf
Applied rewrites98.4%
(FPCore (x y z t) :precision binary64 (if (<= z -0.7) (* (+ t y) (/ x z)) (if (<= z 1.0) (* x (- (/ y z) (* (+ 1.0 z) t))) (/ (* (+ t y) x) z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.7) {
tmp = (t + y) * (x / z);
} else if (z <= 1.0) {
tmp = x * ((y / z) - ((1.0 + z) * t));
} else {
tmp = ((t + 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 (z <= (-0.7d0)) then
tmp = (t + y) * (x / z)
else if (z <= 1.0d0) then
tmp = x * ((y / z) - ((1.0d0 + z) * t))
else
tmp = ((t + y) * x) / z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.7) {
tmp = (t + y) * (x / z);
} else if (z <= 1.0) {
tmp = x * ((y / z) - ((1.0 + z) * t));
} else {
tmp = ((t + y) * x) / z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -0.7: tmp = (t + y) * (x / z) elif z <= 1.0: tmp = x * ((y / z) - ((1.0 + z) * t)) else: tmp = ((t + y) * x) / z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -0.7) tmp = Float64(Float64(t + y) * Float64(x / z)); elseif (z <= 1.0) tmp = Float64(x * Float64(Float64(y / z) - Float64(Float64(1.0 + z) * t))); else tmp = Float64(Float64(Float64(t + y) * x) / z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -0.7) tmp = (t + y) * (x / z); elseif (z <= 1.0) tmp = x * ((y / z) - ((1.0 + z) * t)); else tmp = ((t + y) * x) / z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -0.7], N[(N[(t + y), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.0], N[(x * N[(N[(y / z), $MachinePrecision] - N[(N[(1.0 + z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t + y), $MachinePrecision] * x), $MachinePrecision] / z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.7:\\
\;\;\;\;\left(t + y\right) \cdot \frac{x}{z}\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - \left(1 + z\right) \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(t + y\right) \cdot x}{z}\\
\end{array}
\end{array}
if z < -0.69999999999999996Initial program 97.3%
Taylor expanded in z around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6486.0
Applied rewrites86.0%
Taylor expanded in y around 0
lower-+.f6486.0
Applied rewrites86.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-/.f6487.2
Applied rewrites87.2%
if -0.69999999999999996 < z < 1Initial program 92.4%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f6492.1
Applied rewrites92.1%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
lower-+.f6492.1
Applied rewrites92.1%
if 1 < z Initial program 96.8%
Taylor expanded in z around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6486.8
Applied rewrites86.8%
Taylor expanded in y around 0
lower-+.f6486.8
Applied rewrites86.8%
(FPCore (x y z t) :precision binary64 (if (<= z -0.7) (* (+ t y) (/ x z)) (if (<= z 1.0) (* x (- (/ y z) (fma t z t))) (/ (* (+ t y) x) z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.7) {
tmp = (t + y) * (x / z);
} else if (z <= 1.0) {
tmp = x * ((y / z) - fma(t, z, t));
} else {
tmp = ((t + y) * x) / z;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= -0.7) tmp = Float64(Float64(t + y) * Float64(x / z)); elseif (z <= 1.0) tmp = Float64(x * Float64(Float64(y / z) - fma(t, z, t))); else tmp = Float64(Float64(Float64(t + y) * x) / z); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -0.7], N[(N[(t + y), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.0], N[(x * N[(N[(y / z), $MachinePrecision] - N[(t * z + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t + y), $MachinePrecision] * x), $MachinePrecision] / z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.7:\\
\;\;\;\;\left(t + y\right) \cdot \frac{x}{z}\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - \mathsf{fma}\left(t, z, t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(t + y\right) \cdot x}{z}\\
\end{array}
\end{array}
if z < -0.69999999999999996Initial program 97.3%
Taylor expanded in z around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6486.0
Applied rewrites86.0%
Taylor expanded in y around 0
lower-+.f6486.0
Applied rewrites86.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-/.f6487.2
Applied rewrites87.2%
if -0.69999999999999996 < z < 1Initial program 92.4%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f6492.1
Applied rewrites92.1%
if 1 < z Initial program 96.8%
Taylor expanded in z around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6486.8
Applied rewrites86.8%
Taylor expanded in y around 0
lower-+.f6486.8
Applied rewrites86.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ t z))))
(if (<= t -3e+121)
t_1
(if (<= t -9.6e-281)
(* x (/ y z))
(if (<= t 5.8e+158) (* y (/ x z)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t / z);
double tmp;
if (t <= -3e+121) {
tmp = t_1;
} else if (t <= -9.6e-281) {
tmp = x * (y / z);
} else if (t <= 5.8e+158) {
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 (t <= (-3d+121)) then
tmp = t_1
else if (t <= (-9.6d-281)) then
tmp = x * (y / z)
else if (t <= 5.8d+158) 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 (t <= -3e+121) {
tmp = t_1;
} else if (t <= -9.6e-281) {
tmp = x * (y / z);
} else if (t <= 5.8e+158) {
tmp = y * (x / z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t / z) tmp = 0 if t <= -3e+121: tmp = t_1 elif t <= -9.6e-281: tmp = x * (y / z) elif t <= 5.8e+158: 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 (t <= -3e+121) tmp = t_1; elseif (t <= -9.6e-281) tmp = Float64(x * Float64(y / z)); elseif (t <= 5.8e+158) 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 (t <= -3e+121) tmp = t_1; elseif (t <= -9.6e-281) tmp = x * (y / z); elseif (t <= 5.8e+158) 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[t, -3e+121], t$95$1, If[LessEqual[t, -9.6e-281], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 5.8e+158], 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}\;t \leq -3 \cdot 10^{+121}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -9.6 \cdot 10^{-281}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{elif}\;t \leq 5.8 \cdot 10^{+158}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -3.0000000000000002e121 or 5.80000000000000048e158 < t Initial program 96.4%
lift-/.f64N/A
frac-2negN/A
mul-1-negN/A
*-commutativeN/A
mul-1-negN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6496.4
Applied rewrites96.4%
Taylor expanded in y around 0
frac-timesN/A
*-commutativeN/A
mul-1-negN/A
mul-1-negN/A
frac-2negN/A
frac-subN/A
*-commutativeN/A
*-commutativeN/A
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lift-neg.f64N/A
lift--.f6478.5
Applied rewrites78.5%
Taylor expanded in z around inf
lower-/.f6455.6
Applied rewrites55.6%
if -3.0000000000000002e121 < t < -9.6000000000000002e-281Initial program 94.1%
Taylor expanded in y around inf
lift-/.f6473.4
Applied rewrites73.4%
if -9.6000000000000002e-281 < t < 5.80000000000000048e158Initial program 94.0%
Taylor expanded in z around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6476.3
Applied rewrites76.3%
Taylor expanded in y around 0
Applied rewrites28.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6430.0
Applied rewrites30.0%
Taylor expanded in y around inf
Applied rewrites71.8%
(FPCore (x y z t)
:precision binary64
(if (<= t -9e+122)
(/ (* t x) z)
(if (<= t -9.6e-281)
(* x (/ y z))
(if (<= t 8.4e+158) (* y (/ x z)) (* t (/ x z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -9e+122) {
tmp = (t * x) / z;
} else if (t <= -9.6e-281) {
tmp = x * (y / z);
} else if (t <= 8.4e+158) {
tmp = y * (x / z);
} else {
tmp = t * (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 (t <= (-9d+122)) then
tmp = (t * x) / z
else if (t <= (-9.6d-281)) then
tmp = x * (y / z)
else if (t <= 8.4d+158) then
tmp = y * (x / z)
else
tmp = t * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -9e+122) {
tmp = (t * x) / z;
} else if (t <= -9.6e-281) {
tmp = x * (y / z);
} else if (t <= 8.4e+158) {
tmp = y * (x / z);
} else {
tmp = t * (x / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -9e+122: tmp = (t * x) / z elif t <= -9.6e-281: tmp = x * (y / z) elif t <= 8.4e+158: tmp = y * (x / z) else: tmp = t * (x / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -9e+122) tmp = Float64(Float64(t * x) / z); elseif (t <= -9.6e-281) tmp = Float64(x * Float64(y / z)); elseif (t <= 8.4e+158) tmp = Float64(y * Float64(x / z)); else tmp = Float64(t * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -9e+122) tmp = (t * x) / z; elseif (t <= -9.6e-281) tmp = x * (y / z); elseif (t <= 8.4e+158) tmp = y * (x / z); else tmp = t * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -9e+122], N[(N[(t * x), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[t, -9.6e-281], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 8.4e+158], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9 \cdot 10^{+122}:\\
\;\;\;\;\frac{t \cdot x}{z}\\
\mathbf{elif}\;t \leq -9.6 \cdot 10^{-281}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{elif}\;t \leq 8.4 \cdot 10^{+158}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\end{array}
\end{array}
if t < -8.99999999999999995e122Initial program 96.1%
Taylor expanded in z around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6456.3
Applied rewrites56.3%
Taylor expanded in y around 0
Applied rewrites46.7%
if -8.99999999999999995e122 < t < -9.6000000000000002e-281Initial program 94.1%
Taylor expanded in y around inf
lift-/.f6473.3
Applied rewrites73.3%
if -9.6000000000000002e-281 < t < 8.3999999999999996e158Initial program 94.0%
Taylor expanded in z around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6476.2
Applied rewrites76.2%
Taylor expanded in y around 0
Applied rewrites28.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6430.0
Applied rewrites30.0%
Taylor expanded in y around inf
Applied rewrites71.8%
if 8.3999999999999996e158 < t Initial program 96.9%
Taylor expanded in z around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6454.9
Applied rewrites54.9%
Taylor expanded in y around 0
Applied rewrites46.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6447.6
Applied rewrites47.6%
(FPCore (x y z t) :precision binary64 (if (<= z -1.05) (* (+ t y) (/ x z)) (if (<= z 1.0) (* x (- (/ y z) t)) (/ (* (+ t y) x) z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.05) {
tmp = (t + y) * (x / z);
} else if (z <= 1.0) {
tmp = x * ((y / z) - t);
} else {
tmp = ((t + 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 (z <= (-1.05d0)) then
tmp = (t + y) * (x / z)
else if (z <= 1.0d0) then
tmp = x * ((y / z) - t)
else
tmp = ((t + y) * x) / z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.05) {
tmp = (t + y) * (x / z);
} else if (z <= 1.0) {
tmp = x * ((y / z) - t);
} else {
tmp = ((t + y) * x) / z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.05: tmp = (t + y) * (x / z) elif z <= 1.0: tmp = x * ((y / z) - t) else: tmp = ((t + y) * x) / z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.05) tmp = Float64(Float64(t + y) * Float64(x / z)); elseif (z <= 1.0) tmp = Float64(x * Float64(Float64(y / z) - t)); else tmp = Float64(Float64(Float64(t + y) * x) / z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.05) tmp = (t + y) * (x / z); elseif (z <= 1.0) tmp = x * ((y / z) - t); else tmp = ((t + y) * x) / z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.05], N[(N[(t + y), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.0], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t + y), $MachinePrecision] * x), $MachinePrecision] / z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.05:\\
\;\;\;\;\left(t + y\right) \cdot \frac{x}{z}\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(t + y\right) \cdot x}{z}\\
\end{array}
\end{array}
if z < -1.05000000000000004Initial program 97.3%
Taylor expanded in z around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6486.0
Applied rewrites86.0%
Taylor expanded in y around 0
lower-+.f6486.0
Applied rewrites86.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-/.f6487.3
Applied rewrites87.3%
if -1.05000000000000004 < z < 1Initial program 92.4%
Taylor expanded in z around 0
Applied rewrites91.8%
if 1 < z Initial program 96.8%
Taylor expanded in z around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6486.8
Applied rewrites86.8%
Taylor expanded in y around 0
lower-+.f6486.8
Applied rewrites86.8%
(FPCore (x y z t) :precision binary64 (if (<= z -7.5e-55) (* (+ t y) (/ x z)) (if (<= z 1.0) (* y (/ x z)) (/ (* (+ t y) x) z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7.5e-55) {
tmp = (t + y) * (x / z);
} else if (z <= 1.0) {
tmp = y * (x / z);
} else {
tmp = ((t + 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 (z <= (-7.5d-55)) then
tmp = (t + y) * (x / z)
else if (z <= 1.0d0) then
tmp = y * (x / z)
else
tmp = ((t + y) * x) / z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7.5e-55) {
tmp = (t + y) * (x / z);
} else if (z <= 1.0) {
tmp = y * (x / z);
} else {
tmp = ((t + y) * x) / z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -7.5e-55: tmp = (t + y) * (x / z) elif z <= 1.0: tmp = y * (x / z) else: tmp = ((t + y) * x) / z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -7.5e-55) tmp = Float64(Float64(t + y) * Float64(x / z)); elseif (z <= 1.0) tmp = Float64(y * Float64(x / z)); else tmp = Float64(Float64(Float64(t + y) * x) / z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -7.5e-55) tmp = (t + y) * (x / z); elseif (z <= 1.0) tmp = y * (x / z); else tmp = ((t + y) * x) / z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -7.5e-55], N[(N[(t + y), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.0], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t + y), $MachinePrecision] * x), $MachinePrecision] / z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.5 \cdot 10^{-55}:\\
\;\;\;\;\left(t + y\right) \cdot \frac{x}{z}\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(t + y\right) \cdot x}{z}\\
\end{array}
\end{array}
if z < -7.50000000000000023e-55Initial program 97.5%
Taylor expanded in z around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6482.4
Applied rewrites82.4%
Taylor expanded in y around 0
lower-+.f6482.4
Applied rewrites82.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-/.f6483.3
Applied rewrites83.3%
if -7.50000000000000023e-55 < z < 1Initial program 91.8%
Taylor expanded in z around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6455.2
Applied rewrites55.2%
Taylor expanded in y around 0
Applied rewrites13.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6416.0
Applied rewrites16.0%
Taylor expanded in y around inf
Applied rewrites70.1%
if 1 < z Initial program 96.8%
Taylor expanded in z around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6486.8
Applied rewrites86.8%
Taylor expanded in y around 0
lower-+.f6486.8
Applied rewrites86.8%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (+ t y) (/ x z)))) (if (<= z -7.5e-55) t_1 (if (<= z 1.0) (* y (/ x z)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (t + y) * (x / z);
double tmp;
if (z <= -7.5e-55) {
tmp = t_1;
} else if (z <= 1.0) {
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 = (t + y) * (x / z)
if (z <= (-7.5d-55)) then
tmp = t_1
else if (z <= 1.0d0) 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 = (t + y) * (x / z);
double tmp;
if (z <= -7.5e-55) {
tmp = t_1;
} else if (z <= 1.0) {
tmp = y * (x / z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (t + y) * (x / z) tmp = 0 if z <= -7.5e-55: tmp = t_1 elif z <= 1.0: tmp = y * (x / z) 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 <= -7.5e-55) tmp = t_1; elseif (z <= 1.0) tmp = Float64(y * Float64(x / z)); 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 <= -7.5e-55) tmp = t_1; elseif (z <= 1.0) tmp = y * (x / z); 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, -7.5e-55], t$95$1, If[LessEqual[z, 1.0], N[(y * N[(x / z), $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 -7.5 \cdot 10^{-55}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7.50000000000000023e-55 or 1 < z Initial program 97.2%
Taylor expanded in z around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6484.5
Applied rewrites84.5%
Taylor expanded in y around 0
lower-+.f6484.5
Applied rewrites84.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-/.f6484.7
Applied rewrites84.7%
if -7.50000000000000023e-55 < z < 1Initial program 91.8%
Taylor expanded in z around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6455.2
Applied rewrites55.2%
Taylor expanded in y around 0
Applied rewrites13.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6416.0
Applied rewrites16.0%
Taylor expanded in y around inf
Applied rewrites70.1%
(FPCore (x y z t) :precision binary64 (if (<= t -1.65e+96) (/ (* t x) z) (if (<= t 8.4e+158) (* y (/ x z)) (* t (/ x z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.65e+96) {
tmp = (t * x) / z;
} else if (t <= 8.4e+158) {
tmp = y * (x / z);
} else {
tmp = t * (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 (t <= (-1.65d+96)) then
tmp = (t * x) / z
else if (t <= 8.4d+158) then
tmp = y * (x / z)
else
tmp = t * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.65e+96) {
tmp = (t * x) / z;
} else if (t <= 8.4e+158) {
tmp = y * (x / z);
} else {
tmp = t * (x / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.65e+96: tmp = (t * x) / z elif t <= 8.4e+158: tmp = y * (x / z) else: tmp = t * (x / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.65e+96) tmp = Float64(Float64(t * x) / z); elseif (t <= 8.4e+158) tmp = Float64(y * Float64(x / z)); else tmp = Float64(t * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.65e+96) tmp = (t * x) / z; elseif (t <= 8.4e+158) tmp = y * (x / z); else tmp = t * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.65e+96], N[(N[(t * x), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[t, 8.4e+158], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.65 \cdot 10^{+96}:\\
\;\;\;\;\frac{t \cdot x}{z}\\
\mathbf{elif}\;t \leq 8.4 \cdot 10^{+158}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\end{array}
\end{array}
if t < -1.64999999999999992e96Initial program 95.9%
Taylor expanded in z around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6457.7
Applied rewrites57.7%
Taylor expanded in y around 0
Applied rewrites45.9%
if -1.64999999999999992e96 < t < 8.3999999999999996e158Initial program 94.0%
Taylor expanded in z around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6477.5
Applied rewrites77.5%
Taylor expanded in y around 0
Applied rewrites28.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6429.9
Applied rewrites29.9%
Taylor expanded in y around inf
Applied rewrites72.4%
if 8.3999999999999996e158 < t Initial program 96.9%
Taylor expanded in z around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6454.9
Applied rewrites54.9%
Taylor expanded in y around 0
Applied rewrites46.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6447.6
Applied rewrites47.6%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* t (/ x z)))) (if (<= t -1.6e+96) t_1 (if (<= t 8.4e+158) (* y (/ x z)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = t * (x / z);
double tmp;
if (t <= -1.6e+96) {
tmp = t_1;
} else if (t <= 8.4e+158) {
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 = t * (x / z)
if (t <= (-1.6d+96)) then
tmp = t_1
else if (t <= 8.4d+158) 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 = t * (x / z);
double tmp;
if (t <= -1.6e+96) {
tmp = t_1;
} else if (t <= 8.4e+158) {
tmp = y * (x / z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = t * (x / z) tmp = 0 if t <= -1.6e+96: tmp = t_1 elif t <= 8.4e+158: tmp = y * (x / z) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(t * Float64(x / z)) tmp = 0.0 if (t <= -1.6e+96) tmp = t_1; elseif (t <= 8.4e+158) tmp = Float64(y * Float64(x / z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t * (x / z); tmp = 0.0; if (t <= -1.6e+96) tmp = t_1; elseif (t <= 8.4e+158) tmp = y * (x / z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.6e+96], t$95$1, If[LessEqual[t, 8.4e+158], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \frac{x}{z}\\
\mathbf{if}\;t \leq -1.6 \cdot 10^{+96}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 8.4 \cdot 10^{+158}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.60000000000000003e96 or 8.3999999999999996e158 < t Initial program 96.3%
Taylor expanded in z around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6456.5
Applied rewrites56.5%
Taylor expanded in y around 0
Applied rewrites46.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6446.2
Applied rewrites46.2%
if -1.60000000000000003e96 < t < 8.3999999999999996e158Initial program 94.0%
Taylor expanded in z around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6477.5
Applied rewrites77.5%
Taylor expanded in y around 0
Applied rewrites28.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6429.9
Applied rewrites29.9%
Taylor expanded in y around inf
Applied rewrites72.4%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* t (/ x z)))) (if (<= z -0.75) t_1 (if (<= z 1.0) (* x (fma (- t) z (- t))) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = t * (x / z);
double tmp;
if (z <= -0.75) {
tmp = t_1;
} else if (z <= 1.0) {
tmp = x * fma(-t, z, -t);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(t * Float64(x / z)) tmp = 0.0 if (z <= -0.75) tmp = t_1; elseif (z <= 1.0) tmp = Float64(x * fma(Float64(-t), z, Float64(-t))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -0.75], t$95$1, If[LessEqual[z, 1.0], N[(x * N[((-t) * z + (-t)), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \frac{x}{z}\\
\mathbf{if}\;z \leq -0.75:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;x \cdot \mathsf{fma}\left(-t, z, -t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -0.75 or 1 < z Initial program 97.0%
Taylor expanded in z around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6486.4
Applied rewrites86.4%
Taylor expanded in y around 0
Applied rewrites52.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6452.8
Applied rewrites52.8%
if -0.75 < z < 1Initial program 92.4%
lift-/.f64N/A
frac-2negN/A
mul-1-negN/A
*-commutativeN/A
mul-1-negN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6492.3
Applied rewrites92.3%
Taylor expanded in y around 0
frac-timesN/A
*-commutativeN/A
mul-1-negN/A
mul-1-negN/A
frac-2negN/A
frac-subN/A
*-commutativeN/A
*-commutativeN/A
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lift-neg.f64N/A
lift--.f6435.0
Applied rewrites35.0%
Taylor expanded in z around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lift-neg.f64N/A
mul-1-negN/A
lift-neg.f6434.7
Applied rewrites34.7%
(FPCore (x y z t) :precision binary64 (* x (- t)))
double code(double x, double y, double z, double t) {
return x * -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 * -t
end function
public static double code(double x, double y, double z, double t) {
return x * -t;
}
def code(x, y, z, t): return x * -t
function code(x, y, z, t) return Float64(x * Float64(-t)) end
function tmp = code(x, y, z, t) tmp = x * -t; end
code[x_, y_, z_, t_] := N[(x * (-t)), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(-t\right)
\end{array}
Initial program 94.7%
lift-/.f64N/A
frac-2negN/A
mul-1-negN/A
*-commutativeN/A
mul-1-negN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6494.7
Applied rewrites94.7%
Taylor expanded in y around 0
frac-timesN/A
*-commutativeN/A
mul-1-negN/A
mul-1-negN/A
frac-2negN/A
frac-subN/A
*-commutativeN/A
*-commutativeN/A
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lift-neg.f64N/A
lift--.f6446.7
Applied rewrites46.7%
Taylor expanded in z around 0
mul-1-negN/A
lift-neg.f6423.4
Applied rewrites23.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- (/ y z) (* t (/ 1.0 (- 1.0 z))))))
(t_2 (* x (- (/ y z) (/ t (- 1.0 z))))))
(if (< t_2 -7.623226303312042e-196)
t_1
(if (< t_2 1.4133944927702302e-211)
(+ (/ (* y x) z) (- (/ (* t x) (- 1.0 z))))
t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z))));
double t_2 = x * ((y / z) - (t / (1.0 - z)));
double tmp;
if (t_2 < -7.623226303312042e-196) {
tmp = t_1;
} else if (t_2 < 1.4133944927702302e-211) {
tmp = ((y * x) / z) + -((t * x) / (1.0 - 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) :: t_2
real(8) :: tmp
t_1 = x * ((y / z) - (t * (1.0d0 / (1.0d0 - z))))
t_2 = x * ((y / z) - (t / (1.0d0 - z)))
if (t_2 < (-7.623226303312042d-196)) then
tmp = t_1
else if (t_2 < 1.4133944927702302d-211) then
tmp = ((y * x) / z) + -((t * x) / (1.0d0 - 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 * ((y / z) - (t * (1.0 / (1.0 - z))));
double t_2 = x * ((y / z) - (t / (1.0 - z)));
double tmp;
if (t_2 < -7.623226303312042e-196) {
tmp = t_1;
} else if (t_2 < 1.4133944927702302e-211) {
tmp = ((y * x) / z) + -((t * x) / (1.0 - z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z)))) t_2 = x * ((y / z) - (t / (1.0 - z))) tmp = 0 if t_2 < -7.623226303312042e-196: tmp = t_1 elif t_2 < 1.4133944927702302e-211: tmp = ((y * x) / z) + -((t * x) / (1.0 - z)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(Float64(y / z) - Float64(t * Float64(1.0 / Float64(1.0 - z))))) t_2 = Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z)))) tmp = 0.0 if (t_2 < -7.623226303312042e-196) tmp = t_1; elseif (t_2 < 1.4133944927702302e-211) tmp = Float64(Float64(Float64(y * x) / z) + Float64(-Float64(Float64(t * x) / Float64(1.0 - z)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z)))); t_2 = x * ((y / z) - (t / (1.0 - z))); tmp = 0.0; if (t_2 < -7.623226303312042e-196) tmp = t_1; elseif (t_2 < 1.4133944927702302e-211) tmp = ((y * x) / z) + -((t * x) / (1.0 - z)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(N[(y / z), $MachinePrecision] - N[(t * N[(1.0 / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$2, -7.623226303312042e-196], t$95$1, If[Less[t$95$2, 1.4133944927702302e-211], N[(N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision] + (-N[(N[(t * x), $MachinePrecision] / N[(1.0 - z), $MachinePrecision]), $MachinePrecision])), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(\frac{y}{z} - t \cdot \frac{1}{1 - z}\right)\\
t_2 := x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\\
\mathbf{if}\;t\_2 < -7.623226303312042 \cdot 10^{-196}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 < 1.4133944927702302 \cdot 10^{-211}:\\
\;\;\;\;\frac{y \cdot x}{z} + \left(-\frac{t \cdot x}{1 - z}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2025095
(FPCore (x y z t)
:name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, C"
:precision binary64
:alt
(! :herbie-platform default (if (< (* x (- (/ y z) (/ t (- 1 z)))) -3811613151656021/5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (* x (- (/ y z) (* t (/ 1 (- 1 z))))) (if (< (* x (- (/ y z) (/ t (- 1 z)))) 7066972463851151/50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ (/ (* y x) z) (- (/ (* t x) (- 1 z)))) (* x (- (/ y z) (* t (/ 1 (- 1 z))))))))
(* x (- (/ y z) (/ t (- 1.0 z)))))