
(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 19 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.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%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (fma (- 1.0 (log t)) z (fma b (- a 0.5) y)))) (if (<= z -0.27) t_1 (if (<= z 3.1e+72) (+ (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, (a - 0.5), y));
double tmp;
if (z <= -0.27) {
tmp = t_1;
} else if (z <= 3.1e+72) {
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, Float64(a - 0.5), y)) tmp = 0.0 if (z <= -0.27) tmp = t_1; elseif (z <= 3.1e+72) 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 * N[(a - 0.5), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -0.27], t$95$1, If[LessEqual[z, 3.1e+72], 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, a - 0.5, y\right)\right)\\
\mathbf{if}\;z \leq -0.27:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.1 \cdot 10^{+72}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, y\right) + x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -0.27000000000000002 or 3.09999999999999988e72 < z 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.8
Applied rewrites99.8%
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--.f6486.5
Applied rewrites86.5%
if -0.27000000000000002 < z < 3.09999999999999988e72Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6496.5
Applied rewrites96.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- 1.0 (log t)) z)))
(if (<= z -1.35e+166)
(fma (- a 0.5) b t_1)
(if (<= z 5.8e+130) (+ (fma (- a 0.5) b y) x) (+ (+ t_1 y) x)))))
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 <= -1.35e+166) {
tmp = fma((a - 0.5), b, t_1);
} else if (z <= 5.8e+130) {
tmp = fma((a - 0.5), b, y) + x;
} else {
tmp = (t_1 + y) + x;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(1.0 - log(t)) * z) tmp = 0.0 if (z <= -1.35e+166) tmp = fma(Float64(a - 0.5), b, t_1); elseif (z <= 5.8e+130) tmp = Float64(fma(Float64(a - 0.5), b, y) + x); else tmp = Float64(Float64(t_1 + y) + x); 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, -1.35e+166], N[(N[(a - 0.5), $MachinePrecision] * b + t$95$1), $MachinePrecision], If[LessEqual[z, 5.8e+130], N[(N[(N[(a - 0.5), $MachinePrecision] * b + y), $MachinePrecision] + x), $MachinePrecision], N[(N[(t$95$1 + y), $MachinePrecision] + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(1 - \log t\right) \cdot z\\
\mathbf{if}\;z \leq -1.35 \cdot 10^{+166}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, t\_1\right)\\
\mathbf{elif}\;z \leq 5.8 \cdot 10^{+130}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, y\right) + x\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 + y\right) + x\\
\end{array}
\end{array}
if z < -1.35000000000000006e166Initial program 99.7%
Taylor expanded in x around inf
Applied rewrites31.7%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f6431.7
Applied rewrites31.7%
Taylor expanded in z around inf
associate--l+N/A
+-commutativeN/A
*-commutativeN/A
associate--l+N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6484.5
Applied rewrites84.5%
if -1.35000000000000006e166 < z < 5.7999999999999998e130Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6491.7
Applied rewrites91.7%
if 5.7999999999999998e130 < z Initial 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--.f6475.1
Applied rewrites75.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- a 0.5) b)) (t_2 (+ (fma (- a 0.5) b y) x)))
(if (<= t_1 -5e+67)
t_2
(if (<= t_1 2e+150) (+ (+ (* (- 1.0 (log t)) z) y) x) t_2))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a - 0.5) * b;
double t_2 = fma((a - 0.5), b, y) + x;
double tmp;
if (t_1 <= -5e+67) {
tmp = t_2;
} else if (t_1 <= 2e+150) {
tmp = (((1.0 - log(t)) * z) + y) + x;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a - 0.5) * b) t_2 = Float64(fma(Float64(a - 0.5), b, y) + x) tmp = 0.0 if (t_1 <= -5e+67) tmp = t_2; elseif (t_1 <= 2e+150) tmp = Float64(Float64(Float64(Float64(1.0 - log(t)) * z) + y) + x); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(a - 0.5), $MachinePrecision] * b + y), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+67], t$95$2, If[LessEqual[t$95$1, 2e+150], N[(N[(N[(N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision] + y), $MachinePrecision] + x), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a - 0.5\right) \cdot b\\
t_2 := \mathsf{fma}\left(a - 0.5, b, y\right) + x\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+67}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+150}:\\
\;\;\;\;\left(\left(1 - \log t\right) \cdot z + y\right) + x\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < -4.99999999999999976e67 or 1.99999999999999996e150 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6490.2
Applied rewrites90.2%
if -4.99999999999999976e67 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < 1.99999999999999996e150Initial 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 z around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6490.7
Applied rewrites90.7%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (log t) z)))
(if (<= z -8.5e+172)
(- (+ x z) t_1)
(if (<= z 1.25e+171) (+ (fma (- a 0.5) b y) x) (- (+ y z) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = log(t) * z;
double tmp;
if (z <= -8.5e+172) {
tmp = (x + z) - t_1;
} else if (z <= 1.25e+171) {
tmp = fma((a - 0.5), b, y) + x;
} else {
tmp = (y + z) - t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(log(t) * z) tmp = 0.0 if (z <= -8.5e+172) tmp = Float64(Float64(x + z) - t_1); elseif (z <= 1.25e+171) tmp = Float64(fma(Float64(a - 0.5), b, y) + x); else tmp = Float64(Float64(y + z) - t_1); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[Log[t], $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -8.5e+172], N[(N[(x + z), $MachinePrecision] - t$95$1), $MachinePrecision], If[LessEqual[z, 1.25e+171], N[(N[(N[(a - 0.5), $MachinePrecision] * b + y), $MachinePrecision] + x), $MachinePrecision], N[(N[(y + z), $MachinePrecision] - t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log t \cdot z\\
\mathbf{if}\;z \leq -8.5 \cdot 10^{+172}:\\
\;\;\;\;\left(x + z\right) - t\_1\\
\mathbf{elif}\;z \leq 1.25 \cdot 10^{+171}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, y\right) + x\\
\mathbf{else}:\\
\;\;\;\;\left(y + z\right) - t\_1\\
\end{array}
\end{array}
if z < -8.50000000000000053e172Initial 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.f6475.2
Applied rewrites75.2%
Taylor expanded in x around inf
Applied rewrites67.5%
if -8.50000000000000053e172 < z < 1.2500000000000001e171Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6490.4
Applied rewrites90.4%
if 1.2500000000000001e171 < z Initial 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.f6477.6
Applied rewrites77.6%
Taylor expanded in x around 0
Applied rewrites69.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (- (+ x z) (* (log t) z))))
(if (<= z -8.5e+172)
t_1
(if (<= z 4.6e+173) (+ (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 = (x + z) - (log(t) * z);
double tmp;
if (z <= -8.5e+172) {
tmp = t_1;
} else if (z <= 4.6e+173) {
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(x + z) - Float64(log(t) * z)) tmp = 0.0 if (z <= -8.5e+172) tmp = t_1; elseif (z <= 4.6e+173) 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[(x + z), $MachinePrecision] - N[(N[Log[t], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -8.5e+172], t$95$1, If[LessEqual[z, 4.6e+173], N[(N[(N[(a - 0.5), $MachinePrecision] * b + y), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x + z\right) - \log t \cdot z\\
\mathbf{if}\;z \leq -8.5 \cdot 10^{+172}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4.6 \cdot 10^{+173}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, y\right) + x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -8.50000000000000053e172 or 4.5999999999999999e173 < z Initial 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.f6476.5
Applied rewrites76.5%
Taylor expanded in x around inf
Applied rewrites67.9%
if -8.50000000000000053e172 < z < 4.5999999999999999e173Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6490.3
Applied rewrites90.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- 1.0 (log t)) z)))
(if (<= z -3.2e+182)
t_1
(if (<= z 1.35e+201) (+ (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 <= -3.2e+182) {
tmp = t_1;
} else if (z <= 1.35e+201) {
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 <= -3.2e+182) tmp = t_1; elseif (z <= 1.35e+201) 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, -3.2e+182], t$95$1, If[LessEqual[z, 1.35e+201], 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 -3.2 \cdot 10^{+182}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{+201}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, y\right) + x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.1999999999999997e182 or 1.35e201 < z Initial program 99.7%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lift-log.f6463.8
Applied rewrites63.8%
if -3.1999999999999997e182 < z < 1.35e201Initial 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.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6478.6
Applied rewrites78.6%
(FPCore (x y z t a b) :precision binary64 (if (<= (- (+ (+ x y) z) (* z (log t))) -5e-155) (fma (- a 0.5) b x) (fma (- a 0.5) b y)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((((x + y) + z) - (z * log(t))) <= -5e-155) {
tmp = fma((a - 0.5), b, x);
} else {
tmp = fma((a - 0.5), b, y);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(Float64(Float64(x + y) + z) - Float64(z * log(t))) <= -5e-155) tmp = fma(Float64(a - 0.5), b, x); else tmp = fma(Float64(a - 0.5), b, y); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(N[(N[(x + y), $MachinePrecision] + z), $MachinePrecision] - N[(z * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -5e-155], N[(N[(a - 0.5), $MachinePrecision] * b + x), $MachinePrecision], N[(N[(a - 0.5), $MachinePrecision] * b + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(\left(x + y\right) + z\right) - z \cdot \log t \leq -5 \cdot 10^{-155}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, y\right)\\
\end{array}
\end{array}
if (-.f64 (+.f64 (+.f64 x y) z) (*.f64 z (log.f64 t))) < -4.9999999999999999e-155Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites56.8%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f6456.8
Applied rewrites56.8%
if -4.9999999999999999e-155 < (-.f64 (+.f64 (+.f64 x y) z) (*.f64 z (log.f64 t))) Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites57.7%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f6457.7
Applied rewrites57.7%
Taylor expanded in y around inf
associate--l+58.3
+-commutative58.3
*-commutative58.3
associate--l+58.3
Applied rewrites58.3%
(FPCore (x y z t a b) :precision binary64 (if (<= (+ x y) 1e+42) (fma (- a 0.5) b x) (fma a b y)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x + y) <= 1e+42) {
tmp = fma((a - 0.5), b, x);
} else {
tmp = fma(a, b, y);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(x + y) <= 1e+42) tmp = fma(Float64(a - 0.5), b, x); else tmp = fma(a, b, y); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(x + y), $MachinePrecision], 1e+42], N[(N[(a - 0.5), $MachinePrecision] * b + x), $MachinePrecision], N[(a * b + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq 10^{+42}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, b, y\right)\\
\end{array}
\end{array}
if (+.f64 x y) < 1.00000000000000004e42Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites57.3%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f6457.3
Applied rewrites57.3%
if 1.00000000000000004e42 < (+.f64 x y) Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites57.0%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f6457.0
Applied rewrites57.0%
Taylor expanded in y around inf
associate--l+57.7
+-commutative57.7
*-commutative57.7
associate--l+57.7
Applied rewrites57.7%
Taylor expanded in a around inf
Applied rewrites49.4%
(FPCore (x y z t a b)
:precision binary64
(if (<= (+ x y) -1e+45)
(fma a b x)
(if (<= (+ x y) -1e-12)
(fma -0.5 b x)
(if (<= (+ x y) 1e+42) (* (- a 0.5) b) (fma a b y)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x + y) <= -1e+45) {
tmp = fma(a, b, x);
} else if ((x + y) <= -1e-12) {
tmp = fma(-0.5, b, x);
} else if ((x + y) <= 1e+42) {
tmp = (a - 0.5) * b;
} else {
tmp = fma(a, b, y);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(x + y) <= -1e+45) tmp = fma(a, b, x); elseif (Float64(x + y) <= -1e-12) tmp = fma(-0.5, b, x); elseif (Float64(x + y) <= 1e+42) tmp = Float64(Float64(a - 0.5) * b); else tmp = fma(a, b, y); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(x + y), $MachinePrecision], -1e+45], N[(a * b + x), $MachinePrecision], If[LessEqual[N[(x + y), $MachinePrecision], -1e-12], N[(-0.5 * b + x), $MachinePrecision], If[LessEqual[N[(x + y), $MachinePrecision], 1e+42], N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision], N[(a * b + y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -1 \cdot 10^{+45}:\\
\;\;\;\;\mathsf{fma}\left(a, b, x\right)\\
\mathbf{elif}\;x + y \leq -1 \cdot 10^{-12}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, b, x\right)\\
\mathbf{elif}\;x + y \leq 10^{+42}:\\
\;\;\;\;\left(a - 0.5\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, b, y\right)\\
\end{array}
\end{array}
if (+.f64 x y) < -9.9999999999999993e44Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites55.5%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f6455.5
Applied rewrites55.5%
Taylor expanded in a around inf
Applied rewrites47.7%
if -9.9999999999999993e44 < (+.f64 x y) < -9.9999999999999998e-13Initial program 99.8%
Taylor expanded in x around inf
Applied rewrites57.3%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f6457.3
Applied rewrites57.3%
Taylor expanded in a around 0
Applied rewrites28.8%
if -9.9999999999999998e-13 < (+.f64 x y) < 1.00000000000000004e42Initial program 99.8%
Taylor expanded in b around inf
*-commutativeN/A
lift--.f64N/A
lift-*.f6454.5
Applied rewrites54.5%
if 1.00000000000000004e42 < (+.f64 x y) Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites57.0%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f6457.0
Applied rewrites57.0%
Taylor expanded in y around inf
associate--l+57.7
+-commutative57.7
*-commutative57.7
associate--l+57.7
Applied rewrites57.7%
Taylor expanded in a around inf
Applied rewrites49.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (- (+ (+ x y) z) (* z (log t))) (* (- a 0.5) b))))
(if (<= t_1 -5e+292)
(fma a b x)
(if (<= t_1 -5e-155)
(fma -0.5 b x)
(if (<= t_1 2e+306) (fma -0.5 b y) (* b a))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (((x + y) + z) - (z * log(t))) + ((a - 0.5) * b);
double tmp;
if (t_1 <= -5e+292) {
tmp = fma(a, b, x);
} else if (t_1 <= -5e-155) {
tmp = fma(-0.5, b, x);
} else if (t_1 <= 2e+306) {
tmp = fma(-0.5, b, y);
} else {
tmp = b * a;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(Float64(x + y) + z) - Float64(z * log(t))) + Float64(Float64(a - 0.5) * b)) tmp = 0.0 if (t_1 <= -5e+292) tmp = fma(a, b, x); elseif (t_1 <= -5e-155) tmp = fma(-0.5, b, x); elseif (t_1 <= 2e+306) tmp = fma(-0.5, b, y); else tmp = Float64(b * a); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = 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]}, If[LessEqual[t$95$1, -5e+292], N[(a * b + x), $MachinePrecision], If[LessEqual[t$95$1, -5e-155], N[(-0.5 * b + x), $MachinePrecision], If[LessEqual[t$95$1, 2e+306], N[(-0.5 * b + y), $MachinePrecision], N[(b * a), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+292}:\\
\;\;\;\;\mathsf{fma}\left(a, b, x\right)\\
\mathbf{elif}\;t\_1 \leq -5 \cdot 10^{-155}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, b, x\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+306}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, b, y\right)\\
\mathbf{else}:\\
\;\;\;\;b \cdot a\\
\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)) < -4.9999999999999996e292Initial program 100.0%
Taylor expanded in x around inf
Applied rewrites79.1%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f6479.1
Applied rewrites79.1%
Taylor expanded in a around inf
Applied rewrites74.1%
if -4.9999999999999996e292 < (+.f64 (-.f64 (+.f64 (+.f64 x y) z) (*.f64 z (log.f64 t))) (*.f64 (-.f64 a #s(literal 1/2 binary64)) b)) < -4.9999999999999999e-155Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites51.3%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f6451.3
Applied rewrites51.3%
Taylor expanded in a around 0
Applied rewrites38.1%
if -4.9999999999999999e-155 < (+.f64 (-.f64 (+.f64 (+.f64 x y) z) (*.f64 z (log.f64 t))) (*.f64 (-.f64 a #s(literal 1/2 binary64)) b)) < 2.00000000000000003e306Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites51.5%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f6451.5
Applied rewrites51.5%
Taylor expanded in y around inf
associate--l+51.8
+-commutative51.8
*-commutative51.8
associate--l+51.8
Applied rewrites51.8%
Taylor expanded in a around 0
Applied rewrites38.1%
if 2.00000000000000003e306 < (+.f64 (-.f64 (+.f64 (+.f64 x y) z) (*.f64 z (log.f64 t))) (*.f64 (-.f64 a #s(literal 1/2 binary64)) b)) Initial program 100.0%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f6490.6
Applied rewrites90.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (- (+ (+ x y) z) (* z (log t))) (* (- a 0.5) b))))
(if (<= t_1 -5e+292)
(fma a b x)
(if (<= t_1 5e-107) (fma -0.5 b x) (fma a b y)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (((x + y) + z) - (z * log(t))) + ((a - 0.5) * b);
double tmp;
if (t_1 <= -5e+292) {
tmp = fma(a, b, x);
} else if (t_1 <= 5e-107) {
tmp = fma(-0.5, b, x);
} else {
tmp = fma(a, b, y);
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(Float64(x + y) + z) - Float64(z * log(t))) + Float64(Float64(a - 0.5) * b)) tmp = 0.0 if (t_1 <= -5e+292) tmp = fma(a, b, x); elseif (t_1 <= 5e-107) tmp = fma(-0.5, b, x); else tmp = fma(a, b, y); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = 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]}, If[LessEqual[t$95$1, -5e+292], N[(a * b + x), $MachinePrecision], If[LessEqual[t$95$1, 5e-107], N[(-0.5 * b + x), $MachinePrecision], N[(a * b + y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+292}:\\
\;\;\;\;\mathsf{fma}\left(a, b, x\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-107}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, b, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, b, y\right)\\
\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)) < -4.9999999999999996e292Initial program 100.0%
Taylor expanded in x around inf
Applied rewrites79.1%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f6479.1
Applied rewrites79.1%
Taylor expanded in a around inf
Applied rewrites74.1%
if -4.9999999999999996e292 < (+.f64 (-.f64 (+.f64 (+.f64 x y) z) (*.f64 z (log.f64 t))) (*.f64 (-.f64 a #s(literal 1/2 binary64)) b)) < 4.99999999999999971e-107Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites51.3%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f6451.3
Applied rewrites51.3%
Taylor expanded in a around 0
Applied rewrites38.1%
if 4.99999999999999971e-107 < (+.f64 (-.f64 (+.f64 (+.f64 x y) z) (*.f64 z (log.f64 t))) (*.f64 (-.f64 a #s(literal 1/2 binary64)) b)) Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites57.4%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f6457.4
Applied rewrites57.4%
Taylor expanded in y around inf
associate--l+57.9
+-commutative57.9
*-commutative57.9
associate--l+57.9
Applied rewrites57.9%
Taylor expanded in a around inf
Applied rewrites46.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (- (+ (+ x y) z) (* z (log t))) (* (- a 0.5) b))))
(if (<= t_1 -2e+304)
(* b a)
(if (<= t_1 -5e-155)
(fma -0.5 b x)
(if (<= t_1 2e+306) (fma -0.5 b y) (* b a))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (((x + y) + z) - (z * log(t))) + ((a - 0.5) * b);
double tmp;
if (t_1 <= -2e+304) {
tmp = b * a;
} else if (t_1 <= -5e-155) {
tmp = fma(-0.5, b, x);
} else if (t_1 <= 2e+306) {
tmp = fma(-0.5, b, y);
} else {
tmp = b * a;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(Float64(x + y) + z) - Float64(z * log(t))) + Float64(Float64(a - 0.5) * b)) tmp = 0.0 if (t_1 <= -2e+304) tmp = Float64(b * a); elseif (t_1 <= -5e-155) tmp = fma(-0.5, b, x); elseif (t_1 <= 2e+306) tmp = fma(-0.5, b, y); else tmp = Float64(b * a); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = 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]}, If[LessEqual[t$95$1, -2e+304], N[(b * a), $MachinePrecision], If[LessEqual[t$95$1, -5e-155], N[(-0.5 * b + x), $MachinePrecision], If[LessEqual[t$95$1, 2e+306], N[(-0.5 * b + y), $MachinePrecision], N[(b * a), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+304}:\\
\;\;\;\;b \cdot a\\
\mathbf{elif}\;t\_1 \leq -5 \cdot 10^{-155}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, b, x\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+306}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, b, y\right)\\
\mathbf{else}:\\
\;\;\;\;b \cdot a\\
\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)) < -1.9999999999999999e304 or 2.00000000000000003e306 < (+.f64 (-.f64 (+.f64 (+.f64 x y) z) (*.f64 z (log.f64 t))) (*.f64 (-.f64 a #s(literal 1/2 binary64)) b)) Initial program 100.0%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f6488.3
Applied rewrites88.3%
if -1.9999999999999999e304 < (+.f64 (-.f64 (+.f64 (+.f64 x y) z) (*.f64 z (log.f64 t))) (*.f64 (-.f64 a #s(literal 1/2 binary64)) b)) < -4.9999999999999999e-155Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites51.1%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f6451.1
Applied rewrites51.1%
Taylor expanded in a around 0
Applied rewrites38.1%
if -4.9999999999999999e-155 < (+.f64 (-.f64 (+.f64 (+.f64 x y) z) (*.f64 z (log.f64 t))) (*.f64 (-.f64 a #s(literal 1/2 binary64)) b)) < 2.00000000000000003e306Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites51.5%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f6451.5
Applied rewrites51.5%
Taylor expanded in y around inf
associate--l+51.8
+-commutative51.8
*-commutative51.8
associate--l+51.8
Applied rewrites51.8%
Taylor expanded in a around 0
Applied rewrites38.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (- (+ (+ x y) z) (* z (log t))) (* (- a 0.5) b))))
(if (<= t_1 -2e+304)
(* b a)
(if (<= t_1 5e-107) (fma -0.5 b x) (if (<= t_1 2e+306) y (* b a))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (((x + y) + z) - (z * log(t))) + ((a - 0.5) * b);
double tmp;
if (t_1 <= -2e+304) {
tmp = b * a;
} else if (t_1 <= 5e-107) {
tmp = fma(-0.5, b, x);
} else if (t_1 <= 2e+306) {
tmp = y;
} else {
tmp = b * a;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(Float64(x + y) + z) - Float64(z * log(t))) + Float64(Float64(a - 0.5) * b)) tmp = 0.0 if (t_1 <= -2e+304) tmp = Float64(b * a); elseif (t_1 <= 5e-107) tmp = fma(-0.5, b, x); elseif (t_1 <= 2e+306) tmp = y; else tmp = Float64(b * a); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = 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]}, If[LessEqual[t$95$1, -2e+304], N[(b * a), $MachinePrecision], If[LessEqual[t$95$1, 5e-107], N[(-0.5 * b + x), $MachinePrecision], If[LessEqual[t$95$1, 2e+306], y, N[(b * a), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+304}:\\
\;\;\;\;b \cdot a\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-107}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, b, x\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+306}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;b \cdot a\\
\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)) < -1.9999999999999999e304 or 2.00000000000000003e306 < (+.f64 (-.f64 (+.f64 (+.f64 x y) z) (*.f64 z (log.f64 t))) (*.f64 (-.f64 a #s(literal 1/2 binary64)) b)) Initial program 100.0%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f6488.3
Applied rewrites88.3%
if -1.9999999999999999e304 < (+.f64 (-.f64 (+.f64 (+.f64 x y) z) (*.f64 z (log.f64 t))) (*.f64 (-.f64 a #s(literal 1/2 binary64)) b)) < 4.99999999999999971e-107Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites51.2%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f6451.2
Applied rewrites51.2%
Taylor expanded in a around 0
Applied rewrites38.1%
if 4.99999999999999971e-107 < (+.f64 (-.f64 (+.f64 (+.f64 x y) z) (*.f64 z (log.f64 t))) (*.f64 (-.f64 a #s(literal 1/2 binary64)) b)) < 2.00000000000000003e306Initial program 99.9%
Taylor expanded in y around inf
Applied rewrites25.0%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (- a 0.5) b))) (if (<= t_1 -1.2e+195) (* b a) (if (<= t_1 2e+221) (+ y x) (* 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 <= -1.2e+195) {
tmp = b * a;
} else if (t_1 <= 2e+221) {
tmp = y + x;
} 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 <= (-1.2d+195)) then
tmp = b * a
else if (t_1 <= 2d+221) then
tmp = y + x
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 <= -1.2e+195) {
tmp = b * a;
} else if (t_1 <= 2e+221) {
tmp = y + x;
} 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 <= -1.2e+195: tmp = b * a elif t_1 <= 2e+221: tmp = y + x 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 <= -1.2e+195) tmp = Float64(b * a); elseif (t_1 <= 2e+221) tmp = Float64(y + x); 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 <= -1.2e+195) tmp = b * a; elseif (t_1 <= 2e+221) tmp = y + x; 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, -1.2e+195], N[(b * a), $MachinePrecision], If[LessEqual[t$95$1, 2e+221], N[(y + x), $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 -1.2 \cdot 10^{+195}:\\
\;\;\;\;b \cdot a\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+221}:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;b \cdot a\\
\end{array}
\end{array}
if (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < -1.2000000000000001e195 or 2.0000000000000001e221 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) Initial program 100.0%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f6466.0
Applied rewrites66.0%
if -1.2000000000000001e195 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < 2.0000000000000001e221Initial 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 rewrites56.2%
(FPCore (x y z t a b) :precision binary64 (if (<= (+ (- (+ (+ x y) z) (* z (log t))) (* (- a 0.5) b)) -5e-155) 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-155) {
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-155)) 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-155) {
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-155: 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-155) 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-155) 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-155], 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^{-155}:\\
\;\;\;\;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)) < -4.9999999999999999e-155Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites22.1%
if -4.9999999999999999e-155 < (+.f64 (-.f64 (+.f64 (+.f64 x y) z) (*.f64 z (log.f64 t))) (*.f64 (-.f64 a #s(literal 1/2 binary64)) b)) Initial program 99.9%
Taylor expanded in y around inf
Applied rewrites22.1%
(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.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 y around inf
Applied rewrites42.9%
(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.9%
Taylor expanded in x around inf
Applied rewrites21.9%
herbie shell --seed 2025115
(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)))