
(FPCore (x y z t) :precision binary64 (- 1.0 (/ x (* (- y z) (- y t)))))
double code(double x, double y, double z, double t) {
return 1.0 - (x / ((y - z) * (y - 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 = 1.0d0 - (x / ((y - z) * (y - t)))
end function
public static double code(double x, double y, double z, double t) {
return 1.0 - (x / ((y - z) * (y - t)));
}
def code(x, y, z, t): return 1.0 - (x / ((y - z) * (y - t)))
function code(x, y, z, t) return Float64(1.0 - Float64(x / Float64(Float64(y - z) * Float64(y - t)))) end
function tmp = code(x, y, z, t) tmp = 1.0 - (x / ((y - z) * (y - t))); end
code[x_, y_, z_, t_] := N[(1.0 - N[(x / N[(N[(y - z), $MachinePrecision] * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}
\end{array}
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (- 1.0 (/ x (* (- y z) (- y t)))))
double code(double x, double y, double z, double t) {
return 1.0 - (x / ((y - z) * (y - 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 = 1.0d0 - (x / ((y - z) * (y - t)))
end function
public static double code(double x, double y, double z, double t) {
return 1.0 - (x / ((y - z) * (y - t)));
}
def code(x, y, z, t): return 1.0 - (x / ((y - z) * (y - t)))
function code(x, y, z, t) return Float64(1.0 - Float64(x / Float64(Float64(y - z) * Float64(y - t)))) end
function tmp = code(x, y, z, t) tmp = 1.0 - (x / ((y - z) * (y - t))); end
code[x_, y_, z_, t_] := N[(1.0 - N[(x / N[(N[(y - z), $MachinePrecision] * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}
\end{array}
(FPCore (x y z t) :precision binary64 (- 1.0 (/ x (* (- y z) (- y t)))))
double code(double x, double y, double z, double t) {
return 1.0 - (x / ((y - z) * (y - 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 = 1.0d0 - (x / ((y - z) * (y - t)))
end function
public static double code(double x, double y, double z, double t) {
return 1.0 - (x / ((y - z) * (y - t)));
}
def code(x, y, z, t): return 1.0 - (x / ((y - z) * (y - t)))
function code(x, y, z, t) return Float64(1.0 - Float64(x / Float64(Float64(y - z) * Float64(y - t)))) end
function tmp = code(x, y, z, t) tmp = 1.0 - (x / ((y - z) * (y - t))); end
code[x_, y_, z_, t_] := N[(1.0 - N[(x / N[(N[(y - z), $MachinePrecision] * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}
\end{array}
Initial program 99.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (/ (/ x (- y z)) (- y t))))
(t_2 (- 1.0 (/ x (* (- y z) (- y t))))))
(if (<= t_2 -1.0) t_1 (if (<= t_2 2.0) 1.0 t_1))))
double code(double x, double y, double z, double t) {
double t_1 = -((x / (y - z)) / (y - t));
double t_2 = 1.0 - (x / ((y - z) * (y - t)));
double tmp;
if (t_2 <= -1.0) {
tmp = t_1;
} else if (t_2 <= 2.0) {
tmp = 1.0;
} 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)) / (y - t))
t_2 = 1.0d0 - (x / ((y - z) * (y - t)))
if (t_2 <= (-1.0d0)) then
tmp = t_1
else if (t_2 <= 2.0d0) then
tmp = 1.0d0
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)) / (y - t));
double t_2 = 1.0 - (x / ((y - z) * (y - t)));
double tmp;
if (t_2 <= -1.0) {
tmp = t_1;
} else if (t_2 <= 2.0) {
tmp = 1.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = -((x / (y - z)) / (y - t)) t_2 = 1.0 - (x / ((y - z) * (y - t))) tmp = 0 if t_2 <= -1.0: tmp = t_1 elif t_2 <= 2.0: tmp = 1.0 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(-Float64(Float64(x / Float64(y - z)) / Float64(y - t))) t_2 = Float64(1.0 - Float64(x / Float64(Float64(y - z) * Float64(y - t)))) tmp = 0.0 if (t_2 <= -1.0) tmp = t_1; elseif (t_2 <= 2.0) tmp = 1.0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = -((x / (y - z)) / (y - t)); t_2 = 1.0 - (x / ((y - z) * (y - t))); tmp = 0.0; if (t_2 <= -1.0) tmp = t_1; elseif (t_2 <= 2.0) tmp = 1.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = (-N[(N[(x / N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision])}, Block[{t$95$2 = N[(1.0 - N[(x / N[(N[(y - z), $MachinePrecision] * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1.0], t$95$1, If[LessEqual[t$95$2, 2.0], 1.0, t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -\frac{\frac{x}{y - z}}{y - t}\\
t_2 := 1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}\\
\mathbf{if}\;t\_2 \leq -1:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) < -1 or 2 < (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) Initial program 95.9%
Taylor expanded in x around inf
mul-1-negN/A
*-commutativeN/A
lower-neg.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6490.7
Applied rewrites90.7%
if -1 < (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) < 2Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites99.1%
(FPCore (x y z t)
:precision binary64
(if (<= t -2.1e-202)
(+ (/ x (* (- y t) z)) 1.0)
(if (<= t 3.8e-94)
(- 1.0 (/ x (* (- y z) y)))
(+ (/ x (* (- y z) t)) 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.1e-202) {
tmp = (x / ((y - t) * z)) + 1.0;
} else if (t <= 3.8e-94) {
tmp = 1.0 - (x / ((y - z) * y));
} else {
tmp = (x / ((y - z) * t)) + 1.0;
}
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 <= (-2.1d-202)) then
tmp = (x / ((y - t) * z)) + 1.0d0
else if (t <= 3.8d-94) then
tmp = 1.0d0 - (x / ((y - z) * y))
else
tmp = (x / ((y - z) * t)) + 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.1e-202) {
tmp = (x / ((y - t) * z)) + 1.0;
} else if (t <= 3.8e-94) {
tmp = 1.0 - (x / ((y - z) * y));
} else {
tmp = (x / ((y - z) * t)) + 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -2.1e-202: tmp = (x / ((y - t) * z)) + 1.0 elif t <= 3.8e-94: tmp = 1.0 - (x / ((y - z) * y)) else: tmp = (x / ((y - z) * t)) + 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -2.1e-202) tmp = Float64(Float64(x / Float64(Float64(y - t) * z)) + 1.0); elseif (t <= 3.8e-94) tmp = Float64(1.0 - Float64(x / Float64(Float64(y - z) * y))); else tmp = Float64(Float64(x / Float64(Float64(y - z) * t)) + 1.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -2.1e-202) tmp = (x / ((y - t) * z)) + 1.0; elseif (t <= 3.8e-94) tmp = 1.0 - (x / ((y - z) * y)); else tmp = (x / ((y - z) * t)) + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -2.1e-202], N[(N[(x / N[(N[(y - t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], If[LessEqual[t, 3.8e-94], N[(1.0 - N[(x / N[(N[(y - z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.1 \cdot 10^{-202}:\\
\;\;\;\;\frac{x}{\left(y - t\right) \cdot z} + 1\\
\mathbf{elif}\;t \leq 3.8 \cdot 10^{-94}:\\
\;\;\;\;1 - \frac{x}{\left(y - z\right) \cdot y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\left(y - z\right) \cdot t} + 1\\
\end{array}
\end{array}
if t < -2.09999999999999985e-202Initial program 99.4%
Taylor expanded in z around inf
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6480.3
Applied rewrites80.3%
if -2.09999999999999985e-202 < t < 3.79999999999999999e-94Initial program 97.4%
Taylor expanded in y around inf
Applied rewrites88.3%
if 3.79999999999999999e-94 < t Initial program 99.9%
Taylor expanded in t around inf
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6494.7
Applied rewrites94.7%
(FPCore (x y z t) :precision binary64 (if (<= z -2.8e-87) (+ (/ x (* (- y t) z)) 1.0) (- 1.0 (/ (/ x (- y t)) y))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.8e-87) {
tmp = (x / ((y - t) * z)) + 1.0;
} else {
tmp = 1.0 - ((x / (y - t)) / y);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-2.8d-87)) then
tmp = (x / ((y - t) * z)) + 1.0d0
else
tmp = 1.0d0 - ((x / (y - t)) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.8e-87) {
tmp = (x / ((y - t) * z)) + 1.0;
} else {
tmp = 1.0 - ((x / (y - t)) / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.8e-87: tmp = (x / ((y - t) * z)) + 1.0 else: tmp = 1.0 - ((x / (y - t)) / y) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.8e-87) tmp = Float64(Float64(x / Float64(Float64(y - t) * z)) + 1.0); else tmp = Float64(1.0 - Float64(Float64(x / Float64(y - t)) / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -2.8e-87) tmp = (x / ((y - t) * z)) + 1.0; else tmp = 1.0 - ((x / (y - t)) / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.8e-87], N[(N[(x / N[(N[(y - t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], N[(1.0 - N[(N[(x / N[(y - t), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.8 \cdot 10^{-87}:\\
\;\;\;\;\frac{x}{\left(y - t\right) \cdot z} + 1\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{\frac{x}{y - t}}{y}\\
\end{array}
\end{array}
if z < -2.8000000000000001e-87Initial program 99.9%
Taylor expanded in z around inf
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6494.7
Applied rewrites94.7%
if -2.8000000000000001e-87 < z Initial program 98.5%
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6498.8
Applied rewrites98.8%
Taylor expanded in y around inf
Applied rewrites76.9%
(FPCore (x y z t) :precision binary64 (if (<= z -2.8e-87) (+ (/ x (* (- y t) z)) 1.0) (- 1.0 (/ x (* y (- y t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.8e-87) {
tmp = (x / ((y - t) * z)) + 1.0;
} else {
tmp = 1.0 - (x / (y * (y - t)));
}
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 <= (-2.8d-87)) then
tmp = (x / ((y - t) * z)) + 1.0d0
else
tmp = 1.0d0 - (x / (y * (y - t)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.8e-87) {
tmp = (x / ((y - t) * z)) + 1.0;
} else {
tmp = 1.0 - (x / (y * (y - t)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.8e-87: tmp = (x / ((y - t) * z)) + 1.0 else: tmp = 1.0 - (x / (y * (y - t))) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.8e-87) tmp = Float64(Float64(x / Float64(Float64(y - t) * z)) + 1.0); else tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - t)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -2.8e-87) tmp = (x / ((y - t) * z)) + 1.0; else tmp = 1.0 - (x / (y * (y - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.8e-87], N[(N[(x / N[(N[(y - t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], N[(1.0 - N[(x / N[(y * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.8 \cdot 10^{-87}:\\
\;\;\;\;\frac{x}{\left(y - t\right) \cdot z} + 1\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - t\right)}\\
\end{array}
\end{array}
if z < -2.8000000000000001e-87Initial program 99.9%
Taylor expanded in z around inf
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6494.7
Applied rewrites94.7%
if -2.8000000000000001e-87 < z Initial program 98.5%
Taylor expanded in y around inf
Applied rewrites76.3%
(FPCore (x y z t) :precision binary64 (if (<= z -1.8e-87) (+ (/ x (* (- y t) z)) 1.0) (if (<= z -6.2e-243) (- 1.0 (/ x (* y y))) (+ (/ x (* (- y z) t)) 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.8e-87) {
tmp = (x / ((y - t) * z)) + 1.0;
} else if (z <= -6.2e-243) {
tmp = 1.0 - (x / (y * y));
} else {
tmp = (x / ((y - z) * t)) + 1.0;
}
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.8d-87)) then
tmp = (x / ((y - t) * z)) + 1.0d0
else if (z <= (-6.2d-243)) then
tmp = 1.0d0 - (x / (y * y))
else
tmp = (x / ((y - z) * t)) + 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.8e-87) {
tmp = (x / ((y - t) * z)) + 1.0;
} else if (z <= -6.2e-243) {
tmp = 1.0 - (x / (y * y));
} else {
tmp = (x / ((y - z) * t)) + 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.8e-87: tmp = (x / ((y - t) * z)) + 1.0 elif z <= -6.2e-243: tmp = 1.0 - (x / (y * y)) else: tmp = (x / ((y - z) * t)) + 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.8e-87) tmp = Float64(Float64(x / Float64(Float64(y - t) * z)) + 1.0); elseif (z <= -6.2e-243) tmp = Float64(1.0 - Float64(x / Float64(y * y))); else tmp = Float64(Float64(x / Float64(Float64(y - z) * t)) + 1.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.8e-87) tmp = (x / ((y - t) * z)) + 1.0; elseif (z <= -6.2e-243) tmp = 1.0 - (x / (y * y)); else tmp = (x / ((y - z) * t)) + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.8e-87], N[(N[(x / N[(N[(y - t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], If[LessEqual[z, -6.2e-243], N[(1.0 - N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.8 \cdot 10^{-87}:\\
\;\;\;\;\frac{x}{\left(y - t\right) \cdot z} + 1\\
\mathbf{elif}\;z \leq -6.2 \cdot 10^{-243}:\\
\;\;\;\;1 - \frac{x}{y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\left(y - z\right) \cdot t} + 1\\
\end{array}
\end{array}
if z < -1.79999999999999996e-87Initial program 99.9%
Taylor expanded in z around inf
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6494.6
Applied rewrites94.6%
if -1.79999999999999996e-87 < z < -6.1999999999999999e-243Initial program 97.5%
Taylor expanded in y around inf
unpow2N/A
lower-*.f6463.9
Applied rewrites63.9%
if -6.1999999999999999e-243 < z Initial program 98.8%
Taylor expanded in t around inf
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6478.8
Applied rewrites78.8%
(FPCore (x y z t) :precision binary64 (if (<= z -1.8e-87) (+ (/ x (* (- y t) z)) 1.0) (if (<= z -6.2e-243) (- 1.0 (/ x (* y y))) (/ (+ t (/ x (- y z))) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.8e-87) {
tmp = (x / ((y - t) * z)) + 1.0;
} else if (z <= -6.2e-243) {
tmp = 1.0 - (x / (y * y));
} else {
tmp = (t + (x / (y - z))) / t;
}
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.8d-87)) then
tmp = (x / ((y - t) * z)) + 1.0d0
else if (z <= (-6.2d-243)) then
tmp = 1.0d0 - (x / (y * y))
else
tmp = (t + (x / (y - z))) / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.8e-87) {
tmp = (x / ((y - t) * z)) + 1.0;
} else if (z <= -6.2e-243) {
tmp = 1.0 - (x / (y * y));
} else {
tmp = (t + (x / (y - z))) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.8e-87: tmp = (x / ((y - t) * z)) + 1.0 elif z <= -6.2e-243: tmp = 1.0 - (x / (y * y)) else: tmp = (t + (x / (y - z))) / t return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.8e-87) tmp = Float64(Float64(x / Float64(Float64(y - t) * z)) + 1.0); elseif (z <= -6.2e-243) tmp = Float64(1.0 - Float64(x / Float64(y * y))); else tmp = Float64(Float64(t + Float64(x / Float64(y - z))) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.8e-87) tmp = (x / ((y - t) * z)) + 1.0; elseif (z <= -6.2e-243) tmp = 1.0 - (x / (y * y)); else tmp = (t + (x / (y - z))) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.8e-87], N[(N[(x / N[(N[(y - t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], If[LessEqual[z, -6.2e-243], N[(1.0 - N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t + N[(x / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.8 \cdot 10^{-87}:\\
\;\;\;\;\frac{x}{\left(y - t\right) \cdot z} + 1\\
\mathbf{elif}\;z \leq -6.2 \cdot 10^{-243}:\\
\;\;\;\;1 - \frac{x}{y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;\frac{t + \frac{x}{y - z}}{t}\\
\end{array}
\end{array}
if z < -1.79999999999999996e-87Initial program 99.9%
Taylor expanded in z around inf
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6494.6
Applied rewrites94.6%
if -1.79999999999999996e-87 < z < -6.1999999999999999e-243Initial program 97.5%
Taylor expanded in y around inf
unpow2N/A
lower-*.f6463.9
Applied rewrites63.9%
if -6.1999999999999999e-243 < z Initial program 98.8%
Taylor expanded in t around inf
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6478.8
Applied rewrites78.8%
Taylor expanded in t around 0
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lift--.f6477.5
Applied rewrites77.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- 1.0 (/ x (* (- y z) (- y t))))))
(if (<= t_1 -5e+113)
(/ x (* z (- y t)))
(if (<= t_1 -1.0)
(- (/ (/ x y) (- y t)))
(if (<= t_1 2e+18) 1.0 (- (/ x (* y (- y z)))))))))
double code(double x, double y, double z, double t) {
double t_1 = 1.0 - (x / ((y - z) * (y - t)));
double tmp;
if (t_1 <= -5e+113) {
tmp = x / (z * (y - t));
} else if (t_1 <= -1.0) {
tmp = -((x / y) / (y - t));
} else if (t_1 <= 2e+18) {
tmp = 1.0;
} else {
tmp = -(x / (y * (y - 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 = 1.0d0 - (x / ((y - z) * (y - t)))
if (t_1 <= (-5d+113)) then
tmp = x / (z * (y - t))
else if (t_1 <= (-1.0d0)) then
tmp = -((x / y) / (y - t))
else if (t_1 <= 2d+18) then
tmp = 1.0d0
else
tmp = -(x / (y * (y - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = 1.0 - (x / ((y - z) * (y - t)));
double tmp;
if (t_1 <= -5e+113) {
tmp = x / (z * (y - t));
} else if (t_1 <= -1.0) {
tmp = -((x / y) / (y - t));
} else if (t_1 <= 2e+18) {
tmp = 1.0;
} else {
tmp = -(x / (y * (y - z)));
}
return tmp;
}
def code(x, y, z, t): t_1 = 1.0 - (x / ((y - z) * (y - t))) tmp = 0 if t_1 <= -5e+113: tmp = x / (z * (y - t)) elif t_1 <= -1.0: tmp = -((x / y) / (y - t)) elif t_1 <= 2e+18: tmp = 1.0 else: tmp = -(x / (y * (y - z))) return tmp
function code(x, y, z, t) t_1 = Float64(1.0 - Float64(x / Float64(Float64(y - z) * Float64(y - t)))) tmp = 0.0 if (t_1 <= -5e+113) tmp = Float64(x / Float64(z * Float64(y - t))); elseif (t_1 <= -1.0) tmp = Float64(-Float64(Float64(x / y) / Float64(y - t))); elseif (t_1 <= 2e+18) tmp = 1.0; else tmp = Float64(-Float64(x / Float64(y * Float64(y - z)))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 1.0 - (x / ((y - z) * (y - t))); tmp = 0.0; if (t_1 <= -5e+113) tmp = x / (z * (y - t)); elseif (t_1 <= -1.0) tmp = -((x / y) / (y - t)); elseif (t_1 <= 2e+18) tmp = 1.0; else tmp = -(x / (y * (y - z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(1.0 - N[(x / N[(N[(y - z), $MachinePrecision] * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+113], N[(x / N[(z * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -1.0], (-N[(N[(x / y), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), If[LessEqual[t$95$1, 2e+18], 1.0, (-N[(x / N[(y * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+113}:\\
\;\;\;\;\frac{x}{z \cdot \left(y - t\right)}\\
\mathbf{elif}\;t\_1 \leq -1:\\
\;\;\;\;-\frac{\frac{x}{y}}{y - t}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+18}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;-\frac{x}{y \cdot \left(y - z\right)}\\
\end{array}
\end{array}
if (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) < -5e113Initial program 94.6%
Taylor expanded in x around inf
mul-1-negN/A
*-commutativeN/A
lower-neg.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6491.7
Applied rewrites91.7%
Taylor expanded in z around inf
lower-/.f64N/A
lower-*.f64N/A
lift--.f6462.6
Applied rewrites62.6%
if -5e113 < (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) < -1Initial program 99.5%
Taylor expanded in x around inf
mul-1-negN/A
*-commutativeN/A
lower-neg.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6490.8
Applied rewrites90.8%
Taylor expanded in y around inf
Applied rewrites39.9%
if -1 < (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) < 2e18Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites98.1%
if 2e18 < (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) Initial program 95.0%
Taylor expanded in x around inf
mul-1-negN/A
*-commutativeN/A
lower-neg.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6492.3
Applied rewrites92.3%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f64N/A
lift--.f6444.5
Applied rewrites44.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- 1.0 (/ x (* (- y z) (- y t))))) (t_2 (- (/ x (* y (- y z))))))
(if (<= t_1 -5e+262)
(/ x (* t (- y z)))
(if (<= t_1 -1e+14) t_2 (if (<= t_1 2e+18) 1.0 t_2)))))
double code(double x, double y, double z, double t) {
double t_1 = 1.0 - (x / ((y - z) * (y - t)));
double t_2 = -(x / (y * (y - z)));
double tmp;
if (t_1 <= -5e+262) {
tmp = x / (t * (y - z));
} else if (t_1 <= -1e+14) {
tmp = t_2;
} else if (t_1 <= 2e+18) {
tmp = 1.0;
} else {
tmp = t_2;
}
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 = 1.0d0 - (x / ((y - z) * (y - t)))
t_2 = -(x / (y * (y - z)))
if (t_1 <= (-5d+262)) then
tmp = x / (t * (y - z))
else if (t_1 <= (-1d+14)) then
tmp = t_2
else if (t_1 <= 2d+18) then
tmp = 1.0d0
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = 1.0 - (x / ((y - z) * (y - t)));
double t_2 = -(x / (y * (y - z)));
double tmp;
if (t_1 <= -5e+262) {
tmp = x / (t * (y - z));
} else if (t_1 <= -1e+14) {
tmp = t_2;
} else if (t_1 <= 2e+18) {
tmp = 1.0;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = 1.0 - (x / ((y - z) * (y - t))) t_2 = -(x / (y * (y - z))) tmp = 0 if t_1 <= -5e+262: tmp = x / (t * (y - z)) elif t_1 <= -1e+14: tmp = t_2 elif t_1 <= 2e+18: tmp = 1.0 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(1.0 - Float64(x / Float64(Float64(y - z) * Float64(y - t)))) t_2 = Float64(-Float64(x / Float64(y * Float64(y - z)))) tmp = 0.0 if (t_1 <= -5e+262) tmp = Float64(x / Float64(t * Float64(y - z))); elseif (t_1 <= -1e+14) tmp = t_2; elseif (t_1 <= 2e+18) tmp = 1.0; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 1.0 - (x / ((y - z) * (y - t))); t_2 = -(x / (y * (y - z))); tmp = 0.0; if (t_1 <= -5e+262) tmp = x / (t * (y - z)); elseif (t_1 <= -1e+14) tmp = t_2; elseif (t_1 <= 2e+18) tmp = 1.0; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(1.0 - N[(x / N[(N[(y - z), $MachinePrecision] * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = (-N[(x / N[(y * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])}, If[LessEqual[t$95$1, -5e+262], N[(x / N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -1e+14], t$95$2, If[LessEqual[t$95$1, 2e+18], 1.0, t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}\\
t_2 := -\frac{x}{y \cdot \left(y - z\right)}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+262}:\\
\;\;\;\;\frac{x}{t \cdot \left(y - z\right)}\\
\mathbf{elif}\;t\_1 \leq -1 \cdot 10^{+14}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+18}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) < -5.00000000000000008e262Initial program 89.5%
Taylor expanded in t around inf
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6471.5
Applied rewrites71.5%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f64N/A
lift--.f6471.5
Applied rewrites71.5%
if -5.00000000000000008e262 < (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) < -1e14 or 2e18 < (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) Initial program 96.9%
Taylor expanded in x around inf
mul-1-negN/A
*-commutativeN/A
lower-neg.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6492.0
Applied rewrites92.0%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f64N/A
lift--.f6442.5
Applied rewrites42.5%
if -1e14 < (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) < 2e18Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites97.3%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (/ x (* t (- y z)))) (t_2 (- 1.0 (/ x (* (- y z) (- y t)))))) (if (<= t_2 -1.0) t_1 (if (<= t_2 2.0) 1.0 t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x / (t * (y - z));
double t_2 = 1.0 - (x / ((y - z) * (y - t)));
double tmp;
if (t_2 <= -1.0) {
tmp = t_1;
} else if (t_2 <= 2.0) {
tmp = 1.0;
} 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 / (t * (y - z))
t_2 = 1.0d0 - (x / ((y - z) * (y - t)))
if (t_2 <= (-1.0d0)) then
tmp = t_1
else if (t_2 <= 2.0d0) then
tmp = 1.0d0
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 * (y - z));
double t_2 = 1.0 - (x / ((y - z) * (y - t)));
double tmp;
if (t_2 <= -1.0) {
tmp = t_1;
} else if (t_2 <= 2.0) {
tmp = 1.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x / (t * (y - z)) t_2 = 1.0 - (x / ((y - z) * (y - t))) tmp = 0 if t_2 <= -1.0: tmp = t_1 elif t_2 <= 2.0: tmp = 1.0 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x / Float64(t * Float64(y - z))) t_2 = Float64(1.0 - Float64(x / Float64(Float64(y - z) * Float64(y - t)))) tmp = 0.0 if (t_2 <= -1.0) tmp = t_1; elseif (t_2 <= 2.0) tmp = 1.0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x / (t * (y - z)); t_2 = 1.0 - (x / ((y - z) * (y - t))); tmp = 0.0; if (t_2 <= -1.0) tmp = t_1; elseif (t_2 <= 2.0) tmp = 1.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x / N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - N[(x / N[(N[(y - z), $MachinePrecision] * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1.0], t$95$1, If[LessEqual[t$95$2, 2.0], 1.0, t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{t \cdot \left(y - z\right)}\\
t_2 := 1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}\\
\mathbf{if}\;t\_2 \leq -1:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) < -1 or 2 < (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) Initial program 95.9%
Taylor expanded in t around inf
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6462.7
Applied rewrites62.7%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f64N/A
lift--.f6461.5
Applied rewrites61.5%
if -1 < (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) < 2Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites99.1%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (/ x (* z (- y t)))) (t_2 (- 1.0 (/ x (* (- y z) (- y t)))))) (if (<= t_2 -1e+14) t_1 (if (<= t_2 10.0) 1.0 t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x / (z * (y - t));
double t_2 = 1.0 - (x / ((y - z) * (y - t)));
double tmp;
if (t_2 <= -1e+14) {
tmp = t_1;
} else if (t_2 <= 10.0) {
tmp = 1.0;
} 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 / (z * (y - t))
t_2 = 1.0d0 - (x / ((y - z) * (y - t)))
if (t_2 <= (-1d+14)) then
tmp = t_1
else if (t_2 <= 10.0d0) then
tmp = 1.0d0
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 * (y - t));
double t_2 = 1.0 - (x / ((y - z) * (y - t)));
double tmp;
if (t_2 <= -1e+14) {
tmp = t_1;
} else if (t_2 <= 10.0) {
tmp = 1.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x / (z * (y - t)) t_2 = 1.0 - (x / ((y - z) * (y - t))) tmp = 0 if t_2 <= -1e+14: tmp = t_1 elif t_2 <= 10.0: tmp = 1.0 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x / Float64(z * Float64(y - t))) t_2 = Float64(1.0 - Float64(x / Float64(Float64(y - z) * Float64(y - t)))) tmp = 0.0 if (t_2 <= -1e+14) tmp = t_1; elseif (t_2 <= 10.0) tmp = 1.0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x / (z * (y - t)); t_2 = 1.0 - (x / ((y - z) * (y - t))); tmp = 0.0; if (t_2 <= -1e+14) tmp = t_1; elseif (t_2 <= 10.0) tmp = 1.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x / N[(z * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - N[(x / N[(N[(y - z), $MachinePrecision] * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+14], t$95$1, If[LessEqual[t$95$2, 10.0], 1.0, t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{z \cdot \left(y - t\right)}\\
t_2 := 1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+14}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) < -1e14 or 10 < (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) Initial program 95.8%
Taylor expanded in x around inf
mul-1-negN/A
*-commutativeN/A
lower-neg.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6491.9
Applied rewrites91.9%
Taylor expanded in z around inf
lower-/.f64N/A
lower-*.f64N/A
lift--.f6459.7
Applied rewrites59.7%
if -1e14 < (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) < 10Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites98.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ x (* (- y z) (- y t)))) (t_2 (- (/ x (* y y)))))
(if (<= t_1 -2e+24)
t_2
(if (<= t_1 4.0) 1.0 (if (<= t_1 4e+107) t_2 (- (/ x (* t z))))))))
double code(double x, double y, double z, double t) {
double t_1 = x / ((y - z) * (y - t));
double t_2 = -(x / (y * y));
double tmp;
if (t_1 <= -2e+24) {
tmp = t_2;
} else if (t_1 <= 4.0) {
tmp = 1.0;
} else if (t_1 <= 4e+107) {
tmp = t_2;
} 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = x / ((y - z) * (y - t))
t_2 = -(x / (y * y))
if (t_1 <= (-2d+24)) then
tmp = t_2
else if (t_1 <= 4.0d0) then
tmp = 1.0d0
else if (t_1 <= 4d+107) then
tmp = t_2
else
tmp = -(x / (t * z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x / ((y - z) * (y - t));
double t_2 = -(x / (y * y));
double tmp;
if (t_1 <= -2e+24) {
tmp = t_2;
} else if (t_1 <= 4.0) {
tmp = 1.0;
} else if (t_1 <= 4e+107) {
tmp = t_2;
} else {
tmp = -(x / (t * z));
}
return tmp;
}
def code(x, y, z, t): t_1 = x / ((y - z) * (y - t)) t_2 = -(x / (y * y)) tmp = 0 if t_1 <= -2e+24: tmp = t_2 elif t_1 <= 4.0: tmp = 1.0 elif t_1 <= 4e+107: tmp = t_2 else: tmp = -(x / (t * z)) return tmp
function code(x, y, z, t) t_1 = Float64(x / Float64(Float64(y - z) * Float64(y - t))) t_2 = Float64(-Float64(x / Float64(y * y))) tmp = 0.0 if (t_1 <= -2e+24) tmp = t_2; elseif (t_1 <= 4.0) tmp = 1.0; elseif (t_1 <= 4e+107) tmp = t_2; else tmp = Float64(-Float64(x / Float64(t * z))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x / ((y - z) * (y - t)); t_2 = -(x / (y * y)); tmp = 0.0; if (t_1 <= -2e+24) tmp = t_2; elseif (t_1 <= 4.0) tmp = 1.0; elseif (t_1 <= 4e+107) tmp = t_2; else tmp = -(x / (t * z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x / N[(N[(y - z), $MachinePrecision] * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = (-N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision])}, If[LessEqual[t$95$1, -2e+24], t$95$2, If[LessEqual[t$95$1, 4.0], 1.0, If[LessEqual[t$95$1, 4e+107], t$95$2, (-N[(x / N[(t * z), $MachinePrecision]), $MachinePrecision])]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}\\
t_2 := -\frac{x}{y \cdot y}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+24}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 4:\\
\;\;\;\;1\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+107}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;-\frac{x}{t \cdot z}\\
\end{array}
\end{array}
if (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t))) < -2e24 or 4 < (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t))) < 3.9999999999999999e107Initial program 96.2%
Taylor expanded in x around inf
mul-1-negN/A
*-commutativeN/A
lower-neg.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6491.6
Applied rewrites91.6%
Taylor expanded in y around inf
lower-/.f64N/A
unpow2N/A
lower-*.f6427.0
Applied rewrites27.0%
if -2e24 < (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t))) < 4Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites97.7%
if 3.9999999999999999e107 < (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t))) Initial program 94.7%
Taylor expanded in x around inf
mul-1-negN/A
*-commutativeN/A
lower-neg.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6491.8
Applied rewrites91.8%
Taylor expanded in y around 0
lower-/.f64N/A
lift-*.f6447.5
Applied rewrites47.5%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (- (/ x (* t z)))) (t_2 (- 1.0 (/ x (* (- y z) (- y t)))))) (if (<= t_2 -1e+14) t_1 (if (<= t_2 10.0) 1.0 t_1))))
double code(double x, double y, double z, double t) {
double t_1 = -(x / (t * z));
double t_2 = 1.0 - (x / ((y - z) * (y - t)));
double tmp;
if (t_2 <= -1e+14) {
tmp = t_1;
} else if (t_2 <= 10.0) {
tmp = 1.0;
} 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 / (t * z))
t_2 = 1.0d0 - (x / ((y - z) * (y - t)))
if (t_2 <= (-1d+14)) then
tmp = t_1
else if (t_2 <= 10.0d0) then
tmp = 1.0d0
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 t_2 = 1.0 - (x / ((y - z) * (y - t)));
double tmp;
if (t_2 <= -1e+14) {
tmp = t_1;
} else if (t_2 <= 10.0) {
tmp = 1.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = -(x / (t * z)) t_2 = 1.0 - (x / ((y - z) * (y - t))) tmp = 0 if t_2 <= -1e+14: tmp = t_1 elif t_2 <= 10.0: tmp = 1.0 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(-Float64(x / Float64(t * z))) t_2 = Float64(1.0 - Float64(x / Float64(Float64(y - z) * Float64(y - t)))) tmp = 0.0 if (t_2 <= -1e+14) tmp = t_1; elseif (t_2 <= 10.0) tmp = 1.0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = -(x / (t * z)); t_2 = 1.0 - (x / ((y - z) * (y - t))); tmp = 0.0; if (t_2 <= -1e+14) tmp = t_1; elseif (t_2 <= 10.0) tmp = 1.0; 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])}, Block[{t$95$2 = N[(1.0 - N[(x / N[(N[(y - z), $MachinePrecision] * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+14], t$95$1, If[LessEqual[t$95$2, 10.0], 1.0, t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -\frac{x}{t \cdot z}\\
t_2 := 1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+14}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) < -1e14 or 10 < (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) Initial program 95.8%
Taylor expanded in x around inf
mul-1-negN/A
*-commutativeN/A
lower-neg.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6491.9
Applied rewrites91.9%
Taylor expanded in y around 0
lower-/.f64N/A
lift-*.f6443.6
Applied rewrites43.6%
if -1e14 < (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) < 10Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites98.2%
(FPCore (x y z t) :precision binary64 1.0)
double code(double x, double y, double z, double t) {
return 1.0;
}
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 = 1.0d0
end function
public static double code(double x, double y, double z, double t) {
return 1.0;
}
def code(x, y, z, t): return 1.0
function code(x, y, z, t) return 1.0 end
function tmp = code(x, y, z, t) tmp = 1.0; end
code[x_, y_, z_, t_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 99.0%
Taylor expanded in x around 0
Applied rewrites75.3%
herbie shell --seed 2025101
(FPCore (x y z t)
:name "Data.Random.Distribution.Triangular:triangularCDF from random-fu-0.2.6.2, A"
:precision binary64
(- 1.0 (/ x (* (- y z) (- y t)))))