
(FPCore (x y z t a) :precision binary64 (+ x (* (- y z) (/ (- t x) (- a z)))))
double code(double x, double y, double z, double t, double a) {
return x + ((y - z) * ((t - x) / (a - z)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, 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 - x) / (a - z)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y - z) * ((t - x) / (a - z)));
}
def code(x, y, z, t, a): return x + ((y - z) * ((t - x) / (a - z)))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y - z) * ((t - x) / (a - z))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (* (- y z) (/ (- t x) (- a z)))))
double code(double x, double y, double z, double t, double a) {
return x + ((y - z) * ((t - x) / (a - z)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, 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 - x) / (a - z)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y - z) * ((t - x) / (a - z)));
}
def code(x, y, z, t, a): return x + ((y - z) * ((t - x) / (a - z)))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y - z) * ((t - x) / (a - z))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* (- y z) (/ (- t x) (- a z))))))
(if (or (<= t_1 -5e-293) (not (<= t_1 0.0)))
(fma (- t x) (/ (- y z) (- a z)) x)
(- t (* (/ (- t x) z) (- y a))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if ((t_1 <= -5e-293) || !(t_1 <= 0.0)) {
tmp = fma((t - x), ((y - z) / (a - z)), x);
} else {
tmp = t - (((t - x) / z) * (y - a));
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) tmp = 0.0 if ((t_1 <= -5e-293) || !(t_1 <= 0.0)) tmp = fma(Float64(t - x), Float64(Float64(y - z) / Float64(a - z)), x); else tmp = Float64(t - Float64(Float64(Float64(t - x) / z) * Float64(y - a))); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -5e-293], N[Not[LessEqual[t$95$1, 0.0]], $MachinePrecision]], N[(N[(t - x), $MachinePrecision] * N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(t - N[(N[(N[(t - x), $MachinePrecision] / z), $MachinePrecision] * N[(y - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{-293} \lor \neg \left(t\_1 \leq 0\right):\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y - z}{a - z}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t - \frac{t - x}{z} \cdot \left(y - a\right)\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -5.0000000000000003e-293 or 0.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 86.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6495.3
Applied rewrites95.3%
if -5.0000000000000003e-293 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 0.0Initial program 3.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f646.4
Applied rewrites6.4%
Taylor expanded in z around inf
Applied rewrites99.7%
Final simplification95.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (- y z) (/ t (- a z)))))
(if (<= z -2.5e+165)
(* (- t) (/ z (- a z)))
(if (<= z -0.0033)
t_1
(if (<= z 4.6e-51)
(fma (- t x) (/ y a) x)
(if (<= z 2e+134) t_1 (fma t 1.0 x)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y - z) * (t / (a - z));
double tmp;
if (z <= -2.5e+165) {
tmp = -t * (z / (a - z));
} else if (z <= -0.0033) {
tmp = t_1;
} else if (z <= 4.6e-51) {
tmp = fma((t - x), (y / a), x);
} else if (z <= 2e+134) {
tmp = t_1;
} else {
tmp = fma(t, 1.0, x);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(y - z) * Float64(t / Float64(a - z))) tmp = 0.0 if (z <= -2.5e+165) tmp = Float64(Float64(-t) * Float64(z / Float64(a - z))); elseif (z <= -0.0033) tmp = t_1; elseif (z <= 4.6e-51) tmp = fma(Float64(t - x), Float64(y / a), x); elseif (z <= 2e+134) tmp = t_1; else tmp = fma(t, 1.0, x); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.5e+165], N[((-t) * N[(z / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -0.0033], t$95$1, If[LessEqual[z, 4.6e-51], N[(N[(t - x), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 2e+134], t$95$1, N[(t * 1.0 + x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y - z\right) \cdot \frac{t}{a - z}\\
\mathbf{if}\;z \leq -2.5 \cdot 10^{+165}:\\
\;\;\;\;\left(-t\right) \cdot \frac{z}{a - z}\\
\mathbf{elif}\;z \leq -0.0033:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4.6 \cdot 10^{-51}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y}{a}, x\right)\\
\mathbf{elif}\;z \leq 2 \cdot 10^{+134}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t, 1, x\right)\\
\end{array}
\end{array}
if z < -2.49999999999999985e165Initial program 49.3%
Taylor expanded in x around 0
Applied rewrites57.4%
Taylor expanded in y around 0
Applied rewrites74.8%
if -2.49999999999999985e165 < z < -0.0033 or 4.60000000000000004e-51 < z < 1.99999999999999984e134Initial program 78.4%
Taylor expanded in x around 0
Applied rewrites63.3%
if -0.0033 < z < 4.60000000000000004e-51Initial program 88.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6498.5
Applied rewrites98.5%
Taylor expanded in z around 0
Applied rewrites82.7%
if 1.99999999999999984e134 < z Initial program 64.1%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6473.7
Applied rewrites73.7%
Taylor expanded in x around 0
Applied rewrites63.0%
Taylor expanded in z around inf
Applied rewrites54.1%
Final simplification71.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (fma -1.0 t x) (/ (- y a) z) t)))
(if (<= z -9.5e+36)
t_1
(if (<= z -1.05e-88)
(fma t (/ (- y z) (- a z)) x)
(if (<= z 8.2e-51) (fma (- t x) (/ (- y z) a) x) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(fma(-1.0, t, x), ((y - a) / z), t);
double tmp;
if (z <= -9.5e+36) {
tmp = t_1;
} else if (z <= -1.05e-88) {
tmp = fma(t, ((y - z) / (a - z)), x);
} else if (z <= 8.2e-51) {
tmp = fma((t - x), ((y - z) / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(fma(-1.0, t, x), Float64(Float64(y - a) / z), t) tmp = 0.0 if (z <= -9.5e+36) tmp = t_1; elseif (z <= -1.05e-88) tmp = fma(t, Float64(Float64(y - z) / Float64(a - z)), x); elseif (z <= 8.2e-51) tmp = fma(Float64(t - x), Float64(Float64(y - z) / a), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(-1.0 * t + x), $MachinePrecision] * N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] + t), $MachinePrecision]}, If[LessEqual[z, -9.5e+36], t$95$1, If[LessEqual[z, -1.05e-88], N[(t * N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 8.2e-51], N[(N[(t - x), $MachinePrecision] * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\mathsf{fma}\left(-1, t, x\right), \frac{y - a}{z}, t\right)\\
\mathbf{if}\;z \leq -9.5 \cdot 10^{+36}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.05 \cdot 10^{-88}:\\
\;\;\;\;\mathsf{fma}\left(t, \frac{y - z}{a - z}, x\right)\\
\mathbf{elif}\;z \leq 8.2 \cdot 10^{-51}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y - z}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -9.49999999999999974e36 or 8.19999999999999947e-51 < z Initial program 66.6%
Taylor expanded in z around inf
Applied rewrites81.1%
if -9.49999999999999974e36 < z < -1.05e-88Initial program 84.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6494.5
Applied rewrites94.5%
Taylor expanded in x around 0
Applied rewrites84.5%
if -1.05e-88 < z < 8.19999999999999947e-51Initial program 90.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6499.3
Applied rewrites99.3%
Taylor expanded in z around 0
Applied rewrites90.8%
Final simplification84.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- t (* (/ (- t x) z) (- y a)))))
(if (<= z -9.5e+36)
t_1
(if (<= z -1.05e-88)
(fma t (/ (- y z) (- a z)) x)
(if (<= z 8.2e-51) (fma (- t x) (/ (- y z) a) x) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t - (((t - x) / z) * (y - a));
double tmp;
if (z <= -9.5e+36) {
tmp = t_1;
} else if (z <= -1.05e-88) {
tmp = fma(t, ((y - z) / (a - z)), x);
} else if (z <= 8.2e-51) {
tmp = fma((t - x), ((y - z) / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(t - Float64(Float64(Float64(t - x) / z) * Float64(y - a))) tmp = 0.0 if (z <= -9.5e+36) tmp = t_1; elseif (z <= -1.05e-88) tmp = fma(t, Float64(Float64(y - z) / Float64(a - z)), x); elseif (z <= 8.2e-51) tmp = fma(Float64(t - x), Float64(Float64(y - z) / a), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t - N[(N[(N[(t - x), $MachinePrecision] / z), $MachinePrecision] * N[(y - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -9.5e+36], t$95$1, If[LessEqual[z, -1.05e-88], N[(t * N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 8.2e-51], N[(N[(t - x), $MachinePrecision] * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t - \frac{t - x}{z} \cdot \left(y - a\right)\\
\mathbf{if}\;z \leq -9.5 \cdot 10^{+36}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.05 \cdot 10^{-88}:\\
\;\;\;\;\mathsf{fma}\left(t, \frac{y - z}{a - z}, x\right)\\
\mathbf{elif}\;z \leq 8.2 \cdot 10^{-51}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y - z}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -9.49999999999999974e36 or 8.19999999999999947e-51 < z Initial program 66.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6473.9
Applied rewrites73.9%
Taylor expanded in z around inf
Applied rewrites79.1%
if -9.49999999999999974e36 < z < -1.05e-88Initial program 84.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6494.5
Applied rewrites94.5%
Taylor expanded in x around 0
Applied rewrites84.5%
if -1.05e-88 < z < 8.19999999999999947e-51Initial program 90.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6499.3
Applied rewrites99.3%
Taylor expanded in z around 0
Applied rewrites90.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (- t) (/ (- y z) z))))
(if (<= z -1.4e+35)
t_1
(if (<= z 4e-51)
(fma (- t x) (/ y a) x)
(if (<= z 4.4e+61) (* (- t x) (/ y (- a z))) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = -t * ((y - z) / z);
double tmp;
if (z <= -1.4e+35) {
tmp = t_1;
} else if (z <= 4e-51) {
tmp = fma((t - x), (y / a), x);
} else if (z <= 4.4e+61) {
tmp = (t - x) * (y / (a - z));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(-t) * Float64(Float64(y - z) / z)) tmp = 0.0 if (z <= -1.4e+35) tmp = t_1; elseif (z <= 4e-51) tmp = fma(Float64(t - x), Float64(y / a), x); elseif (z <= 4.4e+61) tmp = Float64(Float64(t - x) * Float64(y / Float64(a - z))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[((-t) * N[(N[(y - z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.4e+35], t$95$1, If[LessEqual[z, 4e-51], N[(N[(t - x), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 4.4e+61], N[(N[(t - x), $MachinePrecision] * N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-t\right) \cdot \frac{y - z}{z}\\
\mathbf{if}\;z \leq -1.4 \cdot 10^{+35}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4 \cdot 10^{-51}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y}{a}, x\right)\\
\mathbf{elif}\;z \leq 4.4 \cdot 10^{+61}:\\
\;\;\;\;\left(t - x\right) \cdot \frac{y}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.39999999999999999e35 or 4.4000000000000001e61 < z Initial program 63.0%
Taylor expanded in x around 0
Applied rewrites56.3%
Taylor expanded in a around 0
Applied rewrites57.7%
if -1.39999999999999999e35 < z < 4e-51Initial program 88.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6498.2
Applied rewrites98.2%
Taylor expanded in z around 0
Applied rewrites80.5%
if 4e-51 < z < 4.4000000000000001e61Initial program 82.7%
Taylor expanded in y around inf
Applied rewrites61.5%
Final simplification68.3%
(FPCore (x y z t a)
:precision binary64
(if (<= z -4e+35)
(fma a (/ t z) t)
(if (<= z 2.05e-50)
(fma (- t x) (/ y a) x)
(if (<= z 4.5e+87) (* (- y) (/ (- t x) z)) (fma t 1.0 x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4e+35) {
tmp = fma(a, (t / z), t);
} else if (z <= 2.05e-50) {
tmp = fma((t - x), (y / a), x);
} else if (z <= 4.5e+87) {
tmp = -y * ((t - x) / z);
} else {
tmp = fma(t, 1.0, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -4e+35) tmp = fma(a, Float64(t / z), t); elseif (z <= 2.05e-50) tmp = fma(Float64(t - x), Float64(y / a), x); elseif (z <= 4.5e+87) tmp = Float64(Float64(-y) * Float64(Float64(t - x) / z)); else tmp = fma(t, 1.0, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4e+35], N[(a * N[(t / z), $MachinePrecision] + t), $MachinePrecision], If[LessEqual[z, 2.05e-50], N[(N[(t - x), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 4.5e+87], N[((-y) * N[(N[(t - x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(t * 1.0 + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4 \cdot 10^{+35}:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{t}{z}, t\right)\\
\mathbf{elif}\;z \leq 2.05 \cdot 10^{-50}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y}{a}, x\right)\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{+87}:\\
\;\;\;\;\left(-y\right) \cdot \frac{t - x}{z}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t, 1, x\right)\\
\end{array}
\end{array}
if z < -3.9999999999999999e35Initial program 62.2%
Taylor expanded in x around 0
Applied rewrites61.9%
Taylor expanded in y around 0
Applied rewrites56.9%
Taylor expanded in z around inf
Applied rewrites52.0%
if -3.9999999999999999e35 < z < 2.04999999999999993e-50Initial program 88.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6498.2
Applied rewrites98.2%
Taylor expanded in z around 0
Applied rewrites80.5%
if 2.04999999999999993e-50 < z < 4.5000000000000003e87Initial program 79.5%
Taylor expanded in y around inf
Applied rewrites53.9%
Taylor expanded in z around inf
Applied rewrites45.9%
if 4.5000000000000003e87 < z Initial program 63.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6471.3
Applied rewrites71.3%
Taylor expanded in x around 0
Applied rewrites62.4%
Taylor expanded in z around inf
Applied rewrites50.7%
Final simplification63.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -4.5e+86) (not (<= y 1.36e+81))) (* (- t x) (/ y (- a z))) (fma t (/ (- y z) (- a z)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -4.5e+86) || !(y <= 1.36e+81)) {
tmp = (t - x) * (y / (a - z));
} else {
tmp = fma(t, ((y - z) / (a - z)), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -4.5e+86) || !(y <= 1.36e+81)) tmp = Float64(Float64(t - x) * Float64(y / Float64(a - z))); else tmp = fma(t, Float64(Float64(y - z) / Float64(a - z)), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -4.5e+86], N[Not[LessEqual[y, 1.36e+81]], $MachinePrecision]], N[(N[(t - x), $MachinePrecision] * N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.5 \cdot 10^{+86} \lor \neg \left(y \leq 1.36 \cdot 10^{+81}\right):\\
\;\;\;\;\left(t - x\right) \cdot \frac{y}{a - z}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t, \frac{y - z}{a - z}, x\right)\\
\end{array}
\end{array}
if y < -4.49999999999999993e86 or 1.35999999999999997e81 < y Initial program 86.5%
Taylor expanded in y around inf
Applied rewrites83.4%
if -4.49999999999999993e86 < y < 1.35999999999999997e81Initial program 71.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6479.9
Applied rewrites79.9%
Taylor expanded in x around 0
Applied rewrites74.5%
Final simplification77.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -7.4e+37) (not (<= y 8e-11))) (* (- t x) (/ y (- a z))) (fma t (/ (- z) (- a z)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -7.4e+37) || !(y <= 8e-11)) {
tmp = (t - x) * (y / (a - z));
} else {
tmp = fma(t, (-z / (a - z)), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -7.4e+37) || !(y <= 8e-11)) tmp = Float64(Float64(t - x) * Float64(y / Float64(a - z))); else tmp = fma(t, Float64(Float64(-z) / Float64(a - z)), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -7.4e+37], N[Not[LessEqual[y, 8e-11]], $MachinePrecision]], N[(N[(t - x), $MachinePrecision] * N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[((-z) / N[(a - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.4 \cdot 10^{+37} \lor \neg \left(y \leq 8 \cdot 10^{-11}\right):\\
\;\;\;\;\left(t - x\right) \cdot \frac{y}{a - z}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t, \frac{-z}{a - z}, x\right)\\
\end{array}
\end{array}
if y < -7.3999999999999999e37 or 7.99999999999999952e-11 < y Initial program 85.6%
Taylor expanded in y around inf
Applied rewrites76.5%
if -7.3999999999999999e37 < y < 7.99999999999999952e-11Initial program 67.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6478.3
Applied rewrites78.3%
Taylor expanded in x around 0
Applied rewrites75.2%
Taylor expanded in y around 0
Applied rewrites70.7%
Final simplification73.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.4e+35) (not (<= z 2.4e-50))) (* (- t) (/ (- y z) z)) (fma (- t x) (/ y a) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.4e+35) || !(z <= 2.4e-50)) {
tmp = -t * ((y - z) / z);
} else {
tmp = fma((t - x), (y / a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.4e+35) || !(z <= 2.4e-50)) tmp = Float64(Float64(-t) * Float64(Float64(y - z) / z)); else tmp = fma(Float64(t - x), Float64(y / a), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.4e+35], N[Not[LessEqual[z, 2.4e-50]], $MachinePrecision]], N[((-t) * N[(N[(y - z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(t - x), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.4 \cdot 10^{+35} \lor \neg \left(z \leq 2.4 \cdot 10^{-50}\right):\\
\;\;\;\;\left(-t\right) \cdot \frac{y - z}{z}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y}{a}, x\right)\\
\end{array}
\end{array}
if z < -1.39999999999999999e35 or 2.40000000000000002e-50 < z Initial program 66.9%
Taylor expanded in x around 0
Applied rewrites56.6%
Taylor expanded in a around 0
Applied rewrites54.4%
if -1.39999999999999999e35 < z < 2.40000000000000002e-50Initial program 88.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6498.2
Applied rewrites98.2%
Taylor expanded in z around 0
Applied rewrites80.5%
Final simplification66.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.4e+35) (not (<= z 450000000.0))) (* (- t) (/ z (- a z))) (fma (- t x) (/ y a) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.4e+35) || !(z <= 450000000.0)) {
tmp = -t * (z / (a - z));
} else {
tmp = fma((t - x), (y / a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.4e+35) || !(z <= 450000000.0)) tmp = Float64(Float64(-t) * Float64(z / Float64(a - z))); else tmp = fma(Float64(t - x), Float64(y / a), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.4e+35], N[Not[LessEqual[z, 450000000.0]], $MachinePrecision]], N[((-t) * N[(z / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t - x), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.4 \cdot 10^{+35} \lor \neg \left(z \leq 450000000\right):\\
\;\;\;\;\left(-t\right) \cdot \frac{z}{a - z}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y}{a}, x\right)\\
\end{array}
\end{array}
if z < -1.39999999999999999e35 or 4.5e8 < z Initial program 65.3%
Taylor expanded in x around 0
Applied rewrites56.3%
Taylor expanded in y around 0
Applied rewrites51.7%
if -1.39999999999999999e35 < z < 4.5e8Initial program 88.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6497.6
Applied rewrites97.6%
Taylor expanded in z around 0
Applied rewrites76.3%
Final simplification63.8%
(FPCore (x y z t a) :precision binary64 (if (<= z -4e+35) (fma a (/ t z) t) (if (<= z 3.8e+63) (fma (- t x) (/ y a) x) (fma t 1.0 x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4e+35) {
tmp = fma(a, (t / z), t);
} else if (z <= 3.8e+63) {
tmp = fma((t - x), (y / a), x);
} else {
tmp = fma(t, 1.0, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -4e+35) tmp = fma(a, Float64(t / z), t); elseif (z <= 3.8e+63) tmp = fma(Float64(t - x), Float64(y / a), x); else tmp = fma(t, 1.0, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4e+35], N[(a * N[(t / z), $MachinePrecision] + t), $MachinePrecision], If[LessEqual[z, 3.8e+63], N[(N[(t - x), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision], N[(t * 1.0 + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4 \cdot 10^{+35}:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{t}{z}, t\right)\\
\mathbf{elif}\;z \leq 3.8 \cdot 10^{+63}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t, 1, x\right)\\
\end{array}
\end{array}
if z < -3.9999999999999999e35Initial program 62.2%
Taylor expanded in x around 0
Applied rewrites61.9%
Taylor expanded in y around 0
Applied rewrites56.9%
Taylor expanded in z around inf
Applied rewrites52.0%
if -3.9999999999999999e35 < z < 3.8000000000000001e63Initial program 87.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6495.8
Applied rewrites95.8%
Taylor expanded in z around 0
Applied rewrites70.8%
if 3.8000000000000001e63 < z Initial program 63.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6470.9
Applied rewrites70.9%
Taylor expanded in x around 0
Applied rewrites62.5%
Taylor expanded in z around inf
Applied rewrites47.2%
Final simplification61.4%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.4e+35) (fma a (/ t z) t) (if (<= z 5.8e+65) (fma (/ (- t x) a) y x) (fma t 1.0 x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.4e+35) {
tmp = fma(a, (t / z), t);
} else if (z <= 5.8e+65) {
tmp = fma(((t - x) / a), y, x);
} else {
tmp = fma(t, 1.0, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.4e+35) tmp = fma(a, Float64(t / z), t); elseif (z <= 5.8e+65) tmp = fma(Float64(Float64(t - x) / a), y, x); else tmp = fma(t, 1.0, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.4e+35], N[(a * N[(t / z), $MachinePrecision] + t), $MachinePrecision], If[LessEqual[z, 5.8e+65], N[(N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] * y + x), $MachinePrecision], N[(t * 1.0 + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.4 \cdot 10^{+35}:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{t}{z}, t\right)\\
\mathbf{elif}\;z \leq 5.8 \cdot 10^{+65}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - x}{a}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t, 1, x\right)\\
\end{array}
\end{array}
if z < -1.39999999999999999e35Initial program 62.2%
Taylor expanded in x around 0
Applied rewrites61.9%
Taylor expanded in y around 0
Applied rewrites56.9%
Taylor expanded in z around inf
Applied rewrites52.0%
if -1.39999999999999999e35 < z < 5.8000000000000001e65Initial program 87.1%
Taylor expanded in z around 0
Applied rewrites66.9%
if 5.8000000000000001e65 < z Initial program 65.1%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6472.2
Applied rewrites72.2%
Taylor expanded in x around 0
Applied rewrites63.7%
Taylor expanded in z around inf
Applied rewrites48.1%
Final simplification59.5%
(FPCore (x y z t a) :precision binary64 (if (<= z -6.6e+37) (fma a (/ t z) t) (if (<= z 1.36e+29) (fma t (/ y a) x) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -6.6e+37) {
tmp = fma(a, (t / z), t);
} else if (z <= 1.36e+29) {
tmp = fma(t, (y / a), x);
} else {
tmp = t;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -6.6e+37) tmp = fma(a, Float64(t / z), t); elseif (z <= 1.36e+29) tmp = fma(t, Float64(y / a), x); else tmp = t; end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -6.6e+37], N[(a * N[(t / z), $MachinePrecision] + t), $MachinePrecision], If[LessEqual[z, 1.36e+29], N[(t * N[(y / a), $MachinePrecision] + x), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.6 \cdot 10^{+37}:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{t}{z}, t\right)\\
\mathbf{elif}\;z \leq 1.36 \cdot 10^{+29}:\\
\;\;\;\;\mathsf{fma}\left(t, \frac{y}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -6.6000000000000002e37Initial program 60.9%
Taylor expanded in x around 0
Applied rewrites62.2%
Taylor expanded in y around 0
Applied rewrites58.8%
Taylor expanded in z around inf
Applied rewrites53.7%
if -6.6000000000000002e37 < z < 1.36e29Initial program 89.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6497.7
Applied rewrites97.7%
Taylor expanded in x around 0
Applied rewrites74.9%
Taylor expanded in z around 0
Applied rewrites60.1%
if 1.36e29 < z Initial program 64.5%
Taylor expanded in z around inf
Applied rewrites42.8%
Final simplification54.4%
(FPCore (x y z t a) :precision binary64 (if (<= z -6.6e+37) (fma a (/ t z) t) (if (<= z 1.36e+29) (fma (/ t a) y x) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -6.6e+37) {
tmp = fma(a, (t / z), t);
} else if (z <= 1.36e+29) {
tmp = fma((t / a), y, x);
} else {
tmp = t;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -6.6e+37) tmp = fma(a, Float64(t / z), t); elseif (z <= 1.36e+29) tmp = fma(Float64(t / a), y, x); else tmp = t; end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -6.6e+37], N[(a * N[(t / z), $MachinePrecision] + t), $MachinePrecision], If[LessEqual[z, 1.36e+29], N[(N[(t / a), $MachinePrecision] * y + x), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.6 \cdot 10^{+37}:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{t}{z}, t\right)\\
\mathbf{elif}\;z \leq 1.36 \cdot 10^{+29}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{a}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -6.6000000000000002e37Initial program 60.9%
Taylor expanded in x around 0
Applied rewrites62.2%
Taylor expanded in y around 0
Applied rewrites58.8%
Taylor expanded in z around inf
Applied rewrites53.7%
if -6.6000000000000002e37 < z < 1.36e29Initial program 89.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6497.7
Applied rewrites97.7%
Taylor expanded in z around 0
Applied rewrites69.3%
Taylor expanded in x around 0
Applied rewrites56.6%
if 1.36e29 < z Initial program 64.5%
Taylor expanded in z around inf
Applied rewrites42.8%
Final simplification52.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -1.2e+86) (not (<= y 9e+80))) (* t (/ y a)) (fma t 1.0 x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -1.2e+86) || !(y <= 9e+80)) {
tmp = t * (y / a);
} else {
tmp = fma(t, 1.0, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -1.2e+86) || !(y <= 9e+80)) tmp = Float64(t * Float64(y / a)); else tmp = fma(t, 1.0, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -1.2e+86], N[Not[LessEqual[y, 9e+80]], $MachinePrecision]], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision], N[(t * 1.0 + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.2 \cdot 10^{+86} \lor \neg \left(y \leq 9 \cdot 10^{+80}\right):\\
\;\;\;\;t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t, 1, x\right)\\
\end{array}
\end{array}
if y < -1.2e86 or 9.00000000000000013e80 < y Initial program 85.7%
Taylor expanded in x around 0
Applied rewrites44.0%
Taylor expanded in y around 0
Applied rewrites9.8%
Taylor expanded in z around 0
Applied rewrites31.5%
if -1.2e86 < y < 9.00000000000000013e80Initial program 71.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6479.8
Applied rewrites79.8%
Taylor expanded in x around 0
Applied rewrites74.3%
Taylor expanded in z around inf
Applied rewrites50.0%
Final simplification43.1%
(FPCore (x y z t a) :precision binary64 (if (<= z -3.5e+37) t (if (<= z 1e-47) x t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.5e+37) {
tmp = t;
} else if (z <= 1e-47) {
tmp = x;
} else {
tmp = t;
}
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) :: tmp
if (z <= (-3.5d+37)) then
tmp = t
else if (z <= 1d-47) then
tmp = x
else
tmp = t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.5e+37) {
tmp = t;
} else if (z <= 1e-47) {
tmp = x;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3.5e+37: tmp = t elif z <= 1e-47: tmp = x else: tmp = t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.5e+37) tmp = t; elseif (z <= 1e-47) tmp = x; else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -3.5e+37) tmp = t; elseif (z <= 1e-47) tmp = x; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.5e+37], t, If[LessEqual[z, 1e-47], x, t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.5 \cdot 10^{+37}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq 10^{-47}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -3.5e37 or 9.9999999999999997e-48 < z Initial program 65.9%
Taylor expanded in z around inf
Applied rewrites44.0%
if -3.5e37 < z < 9.9999999999999997e-48Initial program 89.3%
Taylor expanded in a around inf
Applied rewrites39.1%
Final simplification41.7%
(FPCore (x y z t a) :precision binary64 t)
double code(double x, double y, double z, double t, double a) {
return t;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, 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 = t
end function
public static double code(double x, double y, double z, double t, double a) {
return t;
}
def code(x, y, z, t, a): return t
function code(x, y, z, t, a) return t end
function tmp = code(x, y, z, t, a) tmp = t; end
code[x_, y_, z_, t_, a_] := t
\begin{array}{l}
\\
t
\end{array}
Initial program 76.7%
Taylor expanded in z around inf
Applied rewrites27.0%
Final simplification27.0%
herbie shell --seed 2025022
(FPCore (x y z t a)
:name "Numeric.Signal:interpolate from hsignal-0.2.7.1"
:precision binary64
(+ x (* (- y z) (/ (- t x) (- a z)))))