
(FPCore (x y z t a b) :precision binary64 (+ (- (+ (+ x y) z) (* z (log t))) (* (- a 0.5) b)))
double code(double x, double y, double z, double t, double a, double b) {
return (((x + y) + z) - (z * log(t))) + ((a - 0.5) * b);
}
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, a, b)
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), intent (in) :: a
real(8), intent (in) :: b
code = (((x + y) + z) - (z * log(t))) + ((a - 0.5d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return (((x + y) + z) - (z * Math.log(t))) + ((a - 0.5) * b);
}
def code(x, y, z, t, a, b): return (((x + y) + z) - (z * math.log(t))) + ((a - 0.5) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(Float64(x + y) + z) - Float64(z * log(t))) + Float64(Float64(a - 0.5) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = (((x + y) + z) - (z * log(t))) + ((a - 0.5) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(N[(x + y), $MachinePrecision] + z), $MachinePrecision] - N[(z * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b
\end{array}
Herbie found 20 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (+ (- (+ (+ x y) z) (* z (log t))) (* (- a 0.5) b)))
double code(double x, double y, double z, double t, double a, double b) {
return (((x + y) + z) - (z * log(t))) + ((a - 0.5) * b);
}
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, a, b)
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), intent (in) :: a
real(8), intent (in) :: b
code = (((x + y) + z) - (z * log(t))) + ((a - 0.5d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return (((x + y) + z) - (z * Math.log(t))) + ((a - 0.5) * b);
}
def code(x, y, z, t, a, b): return (((x + y) + z) - (z * math.log(t))) + ((a - 0.5) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(Float64(x + y) + z) - Float64(z * log(t))) + Float64(Float64(a - 0.5) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = (((x + y) + z) - (z * log(t))) + ((a - 0.5) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(N[(x + y), $MachinePrecision] + z), $MachinePrecision] - N[(z * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b
\end{array}
(FPCore (x y z t a b) :precision binary64 (+ (+ (fma (- 1.0 (log t)) z (* (- a 0.5) b)) y) x))
double code(double x, double y, double z, double t, double a, double b) {
return (fma((1.0 - log(t)), z, ((a - 0.5) * b)) + y) + x;
}
function code(x, y, z, t, a, b) return Float64(Float64(fma(Float64(1.0 - log(t)), z, Float64(Float64(a - 0.5) * b)) + y) + x) end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision] * z + N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\left(\mathsf{fma}\left(1 - \log t, z, \left(a - 0.5\right) \cdot b\right) + y\right) + x
\end{array}
Initial program 99.8%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lift-log.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f6499.9
Applied rewrites99.9%
(FPCore (x y z t a b) :precision binary64 (if (<= (+ x y) -5e-100) (+ x (- (fma (- a 0.5) b z) (* (log t) z))) (fma (- 1.0 (log t)) z (fma b (- a 0.5) y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x + y) <= -5e-100) {
tmp = x + (fma((a - 0.5), b, z) - (log(t) * z));
} else {
tmp = fma((1.0 - log(t)), z, fma(b, (a - 0.5), y));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(x + y) <= -5e-100) tmp = Float64(x + Float64(fma(Float64(a - 0.5), b, z) - Float64(log(t) * z))); else tmp = fma(Float64(1.0 - log(t)), z, fma(b, Float64(a - 0.5), y)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(x + y), $MachinePrecision], -5e-100], N[(x + N[(N[(N[(a - 0.5), $MachinePrecision] * b + z), $MachinePrecision] - N[(N[Log[t], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision] * z + N[(b * N[(a - 0.5), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -5 \cdot 10^{-100}:\\
\;\;\;\;x + \left(\mathsf{fma}\left(a - 0.5, b, z\right) - \log t \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 - \log t, z, \mathsf{fma}\left(b, a - 0.5, y\right)\right)\\
\end{array}
\end{array}
if (+.f64 x y) < -5.0000000000000001e-100Initial program 99.8%
Taylor expanded in y around 0
associate--l+N/A
lower-+.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f6477.2
Applied rewrites77.2%
if -5.0000000000000001e-100 < (+.f64 x y) Initial program 99.8%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lift-log.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f6499.9
Applied rewrites99.9%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6480.7
Applied rewrites80.7%
(FPCore (x y z t a b) :precision binary64 (if (<= x -2.6e+115) (+ (fma (- a 0.5) b y) x) (fma (- 1.0 (log t)) z (fma b (- a 0.5) y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -2.6e+115) {
tmp = fma((a - 0.5), b, y) + x;
} else {
tmp = fma((1.0 - log(t)), z, fma(b, (a - 0.5), y));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -2.6e+115) tmp = Float64(fma(Float64(a - 0.5), b, y) + x); else tmp = fma(Float64(1.0 - log(t)), z, fma(b, Float64(a - 0.5), y)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -2.6e+115], N[(N[(N[(a - 0.5), $MachinePrecision] * b + y), $MachinePrecision] + x), $MachinePrecision], N[(N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision] * z + N[(b * N[(a - 0.5), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.6 \cdot 10^{+115}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, y\right) + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 - \log t, z, \mathsf{fma}\left(b, a - 0.5, y\right)\right)\\
\end{array}
\end{array}
if x < -2.6e115Initial program 99.8%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6489.3
Applied rewrites89.3%
if -2.6e115 < x Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lift-log.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f6499.9
Applied rewrites99.9%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6484.7
Applied rewrites84.7%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (- z (* z (log t))) (* (- a 0.5) b))))
(if (<= z -1.32e+132)
t_1
(if (<= z 4.5e+155) (+ (fma (- a 0.5) b y) x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (z - (z * log(t))) + ((a - 0.5) * b);
double tmp;
if (z <= -1.32e+132) {
tmp = t_1;
} else if (z <= 4.5e+155) {
tmp = fma((a - 0.5), b, y) + x;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(z - Float64(z * log(t))) + Float64(Float64(a - 0.5) * b)) tmp = 0.0 if (z <= -1.32e+132) tmp = t_1; elseif (z <= 4.5e+155) tmp = Float64(fma(Float64(a - 0.5), b, y) + x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(z - N[(z * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.32e+132], t$95$1, If[LessEqual[z, 4.5e+155], N[(N[(N[(a - 0.5), $MachinePrecision] * b + y), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(z - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b\\
\mathbf{if}\;z \leq -1.32 \cdot 10^{+132}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{+155}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, y\right) + x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.3199999999999999e132 or 4.49999999999999973e155 < z Initial program 99.5%
Taylor expanded in z around inf
Applied rewrites81.6%
if -1.3199999999999999e132 < z < 4.49999999999999973e155Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6492.4
Applied rewrites92.4%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (fma (- 1.0 (log t)) z (fma b -0.5 y)))) (if (<= z -9e+136) t_1 (if (<= z 2.1e+208) (+ (fma (- a 0.5) b y) x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma((1.0 - log(t)), z, fma(b, -0.5, y));
double tmp;
if (z <= -9e+136) {
tmp = t_1;
} else if (z <= 2.1e+208) {
tmp = fma((a - 0.5), b, y) + x;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(Float64(1.0 - log(t)), z, fma(b, -0.5, y)) tmp = 0.0 if (z <= -9e+136) tmp = t_1; elseif (z <= 2.1e+208) tmp = Float64(fma(Float64(a - 0.5), b, y) + x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision] * z + N[(b * -0.5 + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -9e+136], t$95$1, If[LessEqual[z, 2.1e+208], N[(N[(N[(a - 0.5), $MachinePrecision] * b + y), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(1 - \log t, z, \mathsf{fma}\left(b, -0.5, y\right)\right)\\
\mathbf{if}\;z \leq -9 \cdot 10^{+136}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.1 \cdot 10^{+208}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, y\right) + x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -8.9999999999999999e136 or 2.0999999999999998e208 < z Initial program 99.5%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lift-log.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f6499.7
Applied rewrites99.7%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6491.6
Applied rewrites91.6%
Taylor expanded in a around 0
Applied rewrites72.9%
if -8.9999999999999999e136 < z < 2.0999999999999998e208Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6490.1
Applied rewrites90.1%
(FPCore (x y z t a b)
:precision binary64
(if (<= z -2.45e+131)
(- (+ (+ y x) z) (* (log t) z))
(if (<= z 6e+158)
(+ (fma (- a 0.5) b y) x)
(fma (- 1.0 (log t)) z (* b a)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -2.45e+131) {
tmp = ((y + x) + z) - (log(t) * z);
} else if (z <= 6e+158) {
tmp = fma((a - 0.5), b, y) + x;
} else {
tmp = fma((1.0 - log(t)), z, (b * a));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -2.45e+131) tmp = Float64(Float64(Float64(y + x) + z) - Float64(log(t) * z)); elseif (z <= 6e+158) tmp = Float64(fma(Float64(a - 0.5), b, y) + x); else tmp = fma(Float64(1.0 - log(t)), z, Float64(b * a)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -2.45e+131], N[(N[(N[(y + x), $MachinePrecision] + z), $MachinePrecision] - N[(N[Log[t], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6e+158], N[(N[(N[(a - 0.5), $MachinePrecision] * b + y), $MachinePrecision] + x), $MachinePrecision], N[(N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision] * z + N[(b * a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.45 \cdot 10^{+131}:\\
\;\;\;\;\left(\left(y + x\right) + z\right) - \log t \cdot z\\
\mathbf{elif}\;z \leq 6 \cdot 10^{+158}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, y\right) + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 - \log t, z, b \cdot a\right)\\
\end{array}
\end{array}
if z < -2.45000000000000016e131Initial program 99.7%
Taylor expanded in b around 0
associate-+r+N/A
lower--.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f6473.7
Applied rewrites73.7%
if -2.45000000000000016e131 < z < 6e158Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6492.2
Applied rewrites92.2%
if 6e158 < z Initial program 99.4%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lift-log.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f6499.7
Applied rewrites99.7%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6491.1
Applied rewrites91.1%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f6477.7
Applied rewrites77.7%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (fma (- 1.0 (log t)) z (* b a)))) (if (<= z -9.2e+136) t_1 (if (<= z 6e+158) (+ (fma (- a 0.5) b y) x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma((1.0 - log(t)), z, (b * a));
double tmp;
if (z <= -9.2e+136) {
tmp = t_1;
} else if (z <= 6e+158) {
tmp = fma((a - 0.5), b, y) + x;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(Float64(1.0 - log(t)), z, Float64(b * a)) tmp = 0.0 if (z <= -9.2e+136) tmp = t_1; elseif (z <= 6e+158) tmp = Float64(fma(Float64(a - 0.5), b, y) + x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision] * z + N[(b * a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -9.2e+136], t$95$1, If[LessEqual[z, 6e+158], N[(N[(N[(a - 0.5), $MachinePrecision] * b + y), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(1 - \log t, z, b \cdot a\right)\\
\mathbf{if}\;z \leq -9.2 \cdot 10^{+136}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 6 \cdot 10^{+158}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, y\right) + x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -9.2e136 or 6e158 < z Initial program 99.5%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lift-log.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f6499.7
Applied rewrites99.7%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6490.5
Applied rewrites90.5%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f6476.5
Applied rewrites76.5%
if -9.2e136 < z < 6e158Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6492.1
Applied rewrites92.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (- 1.0 (log t))))
(if (<= z -9e+136)
(+ (* t_1 z) x)
(if (<= z 2.1e+208) (+ (fma (- a 0.5) b y) x) (fma t_1 z y)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = 1.0 - log(t);
double tmp;
if (z <= -9e+136) {
tmp = (t_1 * z) + x;
} else if (z <= 2.1e+208) {
tmp = fma((a - 0.5), b, y) + x;
} else {
tmp = fma(t_1, z, y);
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(1.0 - log(t)) tmp = 0.0 if (z <= -9e+136) tmp = Float64(Float64(t_1 * z) + x); elseif (z <= 2.1e+208) tmp = Float64(fma(Float64(a - 0.5), b, y) + x); else tmp = fma(t_1, z, y); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -9e+136], N[(N[(t$95$1 * z), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 2.1e+208], N[(N[(N[(a - 0.5), $MachinePrecision] * b + y), $MachinePrecision] + x), $MachinePrecision], N[(t$95$1 * z + y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 1 - \log t\\
\mathbf{if}\;z \leq -9 \cdot 10^{+136}:\\
\;\;\;\;t\_1 \cdot z + x\\
\mathbf{elif}\;z \leq 2.1 \cdot 10^{+208}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, y\right) + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, z, y\right)\\
\end{array}
\end{array}
if z < -8.9999999999999999e136Initial program 99.7%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lift-log.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f6499.8
Applied rewrites99.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6465.2
Applied rewrites65.2%
if -8.9999999999999999e136 < z < 2.0999999999999998e208Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6490.1
Applied rewrites90.1%
if 2.0999999999999998e208 < z Initial program 99.2%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lift-log.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f6499.7
Applied rewrites99.7%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6494.5
Applied rewrites94.5%
Taylor expanded in y around inf
Applied rewrites73.6%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (fma (- 1.0 (log t)) z y))) (if (<= z -6e+171) t_1 (if (<= z 2.1e+208) (+ (fma (- a 0.5) b y) x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma((1.0 - log(t)), z, y);
double tmp;
if (z <= -6e+171) {
tmp = t_1;
} else if (z <= 2.1e+208) {
tmp = fma((a - 0.5), b, y) + x;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(Float64(1.0 - log(t)), z, y) tmp = 0.0 if (z <= -6e+171) tmp = t_1; elseif (z <= 2.1e+208) tmp = Float64(fma(Float64(a - 0.5), b, y) + x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision] * z + y), $MachinePrecision]}, If[LessEqual[z, -6e+171], t$95$1, If[LessEqual[z, 2.1e+208], N[(N[(N[(a - 0.5), $MachinePrecision] * b + y), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(1 - \log t, z, y\right)\\
\mathbf{if}\;z \leq -6 \cdot 10^{+171}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.1 \cdot 10^{+208}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, y\right) + x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -6.0000000000000002e171 or 2.0999999999999998e208 < z Initial program 99.4%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lift-log.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f6499.7
Applied rewrites99.7%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6492.4
Applied rewrites92.4%
Taylor expanded in y around inf
Applied rewrites70.8%
if -6.0000000000000002e171 < z < 2.0999999999999998e208Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6489.1
Applied rewrites89.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- 1.0 (log t)) z)))
(if (<= z -6.2e+171)
t_1
(if (<= z 2.1e+208) (+ (fma (- a 0.5) b y) x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (1.0 - log(t)) * z;
double tmp;
if (z <= -6.2e+171) {
tmp = t_1;
} else if (z <= 2.1e+208) {
tmp = fma((a - 0.5), b, y) + x;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(1.0 - log(t)) * z) tmp = 0.0 if (z <= -6.2e+171) tmp = t_1; elseif (z <= 2.1e+208) tmp = Float64(fma(Float64(a - 0.5), b, y) + x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -6.2e+171], t$95$1, If[LessEqual[z, 2.1e+208], N[(N[(N[(a - 0.5), $MachinePrecision] * b + y), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(1 - \log t\right) \cdot z\\
\mathbf{if}\;z \leq -6.2 \cdot 10^{+171}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.1 \cdot 10^{+208}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, y\right) + x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -6.1999999999999998e171 or 2.0999999999999998e208 < z Initial program 99.4%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lift-log.f6464.4
Applied rewrites64.4%
if -6.1999999999999998e171 < z < 2.0999999999999998e208Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6489.1
Applied rewrites89.1%
(FPCore (x y z t a b) :precision binary64 (+ (fma (- a 0.5) b y) x))
double code(double x, double y, double z, double t, double a, double b) {
return fma((a - 0.5), b, y) + x;
}
function code(x, y, z, t, a, b) return Float64(fma(Float64(a - 0.5), b, y) + x) end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(a - 0.5), $MachinePrecision] * b + y), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(a - 0.5, b, y\right) + x
\end{array}
Initial program 99.8%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6479.2
Applied rewrites79.2%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (- a 0.5) b))) (if (<= (- (+ (+ x y) z) (* z (log t))) -5e-100) (+ x t_1) (+ y t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a - 0.5) * b;
double tmp;
if ((((x + y) + z) - (z * log(t))) <= -5e-100) {
tmp = x + t_1;
} else {
tmp = y + 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, a, b)
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), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = (a - 0.5d0) * b
if ((((x + y) + z) - (z * log(t))) <= (-5d-100)) then
tmp = x + t_1
else
tmp = y + t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a - 0.5) * b;
double tmp;
if ((((x + y) + z) - (z * Math.log(t))) <= -5e-100) {
tmp = x + t_1;
} else {
tmp = y + t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (a - 0.5) * b tmp = 0 if (((x + y) + z) - (z * math.log(t))) <= -5e-100: tmp = x + t_1 else: tmp = y + t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a - 0.5) * b) tmp = 0.0 if (Float64(Float64(Float64(x + y) + z) - Float64(z * log(t))) <= -5e-100) tmp = Float64(x + t_1); else tmp = Float64(y + t_1); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (a - 0.5) * b; tmp = 0.0; if ((((x + y) + z) - (z * log(t))) <= -5e-100) tmp = x + t_1; else tmp = y + t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[N[(N[(N[(x + y), $MachinePrecision] + z), $MachinePrecision] - N[(z * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -5e-100], N[(x + t$95$1), $MachinePrecision], N[(y + t$95$1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a - 0.5\right) \cdot b\\
\mathbf{if}\;\left(\left(x + y\right) + z\right) - z \cdot \log t \leq -5 \cdot 10^{-100}:\\
\;\;\;\;x + t\_1\\
\mathbf{else}:\\
\;\;\;\;y + t\_1\\
\end{array}
\end{array}
if (-.f64 (+.f64 (+.f64 x y) z) (*.f64 z (log.f64 t))) < -5.0000000000000001e-100Initial program 99.8%
Taylor expanded in x around inf
Applied rewrites57.9%
if -5.0000000000000001e-100 < (-.f64 (+.f64 (+.f64 x y) z) (*.f64 z (log.f64 t))) Initial program 99.8%
Taylor expanded in y around inf
Applied rewrites59.8%
(FPCore (x y z t a b) :precision binary64 (if (<= (+ x y) 0.005) (+ x (* (- a 0.5) b)) (+ y (* a b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x + y) <= 0.005) {
tmp = x + ((a - 0.5) * b);
} else {
tmp = y + (a * b);
}
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, a, b)
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), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((x + y) <= 0.005d0) then
tmp = x + ((a - 0.5d0) * b)
else
tmp = y + (a * b)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x + y) <= 0.005) {
tmp = x + ((a - 0.5) * b);
} else {
tmp = y + (a * b);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (x + y) <= 0.005: tmp = x + ((a - 0.5) * b) else: tmp = y + (a * b) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(x + y) <= 0.005) tmp = Float64(x + Float64(Float64(a - 0.5) * b)); else tmp = Float64(y + Float64(a * b)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((x + y) <= 0.005) tmp = x + ((a - 0.5) * b); else tmp = y + (a * b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(x + y), $MachinePrecision], 0.005], N[(x + N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq 0.005:\\
\;\;\;\;x + \left(a - 0.5\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;y + a \cdot b\\
\end{array}
\end{array}
if (+.f64 x y) < 0.0050000000000000001Initial program 99.8%
Taylor expanded in x around inf
Applied rewrites59.6%
if 0.0050000000000000001 < (+.f64 x y) Initial program 99.9%
Taylor expanded in y around inf
Applied rewrites57.7%
Taylor expanded in a around inf
Applied rewrites48.5%
(FPCore (x y z t a b) :precision binary64 (if (<= (+ x y) -5e+74) (+ x (* a b)) (if (<= (+ x y) 0.005) (* (- a 0.5) b) (+ y (* a b)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x + y) <= -5e+74) {
tmp = x + (a * b);
} else if ((x + y) <= 0.005) {
tmp = (a - 0.5) * b;
} else {
tmp = y + (a * b);
}
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, a, b)
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), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((x + y) <= (-5d+74)) then
tmp = x + (a * b)
else if ((x + y) <= 0.005d0) then
tmp = (a - 0.5d0) * b
else
tmp = y + (a * b)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x + y) <= -5e+74) {
tmp = x + (a * b);
} else if ((x + y) <= 0.005) {
tmp = (a - 0.5) * b;
} else {
tmp = y + (a * b);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (x + y) <= -5e+74: tmp = x + (a * b) elif (x + y) <= 0.005: tmp = (a - 0.5) * b else: tmp = y + (a * b) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(x + y) <= -5e+74) tmp = Float64(x + Float64(a * b)); elseif (Float64(x + y) <= 0.005) tmp = Float64(Float64(a - 0.5) * b); else tmp = Float64(y + Float64(a * b)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((x + y) <= -5e+74) tmp = x + (a * b); elseif ((x + y) <= 0.005) tmp = (a - 0.5) * b; else tmp = y + (a * b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(x + y), $MachinePrecision], -5e+74], N[(x + N[(a * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x + y), $MachinePrecision], 0.005], N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision], N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -5 \cdot 10^{+74}:\\
\;\;\;\;x + a \cdot b\\
\mathbf{elif}\;x + y \leq 0.005:\\
\;\;\;\;\left(a - 0.5\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;y + a \cdot b\\
\end{array}
\end{array}
if (+.f64 x y) < -4.99999999999999963e74Initial program 99.8%
Taylor expanded in x around inf
Applied rewrites58.7%
Taylor expanded in a around inf
Applied rewrites50.6%
if -4.99999999999999963e74 < (+.f64 x y) < 0.0050000000000000001Initial program 99.8%
Taylor expanded in b around inf
*-commutativeN/A
lift--.f64N/A
lift-*.f6454.3
Applied rewrites54.3%
if 0.0050000000000000001 < (+.f64 x y) Initial program 99.9%
Taylor expanded in y around inf
Applied rewrites57.7%
Taylor expanded in a around inf
Applied rewrites48.5%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (- a 0.5) b))) (if (<= t_1 -5e+134) t_1 (if (<= t_1 5e+136) (+ y x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a - 0.5) * b;
double tmp;
if (t_1 <= -5e+134) {
tmp = t_1;
} else if (t_1 <= 5e+136) {
tmp = y + x;
} 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, a, b)
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), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = (a - 0.5d0) * b
if (t_1 <= (-5d+134)) then
tmp = t_1
else if (t_1 <= 5d+136) then
tmp = y + x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a - 0.5) * b;
double tmp;
if (t_1 <= -5e+134) {
tmp = t_1;
} else if (t_1 <= 5e+136) {
tmp = y + x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (a - 0.5) * b tmp = 0 if t_1 <= -5e+134: tmp = t_1 elif t_1 <= 5e+136: tmp = y + x else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a - 0.5) * b) tmp = 0.0 if (t_1 <= -5e+134) tmp = t_1; elseif (t_1 <= 5e+136) tmp = Float64(y + x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (a - 0.5) * b; tmp = 0.0; if (t_1 <= -5e+134) tmp = t_1; elseif (t_1 <= 5e+136) tmp = y + x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+134], t$95$1, If[LessEqual[t$95$1, 5e+136], N[(y + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a - 0.5\right) \cdot b\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+134}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+136}:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < -4.99999999999999981e134 or 5.0000000000000002e136 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) Initial program 99.8%
Taylor expanded in b around inf
*-commutativeN/A
lift--.f64N/A
lift-*.f6475.7
Applied rewrites75.7%
if -4.99999999999999981e134 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < 5.0000000000000002e136Initial program 99.8%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lift-log.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f6499.9
Applied rewrites99.9%
Taylor expanded in y around inf
Applied rewrites59.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- a 0.5) b)))
(if (<= t_1 -2e+228)
(* b a)
(if (<= t_1 5e+220) (+ y x) (if (<= t_1 1e+305) (* -0.5 b) (* b a))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a - 0.5) * b;
double tmp;
if (t_1 <= -2e+228) {
tmp = b * a;
} else if (t_1 <= 5e+220) {
tmp = y + x;
} else if (t_1 <= 1e+305) {
tmp = -0.5 * b;
} else {
tmp = b * a;
}
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, a, b)
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), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = (a - 0.5d0) * b
if (t_1 <= (-2d+228)) then
tmp = b * a
else if (t_1 <= 5d+220) then
tmp = y + x
else if (t_1 <= 1d+305) then
tmp = (-0.5d0) * b
else
tmp = b * a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a - 0.5) * b;
double tmp;
if (t_1 <= -2e+228) {
tmp = b * a;
} else if (t_1 <= 5e+220) {
tmp = y + x;
} else if (t_1 <= 1e+305) {
tmp = -0.5 * b;
} else {
tmp = b * a;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (a - 0.5) * b tmp = 0 if t_1 <= -2e+228: tmp = b * a elif t_1 <= 5e+220: tmp = y + x elif t_1 <= 1e+305: tmp = -0.5 * b else: tmp = b * a return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a - 0.5) * b) tmp = 0.0 if (t_1 <= -2e+228) tmp = Float64(b * a); elseif (t_1 <= 5e+220) tmp = Float64(y + x); elseif (t_1 <= 1e+305) tmp = Float64(-0.5 * b); else tmp = Float64(b * a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (a - 0.5) * b; tmp = 0.0; if (t_1 <= -2e+228) tmp = b * a; elseif (t_1 <= 5e+220) tmp = y + x; elseif (t_1 <= 1e+305) tmp = -0.5 * b; else tmp = b * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+228], N[(b * a), $MachinePrecision], If[LessEqual[t$95$1, 5e+220], N[(y + x), $MachinePrecision], If[LessEqual[t$95$1, 1e+305], N[(-0.5 * b), $MachinePrecision], N[(b * a), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a - 0.5\right) \cdot b\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+228}:\\
\;\;\;\;b \cdot a\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+220}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;t\_1 \leq 10^{+305}:\\
\;\;\;\;-0.5 \cdot b\\
\mathbf{else}:\\
\;\;\;\;b \cdot a\\
\end{array}
\end{array}
if (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < -1.9999999999999998e228 or 9.9999999999999994e304 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) Initial program 99.8%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f6479.3
Applied rewrites79.3%
if -1.9999999999999998e228 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < 5.0000000000000002e220Initial program 99.8%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lift-log.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f6499.9
Applied rewrites99.9%
Taylor expanded in y around inf
Applied rewrites54.3%
if 5.0000000000000002e220 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < 9.9999999999999994e304Initial program 99.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites61.3%
Taylor expanded in b around inf
associate-*r*N/A
associate-*r/N/A
metadata-evalN/A
div-subN/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6451.3
Applied rewrites51.3%
Taylor expanded in a around 0
lower-*.f6442.0
Applied rewrites42.0%
(FPCore (x y z t a b) :precision binary64 (if (<= b -1.95e+142) (* -0.5 b) (if (<= b 5.2e+124) (+ y x) (* -0.5 b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -1.95e+142) {
tmp = -0.5 * b;
} else if (b <= 5.2e+124) {
tmp = y + x;
} else {
tmp = -0.5 * b;
}
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, a, b)
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), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (b <= (-1.95d+142)) then
tmp = (-0.5d0) * b
else if (b <= 5.2d+124) then
tmp = y + x
else
tmp = (-0.5d0) * b
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -1.95e+142) {
tmp = -0.5 * b;
} else if (b <= 5.2e+124) {
tmp = y + x;
} else {
tmp = -0.5 * b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if b <= -1.95e+142: tmp = -0.5 * b elif b <= 5.2e+124: tmp = y + x else: tmp = -0.5 * b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -1.95e+142) tmp = Float64(-0.5 * b); elseif (b <= 5.2e+124) tmp = Float64(y + x); else tmp = Float64(-0.5 * b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (b <= -1.95e+142) tmp = -0.5 * b; elseif (b <= 5.2e+124) tmp = y + x; else tmp = -0.5 * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -1.95e+142], N[(-0.5 * b), $MachinePrecision], If[LessEqual[b, 5.2e+124], N[(y + x), $MachinePrecision], N[(-0.5 * b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.95 \cdot 10^{+142}:\\
\;\;\;\;-0.5 \cdot b\\
\mathbf{elif}\;b \leq 5.2 \cdot 10^{+124}:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot b\\
\end{array}
\end{array}
if b < -1.95e142 or 5.2000000000000001e124 < b Initial program 99.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites76.1%
Taylor expanded in b around inf
associate-*r*N/A
associate-*r/N/A
metadata-evalN/A
div-subN/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6467.7
Applied rewrites67.7%
Taylor expanded in a around 0
lower-*.f6434.7
Applied rewrites34.7%
if -1.95e142 < b < 5.2000000000000001e124Initial program 99.8%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lift-log.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f6499.9
Applied rewrites99.9%
Taylor expanded in y around inf
Applied rewrites52.5%
(FPCore (x y z t a b) :precision binary64 (+ y x))
double code(double x, double y, double z, double t, double a, double b) {
return y + x;
}
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, a, b)
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), intent (in) :: a
real(8), intent (in) :: b
code = y + x
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return y + x;
}
def code(x, y, z, t, a, b): return y + x
function code(x, y, z, t, a, b) return Float64(y + x) end
function tmp = code(x, y, z, t, a, b) tmp = y + x; end
code[x_, y_, z_, t_, a_, b_] := N[(y + x), $MachinePrecision]
\begin{array}{l}
\\
y + x
\end{array}
Initial program 99.8%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lift-log.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f6499.9
Applied rewrites99.9%
Taylor expanded in y around inf
Applied rewrites41.9%
(FPCore (x y z t a b) :precision binary64 (if (<= (+ (- (+ (+ x y) z) (* z (log t))) (* (- a 0.5) b)) -5e-139) x y))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((((x + y) + z) - (z * log(t))) + ((a - 0.5) * b)) <= -5e-139) {
tmp = x;
} 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, a, b)
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), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (((((x + y) + z) - (z * log(t))) + ((a - 0.5d0) * b)) <= (-5d-139)) then
tmp = x
else
tmp = y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((((x + y) + z) - (z * Math.log(t))) + ((a - 0.5) * b)) <= -5e-139) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((((x + y) + z) - (z * math.log(t))) + ((a - 0.5) * b)) <= -5e-139: tmp = x else: tmp = y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(Float64(Float64(Float64(x + y) + z) - Float64(z * log(t))) + Float64(Float64(a - 0.5) * b)) <= -5e-139) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (((((x + y) + z) - (z * log(t))) + ((a - 0.5) * b)) <= -5e-139) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(N[(N[(N[(x + y), $MachinePrecision] + z), $MachinePrecision] - N[(z * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], -5e-139], x, y]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \leq -5 \cdot 10^{-139}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if (+.f64 (-.f64 (+.f64 (+.f64 x y) z) (*.f64 z (log.f64 t))) (*.f64 (-.f64 a #s(literal 1/2 binary64)) b)) < -5.00000000000000034e-139Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites21.6%
if -5.00000000000000034e-139 < (+.f64 (-.f64 (+.f64 (+.f64 x y) z) (*.f64 z (log.f64 t))) (*.f64 (-.f64 a #s(literal 1/2 binary64)) b)) Initial program 99.8%
Taylor expanded in y around inf
Applied rewrites22.5%
(FPCore (x y z t a b) :precision binary64 x)
double code(double x, double y, double z, double t, double a, double b) {
return x;
}
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, a, b)
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), intent (in) :: a
real(8), intent (in) :: b
code = x
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x;
}
def code(x, y, z, t, a, b): return x
function code(x, y, z, t, a, b) return x end
function tmp = code(x, y, z, t, a, b) tmp = x; end
code[x_, y_, z_, t_, a_, b_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 99.8%
Taylor expanded in x around inf
Applied rewrites21.9%
herbie shell --seed 2025119
(FPCore (x y z t a b)
:name "Numeric.SpecFunctions:logBeta from math-functions-0.1.5.2, A"
:precision binary64
(+ (- (+ (+ x y) z) (* z (log t))) (* (- a 0.5) b)))