
(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 9 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 (* (/ x z) y)) (t_2 (- (/ y z) (/ t (- 1.0 z))))) (if (<= t_2 (- INFINITY)) t_1 (if (<= t_2 4e+297) (* x t_2) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (x / z) * y;
double t_2 = (y / z) - (t / (1.0 - z));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= 4e+297) {
tmp = x * t_2;
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = (x / z) * y;
double t_2 = (y / z) - (t / (1.0 - z));
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = t_1;
} else if (t_2 <= 4e+297) {
tmp = x * t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / z) * y t_2 = (y / z) - (t / (1.0 - z)) tmp = 0 if t_2 <= -math.inf: tmp = t_1 elif t_2 <= 4e+297: tmp = x * t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / z) * y) t_2 = Float64(Float64(y / z) - Float64(t / Float64(1.0 - z))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= 4e+297) tmp = Float64(x * t_2); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / z) * y; t_2 = (y / z) - (t / (1.0 - z)); tmp = 0.0; if (t_2 <= -Inf) tmp = t_1; elseif (t_2 <= 4e+297) tmp = x * t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, 4e+297], N[(x * t$95$2), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{z} \cdot y\\
t_2 := \frac{y}{z} - \frac{t}{1 - z}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{+297}:\\
\;\;\;\;x \cdot t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < -inf.0 or 4.0000000000000001e297 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) Initial program 71.3%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
associate-*r/N/A
associate-*r*N/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-/.f6498.7
Applied rewrites98.7%
Taylor expanded in y around inf
lift-/.f6497.3
Applied rewrites97.3%
if -inf.0 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < 4.0000000000000001e297Initial program 98.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (fma (/ (- t) y) (/ x (- 1.0 z)) (/ x z)) y))
(t_2 (* x (- (/ y z) (/ t (- 1.0 z))))))
(if (<= t_2 (- INFINITY)) t_1 (if (<= t_2 5e+293) t_2 t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma((-t / y), (x / (1.0 - z)), (x / z)) * y;
double t_2 = x * ((y / z) - (t / (1.0 - z)));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= 5e+293) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(fma(Float64(Float64(-t) / y), Float64(x / Float64(1.0 - z)), Float64(x / z)) * y) t_2 = Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z)))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= 5e+293) tmp = t_2; else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[((-t) / y), $MachinePrecision] * N[(x / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] + N[(x / z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, 5e+293], t$95$2, t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{-t}{y}, \frac{x}{1 - z}, \frac{x}{z}\right) \cdot y\\
t_2 := x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+293}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 x (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z)))) < -inf.0 or 5.00000000000000033e293 < (*.f64 x (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z)))) Initial program 85.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
associate-*r/N/A
associate-*r*N/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-/.f6494.7
Applied rewrites94.7%
if -inf.0 < (*.f64 x (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z)))) < 5.00000000000000033e293Initial program 98.1%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (/ (+ t y) z)))) (if (<= z -48.0) t_1 (if (<= z 1.1e-14) (* x (- (/ y z) t)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * ((t + y) / z);
double tmp;
if (z <= -48.0) {
tmp = t_1;
} else if (z <= 1.1e-14) {
tmp = x * ((y / z) - t);
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x * ((t + y) / z)
if (z <= (-48.0d0)) then
tmp = t_1
else if (z <= 1.1d-14) then
tmp = x * ((y / z) - t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * ((t + y) / z);
double tmp;
if (z <= -48.0) {
tmp = t_1;
} else if (z <= 1.1e-14) {
tmp = x * ((y / z) - t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * ((t + y) / z) tmp = 0 if z <= -48.0: tmp = t_1 elif z <= 1.1e-14: tmp = x * ((y / z) - t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(Float64(t + y) / z)) tmp = 0.0 if (z <= -48.0) tmp = t_1; elseif (z <= 1.1e-14) tmp = Float64(x * Float64(Float64(y / z) - t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * ((t + y) / z); tmp = 0.0; if (z <= -48.0) tmp = t_1; elseif (z <= 1.1e-14) tmp = x * ((y / z) - t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(N[(t + y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -48.0], t$95$1, If[LessEqual[z, 1.1e-14], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{t + y}{z}\\
\mathbf{if}\;z \leq -48:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{-14}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -48 or 1.1e-14 < z Initial program 97.4%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6495.9
Applied rewrites95.9%
Taylor expanded in y around 0
lower-+.f6495.9
Applied rewrites95.9%
if -48 < z < 1.1e-14Initial program 92.2%
Taylor expanded in z around 0
Applied rewrites91.7%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (/ (* (+ t y) x) z))) (if (<= z -48.0) t_1 (if (<= z 1.1e-14) (* x (- (/ y z) t)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = ((t + y) * x) / z;
double tmp;
if (z <= -48.0) {
tmp = t_1;
} else if (z <= 1.1e-14) {
tmp = x * ((y / z) - t);
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = ((t + y) * x) / z
if (z <= (-48.0d0)) then
tmp = t_1
else if (z <= 1.1d-14) then
tmp = x * ((y / z) - t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = ((t + y) * x) / z;
double tmp;
if (z <= -48.0) {
tmp = t_1;
} else if (z <= 1.1e-14) {
tmp = x * ((y / z) - t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = ((t + y) * x) / z tmp = 0 if z <= -48.0: tmp = t_1 elif z <= 1.1e-14: tmp = x * ((y / z) - t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(Float64(t + y) * x) / z) tmp = 0.0 if (z <= -48.0) tmp = t_1; elseif (z <= 1.1e-14) tmp = Float64(x * Float64(Float64(y / z) - t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = ((t + y) * x) / z; tmp = 0.0; if (z <= -48.0) tmp = t_1; elseif (z <= 1.1e-14) tmp = x * ((y / z) - t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(t + y), $MachinePrecision] * x), $MachinePrecision] / z), $MachinePrecision]}, If[LessEqual[z, -48.0], t$95$1, If[LessEqual[z, 1.1e-14], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(t + y\right) \cdot x}{z}\\
\mathbf{if}\;z \leq -48:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{-14}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -48 or 1.1e-14 < z Initial program 97.4%
Taylor expanded in z around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6486.3
Applied rewrites86.3%
Taylor expanded in y around 0
lower-+.f6486.3
Applied rewrites86.3%
if -48 < z < 1.1e-14Initial program 92.2%
Taylor expanded in z around 0
Applied rewrites91.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ y z))))
(if (<= z -3.6e+196)
t_1
(if (<= z -8.5e+27)
(* x (/ t z))
(if (<= z 4800.0)
(* x (- (/ y z) t))
(if (<= z 2.8e+135) (/ (* t x) z) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (y / z);
double tmp;
if (z <= -3.6e+196) {
tmp = t_1;
} else if (z <= -8.5e+27) {
tmp = x * (t / z);
} else if (z <= 4800.0) {
tmp = x * ((y / z) - t);
} else if (z <= 2.8e+135) {
tmp = (t * 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 * (y / z)
if (z <= (-3.6d+196)) then
tmp = t_1
else if (z <= (-8.5d+27)) then
tmp = x * (t / z)
else if (z <= 4800.0d0) then
tmp = x * ((y / z) - t)
else if (z <= 2.8d+135) then
tmp = (t * 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 * (y / z);
double tmp;
if (z <= -3.6e+196) {
tmp = t_1;
} else if (z <= -8.5e+27) {
tmp = x * (t / z);
} else if (z <= 4800.0) {
tmp = x * ((y / z) - t);
} else if (z <= 2.8e+135) {
tmp = (t * x) / z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (y / z) tmp = 0 if z <= -3.6e+196: tmp = t_1 elif z <= -8.5e+27: tmp = x * (t / z) elif z <= 4800.0: tmp = x * ((y / z) - t) elif z <= 2.8e+135: tmp = (t * x) / z else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(y / z)) tmp = 0.0 if (z <= -3.6e+196) tmp = t_1; elseif (z <= -8.5e+27) tmp = Float64(x * Float64(t / z)); elseif (z <= 4800.0) tmp = Float64(x * Float64(Float64(y / z) - t)); elseif (z <= 2.8e+135) tmp = Float64(Float64(t * x) / z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (y / z); tmp = 0.0; if (z <= -3.6e+196) tmp = t_1; elseif (z <= -8.5e+27) tmp = x * (t / z); elseif (z <= 4800.0) tmp = x * ((y / z) - t); elseif (z <= 2.8e+135) tmp = (t * x) / z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.6e+196], t$95$1, If[LessEqual[z, -8.5e+27], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4800.0], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.8e+135], N[(N[(t * x), $MachinePrecision] / z), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{y}{z}\\
\mathbf{if}\;z \leq -3.6 \cdot 10^{+196}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -8.5 \cdot 10^{+27}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{elif}\;z \leq 4800:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{+135}:\\
\;\;\;\;\frac{t \cdot x}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.60000000000000007e196 or 2.80000000000000002e135 < z Initial program 95.8%
Taylor expanded in y around inf
lift-/.f6460.5
Applied rewrites60.5%
if -3.60000000000000007e196 < z < -8.5e27Initial program 98.3%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6498.3
Applied rewrites98.3%
Taylor expanded in y around 0
Applied rewrites55.7%
if -8.5e27 < z < 4800Initial program 92.7%
Taylor expanded in z around 0
Applied rewrites90.1%
if 4800 < z < 2.80000000000000002e135Initial program 98.9%
Taylor expanded in z around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6492.2
Applied rewrites92.2%
Taylor expanded in y around 0
Applied rewrites49.0%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (/ t z)))) (if (<= t -1e+26) t_1 (if (<= t 1.55e+83) (* (/ x z) y) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t / z);
double tmp;
if (t <= -1e+26) {
tmp = t_1;
} else if (t <= 1.55e+83) {
tmp = (x / z) * y;
} 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 <= (-1d+26)) then
tmp = t_1
else if (t <= 1.55d+83) then
tmp = (x / z) * y
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 <= -1e+26) {
tmp = t_1;
} else if (t <= 1.55e+83) {
tmp = (x / z) * y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t / z) tmp = 0 if t <= -1e+26: tmp = t_1 elif t <= 1.55e+83: tmp = (x / z) * y else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t / z)) tmp = 0.0 if (t <= -1e+26) tmp = t_1; elseif (t <= 1.55e+83) tmp = Float64(Float64(x / z) * y); 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 <= -1e+26) tmp = t_1; elseif (t <= 1.55e+83) tmp = (x / z) * y; 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, -1e+26], t$95$1, If[LessEqual[t, 1.55e+83], N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{t}{z}\\
\mathbf{if}\;t \leq -1 \cdot 10^{+26}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.55 \cdot 10^{+83}:\\
\;\;\;\;\frac{x}{z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.00000000000000005e26 or 1.54999999999999996e83 < t Initial program 96.1%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6466.1
Applied rewrites66.1%
Taylor expanded in y around 0
Applied rewrites50.7%
if -1.00000000000000005e26 < t < 1.54999999999999996e83Initial program 93.9%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
associate-*r/N/A
associate-*r*N/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-/.f6489.5
Applied rewrites89.5%
Taylor expanded in y around inf
lift-/.f6477.5
Applied rewrites77.5%
(FPCore (x y z t) :precision binary64 (if (<= t -1e+26) (/ (* t x) z) (if (<= t 1.6e+83) (* (/ x z) y) (* (/ x z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1e+26) {
tmp = (t * x) / z;
} else if (t <= 1.6e+83) {
tmp = (x / z) * y;
} else {
tmp = (x / 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 (t <= (-1d+26)) then
tmp = (t * x) / z
else if (t <= 1.6d+83) then
tmp = (x / z) * y
else
tmp = (x / z) * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1e+26) {
tmp = (t * x) / z;
} else if (t <= 1.6e+83) {
tmp = (x / z) * y;
} else {
tmp = (x / z) * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1e+26: tmp = (t * x) / z elif t <= 1.6e+83: tmp = (x / z) * y else: tmp = (x / z) * t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1e+26) tmp = Float64(Float64(t * x) / z); elseif (t <= 1.6e+83) tmp = Float64(Float64(x / z) * y); else tmp = Float64(Float64(x / z) * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1e+26) tmp = (t * x) / z; elseif (t <= 1.6e+83) tmp = (x / z) * y; else tmp = (x / z) * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1e+26], N[(N[(t * x), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[t, 1.6e+83], N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision], N[(N[(x / z), $MachinePrecision] * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1 \cdot 10^{+26}:\\
\;\;\;\;\frac{t \cdot x}{z}\\
\mathbf{elif}\;t \leq 1.6 \cdot 10^{+83}:\\
\;\;\;\;\frac{x}{z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} \cdot t\\
\end{array}
\end{array}
if t < -1.00000000000000005e26Initial program 96.4%
Taylor expanded in z around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6459.0
Applied rewrites59.0%
Taylor expanded in y around 0
Applied rewrites42.7%
if -1.00000000000000005e26 < t < 1.5999999999999999e83Initial program 93.9%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
associate-*r/N/A
associate-*r*N/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-/.f6489.5
Applied rewrites89.5%
Taylor expanded in y around inf
lift-/.f6477.5
Applied rewrites77.5%
if 1.5999999999999999e83 < t Initial program 95.8%
Taylor expanded in z around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6458.8
Applied rewrites58.8%
Taylor expanded in y around 0
associate-*r/N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f6445.2
Applied rewrites45.2%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (/ x z) t))) (if (<= t -1e+26) t_1 (if (<= t 1.6e+83) (* (/ x z) y) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (x / z) * t;
double tmp;
if (t <= -1e+26) {
tmp = t_1;
} else if (t <= 1.6e+83) {
tmp = (x / z) * y;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (x / z) * t
if (t <= (-1d+26)) then
tmp = t_1
else if (t <= 1.6d+83) then
tmp = (x / z) * y
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x / z) * t;
double tmp;
if (t <= -1e+26) {
tmp = t_1;
} else if (t <= 1.6e+83) {
tmp = (x / z) * y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / z) * t tmp = 0 if t <= -1e+26: tmp = t_1 elif t <= 1.6e+83: tmp = (x / z) * y else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / z) * t) tmp = 0.0 if (t <= -1e+26) tmp = t_1; elseif (t <= 1.6e+83) tmp = Float64(Float64(x / z) * y); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / z) * t; tmp = 0.0; if (t <= -1e+26) tmp = t_1; elseif (t <= 1.6e+83) tmp = (x / z) * y; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / z), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -1e+26], t$95$1, If[LessEqual[t, 1.6e+83], N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{z} \cdot t\\
\mathbf{if}\;t \leq -1 \cdot 10^{+26}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.6 \cdot 10^{+83}:\\
\;\;\;\;\frac{x}{z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.00000000000000005e26 or 1.5999999999999999e83 < t Initial 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.f6458.9
Applied rewrites58.9%
Taylor expanded in y around 0
associate-*r/N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f6443.7
Applied rewrites43.7%
if -1.00000000000000005e26 < t < 1.5999999999999999e83Initial program 93.9%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
associate-*r/N/A
associate-*r*N/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-/.f6489.5
Applied rewrites89.5%
Taylor expanded in y around inf
lift-/.f6477.5
Applied rewrites77.5%
(FPCore (x y z t) :precision binary64 (* (/ x z) t))
double code(double x, double y, double z, double t) {
return (x / z) * 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 / z) * t
end function
public static double code(double x, double y, double z, double t) {
return (x / z) * t;
}
def code(x, y, z, t): return (x / z) * t
function code(x, y, z, t) return Float64(Float64(x / z) * t) end
function tmp = code(x, y, z, t) tmp = (x / z) * t; end
code[x_, y_, z_, t_] := N[(N[(x / z), $MachinePrecision] * t), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{z} \cdot t
\end{array}
Initial program 94.8%
Taylor expanded in z around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6471.6
Applied rewrites71.6%
Taylor expanded in y around 0
associate-*r/N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f6434.3
Applied rewrites34.3%
herbie shell --seed 2025112
(FPCore (x y z t)
:name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, C"
:precision binary64
(* x (- (/ y z) (/ t (- 1.0 z)))))