
(FPCore (x y z t a) :precision binary64 (- x (/ (- y z) (/ (+ (- t z) 1.0) a))))
double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / a));
}
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)
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
code = x - ((y - z) / (((t - z) + 1.0d0) / a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / a));
}
def code(x, y, z, t, a): return x - ((y - z) / (((t - z) + 1.0) / a))
function code(x, y, z, t, a) return Float64(x - Float64(Float64(y - z) / Float64(Float64(Float64(t - z) + 1.0) / a))) end
function tmp = code(x, y, z, t, a) tmp = x - ((y - z) / (((t - z) + 1.0) / a)); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(y - z), $MachinePrecision] / N[(N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y - z}{\frac{\left(t - z\right) + 1}{a}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (- x (/ (- y z) (/ (+ (- t z) 1.0) a))))
double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / a));
}
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)
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
code = x - ((y - z) / (((t - z) + 1.0d0) / a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / a));
}
def code(x, y, z, t, a): return x - ((y - z) / (((t - z) + 1.0) / a))
function code(x, y, z, t, a) return Float64(x - Float64(Float64(y - z) / Float64(Float64(Float64(t - z) + 1.0) / a))) end
function tmp = code(x, y, z, t, a) tmp = x - ((y - z) / (((t - z) + 1.0) / a)); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(y - z), $MachinePrecision] / N[(N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y - z}{\frac{\left(t - z\right) + 1}{a}}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (- t z) -1.0)))
(if (or (<= a -1e+35) (not (<= a 1.5e+21)))
(- x (/ (- y z) (/ t_1 a)))
(- x (/ (* (- y z) a) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t - z) - -1.0;
double tmp;
if ((a <= -1e+35) || !(a <= 1.5e+21)) {
tmp = x - ((y - z) / (t_1 / a));
} else {
tmp = x - (((y - z) * a) / 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)
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) :: t_1
real(8) :: tmp
t_1 = (t - z) - (-1.0d0)
if ((a <= (-1d+35)) .or. (.not. (a <= 1.5d+21))) then
tmp = x - ((y - z) / (t_1 / a))
else
tmp = x - (((y - z) * a) / t_1)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (t - z) - -1.0;
double tmp;
if ((a <= -1e+35) || !(a <= 1.5e+21)) {
tmp = x - ((y - z) / (t_1 / a));
} else {
tmp = x - (((y - z) * a) / t_1);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (t - z) - -1.0 tmp = 0 if (a <= -1e+35) or not (a <= 1.5e+21): tmp = x - ((y - z) / (t_1 / a)) else: tmp = x - (((y - z) * a) / t_1) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(t - z) - -1.0) tmp = 0.0 if ((a <= -1e+35) || !(a <= 1.5e+21)) tmp = Float64(x - Float64(Float64(y - z) / Float64(t_1 / a))); else tmp = Float64(x - Float64(Float64(Float64(y - z) * a) / t_1)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (t - z) - -1.0; tmp = 0.0; if ((a <= -1e+35) || ~((a <= 1.5e+21))) tmp = x - ((y - z) / (t_1 / a)); else tmp = x - (((y - z) * a) / t_1); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t - z), $MachinePrecision] - -1.0), $MachinePrecision]}, If[Or[LessEqual[a, -1e+35], N[Not[LessEqual[a, 1.5e+21]], $MachinePrecision]], N[(x - N[(N[(y - z), $MachinePrecision] / N[(t$95$1 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(N[(y - z), $MachinePrecision] * a), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t - z\right) - -1\\
\mathbf{if}\;a \leq -1 \cdot 10^{+35} \lor \neg \left(a \leq 1.5 \cdot 10^{+21}\right):\\
\;\;\;\;x - \frac{y - z}{\frac{t\_1}{a}}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{\left(y - z\right) \cdot a}{t\_1}\\
\end{array}
\end{array}
if a < -9.9999999999999997e34 or 1.5e21 < a Initial program 99.9%
if -9.9999999999999997e34 < a < 1.5e21Initial program 89.1%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6499.9
lift-+.f64N/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6499.9
Applied rewrites99.9%
Final simplification99.9%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (- y z) (/ (- (- t z) -1.0) a)))) (if (or (<= t_1 -2e+276) (not (<= t_1 2e+245))) (* (- y) a) (- x a))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y - z) / (((t - z) - -1.0) / a);
double tmp;
if ((t_1 <= -2e+276) || !(t_1 <= 2e+245)) {
tmp = -y * a;
} else {
tmp = x - 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)
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) :: t_1
real(8) :: tmp
t_1 = (y - z) / (((t - z) - (-1.0d0)) / a)
if ((t_1 <= (-2d+276)) .or. (.not. (t_1 <= 2d+245))) then
tmp = -y * a
else
tmp = x - a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y - z) / (((t - z) - -1.0) / a);
double tmp;
if ((t_1 <= -2e+276) || !(t_1 <= 2e+245)) {
tmp = -y * a;
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y - z) / (((t - z) - -1.0) / a) tmp = 0 if (t_1 <= -2e+276) or not (t_1 <= 2e+245): tmp = -y * a else: tmp = x - a return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y - z) / Float64(Float64(Float64(t - z) - -1.0) / a)) tmp = 0.0 if ((t_1 <= -2e+276) || !(t_1 <= 2e+245)) tmp = Float64(Float64(-y) * a); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y - z) / (((t - z) - -1.0) / a); tmp = 0.0; if ((t_1 <= -2e+276) || ~((t_1 <= 2e+245))) tmp = -y * a; else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] / N[(N[(N[(t - z), $MachinePrecision] - -1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -2e+276], N[Not[LessEqual[t$95$1, 2e+245]], $MachinePrecision]], N[((-y) * a), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y - z}{\frac{\left(t - z\right) - -1}{a}}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+276} \lor \neg \left(t\_1 \leq 2 \cdot 10^{+245}\right):\\
\;\;\;\;\left(-y\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) < -2.0000000000000001e276 or 2.00000000000000009e245 < (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) Initial program 99.8%
Taylor expanded in x around 0
mul-1-negN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6499.9
Applied rewrites99.9%
Taylor expanded in z around 0
Applied rewrites69.4%
Taylor expanded in t around inf
Applied rewrites53.5%
Taylor expanded in t around 0
Applied rewrites56.1%
if -2.0000000000000001e276 < (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) < 2.00000000000000009e245Initial program 93.1%
Taylor expanded in z around inf
lower--.f6470.3
Applied rewrites70.3%
Final simplification68.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (+ 1.0 t) z)))
(if (<= z -5e+63)
(fma (/ z t_1) a x)
(if (<= z 8.2e+26)
(- x (/ (fma a y (* (- a) z)) t_1))
(fma (/ (- z y) (- 1.0 z)) a x)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (1.0 + t) - z;
double tmp;
if (z <= -5e+63) {
tmp = fma((z / t_1), a, x);
} else if (z <= 8.2e+26) {
tmp = x - (fma(a, y, (-a * z)) / t_1);
} else {
tmp = fma(((z - y) / (1.0 - z)), a, x);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(1.0 + t) - z) tmp = 0.0 if (z <= -5e+63) tmp = fma(Float64(z / t_1), a, x); elseif (z <= 8.2e+26) tmp = Float64(x - Float64(fma(a, y, Float64(Float64(-a) * z)) / t_1)); else tmp = fma(Float64(Float64(z - y) / Float64(1.0 - z)), a, x); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(1.0 + t), $MachinePrecision] - z), $MachinePrecision]}, If[LessEqual[z, -5e+63], N[(N[(z / t$95$1), $MachinePrecision] * a + x), $MachinePrecision], If[LessEqual[z, 8.2e+26], N[(x - N[(N[(a * y + N[((-a) * z), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z - y), $MachinePrecision] / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(1 + t\right) - z\\
\mathbf{if}\;z \leq -5 \cdot 10^{+63}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t\_1}, a, x\right)\\
\mathbf{elif}\;z \leq 8.2 \cdot 10^{+26}:\\
\;\;\;\;x - \frac{\mathsf{fma}\left(a, y, \left(-a\right) \cdot z\right)}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{1 - z}, a, x\right)\\
\end{array}
\end{array}
if z < -5.00000000000000011e63Initial program 85.6%
Taylor expanded in y around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
metadata-evalN/A
*-lft-identityN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6494.7
Applied rewrites94.7%
if -5.00000000000000011e63 < z < 8.19999999999999967e26Initial program 98.6%
Taylor expanded in y around 0
+-commutativeN/A
associate-*r/N/A
div-add-revN/A
lower-/.f64N/A
lower-fma.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower--.f64N/A
lower-+.f6497.3
Applied rewrites97.3%
if 8.19999999999999967e26 < z Initial program 90.2%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in t around 0
Applied rewrites92.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- z y) t) a x)))
(if (<= z -3.6e+74)
(- x a)
(if (<= z -3e-135)
t_1
(if (<= z 1.8e-92) (fma (- y) a x) (if (<= z 4.1e+54) t_1 (- x a)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((z - y) / t), a, x);
double tmp;
if (z <= -3.6e+74) {
tmp = x - a;
} else if (z <= -3e-135) {
tmp = t_1;
} else if (z <= 1.8e-92) {
tmp = fma(-y, a, x);
} else if (z <= 4.1e+54) {
tmp = t_1;
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(z - y) / t), a, x) tmp = 0.0 if (z <= -3.6e+74) tmp = Float64(x - a); elseif (z <= -3e-135) tmp = t_1; elseif (z <= 1.8e-92) tmp = fma(Float64(-y), a, x); elseif (z <= 4.1e+54) tmp = t_1; else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(z - y), $MachinePrecision] / t), $MachinePrecision] * a + x), $MachinePrecision]}, If[LessEqual[z, -3.6e+74], N[(x - a), $MachinePrecision], If[LessEqual[z, -3e-135], t$95$1, If[LessEqual[z, 1.8e-92], N[((-y) * a + x), $MachinePrecision], If[LessEqual[z, 4.1e+54], t$95$1, N[(x - a), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{z - y}{t}, a, x\right)\\
\mathbf{if}\;z \leq -3.6 \cdot 10^{+74}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq -3 \cdot 10^{-135}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{-92}:\\
\;\;\;\;\mathsf{fma}\left(-y, a, x\right)\\
\mathbf{elif}\;z \leq 4.1 \cdot 10^{+54}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -3.59999999999999988e74 or 4.09999999999999967e54 < z Initial program 87.1%
Taylor expanded in z around inf
lower--.f6482.8
Applied rewrites82.8%
if -3.59999999999999988e74 < z < -3.00000000000000012e-135 or 1.80000000000000008e-92 < z < 4.09999999999999967e54Initial program 96.8%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6499.8
Applied rewrites99.8%
Taylor expanded in t around inf
Applied rewrites83.8%
if -3.00000000000000012e-135 < z < 1.80000000000000008e-92Initial program 99.9%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6498.9
Applied rewrites98.9%
Taylor expanded in t around 0
Applied rewrites82.1%
Taylor expanded in z around 0
Applied rewrites82.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- x (/ (* a y) t))))
(if (<= z -3.6e+74)
(- x a)
(if (<= z -3e-135)
t_1
(if (<= z 1.7e-92) (fma (- y) a x) (if (<= z 1.35e+55) t_1 (- x a)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x - ((a * y) / t);
double tmp;
if (z <= -3.6e+74) {
tmp = x - a;
} else if (z <= -3e-135) {
tmp = t_1;
} else if (z <= 1.7e-92) {
tmp = fma(-y, a, x);
} else if (z <= 1.35e+55) {
tmp = t_1;
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x - Float64(Float64(a * y) / t)) tmp = 0.0 if (z <= -3.6e+74) tmp = Float64(x - a); elseif (z <= -3e-135) tmp = t_1; elseif (z <= 1.7e-92) tmp = fma(Float64(-y), a, x); elseif (z <= 1.35e+55) tmp = t_1; else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x - N[(N[(a * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.6e+74], N[(x - a), $MachinePrecision], If[LessEqual[z, -3e-135], t$95$1, If[LessEqual[z, 1.7e-92], N[((-y) * a + x), $MachinePrecision], If[LessEqual[z, 1.35e+55], t$95$1, N[(x - a), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - \frac{a \cdot y}{t}\\
\mathbf{if}\;z \leq -3.6 \cdot 10^{+74}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq -3 \cdot 10^{-135}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{-92}:\\
\;\;\;\;\mathsf{fma}\left(-y, a, x\right)\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{+55}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -3.59999999999999988e74 or 1.34999999999999988e55 < z Initial program 87.1%
Taylor expanded in z around inf
lower--.f6482.8
Applied rewrites82.8%
if -3.59999999999999988e74 < z < -3.00000000000000012e-135 or 1.7000000000000001e-92 < z < 1.34999999999999988e55Initial program 96.8%
Taylor expanded in t around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6482.4
Applied rewrites82.4%
Taylor expanded in y around inf
Applied rewrites76.6%
if -3.00000000000000012e-135 < z < 1.7000000000000001e-92Initial program 99.9%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6498.9
Applied rewrites98.9%
Taylor expanded in t around 0
Applied rewrites82.1%
Taylor expanded in z around 0
Applied rewrites82.1%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (- (+ 1.0 t) z))) (fma (- (/ z t_1) (/ y t_1)) a x)))
double code(double x, double y, double z, double t, double a) {
double t_1 = (1.0 + t) - z;
return fma(((z / t_1) - (y / t_1)), a, x);
}
function code(x, y, z, t, a) t_1 = Float64(Float64(1.0 + t) - z) return fma(Float64(Float64(z / t_1) - Float64(y / t_1)), a, x) end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(1.0 + t), $MachinePrecision] - z), $MachinePrecision]}, N[(N[(N[(z / t$95$1), $MachinePrecision] - N[(y / t$95$1), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(1 + t\right) - z\\
\mathsf{fma}\left(\frac{z}{t\_1} - \frac{y}{t\_1}, a, x\right)
\end{array}
\end{array}
Initial program 93.8%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6499.5
Applied rewrites99.5%
(FPCore (x y z t a)
:precision binary64
(if (<= z -3.6e+74)
(- x a)
(if (<= z 0.039)
(fma (- a) (/ y (+ 1.0 t)) x)
(if (<= z 9.3e+210) (- x (* a (/ y (- 1.0 z)))) (- x a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.6e+74) {
tmp = x - a;
} else if (z <= 0.039) {
tmp = fma(-a, (y / (1.0 + t)), x);
} else if (z <= 9.3e+210) {
tmp = x - (a * (y / (1.0 - z)));
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.6e+74) tmp = Float64(x - a); elseif (z <= 0.039) tmp = fma(Float64(-a), Float64(y / Float64(1.0 + t)), x); elseif (z <= 9.3e+210) tmp = Float64(x - Float64(a * Float64(y / Float64(1.0 - z)))); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.6e+74], N[(x - a), $MachinePrecision], If[LessEqual[z, 0.039], N[((-a) * N[(y / N[(1.0 + t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 9.3e+210], N[(x - N[(a * N[(y / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.6 \cdot 10^{+74}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 0.039:\\
\;\;\;\;\mathsf{fma}\left(-a, \frac{y}{1 + t}, x\right)\\
\mathbf{elif}\;z \leq 9.3 \cdot 10^{+210}:\\
\;\;\;\;x - a \cdot \frac{y}{1 - z}\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -3.59999999999999988e74 or 9.2999999999999998e210 < z Initial program 84.1%
Taylor expanded in z around inf
lower--.f6487.7
Applied rewrites87.7%
if -3.59999999999999988e74 < z < 0.0389999999999999999Initial program 98.6%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6499.2
Applied rewrites99.2%
Taylor expanded in z around 0
associate-/l*N/A
fp-cancel-sub-sign-invN/A
distribute-lft-neg-inN/A
associate-/l*N/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower-+.f6493.0
Applied rewrites93.0%
if 0.0389999999999999999 < z < 9.2999999999999998e210Initial program 95.4%
Taylor expanded in t around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6485.7
Applied rewrites85.7%
Taylor expanded in y around inf
Applied rewrites81.3%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.45e+64)
(fma (/ z (- (+ 1.0 t) z)) a x)
(if (<= z 9.8e+26)
(- x (/ (* (- y z) a) (- (- t z) -1.0)))
(fma (/ (- z y) (- 1.0 z)) a x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.45e+64) {
tmp = fma((z / ((1.0 + t) - z)), a, x);
} else if (z <= 9.8e+26) {
tmp = x - (((y - z) * a) / ((t - z) - -1.0));
} else {
tmp = fma(((z - y) / (1.0 - z)), a, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.45e+64) tmp = fma(Float64(z / Float64(Float64(1.0 + t) - z)), a, x); elseif (z <= 9.8e+26) tmp = Float64(x - Float64(Float64(Float64(y - z) * a) / Float64(Float64(t - z) - -1.0))); else tmp = fma(Float64(Float64(z - y) / Float64(1.0 - z)), a, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.45e+64], N[(N[(z / N[(N[(1.0 + t), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], If[LessEqual[z, 9.8e+26], N[(x - N[(N[(N[(y - z), $MachinePrecision] * a), $MachinePrecision] / N[(N[(t - z), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z - y), $MachinePrecision] / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.45 \cdot 10^{+64}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{\left(1 + t\right) - z}, a, x\right)\\
\mathbf{elif}\;z \leq 9.8 \cdot 10^{+26}:\\
\;\;\;\;x - \frac{\left(y - z\right) \cdot a}{\left(t - z\right) - -1}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{1 - z}, a, x\right)\\
\end{array}
\end{array}
if z < -1.44999999999999997e64Initial program 85.6%
Taylor expanded in y around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
metadata-evalN/A
*-lft-identityN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6494.7
Applied rewrites94.7%
if -1.44999999999999997e64 < z < 9.79999999999999947e26Initial program 98.6%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6497.3
lift-+.f64N/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6497.3
Applied rewrites97.3%
if 9.79999999999999947e26 < z Initial program 90.2%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in t around 0
Applied rewrites92.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (+ 1.0 t) z)))
(if (<= z -1.15e+26)
(fma (/ z t_1) a x)
(if (<= z 4.4e+154)
(- x (* (/ y t_1) a))
(fma (/ (- z y) (- 1.0 z)) a x)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (1.0 + t) - z;
double tmp;
if (z <= -1.15e+26) {
tmp = fma((z / t_1), a, x);
} else if (z <= 4.4e+154) {
tmp = x - ((y / t_1) * a);
} else {
tmp = fma(((z - y) / (1.0 - z)), a, x);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(1.0 + t) - z) tmp = 0.0 if (z <= -1.15e+26) tmp = fma(Float64(z / t_1), a, x); elseif (z <= 4.4e+154) tmp = Float64(x - Float64(Float64(y / t_1) * a)); else tmp = fma(Float64(Float64(z - y) / Float64(1.0 - z)), a, x); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(1.0 + t), $MachinePrecision] - z), $MachinePrecision]}, If[LessEqual[z, -1.15e+26], N[(N[(z / t$95$1), $MachinePrecision] * a + x), $MachinePrecision], If[LessEqual[z, 4.4e+154], N[(x - N[(N[(y / t$95$1), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z - y), $MachinePrecision] / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(1 + t\right) - z\\
\mathbf{if}\;z \leq -1.15 \cdot 10^{+26}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t\_1}, a, x\right)\\
\mathbf{elif}\;z \leq 4.4 \cdot 10^{+154}:\\
\;\;\;\;x - \frac{y}{t\_1} \cdot a\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{1 - z}, a, x\right)\\
\end{array}
\end{array}
if z < -1.15e26Initial program 87.7%
Taylor expanded in y around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
metadata-evalN/A
*-lft-identityN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6493.9
Applied rewrites93.9%
if -1.15e26 < z < 4.4000000000000002e154Initial program 98.0%
Taylor expanded in y around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6495.4
Applied rewrites95.4%
if 4.4000000000000002e154 < z Initial program 88.2%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in t around 0
Applied rewrites97.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -5.8e+68) (not (<= z 6.9e+25))) (fma (/ (- z y) (- 1.0 z)) a x) (fma (- a) (/ y (+ 1.0 t)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -5.8e+68) || !(z <= 6.9e+25)) {
tmp = fma(((z - y) / (1.0 - z)), a, x);
} else {
tmp = fma(-a, (y / (1.0 + t)), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -5.8e+68) || !(z <= 6.9e+25)) tmp = fma(Float64(Float64(z - y) / Float64(1.0 - z)), a, x); else tmp = fma(Float64(-a), Float64(y / Float64(1.0 + t)), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -5.8e+68], N[Not[LessEqual[z, 6.9e+25]], $MachinePrecision]], N[(N[(N[(z - y), $MachinePrecision] / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], N[((-a) * N[(y / N[(1.0 + t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{+68} \lor \neg \left(z \leq 6.9 \cdot 10^{+25}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{1 - z}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-a, \frac{y}{1 + t}, x\right)\\
\end{array}
\end{array}
if z < -5.80000000000000023e68 or 6.8999999999999998e25 < z Initial program 87.6%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6499.9
Applied rewrites99.9%
Taylor expanded in t around 0
Applied rewrites90.2%
if -5.80000000000000023e68 < z < 6.8999999999999998e25Initial program 98.6%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6499.2
Applied rewrites99.2%
Taylor expanded in z around 0
associate-/l*N/A
fp-cancel-sub-sign-invN/A
distribute-lft-neg-inN/A
associate-/l*N/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower-+.f6492.9
Applied rewrites92.9%
Final simplification91.7%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.1e+26)
(fma (/ z (- (+ 1.0 t) z)) a x)
(if (<= z 6.9e+25)
(fma (- a) (/ y (+ 1.0 t)) x)
(fma (/ (- z y) (- 1.0 z)) a x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.1e+26) {
tmp = fma((z / ((1.0 + t) - z)), a, x);
} else if (z <= 6.9e+25) {
tmp = fma(-a, (y / (1.0 + t)), x);
} else {
tmp = fma(((z - y) / (1.0 - z)), a, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.1e+26) tmp = fma(Float64(z / Float64(Float64(1.0 + t) - z)), a, x); elseif (z <= 6.9e+25) tmp = fma(Float64(-a), Float64(y / Float64(1.0 + t)), x); else tmp = fma(Float64(Float64(z - y) / Float64(1.0 - z)), a, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.1e+26], N[(N[(z / N[(N[(1.0 + t), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], If[LessEqual[z, 6.9e+25], N[((-a) * N[(y / N[(1.0 + t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(z - y), $MachinePrecision] / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.1 \cdot 10^{+26}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{\left(1 + t\right) - z}, a, x\right)\\
\mathbf{elif}\;z \leq 6.9 \cdot 10^{+25}:\\
\;\;\;\;\mathsf{fma}\left(-a, \frac{y}{1 + t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{1 - z}, a, x\right)\\
\end{array}
\end{array}
if z < -1.10000000000000004e26Initial program 87.7%
Taylor expanded in y around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
metadata-evalN/A
*-lft-identityN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6493.9
Applied rewrites93.9%
if -1.10000000000000004e26 < z < 6.8999999999999998e25Initial program 98.5%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6499.2
Applied rewrites99.2%
Taylor expanded in z around 0
associate-/l*N/A
fp-cancel-sub-sign-invN/A
distribute-lft-neg-inN/A
associate-/l*N/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower-+.f6496.1
Applied rewrites96.1%
if 6.8999999999999998e25 < z Initial program 90.2%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in t around 0
Applied rewrites92.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -3.6e+74) (not (<= z 4.3e+73))) (- x a) (fma (- a) (/ y (+ 1.0 t)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.6e+74) || !(z <= 4.3e+73)) {
tmp = x - a;
} else {
tmp = fma(-a, (y / (1.0 + t)), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -3.6e+74) || !(z <= 4.3e+73)) tmp = Float64(x - a); else tmp = fma(Float64(-a), Float64(y / Float64(1.0 + t)), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -3.6e+74], N[Not[LessEqual[z, 4.3e+73]], $MachinePrecision]], N[(x - a), $MachinePrecision], N[((-a) * N[(y / N[(1.0 + t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.6 \cdot 10^{+74} \lor \neg \left(z \leq 4.3 \cdot 10^{+73}\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-a, \frac{y}{1 + t}, x\right)\\
\end{array}
\end{array}
if z < -3.59999999999999988e74 or 4.30000000000000013e73 < z Initial program 86.9%
Taylor expanded in z around inf
lower--.f6483.3
Applied rewrites83.3%
if -3.59999999999999988e74 < z < 4.30000000000000013e73Initial program 98.7%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6499.3
Applied rewrites99.3%
Taylor expanded in z around 0
associate-/l*N/A
fp-cancel-sub-sign-invN/A
distribute-lft-neg-inN/A
associate-/l*N/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower-+.f6491.2
Applied rewrites91.2%
Final simplification88.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -9.5e+25) (not (<= z 2.2e-7))) (- x a) (fma (fma (- 1.0 y) z (- y)) a x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -9.5e+25) || !(z <= 2.2e-7)) {
tmp = x - a;
} else {
tmp = fma(fma((1.0 - y), z, -y), a, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -9.5e+25) || !(z <= 2.2e-7)) tmp = Float64(x - a); else tmp = fma(fma(Float64(1.0 - y), z, Float64(-y)), a, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -9.5e+25], N[Not[LessEqual[z, 2.2e-7]], $MachinePrecision]], N[(x - a), $MachinePrecision], N[(N[(N[(1.0 - y), $MachinePrecision] * z + (-y)), $MachinePrecision] * a + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.5 \cdot 10^{+25} \lor \neg \left(z \leq 2.2 \cdot 10^{-7}\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(1 - y, z, -y\right), a, x\right)\\
\end{array}
\end{array}
if z < -9.5000000000000005e25 or 2.2000000000000001e-7 < z Initial program 88.5%
Taylor expanded in z around inf
lower--.f6476.5
Applied rewrites76.5%
if -9.5000000000000005e25 < z < 2.2000000000000001e-7Initial program 99.2%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6499.2
Applied rewrites99.2%
Taylor expanded in t around 0
Applied rewrites76.4%
Taylor expanded in z around 0
Applied rewrites76.2%
Final simplification76.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -3.9e+41) (not (<= z 4.6e+25))) (- x a) (fma (- y) a x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.9e+41) || !(z <= 4.6e+25)) {
tmp = x - a;
} else {
tmp = fma(-y, a, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -3.9e+41) || !(z <= 4.6e+25)) tmp = Float64(x - a); else tmp = fma(Float64(-y), a, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -3.9e+41], N[Not[LessEqual[z, 4.6e+25]], $MachinePrecision]], N[(x - a), $MachinePrecision], N[((-y) * a + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.9 \cdot 10^{+41} \lor \neg \left(z \leq 4.6 \cdot 10^{+25}\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-y, a, x\right)\\
\end{array}
\end{array}
if z < -3.8999999999999997e41 or 4.5999999999999996e25 < z Initial program 88.4%
Taylor expanded in z around inf
lower--.f6478.0
Applied rewrites78.0%
if -3.8999999999999997e41 < z < 4.5999999999999996e25Initial program 98.5%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6499.2
Applied rewrites99.2%
Taylor expanded in t around 0
Applied rewrites75.1%
Taylor expanded in z around 0
Applied rewrites74.8%
Final simplification76.2%
(FPCore (x y z t a) :precision binary64 (- x a))
double code(double x, double y, double z, double t, double a) {
return x - a;
}
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)
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
code = x - a
end function
public static double code(double x, double y, double z, double t, double a) {
return x - a;
}
def code(x, y, z, t, a): return x - a
function code(x, y, z, t, a) return Float64(x - a) end
function tmp = code(x, y, z, t, a) tmp = x - a; end
code[x_, y_, z_, t_, a_] := N[(x - a), $MachinePrecision]
\begin{array}{l}
\\
x - a
\end{array}
Initial program 93.8%
Taylor expanded in z around inf
lower--.f6463.4
Applied rewrites63.4%
(FPCore (x y z t a) :precision binary64 (- a))
double code(double x, double y, double z, double t, double a) {
return -a;
}
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)
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
code = -a
end function
public static double code(double x, double y, double z, double t, double a) {
return -a;
}
def code(x, y, z, t, a): return -a
function code(x, y, z, t, a) return Float64(-a) end
function tmp = code(x, y, z, t, a) tmp = -a; end
code[x_, y_, z_, t_, a_] := (-a)
\begin{array}{l}
\\
-a
\end{array}
Initial program 93.8%
Taylor expanded in z around inf
lower--.f6463.4
Applied rewrites63.4%
Taylor expanded in x around 0
Applied rewrites18.6%
(FPCore (x y z t a) :precision binary64 (- x (* (/ (- y z) (+ (- t z) 1.0)) a)))
double code(double x, double y, double z, double t, double a) {
return x - (((y - z) / ((t - z) + 1.0)) * a);
}
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)
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
code = x - (((y - z) / ((t - z) + 1.0d0)) * a)
end function
public static double code(double x, double y, double z, double t, double a) {
return x - (((y - z) / ((t - z) + 1.0)) * a);
}
def code(x, y, z, t, a): return x - (((y - z) / ((t - z) + 1.0)) * a)
function code(x, y, z, t, a) return Float64(x - Float64(Float64(Float64(y - z) / Float64(Float64(t - z) + 1.0)) * a)) end
function tmp = code(x, y, z, t, a) tmp = x - (((y - z) / ((t - z) + 1.0)) * a); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(N[(y - z), $MachinePrecision] / N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y - z}{\left(t - z\right) + 1} \cdot a
\end{array}
herbie shell --seed 2025016
(FPCore (x y z t a)
:name "Graphics.Rendering.Chart.SparkLine:renderSparkLine from Chart-1.5.3"
:precision binary64
:alt
(! :herbie-platform default (- x (* (/ (- y z) (+ (- t z) 1)) a)))
(- x (/ (- y z) (/ (+ (- t z) 1.0) a))))