
(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 -1e-275) (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 <= -1e-275) || !(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 <= -1e-275) || !(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, -1e-275], 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 -1 \cdot 10^{-275} \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)))) < -9.99999999999999934e-276 or 0.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial 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-/.f6494.7
Applied rewrites94.7%
if -9.99999999999999934e-276 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 0.0Initial program 3.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-/.f647.3
Applied rewrites7.3%
Taylor expanded in z around inf
fp-cancel-sub-sign-invN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
*-lft-identityN/A
associate-+l-N/A
div-subN/A
lower--.f64N/A
div-subN/A
associate-/l*N/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6499.7
Applied rewrites99.7%
Final simplification95.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma a (/ (- t x) z) t)))
(if (<= z -1.65e+146)
t_1
(if (<= z -2.35e+39)
(* (- t x) (/ y (- a z)))
(if (<= z 1.36e+23)
(fma (- t x) (/ y a) x)
(if (<= z 2.6e+173) (* (- y z) (/ t (- a z))) t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(a, ((t - x) / z), t);
double tmp;
if (z <= -1.65e+146) {
tmp = t_1;
} else if (z <= -2.35e+39) {
tmp = (t - x) * (y / (a - z));
} else if (z <= 1.36e+23) {
tmp = fma((t - x), (y / a), x);
} else if (z <= 2.6e+173) {
tmp = (y - z) * (t / (a - z));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(a, Float64(Float64(t - x) / z), t) tmp = 0.0 if (z <= -1.65e+146) tmp = t_1; elseif (z <= -2.35e+39) tmp = Float64(Float64(t - x) * Float64(y / Float64(a - z))); elseif (z <= 1.36e+23) tmp = fma(Float64(t - x), Float64(y / a), x); elseif (z <= 2.6e+173) tmp = Float64(Float64(y - z) * Float64(t / Float64(a - z))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(a * N[(N[(t - x), $MachinePrecision] / z), $MachinePrecision] + t), $MachinePrecision]}, If[LessEqual[z, -1.65e+146], t$95$1, If[LessEqual[z, -2.35e+39], N[(N[(t - x), $MachinePrecision] * N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.36e+23], N[(N[(t - x), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 2.6e+173], N[(N[(y - z), $MachinePrecision] * N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, \frac{t - x}{z}, t\right)\\
\mathbf{if}\;z \leq -1.65 \cdot 10^{+146}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -2.35 \cdot 10^{+39}:\\
\;\;\;\;\left(t - x\right) \cdot \frac{y}{a - z}\\
\mathbf{elif}\;z \leq 1.36 \cdot 10^{+23}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y}{a}, x\right)\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{+173}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{t}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.65000000000000008e146 or 2.5999999999999999e173 < z Initial program 59.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-/.f6467.0
Applied rewrites67.0%
Taylor expanded in z around inf
fp-cancel-sub-sign-invN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
*-lft-identityN/A
associate-+l-N/A
div-subN/A
lower--.f64N/A
div-subN/A
associate-/l*N/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6495.0
Applied rewrites95.0%
Taylor expanded in y around 0
Applied rewrites73.5%
if -1.65000000000000008e146 < z < -2.35e39Initial program 70.7%
Taylor expanded in y around inf
div-subN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6465.5
Applied rewrites65.5%
if -2.35e39 < z < 1.36e23Initial program 87.8%
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.3
Applied rewrites94.3%
Taylor expanded in z around 0
lower-/.f6471.6
Applied rewrites71.6%
if 1.36e23 < z < 2.5999999999999999e173Initial program 87.4%
Taylor expanded in x around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6465.6
Applied rewrites65.6%
Final simplification70.5%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.65e+146)
(fma a (/ (- t x) z) t)
(if (<= z -2.35e+39)
(* (- t x) (/ y (- a z)))
(if (<= z 7.8e+23) (fma (- t x) (/ y a) x) (* (- t) (/ (- y z) z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.65e+146) {
tmp = fma(a, ((t - x) / z), t);
} else if (z <= -2.35e+39) {
tmp = (t - x) * (y / (a - z));
} else if (z <= 7.8e+23) {
tmp = fma((t - x), (y / a), x);
} else {
tmp = -t * ((y - z) / z);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.65e+146) tmp = fma(a, Float64(Float64(t - x) / z), t); elseif (z <= -2.35e+39) tmp = Float64(Float64(t - x) * Float64(y / Float64(a - z))); elseif (z <= 7.8e+23) tmp = fma(Float64(t - x), Float64(y / a), x); else tmp = Float64(Float64(-t) * Float64(Float64(y - z) / z)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.65e+146], N[(a * N[(N[(t - x), $MachinePrecision] / z), $MachinePrecision] + t), $MachinePrecision], If[LessEqual[z, -2.35e+39], N[(N[(t - x), $MachinePrecision] * N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.8e+23], N[(N[(t - x), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision], N[((-t) * N[(N[(y - z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.65 \cdot 10^{+146}:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{t - x}{z}, t\right)\\
\mathbf{elif}\;z \leq -2.35 \cdot 10^{+39}:\\
\;\;\;\;\left(t - x\right) \cdot \frac{y}{a - z}\\
\mathbf{elif}\;z \leq 7.8 \cdot 10^{+23}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-t\right) \cdot \frac{y - z}{z}\\
\end{array}
\end{array}
if z < -1.65000000000000008e146Initial program 53.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-/.f6461.4
Applied rewrites61.4%
Taylor expanded in z around inf
fp-cancel-sub-sign-invN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
*-lft-identityN/A
associate-+l-N/A
div-subN/A
lower--.f64N/A
div-subN/A
associate-/l*N/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6495.7
Applied rewrites95.7%
Taylor expanded in y around 0
Applied rewrites71.9%
if -1.65000000000000008e146 < z < -2.35e39Initial program 70.7%
Taylor expanded in y around inf
div-subN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6465.5
Applied rewrites65.5%
if -2.35e39 < z < 7.8000000000000001e23Initial program 87.8%
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.3
Applied rewrites94.3%
Taylor expanded in z around 0
lower-/.f6471.6
Applied rewrites71.6%
if 7.8000000000000001e23 < z Initial program 78.2%
Taylor expanded in x around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6463.1
Applied rewrites63.1%
Taylor expanded in a around 0
Applied rewrites62.9%
Final simplification68.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- t x) z)))
(if (<= z -4.9e+145)
(fma a t_1 t)
(if (<= z -3.7e+39)
(* t_1 (- y))
(if (<= z 7.8e+23) (fma (- t x) (/ y a) x) (* (- t) (/ (- y z) z)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t - x) / z;
double tmp;
if (z <= -4.9e+145) {
tmp = fma(a, t_1, t);
} else if (z <= -3.7e+39) {
tmp = t_1 * -y;
} else if (z <= 7.8e+23) {
tmp = fma((t - x), (y / a), x);
} else {
tmp = -t * ((y - z) / z);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(t - x) / z) tmp = 0.0 if (z <= -4.9e+145) tmp = fma(a, t_1, t); elseif (z <= -3.7e+39) tmp = Float64(t_1 * Float64(-y)); elseif (z <= 7.8e+23) tmp = fma(Float64(t - x), Float64(y / a), x); else tmp = Float64(Float64(-t) * Float64(Float64(y - z) / z)); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] / z), $MachinePrecision]}, If[LessEqual[z, -4.9e+145], N[(a * t$95$1 + t), $MachinePrecision], If[LessEqual[z, -3.7e+39], N[(t$95$1 * (-y)), $MachinePrecision], If[LessEqual[z, 7.8e+23], N[(N[(t - x), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision], N[((-t) * N[(N[(y - z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - x}{z}\\
\mathbf{if}\;z \leq -4.9 \cdot 10^{+145}:\\
\;\;\;\;\mathsf{fma}\left(a, t\_1, t\right)\\
\mathbf{elif}\;z \leq -3.7 \cdot 10^{+39}:\\
\;\;\;\;t\_1 \cdot \left(-y\right)\\
\mathbf{elif}\;z \leq 7.8 \cdot 10^{+23}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-t\right) \cdot \frac{y - z}{z}\\
\end{array}
\end{array}
if z < -4.90000000000000003e145Initial program 53.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-/.f6461.4
Applied rewrites61.4%
Taylor expanded in z around inf
fp-cancel-sub-sign-invN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
*-lft-identityN/A
associate-+l-N/A
div-subN/A
lower--.f64N/A
div-subN/A
associate-/l*N/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6495.7
Applied rewrites95.7%
Taylor expanded in y around 0
Applied rewrites71.9%
if -4.90000000000000003e145 < z < -3.70000000000000012e39Initial program 70.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-/.f6474.4
Applied rewrites74.4%
Taylor expanded in z around inf
fp-cancel-sub-sign-invN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
*-lft-identityN/A
associate-+l-N/A
div-subN/A
lower--.f64N/A
div-subN/A
associate-/l*N/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6476.7
Applied rewrites76.7%
Taylor expanded in y around -inf
Applied rewrites57.4%
if -3.70000000000000012e39 < z < 7.8000000000000001e23Initial program 87.8%
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.3
Applied rewrites94.3%
Taylor expanded in z around 0
lower-/.f6471.6
Applied rewrites71.6%
if 7.8000000000000001e23 < z Initial program 78.2%
Taylor expanded in x around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6463.1
Applied rewrites63.1%
Taylor expanded in a around 0
Applied rewrites62.9%
Final simplification68.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (- t x))))
(if (<= z -5.2e+189)
t_1
(if (<= z -2.1e+110)
(/ (* (- y a) x) z)
(if (<= z 1.55e+97) (fma (/ (- t x) a) y x) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (t - x);
double tmp;
if (z <= -5.2e+189) {
tmp = t_1;
} else if (z <= -2.1e+110) {
tmp = ((y - a) * x) / z;
} else if (z <= 1.55e+97) {
tmp = fma(((t - x) / a), y, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x + Float64(t - x)) tmp = 0.0 if (z <= -5.2e+189) tmp = t_1; elseif (z <= -2.1e+110) tmp = Float64(Float64(Float64(y - a) * x) / z); elseif (z <= 1.55e+97) tmp = fma(Float64(Float64(t - x) / a), y, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(t - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5.2e+189], t$95$1, If[LessEqual[z, -2.1e+110], N[(N[(N[(y - a), $MachinePrecision] * x), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[z, 1.55e+97], N[(N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] * y + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(t - x\right)\\
\mathbf{if}\;z \leq -5.2 \cdot 10^{+189}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -2.1 \cdot 10^{+110}:\\
\;\;\;\;\frac{\left(y - a\right) \cdot x}{z}\\
\mathbf{elif}\;z \leq 1.55 \cdot 10^{+97}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - x}{a}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -5.19999999999999963e189 or 1.54999999999999991e97 < z Initial program 70.3%
Taylor expanded in z around inf
lower--.f6453.9
Applied rewrites53.9%
if -5.19999999999999963e189 < z < -2.10000000000000015e110Initial program 43.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-/.f6451.9
Applied rewrites51.9%
Taylor expanded in z around inf
fp-cancel-sub-sign-invN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
*-lft-identityN/A
associate-+l-N/A
div-subN/A
lower--.f64N/A
div-subN/A
associate-/l*N/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6491.4
Applied rewrites91.4%
Taylor expanded in x around inf
Applied rewrites58.8%
if -2.10000000000000015e110 < z < 1.54999999999999991e97Initial program 86.7%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6460.9
Applied rewrites60.9%
Final simplification58.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -6e+78) (not (<= a 0.0027))) (fma (- t x) (/ (- y z) a) x) (fma (- (- t x)) (/ (- y a) z) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -6e+78) || !(a <= 0.0027)) {
tmp = fma((t - x), ((y - z) / a), x);
} else {
tmp = fma(-(t - x), ((y - a) / z), t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -6e+78) || !(a <= 0.0027)) tmp = fma(Float64(t - x), Float64(Float64(y - z) / a), x); else tmp = fma(Float64(-Float64(t - x)), Float64(Float64(y - a) / z), t); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -6e+78], N[Not[LessEqual[a, 0.0027]], $MachinePrecision]], N[(N[(t - x), $MachinePrecision] * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], N[((-N[(t - x), $MachinePrecision]) * N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] + t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -6 \cdot 10^{+78} \lor \neg \left(a \leq 0.0027\right):\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y - z}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-\left(t - x\right), \frac{y - a}{z}, t\right)\\
\end{array}
\end{array}
if a < -5.99999999999999964e78 or 0.0027000000000000001 < a Initial 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-/.f6493.6
Applied rewrites93.6%
Taylor expanded in a around inf
lower-/.f64N/A
lower--.f6479.6
Applied rewrites79.6%
if -5.99999999999999964e78 < a < 0.0027000000000000001Initial program 74.0%
Taylor expanded in z around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
mul-1-negN/A
distribute-rgt-out--N/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-/.f64N/A
lower--.f6481.3
Applied rewrites81.3%
Final simplification80.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- y z) a)))
(if (<= a -6e+78)
(+ x (* t_1 (- t x)))
(if (<= a 0.0027)
(fma (- (- t x)) (/ (- y a) z) t)
(fma (- t x) t_1 x)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y - z) / a;
double tmp;
if (a <= -6e+78) {
tmp = x + (t_1 * (t - x));
} else if (a <= 0.0027) {
tmp = fma(-(t - x), ((y - a) / z), t);
} else {
tmp = fma((t - x), t_1, x);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(y - z) / a) tmp = 0.0 if (a <= -6e+78) tmp = Float64(x + Float64(t_1 * Float64(t - x))); elseif (a <= 0.0027) tmp = fma(Float64(-Float64(t - x)), Float64(Float64(y - a) / z), t); else tmp = fma(Float64(t - x), t_1, x); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[a, -6e+78], N[(x + N[(t$95$1 * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 0.0027], N[((-N[(t - x), $MachinePrecision]) * N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] + t), $MachinePrecision], N[(N[(t - x), $MachinePrecision] * t$95$1 + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y - z}{a}\\
\mathbf{if}\;a \leq -6 \cdot 10^{+78}:\\
\;\;\;\;x + t\_1 \cdot \left(t - x\right)\\
\mathbf{elif}\;a \leq 0.0027:\\
\;\;\;\;\mathsf{fma}\left(-\left(t - x\right), \frac{y - a}{z}, t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t - x, t\_1, x\right)\\
\end{array}
\end{array}
if a < -5.99999999999999964e78Initial program 91.2%
Taylor expanded in a around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6486.2
Applied rewrites86.2%
if -5.99999999999999964e78 < a < 0.0027000000000000001Initial program 74.0%
Taylor expanded in z around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
mul-1-negN/A
distribute-rgt-out--N/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-/.f64N/A
lower--.f6481.3
Applied rewrites81.3%
if 0.0027000000000000001 < a Initial program 86.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-/.f6492.2
Applied rewrites92.2%
Taylor expanded in a around inf
lower-/.f64N/A
lower--.f6475.2
Applied rewrites75.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.2e+31) (not (<= z 0.0036))) (fma (/ (- t x) z) (- y) t) (fma (- t x) (/ (- y z) a) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.2e+31) || !(z <= 0.0036)) {
tmp = fma(((t - x) / z), -y, t);
} else {
tmp = fma((t - x), ((y - z) / a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.2e+31) || !(z <= 0.0036)) tmp = fma(Float64(Float64(t - x) / z), Float64(-y), t); else tmp = fma(Float64(t - x), Float64(Float64(y - z) / a), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.2e+31], N[Not[LessEqual[z, 0.0036]], $MachinePrecision]], N[(N[(N[(t - x), $MachinePrecision] / z), $MachinePrecision] * (-y) + t), $MachinePrecision], N[(N[(t - x), $MachinePrecision] * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.2 \cdot 10^{+31} \lor \neg \left(z \leq 0.0036\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{t - x}{z}, -y, t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y - z}{a}, x\right)\\
\end{array}
\end{array}
if z < -1.19999999999999991e31 or 0.0035999999999999999 < z Initial program 72.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-/.f6476.8
Applied rewrites76.8%
Taylor expanded in z around inf
fp-cancel-sub-sign-invN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
*-lft-identityN/A
associate-+l-N/A
div-subN/A
lower--.f64N/A
div-subN/A
associate-/l*N/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6483.0
Applied rewrites83.0%
Taylor expanded in a around 0
Applied rewrites79.9%
if -1.19999999999999991e31 < z < 0.0035999999999999999Initial program 87.8%
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.7
Applied rewrites94.7%
Taylor expanded in a around inf
lower-/.f64N/A
lower--.f6477.0
Applied rewrites77.0%
Final simplification78.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (- t x))))
(if (<= z -5.2e+189)
t_1
(if (<= z -9e+112)
(/ (* (- y a) x) z)
(if (<= z 1.3e+97) (fma y (/ t a) x) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (t - x);
double tmp;
if (z <= -5.2e+189) {
tmp = t_1;
} else if (z <= -9e+112) {
tmp = ((y - a) * x) / z;
} else if (z <= 1.3e+97) {
tmp = fma(y, (t / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x + Float64(t - x)) tmp = 0.0 if (z <= -5.2e+189) tmp = t_1; elseif (z <= -9e+112) tmp = Float64(Float64(Float64(y - a) * x) / z); elseif (z <= 1.3e+97) tmp = fma(y, Float64(t / a), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(t - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5.2e+189], t$95$1, If[LessEqual[z, -9e+112], N[(N[(N[(y - a), $MachinePrecision] * x), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[z, 1.3e+97], N[(y * N[(t / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(t - x\right)\\
\mathbf{if}\;z \leq -5.2 \cdot 10^{+189}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -9 \cdot 10^{+112}:\\
\;\;\;\;\frac{\left(y - a\right) \cdot x}{z}\\
\mathbf{elif}\;z \leq 1.3 \cdot 10^{+97}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -5.19999999999999963e189 or 1.3e97 < z Initial program 70.3%
Taylor expanded in z around inf
lower--.f6453.9
Applied rewrites53.9%
if -5.19999999999999963e189 < z < -8.9999999999999998e112Initial program 43.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-/.f6451.9
Applied rewrites51.9%
Taylor expanded in z around inf
fp-cancel-sub-sign-invN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
*-lft-identityN/A
associate-+l-N/A
div-subN/A
lower--.f64N/A
div-subN/A
associate-/l*N/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6491.4
Applied rewrites91.4%
Taylor expanded in x around inf
Applied rewrites58.8%
if -8.9999999999999998e112 < z < 1.3e97Initial program 86.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-/.f6492.4
Applied rewrites92.4%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6460.9
Applied rewrites60.9%
Taylor expanded in x around 0
Applied rewrites49.9%
Final simplification51.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.2e+31) (not (<= z 0.0035))) (fma (/ (- t x) z) (- y) t) (fma (- t x) (/ y a) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.2e+31) || !(z <= 0.0035)) {
tmp = fma(((t - x) / z), -y, t);
} else {
tmp = fma((t - x), (y / a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.2e+31) || !(z <= 0.0035)) tmp = fma(Float64(Float64(t - x) / z), Float64(-y), t); 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.2e+31], N[Not[LessEqual[z, 0.0035]], $MachinePrecision]], N[(N[(N[(t - x), $MachinePrecision] / z), $MachinePrecision] * (-y) + t), $MachinePrecision], N[(N[(t - x), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.2 \cdot 10^{+31} \lor \neg \left(z \leq 0.0035\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{t - x}{z}, -y, t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y}{a}, x\right)\\
\end{array}
\end{array}
if z < -1.19999999999999991e31 or 0.00350000000000000007 < z Initial program 72.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-/.f6476.8
Applied rewrites76.8%
Taylor expanded in z around inf
fp-cancel-sub-sign-invN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
*-lft-identityN/A
associate-+l-N/A
div-subN/A
lower--.f64N/A
div-subN/A
associate-/l*N/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6483.0
Applied rewrites83.0%
Taylor expanded in a around 0
Applied rewrites79.9%
if -1.19999999999999991e31 < z < 0.00350000000000000007Initial program 87.8%
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.7
Applied rewrites94.7%
Taylor expanded in z around 0
lower-/.f6473.5
Applied rewrites73.5%
Final simplification76.7%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.05e+90) (fma a (/ (- t x) z) t) (if (<= z 7.8e+23) (fma (- t x) (/ y a) x) (* (- t) (/ (- y z) z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.05e+90) {
tmp = fma(a, ((t - x) / z), t);
} else if (z <= 7.8e+23) {
tmp = fma((t - x), (y / a), x);
} else {
tmp = -t * ((y - z) / z);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.05e+90) tmp = fma(a, Float64(Float64(t - x) / z), t); elseif (z <= 7.8e+23) tmp = fma(Float64(t - x), Float64(y / a), x); else tmp = Float64(Float64(-t) * Float64(Float64(y - z) / z)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.05e+90], N[(a * N[(N[(t - x), $MachinePrecision] / z), $MachinePrecision] + t), $MachinePrecision], If[LessEqual[z, 7.8e+23], N[(N[(t - x), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision], N[((-t) * N[(N[(y - z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.05 \cdot 10^{+90}:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{t - x}{z}, t\right)\\
\mathbf{elif}\;z \leq 7.8 \cdot 10^{+23}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-t\right) \cdot \frac{y - z}{z}\\
\end{array}
\end{array}
if z < -1.0499999999999999e90Initial program 55.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-/.f6461.4
Applied rewrites61.4%
Taylor expanded in z around inf
fp-cancel-sub-sign-invN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
*-lft-identityN/A
associate-+l-N/A
div-subN/A
lower--.f64N/A
div-subN/A
associate-/l*N/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6494.2
Applied rewrites94.2%
Taylor expanded in y around 0
Applied rewrites61.5%
if -1.0499999999999999e90 < z < 7.8000000000000001e23Initial program 86.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-/.f6493.2
Applied rewrites93.2%
Taylor expanded in z around 0
lower-/.f6468.8
Applied rewrites68.8%
if 7.8000000000000001e23 < z Initial program 78.2%
Taylor expanded in x around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6463.1
Applied rewrites63.1%
Taylor expanded in a around 0
Applied rewrites62.9%
Final simplification66.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.05e+90) (not (<= z 1.02e+24))) (fma a (/ (- t x) z) t) (fma (- t x) (/ y a) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.05e+90) || !(z <= 1.02e+24)) {
tmp = fma(a, ((t - x) / z), t);
} else {
tmp = fma((t - x), (y / a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.05e+90) || !(z <= 1.02e+24)) tmp = fma(a, Float64(Float64(t - x) / z), t); 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.05e+90], N[Not[LessEqual[z, 1.02e+24]], $MachinePrecision]], N[(a * N[(N[(t - x), $MachinePrecision] / z), $MachinePrecision] + t), $MachinePrecision], N[(N[(t - x), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.05 \cdot 10^{+90} \lor \neg \left(z \leq 1.02 \cdot 10^{+24}\right):\\
\;\;\;\;\mathsf{fma}\left(a, \frac{t - x}{z}, t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y}{a}, x\right)\\
\end{array}
\end{array}
if z < -1.0499999999999999e90 or 1.02000000000000004e24 < z Initial program 70.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-/.f6475.1
Applied rewrites75.1%
Taylor expanded in z around inf
fp-cancel-sub-sign-invN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
*-lft-identityN/A
associate-+l-N/A
div-subN/A
lower--.f64N/A
div-subN/A
associate-/l*N/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6486.1
Applied rewrites86.1%
Taylor expanded in y around 0
Applied rewrites57.5%
if -1.0499999999999999e90 < z < 1.02000000000000004e24Initial program 86.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-/.f6493.2
Applied rewrites93.2%
Taylor expanded in z around 0
lower-/.f6468.8
Applied rewrites68.8%
Final simplification64.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.05e+90) (not (<= z 1.02e+24))) (fma a (/ (- t x) z) t) (fma (/ (- t x) a) y x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.05e+90) || !(z <= 1.02e+24)) {
tmp = fma(a, ((t - x) / z), t);
} else {
tmp = fma(((t - x) / a), y, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.05e+90) || !(z <= 1.02e+24)) tmp = fma(a, Float64(Float64(t - x) / z), t); else tmp = fma(Float64(Float64(t - x) / a), y, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.05e+90], N[Not[LessEqual[z, 1.02e+24]], $MachinePrecision]], N[(a * N[(N[(t - x), $MachinePrecision] / z), $MachinePrecision] + t), $MachinePrecision], N[(N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] * y + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.05 \cdot 10^{+90} \lor \neg \left(z \leq 1.02 \cdot 10^{+24}\right):\\
\;\;\;\;\mathsf{fma}\left(a, \frac{t - x}{z}, t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - x}{a}, y, x\right)\\
\end{array}
\end{array}
if z < -1.0499999999999999e90 or 1.02000000000000004e24 < z Initial program 70.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-/.f6475.1
Applied rewrites75.1%
Taylor expanded in z around inf
fp-cancel-sub-sign-invN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
*-lft-identityN/A
associate-+l-N/A
div-subN/A
lower--.f64N/A
div-subN/A
associate-/l*N/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6486.1
Applied rewrites86.1%
Taylor expanded in y around 0
Applied rewrites57.5%
if -1.0499999999999999e90 < z < 1.02000000000000004e24Initial program 86.7%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6465.3
Applied rewrites65.3%
Final simplification62.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1e+104) (not (<= z 1.3e+97))) (+ x (- t x)) (fma y (/ t a) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1e+104) || !(z <= 1.3e+97)) {
tmp = x + (t - x);
} else {
tmp = fma(y, (t / a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1e+104) || !(z <= 1.3e+97)) tmp = Float64(x + Float64(t - x)); else tmp = fma(y, Float64(t / a), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1e+104], N[Not[LessEqual[z, 1.3e+97]], $MachinePrecision]], N[(x + N[(t - x), $MachinePrecision]), $MachinePrecision], N[(y * N[(t / a), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{+104} \lor \neg \left(z \leq 1.3 \cdot 10^{+97}\right):\\
\;\;\;\;x + \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{a}, x\right)\\
\end{array}
\end{array}
if z < -1e104 or 1.3e97 < z Initial program 66.1%
Taylor expanded in z around inf
lower--.f6448.3
Applied rewrites48.3%
if -1e104 < z < 1.3e97Initial program 86.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-/.f6492.3
Applied rewrites92.3%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6461.2
Applied rewrites61.2%
Taylor expanded in x around 0
Applied rewrites50.1%
Final simplification49.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1e+104) (not (<= z 8500.0))) (+ x (- t x)) (/ (* t y) a)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1e+104) || !(z <= 8500.0)) {
tmp = x + (t - x);
} else {
tmp = (t * y) / 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) :: tmp
if ((z <= (-1d+104)) .or. (.not. (z <= 8500.0d0))) then
tmp = x + (t - x)
else
tmp = (t * y) / a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1e+104) || !(z <= 8500.0)) {
tmp = x + (t - x);
} else {
tmp = (t * y) / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1e+104) or not (z <= 8500.0): tmp = x + (t - x) else: tmp = (t * y) / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1e+104) || !(z <= 8500.0)) tmp = Float64(x + Float64(t - x)); else tmp = Float64(Float64(t * y) / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1e+104) || ~((z <= 8500.0))) tmp = x + (t - x); else tmp = (t * y) / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1e+104], N[Not[LessEqual[z, 8500.0]], $MachinePrecision]], N[(x + N[(t - x), $MachinePrecision]), $MachinePrecision], N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{+104} \lor \neg \left(z \leq 8500\right):\\
\;\;\;\;x + \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t \cdot y}{a}\\
\end{array}
\end{array}
if z < -1e104 or 8500 < z Initial program 71.0%
Taylor expanded in z around inf
lower--.f6443.9
Applied rewrites43.9%
if -1e104 < z < 8500Initial program 86.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-/.f6492.6
Applied rewrites92.6%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6464.6
Applied rewrites64.6%
Taylor expanded in x around 0
Applied rewrites24.7%
Final simplification32.5%
(FPCore (x y z t a) :precision binary64 (+ x (- t x)))
double code(double x, double y, double z, double t, double a) {
return x + (t - 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)
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 + (t - x)
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (t - x);
}
def code(x, y, z, t, a): return x + (t - x)
function code(x, y, z, t, a) return Float64(x + Float64(t - x)) end
function tmp = code(x, y, z, t, a) tmp = x + (t - x); end
code[x_, y_, z_, t_, a_] := N[(x + N[(t - x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(t - x\right)
\end{array}
Initial program 80.0%
Taylor expanded in z around inf
lower--.f6423.3
Applied rewrites23.3%
(FPCore (x y z t a) :precision binary64 (+ x (- x)))
double code(double x, double y, double z, double t, double a) {
return x + -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)
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 + -x
end function
public static double code(double x, double y, double z, double t, double a) {
return x + -x;
}
def code(x, y, z, t, a): return x + -x
function code(x, y, z, t, a) return Float64(x + Float64(-x)) end
function tmp = code(x, y, z, t, a) tmp = x + -x; end
code[x_, y_, z_, t_, a_] := N[(x + (-x)), $MachinePrecision]
\begin{array}{l}
\\
x + \left(-x\right)
\end{array}
Initial program 80.0%
Taylor expanded in z around inf
lower--.f6423.3
Applied rewrites23.3%
Taylor expanded in x around inf
Applied rewrites2.6%
herbie shell --seed 2025016
(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)))))