
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y x) (- z t)) (- a t))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (a - 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 = x + (((y - x) * (z - t)) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (a - t));
}
def code(x, y, z, t, a): return x + (((y - x) * (z - t)) / (a - t))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - x) * Float64(z - t)) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - x) * (z - t)) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y x) (- z t)) (- a t))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (a - 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 = x + (((y - x) * (z - t)) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (a - t));
}
def code(x, y, z, t, a): return x + (((y - x) * (z - t)) / (a - t))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - x) * Float64(z - t)) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - x) * (z - t)) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- y (* (/ (- y x) t) (- z a))))
(t_2 (+ x (/ (* (- y x) (- z t)) (- a t)))))
(if (<= t_2 (- INFINITY))
t_1
(if (<= t_2 -1e-291)
t_2
(if (<= t_2 0.0)
(- y (* (- x) (/ (- z a) t)))
(if (<= t_2 2e+298) t_2 t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y - (((y - x) / t) * (z - a));
double t_2 = x + (((y - x) * (z - t)) / (a - t));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= -1e-291) {
tmp = t_2;
} else if (t_2 <= 0.0) {
tmp = y - (-x * ((z - a) / t));
} else if (t_2 <= 2e+298) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = y - (((y - x) / t) * (z - a));
double t_2 = x + (((y - x) * (z - t)) / (a - t));
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = t_1;
} else if (t_2 <= -1e-291) {
tmp = t_2;
} else if (t_2 <= 0.0) {
tmp = y - (-x * ((z - a) / t));
} else if (t_2 <= 2e+298) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y - (((y - x) / t) * (z - a)) t_2 = x + (((y - x) * (z - t)) / (a - t)) tmp = 0 if t_2 <= -math.inf: tmp = t_1 elif t_2 <= -1e-291: tmp = t_2 elif t_2 <= 0.0: tmp = y - (-x * ((z - a) / t)) elif t_2 <= 2e+298: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(y - Float64(Float64(Float64(y - x) / t) * Float64(z - a))) t_2 = Float64(x + Float64(Float64(Float64(y - x) * Float64(z - t)) / Float64(a - t))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= -1e-291) tmp = t_2; elseif (t_2 <= 0.0) tmp = Float64(y - Float64(Float64(-x) * Float64(Float64(z - a) / t))); elseif (t_2 <= 2e+298) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y - (((y - x) / t) * (z - a)); t_2 = x + (((y - x) * (z - t)) / (a - t)); tmp = 0.0; if (t_2 <= -Inf) tmp = t_1; elseif (t_2 <= -1e-291) tmp = t_2; elseif (t_2 <= 0.0) tmp = y - (-x * ((z - a) / t)); elseif (t_2 <= 2e+298) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y - N[(N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision] * N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(N[(y - x), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, -1e-291], t$95$2, If[LessEqual[t$95$2, 0.0], N[(y - N[((-x) * N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+298], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y - \frac{y - x}{t} \cdot \left(z - a\right)\\
t_2 := x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -1 \cdot 10^{-291}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;y - \left(-x\right) \cdot \frac{z - a}{t}\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+298}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < -inf.0 or 1.9999999999999999e298 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) Initial program 38.1%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift--.f64N/A
flip--N/A
associate-/r/N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
difference-of-squaresN/A
lift--.f64N/A
lower-*.f64N/A
lower-+.f6457.0
Applied rewrites57.0%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6452.0
Applied rewrites52.0%
Taylor expanded in t 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--.f6471.7
Applied rewrites71.7%
if -inf.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < -9.99999999999999962e-292 or 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < 1.9999999999999999e298Initial program 97.1%
if -9.99999999999999962e-292 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < 0.0Initial program 4.2%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift--.f64N/A
flip--N/A
associate-/r/N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
difference-of-squaresN/A
lift--.f64N/A
lower-*.f64N/A
lower-+.f643.7
Applied rewrites3.7%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f641.6
Applied rewrites1.6%
Taylor expanded in t 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--.f6482.9
Applied rewrites82.9%
Taylor expanded in x around inf
Applied rewrites99.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- y x) (/ (- z t) a) x)))
(if (<= a -9e-80)
t_1
(if (<= a 5e-203)
(- y (/ (* z (- y x)) t))
(if (<= a 1.95e-16) (- y (* (- x) (/ (- z a) t))) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y - x), ((z - t) / a), x);
double tmp;
if (a <= -9e-80) {
tmp = t_1;
} else if (a <= 5e-203) {
tmp = y - ((z * (y - x)) / t);
} else if (a <= 1.95e-16) {
tmp = y - (-x * ((z - a) / t));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y - x), Float64(Float64(z - t) / a), x) tmp = 0.0 if (a <= -9e-80) tmp = t_1; elseif (a <= 5e-203) tmp = Float64(y - Float64(Float64(z * Float64(y - x)) / t)); elseif (a <= 1.95e-16) tmp = Float64(y - Float64(Float64(-x) * Float64(Float64(z - a) / t))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - x), $MachinePrecision] * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -9e-80], t$95$1, If[LessEqual[a, 5e-203], N[(y - N[(N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.95e-16], N[(y - N[((-x) * N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y - x, \frac{z - t}{a}, x\right)\\
\mathbf{if}\;a \leq -9 \cdot 10^{-80}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 5 \cdot 10^{-203}:\\
\;\;\;\;y - \frac{z \cdot \left(y - x\right)}{t}\\
\mathbf{elif}\;a \leq 1.95 \cdot 10^{-16}:\\
\;\;\;\;y - \left(-x\right) \cdot \frac{z - a}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -9.0000000000000006e-80 or 1.94999999999999989e-16 < a Initial program 71.4%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift--.f64N/A
flip--N/A
associate-/r/N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
difference-of-squaresN/A
lift--.f64N/A
lower-*.f64N/A
lower-+.f6465.2
Applied rewrites65.2%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6477.2
Applied rewrites77.2%
if -9.0000000000000006e-80 < a < 5.0000000000000002e-203Initial program 67.8%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift--.f64N/A
flip--N/A
associate-/r/N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
difference-of-squaresN/A
lift--.f64N/A
lower-*.f64N/A
lower-+.f6453.7
Applied rewrites53.7%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6419.3
Applied rewrites19.3%
Taylor expanded in t 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--.f6488.8
Applied rewrites88.8%
Taylor expanded in z around inf
Applied rewrites83.3%
if 5.0000000000000002e-203 < a < 1.94999999999999989e-16Initial program 52.6%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift--.f64N/A
flip--N/A
associate-/r/N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
difference-of-squaresN/A
lift--.f64N/A
lower-*.f64N/A
lower-+.f6443.2
Applied rewrites43.2%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6424.3
Applied rewrites24.3%
Taylor expanded in t 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--.f6477.7
Applied rewrites77.7%
Taylor expanded in x around inf
Applied rewrites74.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ z a) (- y x) x)))
(if (<= a -1.1e-76)
t_1
(if (<= a 1.3e-304)
(* (- y x) (/ z (- a t)))
(if (<= a 8.5e-40) (* (/ (- z t) t) (- y)) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((z / a), (y - x), x);
double tmp;
if (a <= -1.1e-76) {
tmp = t_1;
} else if (a <= 1.3e-304) {
tmp = (y - x) * (z / (a - t));
} else if (a <= 8.5e-40) {
tmp = ((z - t) / t) * -y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(z / a), Float64(y - x), x) tmp = 0.0 if (a <= -1.1e-76) tmp = t_1; elseif (a <= 1.3e-304) tmp = Float64(Float64(y - x) * Float64(z / Float64(a - t))); elseif (a <= 8.5e-40) tmp = Float64(Float64(Float64(z - t) / t) * Float64(-y)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z / a), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -1.1e-76], t$95$1, If[LessEqual[a, 1.3e-304], N[(N[(y - x), $MachinePrecision] * N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 8.5e-40], N[(N[(N[(z - t), $MachinePrecision] / t), $MachinePrecision] * (-y)), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{z}{a}, y - x, x\right)\\
\mathbf{if}\;a \leq -1.1 \cdot 10^{-76}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 1.3 \cdot 10^{-304}:\\
\;\;\;\;\left(y - x\right) \cdot \frac{z}{a - t}\\
\mathbf{elif}\;a \leq 8.5 \cdot 10^{-40}:\\
\;\;\;\;\frac{z - t}{t} \cdot \left(-y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.1e-76 or 8.4999999999999998e-40 < a Initial program 70.6%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6467.3
Applied rewrites67.3%
Applied rewrites68.9%
if -1.1e-76 < a < 1.29999999999999998e-304Initial program 68.3%
Taylor expanded in z 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--.f6469.3
Applied rewrites69.3%
if 1.29999999999999998e-304 < a < 8.4999999999999998e-40Initial program 60.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift--.f64N/A
flip--N/A
associate-/r/N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
difference-of-squaresN/A
lift--.f64N/A
lower-*.f64N/A
lower-+.f6451.7
Applied rewrites51.7%
Taylor expanded in a around 0
+-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-/.f64N/A
lower--.f6458.7
Applied rewrites58.7%
Taylor expanded in x around 0
Applied rewrites58.4%
Final simplification66.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ z a) (- y x) x)))
(if (<= a -1.35e-97)
t_1
(if (<= a 1.1e-304)
(* (/ (- x y) t) z)
(if (<= a 8.5e-40) (* (/ (- z t) t) (- y)) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((z / a), (y - x), x);
double tmp;
if (a <= -1.35e-97) {
tmp = t_1;
} else if (a <= 1.1e-304) {
tmp = ((x - y) / t) * z;
} else if (a <= 8.5e-40) {
tmp = ((z - t) / t) * -y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(z / a), Float64(y - x), x) tmp = 0.0 if (a <= -1.35e-97) tmp = t_1; elseif (a <= 1.1e-304) tmp = Float64(Float64(Float64(x - y) / t) * z); elseif (a <= 8.5e-40) tmp = Float64(Float64(Float64(z - t) / t) * Float64(-y)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z / a), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -1.35e-97], t$95$1, If[LessEqual[a, 1.1e-304], N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[a, 8.5e-40], N[(N[(N[(z - t), $MachinePrecision] / t), $MachinePrecision] * (-y)), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{z}{a}, y - x, x\right)\\
\mathbf{if}\;a \leq -1.35 \cdot 10^{-97}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 1.1 \cdot 10^{-304}:\\
\;\;\;\;\frac{x - y}{t} \cdot z\\
\mathbf{elif}\;a \leq 8.5 \cdot 10^{-40}:\\
\;\;\;\;\frac{z - t}{t} \cdot \left(-y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.34999999999999993e-97 or 8.4999999999999998e-40 < a Initial program 69.4%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6465.1
Applied rewrites65.1%
Applied rewrites66.5%
if -1.34999999999999993e-97 < a < 1.1e-304Initial program 72.2%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift--.f64N/A
flip--N/A
associate-/r/N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
difference-of-squaresN/A
lift--.f64N/A
lower-*.f64N/A
lower-+.f6449.6
Applied rewrites49.6%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6418.6
Applied rewrites18.6%
Taylor expanded in t 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--.f6489.4
Applied rewrites89.4%
Taylor expanded in z around inf
Applied rewrites70.2%
if 1.1e-304 < a < 8.4999999999999998e-40Initial program 60.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift--.f64N/A
flip--N/A
associate-/r/N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
difference-of-squaresN/A
lift--.f64N/A
lower-*.f64N/A
lower-+.f6451.7
Applied rewrites51.7%
Taylor expanded in a around 0
+-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-/.f64N/A
lower--.f6458.7
Applied rewrites58.7%
Taylor expanded in x around 0
Applied rewrites58.4%
Final simplification65.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -5.3e-79) (not (<= a 2.6e+34))) (fma (- y x) (/ (- z t) a) x) (- y (* (/ (- y x) t) (- z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -5.3e-79) || !(a <= 2.6e+34)) {
tmp = fma((y - x), ((z - t) / a), x);
} else {
tmp = y - (((y - x) / t) * (z - a));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -5.3e-79) || !(a <= 2.6e+34)) tmp = fma(Float64(y - x), Float64(Float64(z - t) / a), x); else tmp = Float64(y - Float64(Float64(Float64(y - x) / t) * Float64(z - a))); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -5.3e-79], N[Not[LessEqual[a, 2.6e+34]], $MachinePrecision]], N[(N[(y - x), $MachinePrecision] * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], N[(y - N[(N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision] * N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.3 \cdot 10^{-79} \lor \neg \left(a \leq 2.6 \cdot 10^{+34}\right):\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{z - t}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;y - \frac{y - x}{t} \cdot \left(z - a\right)\\
\end{array}
\end{array}
if a < -5.2999999999999998e-79 or 2.59999999999999997e34 < a Initial program 70.9%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift--.f64N/A
flip--N/A
associate-/r/N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
difference-of-squaresN/A
lift--.f64N/A
lower-*.f64N/A
lower-+.f6464.4
Applied rewrites64.4%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6477.5
Applied rewrites77.5%
if -5.2999999999999998e-79 < a < 2.59999999999999997e34Initial program 64.1%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift--.f64N/A
flip--N/A
associate-/r/N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
difference-of-squaresN/A
lift--.f64N/A
lower-*.f64N/A
lower-+.f6452.2
Applied rewrites52.2%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6423.3
Applied rewrites23.3%
Taylor expanded in t 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--.f6484.8
Applied rewrites84.8%
Final simplification80.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -9e-80) (not (<= a 3.3e-29))) (fma (- y x) (/ (- z t) a) x) (- y (/ (* z (- y x)) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -9e-80) || !(a <= 3.3e-29)) {
tmp = fma((y - x), ((z - t) / a), x);
} else {
tmp = y - ((z * (y - x)) / t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -9e-80) || !(a <= 3.3e-29)) tmp = fma(Float64(y - x), Float64(Float64(z - t) / a), x); else tmp = Float64(y - Float64(Float64(z * Float64(y - x)) / t)); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -9e-80], N[Not[LessEqual[a, 3.3e-29]], $MachinePrecision]], N[(N[(y - x), $MachinePrecision] * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], N[(y - N[(N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -9 \cdot 10^{-80} \lor \neg \left(a \leq 3.3 \cdot 10^{-29}\right):\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{z - t}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;y - \frac{z \cdot \left(y - x\right)}{t}\\
\end{array}
\end{array}
if a < -9.0000000000000006e-80 or 3.30000000000000028e-29 < a Initial program 71.0%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift--.f64N/A
flip--N/A
associate-/r/N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
difference-of-squaresN/A
lift--.f64N/A
lower-*.f64N/A
lower-+.f6465.5
Applied rewrites65.5%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6476.7
Applied rewrites76.7%
if -9.0000000000000006e-80 < a < 3.30000000000000028e-29Initial program 63.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift--.f64N/A
flip--N/A
associate-/r/N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
difference-of-squaresN/A
lift--.f64N/A
lower-*.f64N/A
lower-+.f6450.0
Applied rewrites50.0%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6420.9
Applied rewrites20.9%
Taylor expanded in t 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--.f6485.2
Applied rewrites85.2%
Taylor expanded in z around inf
Applied rewrites76.9%
Final simplification76.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1e-78) (not (<= a 5.1e-39))) (fma (- z t) (/ (- y x) a) x) (- y (/ (* z (- y x)) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1e-78) || !(a <= 5.1e-39)) {
tmp = fma((z - t), ((y - x) / a), x);
} else {
tmp = y - ((z * (y - x)) / t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1e-78) || !(a <= 5.1e-39)) tmp = fma(Float64(z - t), Float64(Float64(y - x) / a), x); else tmp = Float64(y - Float64(Float64(z * Float64(y - x)) / t)); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1e-78], N[Not[LessEqual[a, 5.1e-39]], $MachinePrecision]], N[(N[(z - t), $MachinePrecision] * N[(N[(y - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], N[(y - N[(N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1 \cdot 10^{-78} \lor \neg \left(a \leq 5.1 \cdot 10^{-39}\right):\\
\;\;\;\;\mathsf{fma}\left(z - t, \frac{y - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;y - \frac{z \cdot \left(y - x\right)}{t}\\
\end{array}
\end{array}
if a < -9.99999999999999999e-79 or 5.09999999999999988e-39 < a Initial program 70.8%
Taylor expanded in a around inf
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6475.1
Applied rewrites75.1%
if -9.99999999999999999e-79 < a < 5.09999999999999988e-39Initial program 63.9%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift--.f64N/A
flip--N/A
associate-/r/N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
difference-of-squaresN/A
lift--.f64N/A
lower-*.f64N/A
lower-+.f6449.6
Applied rewrites49.6%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6421.7
Applied rewrites21.7%
Taylor expanded in t 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--.f6484.5
Applied rewrites84.5%
Taylor expanded in z around inf
Applied rewrites76.2%
Final simplification75.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -2.9e-79) (not (<= a 3.3e-29))) (fma (/ z a) (- y x) x) (- y (/ (* z (- y x)) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -2.9e-79) || !(a <= 3.3e-29)) {
tmp = fma((z / a), (y - x), x);
} else {
tmp = y - ((z * (y - x)) / t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -2.9e-79) || !(a <= 3.3e-29)) tmp = fma(Float64(z / a), Float64(y - x), x); else tmp = Float64(y - Float64(Float64(z * Float64(y - x)) / t)); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -2.9e-79], N[Not[LessEqual[a, 3.3e-29]], $MachinePrecision]], N[(N[(z / a), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision], N[(y - N[(N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.9 \cdot 10^{-79} \lor \neg \left(a \leq 3.3 \cdot 10^{-29}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;y - \frac{z \cdot \left(y - x\right)}{t}\\
\end{array}
\end{array}
if a < -2.9000000000000001e-79 or 3.30000000000000028e-29 < a Initial program 71.0%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6467.1
Applied rewrites67.1%
Applied rewrites69.3%
if -2.9000000000000001e-79 < a < 3.30000000000000028e-29Initial program 63.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift--.f64N/A
flip--N/A
associate-/r/N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
difference-of-squaresN/A
lift--.f64N/A
lower-*.f64N/A
lower-+.f6450.0
Applied rewrites50.0%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6420.9
Applied rewrites20.9%
Taylor expanded in t 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--.f6485.2
Applied rewrites85.2%
Taylor expanded in z around inf
Applied rewrites76.9%
Final simplification72.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -8e+178) (not (<= t 1.95e+112))) (fma a (/ (- y x) t) y) (fma (/ z a) (- y x) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -8e+178) || !(t <= 1.95e+112)) {
tmp = fma(a, ((y - x) / t), y);
} else {
tmp = fma((z / a), (y - x), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -8e+178) || !(t <= 1.95e+112)) tmp = fma(a, Float64(Float64(y - x) / t), y); else tmp = fma(Float64(z / a), Float64(y - x), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -8e+178], N[Not[LessEqual[t, 1.95e+112]], $MachinePrecision]], N[(a * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision], N[(N[(z / a), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8 \cdot 10^{+178} \lor \neg \left(t \leq 1.95 \cdot 10^{+112}\right):\\
\;\;\;\;\mathsf{fma}\left(a, \frac{y - x}{t}, y\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y - x, x\right)\\
\end{array}
\end{array}
if t < -8.0000000000000004e178 or 1.94999999999999984e112 < t Initial program 30.0%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift--.f64N/A
flip--N/A
associate-/r/N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
difference-of-squaresN/A
lift--.f64N/A
lower-*.f64N/A
lower-+.f6415.7
Applied rewrites15.7%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6410.5
Applied rewrites10.5%
Taylor expanded in t 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--.f6487.2
Applied rewrites87.2%
Taylor expanded in z around 0
Applied rewrites64.8%
if -8.0000000000000004e178 < t < 1.94999999999999984e112Initial program 80.2%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6461.4
Applied rewrites61.4%
Applied rewrites61.6%
Final simplification62.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.35e-97) (not (<= a 2.9e-18))) (fma (/ z a) (- y x) x) (* (/ (- x y) t) z)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.35e-97) || !(a <= 2.9e-18)) {
tmp = fma((z / a), (y - x), x);
} else {
tmp = ((x - y) / t) * z;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.35e-97) || !(a <= 2.9e-18)) tmp = fma(Float64(z / a), Float64(y - x), x); else tmp = Float64(Float64(Float64(x - y) / t) * z); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.35e-97], N[Not[LessEqual[a, 2.9e-18]], $MachinePrecision]], N[(N[(z / a), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.35 \cdot 10^{-97} \lor \neg \left(a \leq 2.9 \cdot 10^{-18}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x - y}{t} \cdot z\\
\end{array}
\end{array}
if a < -1.34999999999999993e-97 or 2.9e-18 < a Initial program 69.8%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6465.4
Applied rewrites65.4%
Applied rewrites66.8%
if -1.34999999999999993e-97 < a < 2.9e-18Initial program 64.9%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift--.f64N/A
flip--N/A
associate-/r/N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
difference-of-squaresN/A
lift--.f64N/A
lower-*.f64N/A
lower-+.f6451.3
Applied rewrites51.3%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6420.3
Applied rewrites20.3%
Taylor expanded in t 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--.f6487.1
Applied rewrites87.1%
Taylor expanded in z around inf
Applied rewrites54.0%
Final simplification61.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.46e-97) (not (<= a 2.55e+34))) (fma (/ y a) z x) (* (/ (- x y) t) z)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.46e-97) || !(a <= 2.55e+34)) {
tmp = fma((y / a), z, x);
} else {
tmp = ((x - y) / t) * z;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.46e-97) || !(a <= 2.55e+34)) tmp = fma(Float64(y / a), z, x); else tmp = Float64(Float64(Float64(x - y) / t) * z); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.46e-97], N[Not[LessEqual[a, 2.55e+34]], $MachinePrecision]], N[(N[(y / a), $MachinePrecision] * z + x), $MachinePrecision], N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.46 \cdot 10^{-97} \lor \neg \left(a \leq 2.55 \cdot 10^{+34}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x - y}{t} \cdot z\\
\end{array}
\end{array}
if a < -1.4600000000000001e-97 or 2.55000000000000018e34 < a Initial program 69.2%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6465.3
Applied rewrites65.3%
Taylor expanded in x around 0
Applied rewrites58.5%
if -1.4600000000000001e-97 < a < 2.55000000000000018e34Initial program 66.0%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift--.f64N/A
flip--N/A
associate-/r/N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
difference-of-squaresN/A
lift--.f64N/A
lower-*.f64N/A
lower-+.f6453.1
Applied rewrites53.1%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6423.1
Applied rewrites23.1%
Taylor expanded in t 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.5
Applied rewrites86.5%
Taylor expanded in z around inf
Applied rewrites54.3%
Final simplification56.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.46e-97) (not (<= a 1.52e+34))) (fma (/ y a) z x) (/ (* (- x y) z) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.46e-97) || !(a <= 1.52e+34)) {
tmp = fma((y / a), z, x);
} else {
tmp = ((x - y) * z) / t;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.46e-97) || !(a <= 1.52e+34)) tmp = fma(Float64(y / a), z, x); else tmp = Float64(Float64(Float64(x - y) * z) / t); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.46e-97], N[Not[LessEqual[a, 1.52e+34]], $MachinePrecision]], N[(N[(y / a), $MachinePrecision] * z + x), $MachinePrecision], N[(N[(N[(x - y), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.46 \cdot 10^{-97} \lor \neg \left(a \leq 1.52 \cdot 10^{+34}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x - y\right) \cdot z}{t}\\
\end{array}
\end{array}
if a < -1.4600000000000001e-97 or 1.52000000000000001e34 < a Initial program 69.2%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6465.3
Applied rewrites65.3%
Taylor expanded in x around 0
Applied rewrites58.5%
if -1.4600000000000001e-97 < a < 1.52000000000000001e34Initial program 66.0%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift--.f64N/A
flip--N/A
associate-/r/N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
difference-of-squaresN/A
lift--.f64N/A
lower-*.f64N/A
lower-+.f6453.1
Applied rewrites53.1%
Taylor expanded in a around 0
+-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-/.f64N/A
lower--.f6464.7
Applied rewrites64.7%
Taylor expanded in z around inf
Applied rewrites50.5%
Final simplification55.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -7.5e+178) (not (<= t 1.9e+132))) y (fma (/ y a) z x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -7.5e+178) || !(t <= 1.9e+132)) {
tmp = y;
} else {
tmp = fma((y / a), z, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -7.5e+178) || !(t <= 1.9e+132)) tmp = y; else tmp = fma(Float64(y / a), z, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -7.5e+178], N[Not[LessEqual[t, 1.9e+132]], $MachinePrecision]], y, N[(N[(y / a), $MachinePrecision] * z + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.5 \cdot 10^{+178} \lor \neg \left(t \leq 1.9 \cdot 10^{+132}\right):\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, z, x\right)\\
\end{array}
\end{array}
if t < -7.4999999999999995e178 or 1.90000000000000003e132 < t Initial program 28.9%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift--.f64N/A
flip--N/A
associate-/r/N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
difference-of-squaresN/A
lift--.f64N/A
lower-*.f64N/A
lower-+.f6411.7
Applied rewrites11.7%
Taylor expanded in a around 0
+-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-/.f64N/A
lower--.f6445.1
Applied rewrites45.1%
Taylor expanded in z around 0
Applied rewrites35.1%
Applied rewrites55.2%
if -7.4999999999999995e178 < t < 1.90000000000000003e132Initial program 79.2%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6460.9
Applied rewrites60.9%
Taylor expanded in x around 0
Applied rewrites53.4%
Final simplification53.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.6e+106) (not (<= z 1.12e+83))) (* y (/ z a)) (- x (- y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.6e+106) || !(z <= 1.12e+83)) {
tmp = y * (z / a);
} else {
tmp = x - -y;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
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 <= (-1.6d+106)) .or. (.not. (z <= 1.12d+83))) then
tmp = y * (z / a)
else
tmp = x - -y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.6e+106) || !(z <= 1.12e+83)) {
tmp = y * (z / a);
} else {
tmp = x - -y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.6e+106) or not (z <= 1.12e+83): tmp = y * (z / a) else: tmp = x - -y return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.6e+106) || !(z <= 1.12e+83)) tmp = Float64(y * Float64(z / a)); else tmp = Float64(x - Float64(-y)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.6e+106) || ~((z <= 1.12e+83))) tmp = y * (z / a); else tmp = x - -y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.6e+106], N[Not[LessEqual[z, 1.12e+83]], $MachinePrecision]], N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision], N[(x - (-y)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.6 \cdot 10^{+106} \lor \neg \left(z \leq 1.12 \cdot 10^{+83}\right):\\
\;\;\;\;y \cdot \frac{z}{a}\\
\mathbf{else}:\\
\;\;\;\;x - \left(-y\right)\\
\end{array}
\end{array}
if z < -1.5999999999999999e106 or 1.12e83 < z Initial program 72.9%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6455.8
Applied rewrites55.8%
Taylor expanded in x around 0
Applied rewrites30.6%
Applied rewrites36.0%
if -1.5999999999999999e106 < z < 1.12e83Initial program 64.7%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift--.f64N/A
flip--N/A
associate-/r/N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
difference-of-squaresN/A
lift--.f64N/A
lower-*.f64N/A
lower-+.f6457.2
Applied rewrites57.2%
Taylor expanded in a around 0
+-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-/.f64N/A
lower--.f6427.2
Applied rewrites27.2%
Taylor expanded in z around 0
Applied rewrites19.3%
Taylor expanded in x around 0
Applied rewrites42.3%
Final simplification39.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.6e+106) (* y (/ z a)) (if (<= z 1.12e+83) (- x (- y)) (* (/ y a) z))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.6e+106) {
tmp = y * (z / a);
} else if (z <= 1.12e+83) {
tmp = x - -y;
} else {
tmp = (y / a) * z;
}
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 <= (-1.6d+106)) then
tmp = y * (z / a)
else if (z <= 1.12d+83) then
tmp = x - -y
else
tmp = (y / a) * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.6e+106) {
tmp = y * (z / a);
} else if (z <= 1.12e+83) {
tmp = x - -y;
} else {
tmp = (y / a) * z;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.6e+106: tmp = y * (z / a) elif z <= 1.12e+83: tmp = x - -y else: tmp = (y / a) * z return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.6e+106) tmp = Float64(y * Float64(z / a)); elseif (z <= 1.12e+83) tmp = Float64(x - Float64(-y)); else tmp = Float64(Float64(y / a) * z); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.6e+106) tmp = y * (z / a); elseif (z <= 1.12e+83) tmp = x - -y; else tmp = (y / a) * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.6e+106], N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.12e+83], N[(x - (-y)), $MachinePrecision], N[(N[(y / a), $MachinePrecision] * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.6 \cdot 10^{+106}:\\
\;\;\;\;y \cdot \frac{z}{a}\\
\mathbf{elif}\;z \leq 1.12 \cdot 10^{+83}:\\
\;\;\;\;x - \left(-y\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a} \cdot z\\
\end{array}
\end{array}
if z < -1.5999999999999999e106Initial program 69.0%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6451.7
Applied rewrites51.7%
Taylor expanded in x around 0
Applied rewrites26.5%
Applied rewrites30.6%
if -1.5999999999999999e106 < z < 1.12e83Initial program 64.7%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift--.f64N/A
flip--N/A
associate-/r/N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
difference-of-squaresN/A
lift--.f64N/A
lower-*.f64N/A
lower-+.f6457.2
Applied rewrites57.2%
Taylor expanded in a around 0
+-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-/.f64N/A
lower--.f6427.2
Applied rewrites27.2%
Taylor expanded in z around 0
Applied rewrites19.3%
Taylor expanded in x around 0
Applied rewrites42.3%
if 1.12e83 < z Initial program 76.3%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6459.4
Applied rewrites59.4%
Taylor expanded in x around 0
Applied rewrites34.3%
Applied rewrites42.7%
Final simplification40.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -2.2e+242) (not (<= t 2.8e+125))) y (- x (- y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -2.2e+242) || !(t <= 2.8e+125)) {
tmp = y;
} else {
tmp = x - -y;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
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 ((t <= (-2.2d+242)) .or. (.not. (t <= 2.8d+125))) then
tmp = y
else
tmp = x - -y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -2.2e+242) || !(t <= 2.8e+125)) {
tmp = y;
} else {
tmp = x - -y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -2.2e+242) or not (t <= 2.8e+125): tmp = y else: tmp = x - -y return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -2.2e+242) || !(t <= 2.8e+125)) tmp = y; else tmp = Float64(x - Float64(-y)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -2.2e+242) || ~((t <= 2.8e+125))) tmp = y; else tmp = x - -y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -2.2e+242], N[Not[LessEqual[t, 2.8e+125]], $MachinePrecision]], y, N[(x - (-y)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.2 \cdot 10^{+242} \lor \neg \left(t \leq 2.8 \cdot 10^{+125}\right):\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x - \left(-y\right)\\
\end{array}
\end{array}
if t < -2.19999999999999999e242 or 2.8000000000000001e125 < t Initial program 29.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift--.f64N/A
flip--N/A
associate-/r/N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
difference-of-squaresN/A
lift--.f64N/A
lower-*.f64N/A
lower-+.f6414.2
Applied rewrites14.2%
Taylor expanded in a around 0
+-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-/.f64N/A
lower--.f6442.1
Applied rewrites42.1%
Taylor expanded in z around 0
Applied rewrites34.6%
Applied rewrites56.6%
if -2.19999999999999999e242 < t < 2.8000000000000001e125Initial program 77.9%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift--.f64N/A
flip--N/A
associate-/r/N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
difference-of-squaresN/A
lift--.f64N/A
lower-*.f64N/A
lower-+.f6470.6
Applied rewrites70.6%
Taylor expanded in a around 0
+-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-/.f64N/A
lower--.f6435.2
Applied rewrites35.2%
Taylor expanded in z around 0
Applied rewrites10.3%
Taylor expanded in x around 0
Applied rewrites30.7%
Final simplification36.1%
(FPCore (x y z t a) :precision binary64 y)
double code(double x, double y, double z, double t, double a) {
return y;
}
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 = y
end function
public static double code(double x, double y, double z, double t, double a) {
return y;
}
def code(x, y, z, t, a): return y
function code(x, y, z, t, a) return y end
function tmp = code(x, y, z, t, a) tmp = y; end
code[x_, y_, z_, t_, a_] := y
\begin{array}{l}
\\
y
\end{array}
Initial program 67.8%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift--.f64N/A
flip--N/A
associate-/r/N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
difference-of-squaresN/A
lift--.f64N/A
lower-*.f64N/A
lower-+.f6458.9
Applied rewrites58.9%
Taylor expanded in a around 0
+-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-/.f64N/A
lower--.f6436.7
Applied rewrites36.7%
Taylor expanded in z around 0
Applied rewrites15.3%
Applied rewrites21.2%
Final simplification21.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* (/ (- y x) 1.0) (/ (- z t) (- a t))))))
(if (< a -1.6153062845442575e-142)
t_1
(if (< a 3.774403170083174e-182) (- y (* (/ z t) (- y x))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - x) / 1.0) * ((z - t) / (a - t)));
double tmp;
if (a < -1.6153062845442575e-142) {
tmp = t_1;
} else if (a < 3.774403170083174e-182) {
tmp = y - ((z / t) * (y - x));
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
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 = x + (((y - x) / 1.0d0) * ((z - t) / (a - t)))
if (a < (-1.6153062845442575d-142)) then
tmp = t_1
else if (a < 3.774403170083174d-182) then
tmp = y - ((z / t) * (y - x))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - x) / 1.0) * ((z - t) / (a - t)));
double tmp;
if (a < -1.6153062845442575e-142) {
tmp = t_1;
} else if (a < 3.774403170083174e-182) {
tmp = y - ((z / t) * (y - x));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (((y - x) / 1.0) * ((z - t) / (a - t))) tmp = 0 if a < -1.6153062845442575e-142: tmp = t_1 elif a < 3.774403170083174e-182: tmp = y - ((z / t) * (y - x)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(Float64(y - x) / 1.0) * Float64(Float64(z - t) / Float64(a - t)))) tmp = 0.0 if (a < -1.6153062845442575e-142) tmp = t_1; elseif (a < 3.774403170083174e-182) tmp = Float64(y - Float64(Float64(z / t) * Float64(y - x))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (((y - x) / 1.0) * ((z - t) / (a - t))); tmp = 0.0; if (a < -1.6153062845442575e-142) tmp = t_1; elseif (a < 3.774403170083174e-182) tmp = y - ((z / t) * (y - x)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(N[(y - x), $MachinePrecision] / 1.0), $MachinePrecision] * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[a, -1.6153062845442575e-142], t$95$1, If[Less[a, 3.774403170083174e-182], N[(y - N[(N[(z / t), $MachinePrecision] * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y - x}{1} \cdot \frac{z - t}{a - t}\\
\mathbf{if}\;a < -1.6153062845442575 \cdot 10^{-142}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a < 3.774403170083174 \cdot 10^{-182}:\\
\;\;\;\;y - \frac{z}{t} \cdot \left(y - x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2024359
(FPCore (x y z t a)
:name "Graphics.Rendering.Chart.Axis.Types:linMap from Chart-1.5.3"
:precision binary64
:alt
(! :herbie-platform default (if (< a -646122513817703/4000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ x (* (/ (- y x) 1) (/ (- z t) (- a t)))) (if (< a 1887201585041587/50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- y (* (/ z t) (- y x))) (+ x (* (/ (- y x) 1) (/ (- z t) (- a t)))))))
(+ x (/ (* (- y x) (- z t)) (- a t))))