
(FPCore (x y z t) :precision binary64 (+ (- (- (* x (log y)) y) z) (log t)))
double code(double x, double y, double z, double t) {
return (((x * log(y)) - y) - z) + log(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 * log(y)) - y) - z) + log(t)
end function
public static double code(double x, double y, double z, double t) {
return (((x * Math.log(y)) - y) - z) + Math.log(t);
}
def code(x, y, z, t): return (((x * math.log(y)) - y) - z) + math.log(t)
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * log(y)) - y) - z) + log(t)) end
function tmp = code(x, y, z, t) tmp = (((x * log(y)) - y) - z) + log(t); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision] + N[Log[t], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot \log y - y\right) - z\right) + \log t
\end{array}
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (- (- (* x (log y)) y) z) (log t)))
double code(double x, double y, double z, double t) {
return (((x * log(y)) - y) - z) + log(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 * log(y)) - y) - z) + log(t)
end function
public static double code(double x, double y, double z, double t) {
return (((x * Math.log(y)) - y) - z) + Math.log(t);
}
def code(x, y, z, t): return (((x * math.log(y)) - y) - z) + math.log(t)
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * log(y)) - y) - z) + log(t)) end
function tmp = code(x, y, z, t) tmp = (((x * log(y)) - y) - z) + log(t); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision] + N[Log[t], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot \log y - y\right) - z\right) + \log t
\end{array}
(FPCore (x y z t) :precision binary64 (fma (log y) x (- (- (log t) y) z)))
double code(double x, double y, double z, double t) {
return fma(log(y), x, ((log(t) - y) - z));
}
function code(x, y, z, t) return fma(log(y), x, Float64(Float64(log(t) - y) - z)) end
code[x_, y_, z_, t_] := N[(N[Log[y], $MachinePrecision] * x + N[(N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\log y, x, \left(\log t - y\right) - z\right)
\end{array}
Initial program 99.9%
lift-+.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
lift-log.f64N/A
+-commutativeN/A
associate--r+N/A
associate--l+N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift-log.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
lift-+.f64N/A
lift--.f64N/A
lift-log.f64N/A
lift-log.f64N/A
lift-fma.f64N/A
associate--l+N/A
+-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lift-log.f6499.9
Applied rewrites99.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x (log y)) y)) (t_2 (* (log y) x)))
(if (<= t_1 -1e+305)
t_2
(if (<= t_1 -1e+177) (- y) (if (<= t_1 50.0) (+ (- z) (log t)) t_2)))))
double code(double x, double y, double z, double t) {
double t_1 = (x * log(y)) - y;
double t_2 = log(y) * x;
double tmp;
if (t_1 <= -1e+305) {
tmp = t_2;
} else if (t_1 <= -1e+177) {
tmp = -y;
} else if (t_1 <= 50.0) {
tmp = -z + log(t);
} 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 = (x * log(y)) - y
t_2 = log(y) * x
if (t_1 <= (-1d+305)) then
tmp = t_2
else if (t_1 <= (-1d+177)) then
tmp = -y
else if (t_1 <= 50.0d0) then
tmp = -z + log(t)
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 = (x * Math.log(y)) - y;
double t_2 = Math.log(y) * x;
double tmp;
if (t_1 <= -1e+305) {
tmp = t_2;
} else if (t_1 <= -1e+177) {
tmp = -y;
} else if (t_1 <= 50.0) {
tmp = -z + Math.log(t);
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * math.log(y)) - y t_2 = math.log(y) * x tmp = 0 if t_1 <= -1e+305: tmp = t_2 elif t_1 <= -1e+177: tmp = -y elif t_1 <= 50.0: tmp = -z + math.log(t) else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * log(y)) - y) t_2 = Float64(log(y) * x) tmp = 0.0 if (t_1 <= -1e+305) tmp = t_2; elseif (t_1 <= -1e+177) tmp = Float64(-y); elseif (t_1 <= 50.0) tmp = Float64(Float64(-z) + log(t)); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * log(y)) - y; t_2 = log(y) * x; tmp = 0.0; if (t_1 <= -1e+305) tmp = t_2; elseif (t_1 <= -1e+177) tmp = -y; elseif (t_1 <= 50.0) tmp = -z + log(t); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]}, Block[{t$95$2 = N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+305], t$95$2, If[LessEqual[t$95$1, -1e+177], (-y), If[LessEqual[t$95$1, 50.0], N[((-z) + N[Log[t], $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y - y\\
t_2 := \log y \cdot x\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+305}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq -1 \cdot 10^{+177}:\\
\;\;\;\;-y\\
\mathbf{elif}\;t\_1 \leq 50:\\
\;\;\;\;\left(-z\right) + \log t\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (-.f64 (*.f64 x (log.f64 y)) y) < -9.9999999999999994e304 or 50 < (-.f64 (*.f64 x (log.f64 y)) y) Initial program 99.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f6473.2
Applied rewrites73.2%
if -9.9999999999999994e304 < (-.f64 (*.f64 x (log.f64 y)) y) < -1e177Initial program 99.9%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6459.1
Applied rewrites59.1%
if -1e177 < (-.f64 (*.f64 x (log.f64 y)) y) < 50Initial program 99.9%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6465.7
Applied rewrites65.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x (log y)) y)) (t_2 (* (log y) x)))
(if (<= t_1 -1e+305)
t_2
(if (<= t_1 -1e+177) (- y) (if (<= t_1 5e-6) (- z) t_2)))))
double code(double x, double y, double z, double t) {
double t_1 = (x * log(y)) - y;
double t_2 = log(y) * x;
double tmp;
if (t_1 <= -1e+305) {
tmp = t_2;
} else if (t_1 <= -1e+177) {
tmp = -y;
} else if (t_1 <= 5e-6) {
tmp = -z;
} 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 = (x * log(y)) - y
t_2 = log(y) * x
if (t_1 <= (-1d+305)) then
tmp = t_2
else if (t_1 <= (-1d+177)) then
tmp = -y
else if (t_1 <= 5d-6) then
tmp = -z
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 = (x * Math.log(y)) - y;
double t_2 = Math.log(y) * x;
double tmp;
if (t_1 <= -1e+305) {
tmp = t_2;
} else if (t_1 <= -1e+177) {
tmp = -y;
} else if (t_1 <= 5e-6) {
tmp = -z;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * math.log(y)) - y t_2 = math.log(y) * x tmp = 0 if t_1 <= -1e+305: tmp = t_2 elif t_1 <= -1e+177: tmp = -y elif t_1 <= 5e-6: tmp = -z else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * log(y)) - y) t_2 = Float64(log(y) * x) tmp = 0.0 if (t_1 <= -1e+305) tmp = t_2; elseif (t_1 <= -1e+177) tmp = Float64(-y); elseif (t_1 <= 5e-6) tmp = Float64(-z); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * log(y)) - y; t_2 = log(y) * x; tmp = 0.0; if (t_1 <= -1e+305) tmp = t_2; elseif (t_1 <= -1e+177) tmp = -y; elseif (t_1 <= 5e-6) tmp = -z; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]}, Block[{t$95$2 = N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+305], t$95$2, If[LessEqual[t$95$1, -1e+177], (-y), If[LessEqual[t$95$1, 5e-6], (-z), t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y - y\\
t_2 := \log y \cdot x\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+305}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq -1 \cdot 10^{+177}:\\
\;\;\;\;-y\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-6}:\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (-.f64 (*.f64 x (log.f64 y)) y) < -9.9999999999999994e304 or 5.00000000000000041e-6 < (-.f64 (*.f64 x (log.f64 y)) y) Initial program 99.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f6472.5
Applied rewrites72.5%
if -9.9999999999999994e304 < (-.f64 (*.f64 x (log.f64 y)) y) < -1e177Initial program 99.9%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6459.1
Applied rewrites59.1%
if -1e177 < (-.f64 (*.f64 x (log.f64 y)) y) < 5.00000000000000041e-6Initial program 99.9%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6443.5
Applied rewrites43.5%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (- (* x (log y)) y)) (t_2 (- (* (log y) x) (+ z y)))) (if (<= t_1 -2e+23) t_2 (if (<= t_1 50.0) (- (- (log t) y) z) t_2))))
double code(double x, double y, double z, double t) {
double t_1 = (x * log(y)) - y;
double t_2 = (log(y) * x) - (z + y);
double tmp;
if (t_1 <= -2e+23) {
tmp = t_2;
} else if (t_1 <= 50.0) {
tmp = (log(t) - y) - z;
} 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 = (x * log(y)) - y
t_2 = (log(y) * x) - (z + y)
if (t_1 <= (-2d+23)) then
tmp = t_2
else if (t_1 <= 50.0d0) then
tmp = (log(t) - y) - z
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 = (x * Math.log(y)) - y;
double t_2 = (Math.log(y) * x) - (z + y);
double tmp;
if (t_1 <= -2e+23) {
tmp = t_2;
} else if (t_1 <= 50.0) {
tmp = (Math.log(t) - y) - z;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * math.log(y)) - y t_2 = (math.log(y) * x) - (z + y) tmp = 0 if t_1 <= -2e+23: tmp = t_2 elif t_1 <= 50.0: tmp = (math.log(t) - y) - z else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * log(y)) - y) t_2 = Float64(Float64(log(y) * x) - Float64(z + y)) tmp = 0.0 if (t_1 <= -2e+23) tmp = t_2; elseif (t_1 <= 50.0) tmp = Float64(Float64(log(t) - y) - z); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * log(y)) - y; t_2 = (log(y) * x) - (z + y); tmp = 0.0; if (t_1 <= -2e+23) tmp = t_2; elseif (t_1 <= 50.0) tmp = (log(t) - y) - z; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision] - N[(z + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+23], t$95$2, If[LessEqual[t$95$1, 50.0], N[(N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y - y\\
t_2 := \log y \cdot x - \left(z + y\right)\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+23}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 50:\\
\;\;\;\;\left(\log t - y\right) - z\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (-.f64 (*.f64 x (log.f64 y)) y) < -1.9999999999999998e23 or 50 < (-.f64 (*.f64 x (log.f64 y)) y) Initial program 99.8%
lift-+.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
lift-log.f64N/A
+-commutativeN/A
associate--r+N/A
associate--l+N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift-log.f64N/A
+-commutativeN/A
lower-+.f6499.8
Applied rewrites99.8%
Taylor expanded in x around inf
*-commutativeN/A
lift-log.f64N/A
lift-*.f6499.6
Applied rewrites99.6%
if -1.9999999999999998e23 < (-.f64 (*.f64 x (log.f64 y)) y) < 50Initial program 100.0%
Taylor expanded in x around 0
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lift-log.f6497.2
Applied rewrites97.2%
(FPCore (x y z t) :precision binary64 (if (<= y 6.9e-15) (- (fma (log y) x (log t)) z) (- (* (log y) x) (+ z y))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 6.9e-15) {
tmp = fma(log(y), x, log(t)) - z;
} else {
tmp = (log(y) * x) - (z + y);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= 6.9e-15) tmp = Float64(fma(log(y), x, log(t)) - z); else tmp = Float64(Float64(log(y) * x) - Float64(z + y)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, 6.9e-15], N[(N[(N[Log[y], $MachinePrecision] * x + N[Log[t], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], N[(N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision] - N[(z + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 6.9 \cdot 10^{-15}:\\
\;\;\;\;\mathsf{fma}\left(\log y, x, \log t\right) - z\\
\mathbf{else}:\\
\;\;\;\;\log y \cdot x - \left(z + y\right)\\
\end{array}
\end{array}
if y < 6.9000000000000001e-15Initial program 99.8%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift-log.f6499.8
Applied rewrites99.8%
if 6.9000000000000001e-15 < y Initial program 99.9%
lift-+.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
lift-log.f64N/A
+-commutativeN/A
associate--r+N/A
associate--l+N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift-log.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
Taylor expanded in x around inf
*-commutativeN/A
lift-log.f64N/A
lift-*.f6498.2
Applied rewrites98.2%
(FPCore (x y z t) :precision binary64 (- (fma (log y) x (log t)) (+ z y)))
double code(double x, double y, double z, double t) {
return fma(log(y), x, log(t)) - (z + y);
}
function code(x, y, z, t) return Float64(fma(log(y), x, log(t)) - Float64(z + y)) end
code[x_, y_, z_, t_] := N[(N[(N[Log[y], $MachinePrecision] * x + N[Log[t], $MachinePrecision]), $MachinePrecision] - N[(z + y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\log y, x, \log t\right) - \left(z + y\right)
\end{array}
Initial program 99.9%
lift-+.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
lift-log.f64N/A
+-commutativeN/A
associate--r+N/A
associate--l+N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift-log.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (log y) x)))
(if (<= x -7.5e+96)
t_1
(if (<= x -1.3e-136) (+ (- y) (log t)) (if (<= x 6.8e+30) (- z) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = log(y) * x;
double tmp;
if (x <= -7.5e+96) {
tmp = t_1;
} else if (x <= -1.3e-136) {
tmp = -y + log(t);
} else if (x <= 6.8e+30) {
tmp = -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 = log(y) * x
if (x <= (-7.5d+96)) then
tmp = t_1
else if (x <= (-1.3d-136)) then
tmp = -y + log(t)
else if (x <= 6.8d+30) then
tmp = -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 = Math.log(y) * x;
double tmp;
if (x <= -7.5e+96) {
tmp = t_1;
} else if (x <= -1.3e-136) {
tmp = -y + Math.log(t);
} else if (x <= 6.8e+30) {
tmp = -z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.log(y) * x tmp = 0 if x <= -7.5e+96: tmp = t_1 elif x <= -1.3e-136: tmp = -y + math.log(t) elif x <= 6.8e+30: tmp = -z else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(log(y) * x) tmp = 0.0 if (x <= -7.5e+96) tmp = t_1; elseif (x <= -1.3e-136) tmp = Float64(Float64(-y) + log(t)); elseif (x <= 6.8e+30) tmp = Float64(-z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = log(y) * x; tmp = 0.0; if (x <= -7.5e+96) tmp = t_1; elseif (x <= -1.3e-136) tmp = -y + log(t); elseif (x <= 6.8e+30) tmp = -z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -7.5e+96], t$95$1, If[LessEqual[x, -1.3e-136], N[((-y) + N[Log[t], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 6.8e+30], (-z), t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot x\\
\mathbf{if}\;x \leq -7.5 \cdot 10^{+96}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -1.3 \cdot 10^{-136}:\\
\;\;\;\;\left(-y\right) + \log t\\
\mathbf{elif}\;x \leq 6.8 \cdot 10^{+30}:\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -7.4999999999999996e96 or 6.8000000000000005e30 < x Initial program 99.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f6465.7
Applied rewrites65.7%
if -7.4999999999999996e96 < x < -1.29999999999999998e-136Initial program 99.9%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6450.2
Applied rewrites50.2%
if -1.29999999999999998e-136 < x < 6.8000000000000005e30Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6439.1
Applied rewrites39.1%
(FPCore (x y z t) :precision binary64 (if (<= x -3.6e+18) (fma (log y) x (- y)) (if (<= x 1.5e+70) (- (- (log t) y) z) (fma (log y) x (- z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.6e+18) {
tmp = fma(log(y), x, -y);
} else if (x <= 1.5e+70) {
tmp = (log(t) - y) - z;
} else {
tmp = fma(log(y), x, -z);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (x <= -3.6e+18) tmp = fma(log(y), x, Float64(-y)); elseif (x <= 1.5e+70) tmp = Float64(Float64(log(t) - y) - z); else tmp = fma(log(y), x, Float64(-z)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[x, -3.6e+18], N[(N[Log[y], $MachinePrecision] * x + (-y)), $MachinePrecision], If[LessEqual[x, 1.5e+70], N[(N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision], N[(N[Log[y], $MachinePrecision] * x + (-z)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.6 \cdot 10^{+18}:\\
\;\;\;\;\mathsf{fma}\left(\log y, x, -y\right)\\
\mathbf{elif}\;x \leq 1.5 \cdot 10^{+70}:\\
\;\;\;\;\left(\log t - y\right) - z\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log y, x, -z\right)\\
\end{array}
\end{array}
if x < -3.6e18Initial program 99.7%
lift-+.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
lift-log.f64N/A
+-commutativeN/A
associate--r+N/A
associate--l+N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift-log.f64N/A
+-commutativeN/A
lower-+.f6499.7
Applied rewrites99.7%
lift-+.f64N/A
lift--.f64N/A
lift-log.f64N/A
lift-log.f64N/A
lift-fma.f64N/A
associate--l+N/A
+-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lift-log.f6499.7
Applied rewrites99.7%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6478.8
Applied rewrites78.8%
if -3.6e18 < x < 1.49999999999999988e70Initial program 100.0%
Taylor expanded in x around 0
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lift-log.f6495.6
Applied rewrites95.6%
if 1.49999999999999988e70 < x Initial program 99.7%
lift-+.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
lift-log.f64N/A
+-commutativeN/A
associate--r+N/A
associate--l+N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift-log.f64N/A
+-commutativeN/A
lower-+.f6499.7
Applied rewrites99.7%
lift-+.f64N/A
lift--.f64N/A
lift-log.f64N/A
lift-log.f64N/A
lift-fma.f64N/A
associate--l+N/A
+-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lift-log.f6499.8
Applied rewrites99.8%
Taylor expanded in z around inf
mul-1-negN/A
lift-neg.f6482.5
Applied rewrites82.5%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (fma (log y) x (- y)))) (if (<= x -3.6e+18) t_1 (if (<= x 4.5e+35) (- (- (log t) y) z) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma(log(y), x, -y);
double tmp;
if (x <= -3.6e+18) {
tmp = t_1;
} else if (x <= 4.5e+35) {
tmp = (log(t) - y) - z;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(log(y), x, Float64(-y)) tmp = 0.0 if (x <= -3.6e+18) tmp = t_1; elseif (x <= 4.5e+35) tmp = Float64(Float64(log(t) - y) - z); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Log[y], $MachinePrecision] * x + (-y)), $MachinePrecision]}, If[LessEqual[x, -3.6e+18], t$95$1, If[LessEqual[x, 4.5e+35], N[(N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\log y, x, -y\right)\\
\mathbf{if}\;x \leq -3.6 \cdot 10^{+18}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{+35}:\\
\;\;\;\;\left(\log t - y\right) - z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -3.6e18 or 4.4999999999999997e35 < x Initial program 99.7%
lift-+.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
lift-log.f64N/A
+-commutativeN/A
associate--r+N/A
associate--l+N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift-log.f64N/A
+-commutativeN/A
lower-+.f6499.7
Applied rewrites99.7%
lift-+.f64N/A
lift--.f64N/A
lift-log.f64N/A
lift-log.f64N/A
lift-fma.f64N/A
associate--l+N/A
+-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lift-log.f6499.8
Applied rewrites99.8%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6479.9
Applied rewrites79.9%
if -3.6e18 < x < 4.4999999999999997e35Initial program 100.0%
Taylor expanded in x around 0
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lift-log.f6497.1
Applied rewrites97.1%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (log y) x))) (if (<= x -1.25e+97) t_1 (if (<= x 4.15e+71) (- (- (log t) y) z) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = log(y) * x;
double tmp;
if (x <= -1.25e+97) {
tmp = t_1;
} else if (x <= 4.15e+71) {
tmp = (log(t) - y) - z;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
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 = log(y) * x
if (x <= (-1.25d+97)) then
tmp = t_1
else if (x <= 4.15d+71) then
tmp = (log(t) - y) - z
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.log(y) * x;
double tmp;
if (x <= -1.25e+97) {
tmp = t_1;
} else if (x <= 4.15e+71) {
tmp = (Math.log(t) - y) - z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.log(y) * x tmp = 0 if x <= -1.25e+97: tmp = t_1 elif x <= 4.15e+71: tmp = (math.log(t) - y) - z else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(log(y) * x) tmp = 0.0 if (x <= -1.25e+97) tmp = t_1; elseif (x <= 4.15e+71) tmp = Float64(Float64(log(t) - y) - z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = log(y) * x; tmp = 0.0; if (x <= -1.25e+97) tmp = t_1; elseif (x <= 4.15e+71) tmp = (log(t) - y) - z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -1.25e+97], t$95$1, If[LessEqual[x, 4.15e+71], N[(N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot x\\
\mathbf{if}\;x \leq -1.25 \cdot 10^{+97}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 4.15 \cdot 10^{+71}:\\
\;\;\;\;\left(\log t - y\right) - z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.25e97 or 4.1499999999999998e71 < x Initial program 99.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f6468.6
Applied rewrites68.6%
if -1.25e97 < x < 4.1499999999999998e71Initial program 100.0%
Taylor expanded in x around 0
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lift-log.f6492.8
Applied rewrites92.8%
(FPCore (x y z t) :precision binary64 (if (<= y 6e+109) (- z) (- y)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 6e+109) {
tmp = -z;
} else {
tmp = -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 (y <= 6d+109) then
tmp = -z
else
tmp = -y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 6e+109) {
tmp = -z;
} else {
tmp = -y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 6e+109: tmp = -z else: tmp = -y return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 6e+109) tmp = Float64(-z); else tmp = Float64(-y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 6e+109) tmp = -z; else tmp = -y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 6e+109], (-z), (-y)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 6 \cdot 10^{+109}:\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;-y\\
\end{array}
\end{array}
if y < 6.00000000000000031e109Initial program 99.8%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6437.4
Applied rewrites37.4%
if 6.00000000000000031e109 < y Initial program 99.9%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6468.2
Applied rewrites68.2%
(FPCore (x y z t) :precision binary64 (- y))
double code(double x, double y, double z, double t) {
return -y;
}
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 = -y
end function
public static double code(double x, double y, double z, double t) {
return -y;
}
def code(x, y, z, t): return -y
function code(x, y, z, t) return Float64(-y) end
function tmp = code(x, y, z, t) tmp = -y; end
code[x_, y_, z_, t_] := (-y)
\begin{array}{l}
\\
-y
\end{array}
Initial program 99.9%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6429.6
Applied rewrites29.6%
herbie shell --seed 2025095
(FPCore (x y z t)
:name "Numeric.SpecFunctions:incompleteGamma from math-functions-0.1.5.2, A"
:precision binary64
(+ (- (- (* x (log y)) y) z) (log t)))