
(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 15 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 (- y)) (- z (log t))))
double code(double x, double y, double z, double t) {
return fma(log(y), x, -y) - (z - log(t));
}
function code(x, y, z, t) return Float64(fma(log(y), x, Float64(-y)) - Float64(z - log(t))) end
code[x_, y_, z_, t_] := N[(N[(N[Log[y], $MachinePrecision] * x + (-y)), $MachinePrecision] - N[(z - N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\log y, x, -y\right) - \left(z - \log t\right)
\end{array}
Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
mul-1-negN/A
lower-neg.f6499.9
Applied rewrites99.9%
lift-+.f64N/A
lift--.f64N/A
lift-log.f64N/A
associate-+l-N/A
lower--.f64N/A
lower--.f64N/A
lift-log.f6499.9
Applied rewrites99.9%
(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}
Initial program 99.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (fma (log y) x (- y)) z))
(t_2 (+ (- (- (* x (log y)) y) z) (log t))))
(if (<= t_2 -50000000000.0)
t_1
(if (<= t_2 500000000000.0) (- (fma (log y) x (log t)) y) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma(log(y), x, -y) - z;
double t_2 = (((x * log(y)) - y) - z) + log(t);
double tmp;
if (t_2 <= -50000000000.0) {
tmp = t_1;
} else if (t_2 <= 500000000000.0) {
tmp = fma(log(y), x, log(t)) - y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(fma(log(y), x, Float64(-y)) - z) t_2 = Float64(Float64(Float64(Float64(x * log(y)) - y) - z) + log(t)) tmp = 0.0 if (t_2 <= -50000000000.0) tmp = t_1; elseif (t_2 <= 500000000000.0) tmp = Float64(fma(log(y), x, log(t)) - y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[Log[y], $MachinePrecision] * x + (-y)), $MachinePrecision] - z), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision] + N[Log[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -50000000000.0], t$95$1, If[LessEqual[t$95$2, 500000000000.0], N[(N[(N[Log[y], $MachinePrecision] * x + N[Log[t], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\log y, x, -y\right) - z\\
t_2 := \left(\left(x \cdot \log y - y\right) - z\right) + \log t\\
\mathbf{if}\;t\_2 \leq -50000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 500000000000:\\
\;\;\;\;\mathsf{fma}\left(\log y, x, \log t\right) - y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (-.f64 (-.f64 (*.f64 x (log.f64 y)) y) z) (log.f64 t)) < -5e10 or 5e11 < (+.f64 (-.f64 (-.f64 (*.f64 x (log.f64 y)) y) z) (log.f64 t)) Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
mul-1-negN/A
lower-neg.f6499.9
Applied rewrites99.9%
lift-+.f64N/A
lift--.f64N/A
lift-log.f64N/A
associate-+l-N/A
lower--.f64N/A
lower--.f64N/A
lift-log.f6499.9
Applied rewrites99.9%
Taylor expanded in z around inf
Applied rewrites99.6%
if -5e10 < (+.f64 (-.f64 (-.f64 (*.f64 x (log.f64 y)) y) z) (log.f64 t)) < 5e11Initial program 99.9%
Taylor expanded in z around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift-log.f6495.9
Applied rewrites95.9%
(FPCore (x y z t) :precision binary64 (if (<= y 1.4e-6) (- (fma (log y) x (log t)) z) (- (fma (log y) x (- y)) z)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.4e-6) {
tmp = fma(log(y), x, log(t)) - z;
} else {
tmp = fma(log(y), x, -y) - z;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= 1.4e-6) tmp = Float64(fma(log(y), x, log(t)) - z); else tmp = Float64(fma(log(y), x, Float64(-y)) - z); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, 1.4e-6], N[(N[(N[Log[y], $MachinePrecision] * x + N[Log[t], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], N[(N[(N[Log[y], $MachinePrecision] * x + (-y)), $MachinePrecision] - z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.4 \cdot 10^{-6}:\\
\;\;\;\;\mathsf{fma}\left(\log y, x, \log t\right) - z\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log y, x, -y\right) - z\\
\end{array}
\end{array}
if y < 1.39999999999999994e-6Initial 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.7
Applied rewrites99.7%
if 1.39999999999999994e-6 < y Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
mul-1-negN/A
lower-neg.f6499.9
Applied rewrites99.9%
lift-+.f64N/A
lift--.f64N/A
lift-log.f64N/A
associate-+l-N/A
lower--.f64N/A
lower--.f64N/A
lift-log.f6499.9
Applied rewrites99.9%
Taylor expanded in z around inf
Applied rewrites98.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (fma (log y) x (- y)) z))
(t_2 (+ (- (- (* x (log y)) y) z) (log t))))
(if (<= t_2 -10000000.0)
t_1
(if (<= t_2 500000000000.0) (fma (log y) x (log t)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma(log(y), x, -y) - z;
double t_2 = (((x * log(y)) - y) - z) + log(t);
double tmp;
if (t_2 <= -10000000.0) {
tmp = t_1;
} else if (t_2 <= 500000000000.0) {
tmp = fma(log(y), x, log(t));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(fma(log(y), x, Float64(-y)) - z) t_2 = Float64(Float64(Float64(Float64(x * log(y)) - y) - z) + log(t)) tmp = 0.0 if (t_2 <= -10000000.0) tmp = t_1; elseif (t_2 <= 500000000000.0) tmp = fma(log(y), x, log(t)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[Log[y], $MachinePrecision] * x + (-y)), $MachinePrecision] - z), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision] + N[Log[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -10000000.0], t$95$1, If[LessEqual[t$95$2, 500000000000.0], N[(N[Log[y], $MachinePrecision] * x + N[Log[t], $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\log y, x, -y\right) - z\\
t_2 := \left(\left(x \cdot \log y - y\right) - z\right) + \log t\\
\mathbf{if}\;t\_2 \leq -10000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 500000000000:\\
\;\;\;\;\mathsf{fma}\left(\log y, x, \log t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (-.f64 (-.f64 (*.f64 x (log.f64 y)) y) z) (log.f64 t)) < -1e7 or 5e11 < (+.f64 (-.f64 (-.f64 (*.f64 x (log.f64 y)) y) z) (log.f64 t)) Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
mul-1-negN/A
lower-neg.f6499.9
Applied rewrites99.9%
lift-+.f64N/A
lift--.f64N/A
lift-log.f64N/A
associate-+l-N/A
lower--.f64N/A
lower--.f64N/A
lift-log.f6499.9
Applied rewrites99.9%
Taylor expanded in z around inf
Applied rewrites99.5%
if -1e7 < (+.f64 (-.f64 (-.f64 (*.f64 x (log.f64 y)) y) z) (log.f64 t)) < 5e11Initial program 99.9%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift-log.f6496.2
Applied rewrites96.2%
Taylor expanded in z around 0
*-commutativeN/A
+-commutativeN/A
lift-log.f64N/A
lift-log.f64N/A
lift-fma.f6492.8
Applied rewrites92.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (fma (log y) x (- y)) z))
(t_2 (+ (- (- (* x (log y)) y) z) (log t))))
(if (<= t_2 -5e+18) t_1 (if (<= t_2 1000.0) (- (- (log t) y) z) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma(log(y), x, -y) - z;
double t_2 = (((x * log(y)) - y) - z) + log(t);
double tmp;
if (t_2 <= -5e+18) {
tmp = t_1;
} else if (t_2 <= 1000.0) {
tmp = (log(t) - y) - z;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(fma(log(y), x, Float64(-y)) - z) t_2 = Float64(Float64(Float64(Float64(x * log(y)) - y) - z) + log(t)) tmp = 0.0 if (t_2 <= -5e+18) tmp = t_1; elseif (t_2 <= 1000.0) 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[(N[Log[y], $MachinePrecision] * x + (-y)), $MachinePrecision] - z), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision] + N[Log[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+18], t$95$1, If[LessEqual[t$95$2, 1000.0], 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) - z\\
t_2 := \left(\left(x \cdot \log y - y\right) - z\right) + \log t\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+18}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 1000:\\
\;\;\;\;\left(\log t - y\right) - z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (-.f64 (-.f64 (*.f64 x (log.f64 y)) y) z) (log.f64 t)) < -5e18 or 1e3 < (+.f64 (-.f64 (-.f64 (*.f64 x (log.f64 y)) y) z) (log.f64 t)) Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
mul-1-negN/A
lower-neg.f6499.9
Applied rewrites99.9%
lift-+.f64N/A
lift--.f64N/A
lift-log.f64N/A
associate-+l-N/A
lower--.f64N/A
lower--.f64N/A
lift-log.f6499.9
Applied rewrites99.9%
Taylor expanded in z around inf
Applied rewrites99.5%
if -5e18 < (+.f64 (-.f64 (-.f64 (*.f64 x (log.f64 y)) y) z) (log.f64 t)) < 1e3Initial program 99.9%
Taylor expanded in x around 0
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lift-log.f6495.9
Applied rewrites95.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (log y) x)))
(if (<= x -2.7e+104)
(- t_1 z)
(if (<= x 5.7e+79) (- (- (log t) y) z) (- t_1 y)))))
double code(double x, double y, double z, double t) {
double t_1 = log(y) * x;
double tmp;
if (x <= -2.7e+104) {
tmp = t_1 - z;
} else if (x <= 5.7e+79) {
tmp = (log(t) - y) - z;
} else {
tmp = t_1 - 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) :: t_1
real(8) :: tmp
t_1 = log(y) * x
if (x <= (-2.7d+104)) then
tmp = t_1 - z
else if (x <= 5.7d+79) then
tmp = (log(t) - y) - z
else
tmp = t_1 - y
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 <= -2.7e+104) {
tmp = t_1 - z;
} else if (x <= 5.7e+79) {
tmp = (Math.log(t) - y) - z;
} else {
tmp = t_1 - y;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.log(y) * x tmp = 0 if x <= -2.7e+104: tmp = t_1 - z elif x <= 5.7e+79: tmp = (math.log(t) - y) - z else: tmp = t_1 - y return tmp
function code(x, y, z, t) t_1 = Float64(log(y) * x) tmp = 0.0 if (x <= -2.7e+104) tmp = Float64(t_1 - z); elseif (x <= 5.7e+79) tmp = Float64(Float64(log(t) - y) - z); else tmp = Float64(t_1 - y); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = log(y) * x; tmp = 0.0; if (x <= -2.7e+104) tmp = t_1 - z; elseif (x <= 5.7e+79) tmp = (log(t) - y) - z; else tmp = t_1 - y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -2.7e+104], N[(t$95$1 - z), $MachinePrecision], If[LessEqual[x, 5.7e+79], N[(N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision], N[(t$95$1 - y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot x\\
\mathbf{if}\;x \leq -2.7 \cdot 10^{+104}:\\
\;\;\;\;t\_1 - z\\
\mathbf{elif}\;x \leq 5.7 \cdot 10^{+79}:\\
\;\;\;\;\left(\log t - y\right) - z\\
\mathbf{else}:\\
\;\;\;\;t\_1 - y\\
\end{array}
\end{array}
if x < -2.69999999999999985e104Initial program 99.7%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift-log.f6485.1
Applied rewrites85.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f6485.1
Applied rewrites85.1%
if -2.69999999999999985e104 < x < 5.6999999999999997e79Initial program 100.0%
Taylor expanded in x around 0
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lift-log.f6492.2
Applied rewrites92.2%
if 5.6999999999999997e79 < x Initial program 99.7%
Taylor expanded in z around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift-log.f6481.5
Applied rewrites81.5%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f6481.5
Applied rewrites81.5%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (- (* (log y) x) y))) (if (<= x -1.32e+75) t_1 (if (<= x 5.7e+79) (- (- (log t) y) z) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (log(y) * x) - y;
double tmp;
if (x <= -1.32e+75) {
tmp = t_1;
} else if (x <= 5.7e+79) {
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) - y
if (x <= (-1.32d+75)) then
tmp = t_1
else if (x <= 5.7d+79) 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) - y;
double tmp;
if (x <= -1.32e+75) {
tmp = t_1;
} else if (x <= 5.7e+79) {
tmp = (Math.log(t) - y) - z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (math.log(y) * x) - y tmp = 0 if x <= -1.32e+75: tmp = t_1 elif x <= 5.7e+79: tmp = (math.log(t) - y) - z else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(log(y) * x) - y) tmp = 0.0 if (x <= -1.32e+75) tmp = t_1; elseif (x <= 5.7e+79) 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) - y; tmp = 0.0; if (x <= -1.32e+75) tmp = t_1; elseif (x <= 5.7e+79) 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[(N[Log[y], $MachinePrecision] * x), $MachinePrecision] - y), $MachinePrecision]}, If[LessEqual[x, -1.32e+75], t$95$1, If[LessEqual[x, 5.7e+79], 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 - y\\
\mathbf{if}\;x \leq -1.32 \cdot 10^{+75}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 5.7 \cdot 10^{+79}:\\
\;\;\;\;\left(\log t - y\right) - z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.3200000000000001e75 or 5.6999999999999997e79 < x Initial program 99.7%
Taylor expanded in z around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift-log.f6483.2
Applied rewrites83.2%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f6483.2
Applied rewrites83.2%
if -1.3200000000000001e75 < x < 5.6999999999999997e79Initial program 100.0%
Taylor expanded in x around 0
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lift-log.f6493.2
Applied rewrites93.2%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (log y) x))) (if (<= x -4.2e+105) t_1 (if (<= x 1.4e+190) (- (- (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 <= -4.2e+105) {
tmp = t_1;
} else if (x <= 1.4e+190) {
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 <= (-4.2d+105)) then
tmp = t_1
else if (x <= 1.4d+190) 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 <= -4.2e+105) {
tmp = t_1;
} else if (x <= 1.4e+190) {
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 <= -4.2e+105: tmp = t_1 elif x <= 1.4e+190: 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 <= -4.2e+105) tmp = t_1; elseif (x <= 1.4e+190) 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 <= -4.2e+105) tmp = t_1; elseif (x <= 1.4e+190) 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, -4.2e+105], t$95$1, If[LessEqual[x, 1.4e+190], 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 -4.2 \cdot 10^{+105}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.4 \cdot 10^{+190}:\\
\;\;\;\;\left(\log t - y\right) - z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -4.2000000000000002e105 or 1.39999999999999998e190 < x Initial program 99.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f6475.9
Applied rewrites75.9%
if -4.2000000000000002e105 < x < 1.39999999999999998e190Initial program 99.9%
Taylor expanded in x around 0
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lift-log.f6486.8
Applied rewrites86.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x (log y)) y)))
(if (<= t_1 -10000000.0)
(- (- y) z)
(if (<= t_1 10.0) (- (log t) z) (* (log y) x)))))
double code(double x, double y, double z, double t) {
double t_1 = (x * log(y)) - y;
double tmp;
if (t_1 <= -10000000.0) {
tmp = -y - z;
} else if (t_1 <= 10.0) {
tmp = log(t) - z;
} else {
tmp = log(y) * x;
}
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 * log(y)) - y
if (t_1 <= (-10000000.0d0)) then
tmp = -y - z
else if (t_1 <= 10.0d0) then
tmp = log(t) - z
else
tmp = log(y) * x
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 tmp;
if (t_1 <= -10000000.0) {
tmp = -y - z;
} else if (t_1 <= 10.0) {
tmp = Math.log(t) - z;
} else {
tmp = Math.log(y) * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * math.log(y)) - y tmp = 0 if t_1 <= -10000000.0: tmp = -y - z elif t_1 <= 10.0: tmp = math.log(t) - z else: tmp = math.log(y) * x return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * log(y)) - y) tmp = 0.0 if (t_1 <= -10000000.0) tmp = Float64(Float64(-y) - z); elseif (t_1 <= 10.0) tmp = Float64(log(t) - z); else tmp = Float64(log(y) * x); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * log(y)) - y; tmp = 0.0; if (t_1 <= -10000000.0) tmp = -y - z; elseif (t_1 <= 10.0) tmp = log(t) - z; else tmp = log(y) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]}, If[LessEqual[t$95$1, -10000000.0], N[((-y) - z), $MachinePrecision], If[LessEqual[t$95$1, 10.0], N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision], N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y - y\\
\mathbf{if}\;t\_1 \leq -10000000:\\
\;\;\;\;\left(-y\right) - z\\
\mathbf{elif}\;t\_1 \leq 10:\\
\;\;\;\;\log t - z\\
\mathbf{else}:\\
\;\;\;\;\log y \cdot x\\
\end{array}
\end{array}
if (-.f64 (*.f64 x (log.f64 y)) y) < -1e7Initial program 99.9%
Taylor expanded in x around 0
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lift-log.f6472.9
Applied rewrites72.9%
Taylor expanded in y around inf
mul-1-negN/A
lift-neg.f6472.7
Applied rewrites72.7%
if -1e7 < (-.f64 (*.f64 x (log.f64 y)) y) < 10Initial program 100.0%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift-log.f6497.9
Applied rewrites97.9%
Taylor expanded in x around 0
lift-log.f6496.6
Applied rewrites96.6%
if 10 < (-.f64 (*.f64 x (log.f64 y)) y) Initial program 99.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f6474.9
Applied rewrites74.9%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (- (- y) z))) (if (<= z -7e-20) t_1 (if (<= z 860.0) (- (log t) y) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = -y - z;
double tmp;
if (z <= -7e-20) {
tmp = t_1;
} else if (z <= 860.0) {
tmp = log(t) - 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 = -y - z
if (z <= (-7d-20)) then
tmp = t_1
else if (z <= 860.0d0) then
tmp = log(t) - 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 = -y - z;
double tmp;
if (z <= -7e-20) {
tmp = t_1;
} else if (z <= 860.0) {
tmp = Math.log(t) - y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = -y - z tmp = 0 if z <= -7e-20: tmp = t_1 elif z <= 860.0: tmp = math.log(t) - y else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(-y) - z) tmp = 0.0 if (z <= -7e-20) tmp = t_1; elseif (z <= 860.0) tmp = Float64(log(t) - y); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = -y - z; tmp = 0.0; if (z <= -7e-20) tmp = t_1; elseif (z <= 860.0) tmp = log(t) - y; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[((-y) - z), $MachinePrecision]}, If[LessEqual[z, -7e-20], t$95$1, If[LessEqual[z, 860.0], N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-y\right) - z\\
\mathbf{if}\;z \leq -7 \cdot 10^{-20}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 860:\\
\;\;\;\;\log t - y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7.00000000000000007e-20 or 860 < z Initial program 99.9%
Taylor expanded in x around 0
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lift-log.f6477.1
Applied rewrites77.1%
Taylor expanded in y around inf
mul-1-negN/A
lift-neg.f6475.7
Applied rewrites75.7%
if -7.00000000000000007e-20 < z < 860Initial program 99.8%
Taylor expanded in z around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift-log.f6499.7
Applied rewrites99.7%
Taylor expanded in x around 0
lift-log.f6463.6
Applied rewrites63.6%
(FPCore (x y z t) :precision binary64 (if (<= (- (* x (log y)) y) -10000000.0) (- (- y) z) (- (log t) z)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x * log(y)) - y) <= -10000000.0) {
tmp = -y - z;
} else {
tmp = log(t) - z;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (((x * log(y)) - y) <= (-10000000.0d0)) then
tmp = -y - z
else
tmp = log(t) - z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((x * Math.log(y)) - y) <= -10000000.0) {
tmp = -y - z;
} else {
tmp = Math.log(t) - z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x * math.log(y)) - y) <= -10000000.0: tmp = -y - z else: tmp = math.log(t) - z return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(Float64(x * log(y)) - y) <= -10000000.0) tmp = Float64(Float64(-y) - z); else tmp = Float64(log(t) - z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x * log(y)) - y) <= -10000000.0) tmp = -y - z; else tmp = log(t) - z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision], -10000000.0], N[((-y) - z), $MachinePrecision], N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot \log y - y \leq -10000000:\\
\;\;\;\;\left(-y\right) - z\\
\mathbf{else}:\\
\;\;\;\;\log t - z\\
\end{array}
\end{array}
if (-.f64 (*.f64 x (log.f64 y)) y) < -1e7Initial program 99.9%
Taylor expanded in x around 0
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lift-log.f6472.9
Applied rewrites72.9%
Taylor expanded in y around inf
mul-1-negN/A
lift-neg.f6472.7
Applied rewrites72.7%
if -1e7 < (-.f64 (*.f64 x (log.f64 y)) y) Initial 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.f6498.3
Applied rewrites98.3%
Taylor expanded in x around 0
lift-log.f6466.9
Applied rewrites66.9%
(FPCore (x y z t) :precision binary64 (- (- y) z))
double code(double x, double y, double z, double t) {
return -y - 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 = -y - z
end function
public static double code(double x, double y, double z, double t) {
return -y - z;
}
def code(x, y, z, t): return -y - z
function code(x, y, z, t) return Float64(Float64(-y) - z) end
function tmp = code(x, y, z, t) tmp = -y - z; end
code[x_, y_, z_, t_] := N[((-y) - z), $MachinePrecision]
\begin{array}{l}
\\
\left(-y\right) - z
\end{array}
Initial program 99.9%
Taylor expanded in x around 0
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lift-log.f6470.6
Applied rewrites70.6%
Taylor expanded in y around inf
mul-1-negN/A
lift-neg.f6457.5
Applied rewrites57.5%
(FPCore (x y z t) :precision binary64 (if (<= z -3.1e+118) (- z) (if (<= z 2.4e+76) (- y) (- z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.1e+118) {
tmp = -z;
} else if (z <= 2.4e+76) {
tmp = -y;
} else {
tmp = -z;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-3.1d+118)) then
tmp = -z
else if (z <= 2.4d+76) then
tmp = -y
else
tmp = -z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.1e+118) {
tmp = -z;
} else if (z <= 2.4e+76) {
tmp = -y;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -3.1e+118: tmp = -z elif z <= 2.4e+76: tmp = -y else: tmp = -z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -3.1e+118) tmp = Float64(-z); elseif (z <= 2.4e+76) tmp = Float64(-y); else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -3.1e+118) tmp = -z; elseif (z <= 2.4e+76) tmp = -y; else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -3.1e+118], (-z), If[LessEqual[z, 2.4e+76], (-y), (-z)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.1 \cdot 10^{+118}:\\
\;\;\;\;-z\\
\mathbf{elif}\;z \leq 2.4 \cdot 10^{+76}:\\
\;\;\;\;-y\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if z < -3.09999999999999986e118 or 2.4e76 < z Initial program 99.9%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6466.7
Applied rewrites66.7%
if -3.09999999999999986e118 < z < 2.4e76Initial program 99.8%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6436.6
Applied rewrites36.6%
(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.f6430.0
Applied rewrites30.0%
herbie shell --seed 2025119
(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)))