
(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 18 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
(if (<= t -1.12e+106)
(fma (- (- y x)) (/ (- z a) t) y)
(if (<= t 1.1e+141)
(fma (/ (- z t) (- a t)) (- y x) x)
(fma (/ (fma -1.0 y x) t) (- z a) y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.12e+106) {
tmp = fma(-(y - x), ((z - a) / t), y);
} else if (t <= 1.1e+141) {
tmp = fma(((z - t) / (a - t)), (y - x), x);
} else {
tmp = fma((fma(-1.0, y, x) / t), (z - a), y);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.12e+106) tmp = fma(Float64(-Float64(y - x)), Float64(Float64(z - a) / t), y); elseif (t <= 1.1e+141) tmp = fma(Float64(Float64(z - t) / Float64(a - t)), Float64(y - x), x); else tmp = fma(Float64(fma(-1.0, y, x) / t), Float64(z - a), y); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.12e+106], N[((-N[(y - x), $MachinePrecision]) * N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision], If[LessEqual[t, 1.1e+141], N[(N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(-1.0 * y + x), $MachinePrecision] / t), $MachinePrecision] * N[(z - a), $MachinePrecision] + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.12 \cdot 10^{+106}:\\
\;\;\;\;\mathsf{fma}\left(-\left(y - x\right), \frac{z - a}{t}, y\right)\\
\mathbf{elif}\;t \leq 1.1 \cdot 10^{+141}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - t}{a - t}, y - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\mathsf{fma}\left(-1, y, x\right)}{t}, z - a, y\right)\\
\end{array}
\end{array}
if t < -1.1200000000000001e106Initial program 34.3%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6471.0
Applied rewrites71.0%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r*N/A
mul-1-negN/A
associate-*r/N/A
div-subN/A
mul-1-negN/A
associate-*r*N/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
Applied rewrites91.2%
if -1.1200000000000001e106 < t < 1.1e141Initial program 88.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6493.8
Applied rewrites93.8%
if 1.1e141 < t Initial program 37.0%
Taylor expanded in t around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
mul-1-negN/A
div-subN/A
associate-/l*N/A
associate-/l*N/A
distribute-rgt-out--N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
Applied rewrites80.2%
Final simplification91.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (/ (* (- z t) y) (- a t)))))
(if (<= t -1.8e+56)
(fma (- (- y x)) (/ (- z a) t) y)
(if (<= t -7e-86)
t_1
(if (<= t 3.8e-115)
(+ x (/ (* (- y x) z) (- a t)))
(if (<= t 1.82e+137) t_1 (fma (/ (fma -1.0 y x) t) (- z a) y)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((z - t) * y) / (a - t));
double tmp;
if (t <= -1.8e+56) {
tmp = fma(-(y - x), ((z - a) / t), y);
} else if (t <= -7e-86) {
tmp = t_1;
} else if (t <= 3.8e-115) {
tmp = x + (((y - x) * z) / (a - t));
} else if (t <= 1.82e+137) {
tmp = t_1;
} else {
tmp = fma((fma(-1.0, y, x) / t), (z - a), y);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(Float64(z - t) * y) / Float64(a - t))) tmp = 0.0 if (t <= -1.8e+56) tmp = fma(Float64(-Float64(y - x)), Float64(Float64(z - a) / t), y); elseif (t <= -7e-86) tmp = t_1; elseif (t <= 3.8e-115) tmp = Float64(x + Float64(Float64(Float64(y - x) * z) / Float64(a - t))); elseif (t <= 1.82e+137) tmp = t_1; else tmp = fma(Float64(fma(-1.0, y, x) / t), Float64(z - a), y); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.8e+56], N[((-N[(y - x), $MachinePrecision]) * N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision], If[LessEqual[t, -7e-86], t$95$1, If[LessEqual[t, 3.8e-115], N[(x + N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.82e+137], t$95$1, N[(N[(N[(-1.0 * y + x), $MachinePrecision] / t), $MachinePrecision] * N[(z - a), $MachinePrecision] + y), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{\left(z - t\right) \cdot y}{a - t}\\
\mathbf{if}\;t \leq -1.8 \cdot 10^{+56}:\\
\;\;\;\;\mathsf{fma}\left(-\left(y - x\right), \frac{z - a}{t}, y\right)\\
\mathbf{elif}\;t \leq -7 \cdot 10^{-86}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 3.8 \cdot 10^{-115}:\\
\;\;\;\;x + \frac{\left(y - x\right) \cdot z}{a - t}\\
\mathbf{elif}\;t \leq 1.82 \cdot 10^{+137}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\mathsf{fma}\left(-1, y, x\right)}{t}, z - a, y\right)\\
\end{array}
\end{array}
if t < -1.79999999999999999e56Initial program 40.1%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6474.6
Applied rewrites74.6%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r*N/A
mul-1-negN/A
associate-*r/N/A
div-subN/A
mul-1-negN/A
associate-*r*N/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
Applied rewrites85.9%
if -1.79999999999999999e56 < t < -7.00000000000000041e-86 or 3.79999999999999992e-115 < t < 1.81999999999999999e137Initial program 84.8%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f6480.3
Applied rewrites80.3%
if -7.00000000000000041e-86 < t < 3.79999999999999992e-115Initial program 94.5%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6489.7
Applied rewrites89.7%
if 1.81999999999999999e137 < t Initial program 41.1%
Taylor expanded in t around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
mul-1-negN/A
div-subN/A
associate-/l*N/A
associate-/l*N/A
distribute-rgt-out--N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
Applied rewrites81.4%
Final simplification85.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (/ (* (- z t) y) (- a t))))
(t_2 (fma (- (- y x)) (/ (- z a) t) y)))
(if (<= t -1.8e+56)
t_2
(if (<= t -7e-86)
t_1
(if (<= t 3.8e-115)
(+ x (/ (* (- y x) z) (- a t)))
(if (<= t 1.82e+137) t_1 t_2))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((z - t) * y) / (a - t));
double t_2 = fma(-(y - x), ((z - a) / t), y);
double tmp;
if (t <= -1.8e+56) {
tmp = t_2;
} else if (t <= -7e-86) {
tmp = t_1;
} else if (t <= 3.8e-115) {
tmp = x + (((y - x) * z) / (a - t));
} else if (t <= 1.82e+137) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(Float64(z - t) * y) / Float64(a - t))) t_2 = fma(Float64(-Float64(y - x)), Float64(Float64(z - a) / t), y) tmp = 0.0 if (t <= -1.8e+56) tmp = t_2; elseif (t <= -7e-86) tmp = t_1; elseif (t <= 3.8e-115) tmp = Float64(x + Float64(Float64(Float64(y - x) * z) / Float64(a - t))); elseif (t <= 1.82e+137) tmp = t_1; else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[((-N[(y - x), $MachinePrecision]) * N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision]}, If[LessEqual[t, -1.8e+56], t$95$2, If[LessEqual[t, -7e-86], t$95$1, If[LessEqual[t, 3.8e-115], N[(x + N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.82e+137], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{\left(z - t\right) \cdot y}{a - t}\\
t_2 := \mathsf{fma}\left(-\left(y - x\right), \frac{z - a}{t}, y\right)\\
\mathbf{if}\;t \leq -1.8 \cdot 10^{+56}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq -7 \cdot 10^{-86}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 3.8 \cdot 10^{-115}:\\
\;\;\;\;x + \frac{\left(y - x\right) \cdot z}{a - t}\\
\mathbf{elif}\;t \leq 1.82 \cdot 10^{+137}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if t < -1.79999999999999999e56 or 1.81999999999999999e137 < t Initial program 40.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6471.8
Applied rewrites71.8%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r*N/A
mul-1-negN/A
associate-*r/N/A
div-subN/A
mul-1-negN/A
associate-*r*N/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
Applied rewrites84.3%
if -1.79999999999999999e56 < t < -7.00000000000000041e-86 or 3.79999999999999992e-115 < t < 1.81999999999999999e137Initial program 84.8%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f6480.3
Applied rewrites80.3%
if -7.00000000000000041e-86 < t < 3.79999999999999992e-115Initial program 94.5%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6489.7
Applied rewrites89.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- z t) (/ y a) x)))
(if (<= a -4.6e-115)
t_1
(if (<= a 3.95e-162)
(* (/ (- x y) t) z)
(if (<= a 1.15e-46) (fma 1.0 (- y x) x) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((z - t), (y / a), x);
double tmp;
if (a <= -4.6e-115) {
tmp = t_1;
} else if (a <= 3.95e-162) {
tmp = ((x - y) / t) * z;
} else if (a <= 1.15e-46) {
tmp = fma(1.0, (y - x), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(z - t), Float64(y / a), x) tmp = 0.0 if (a <= -4.6e-115) tmp = t_1; elseif (a <= 3.95e-162) tmp = Float64(Float64(Float64(x - y) / t) * z); elseif (a <= 1.15e-46) tmp = fma(1.0, Float64(y - x), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -4.6e-115], t$95$1, If[LessEqual[a, 3.95e-162], N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[a, 1.15e-46], N[(1.0 * N[(y - x), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(z - t, \frac{y}{a}, x\right)\\
\mathbf{if}\;a \leq -4.6 \cdot 10^{-115}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 3.95 \cdot 10^{-162}:\\
\;\;\;\;\frac{x - y}{t} \cdot z\\
\mathbf{elif}\;a \leq 1.15 \cdot 10^{-46}:\\
\;\;\;\;\mathsf{fma}\left(1, y - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -4.59999999999999969e-115 or 1.15e-46 < a Initial program 74.2%
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--.f6471.4
Applied rewrites71.4%
Taylor expanded in x around 0
Applied rewrites62.7%
if -4.59999999999999969e-115 < a < 3.9500000000000001e-162Initial program 71.7%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6479.7
Applied rewrites79.7%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r*N/A
mul-1-negN/A
associate-*r/N/A
div-subN/A
mul-1-negN/A
associate-*r*N/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
Applied rewrites88.8%
Taylor expanded in z around inf
Applied rewrites47.9%
if 3.9500000000000001e-162 < a < 1.15e-46Initial program 70.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6484.9
Applied rewrites84.9%
Taylor expanded in t around inf
Applied rewrites44.3%
Final simplification56.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.25e+66) (not (<= a 1.55e-46))) (+ x (* (/ (- z t) a) (- y x))) (fma (- (- y x)) (/ (- z a) t) y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.25e+66) || !(a <= 1.55e-46)) {
tmp = x + (((z - t) / a) * (y - x));
} else {
tmp = fma(-(y - x), ((z - a) / t), y);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.25e+66) || !(a <= 1.55e-46)) tmp = Float64(x + Float64(Float64(Float64(z - t) / a) * Float64(y - x))); else tmp = fma(Float64(-Float64(y - x)), Float64(Float64(z - a) / t), y); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.25e+66], N[Not[LessEqual[a, 1.55e-46]], $MachinePrecision]], N[(x + N[(N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision] * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-N[(y - x), $MachinePrecision]) * N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.25 \cdot 10^{+66} \lor \neg \left(a \leq 1.55 \cdot 10^{-46}\right):\\
\;\;\;\;x + \frac{z - t}{a} \cdot \left(y - x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-\left(y - x\right), \frac{z - a}{t}, y\right)\\
\end{array}
\end{array}
if a < -1.24999999999999998e66 or 1.55e-46 < a Initial program 74.9%
Taylor expanded in a around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6480.3
Applied rewrites80.3%
if -1.24999999999999998e66 < a < 1.55e-46Initial program 71.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6481.9
Applied rewrites81.9%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r*N/A
mul-1-negN/A
associate-*r/N/A
div-subN/A
mul-1-negN/A
associate-*r*N/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
Applied rewrites78.9%
Final simplification79.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.25e+66) (not (<= a 1.6e-46))) (fma (- z t) (/ (- y x) a) x) (fma (- (- y x)) (/ (- z a) t) y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.25e+66) || !(a <= 1.6e-46)) {
tmp = fma((z - t), ((y - x) / a), x);
} else {
tmp = fma(-(y - x), ((z - a) / t), y);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.25e+66) || !(a <= 1.6e-46)) tmp = fma(Float64(z - t), Float64(Float64(y - x) / a), x); else tmp = fma(Float64(-Float64(y - x)), Float64(Float64(z - a) / t), y); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.25e+66], N[Not[LessEqual[a, 1.6e-46]], $MachinePrecision]], N[(N[(z - t), $MachinePrecision] * N[(N[(y - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], N[((-N[(y - x), $MachinePrecision]) * N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.25 \cdot 10^{+66} \lor \neg \left(a \leq 1.6 \cdot 10^{-46}\right):\\
\;\;\;\;\mathsf{fma}\left(z - t, \frac{y - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-\left(y - x\right), \frac{z - a}{t}, y\right)\\
\end{array}
\end{array}
if a < -1.24999999999999998e66 or 1.6e-46 < a Initial program 74.9%
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--.f6478.9
Applied rewrites78.9%
if -1.24999999999999998e66 < a < 1.6e-46Initial program 71.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6481.9
Applied rewrites81.9%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r*N/A
mul-1-negN/A
associate-*r/N/A
div-subN/A
mul-1-negN/A
associate-*r*N/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
Applied rewrites78.9%
Final simplification78.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -26000000000000.0) (not (<= a 1.6e-46))) (fma (- z t) (/ (- y x) a) x) (- y (/ (* (- z a) (- y x)) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -26000000000000.0) || !(a <= 1.6e-46)) {
tmp = fma((z - t), ((y - x) / a), x);
} else {
tmp = y - (((z - a) * (y - x)) / t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -26000000000000.0) || !(a <= 1.6e-46)) tmp = fma(Float64(z - t), Float64(Float64(y - x) / a), x); else tmp = Float64(y - Float64(Float64(Float64(z - a) * Float64(y - x)) / t)); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -26000000000000.0], N[Not[LessEqual[a, 1.6e-46]], $MachinePrecision]], N[(N[(z - t), $MachinePrecision] * N[(N[(y - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], N[(y - N[(N[(N[(z - a), $MachinePrecision] * N[(y - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -26000000000000 \lor \neg \left(a \leq 1.6 \cdot 10^{-46}\right):\\
\;\;\;\;\mathsf{fma}\left(z - t, \frac{y - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;y - \frac{\left(z - a\right) \cdot \left(y - x\right)}{t}\\
\end{array}
\end{array}
if a < -2.6e13 or 1.6e-46 < a Initial program 75.5%
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--.f6477.0
Applied rewrites77.0%
if -2.6e13 < a < 1.6e-46Initial program 70.7%
Taylor expanded in t around inf
Applied rewrites60.2%
Taylor expanded in t around inf
Applied rewrites74.7%
Final simplification75.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.25e+66) (not (<= a 1.6e-46))) (fma (- z t) (/ (- y x) a) x) (fma (/ (- x y) t) z y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.25e+66) || !(a <= 1.6e-46)) {
tmp = fma((z - t), ((y - x) / a), x);
} else {
tmp = fma(((x - y) / t), z, y);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.25e+66) || !(a <= 1.6e-46)) tmp = fma(Float64(z - t), Float64(Float64(y - x) / a), x); else tmp = fma(Float64(Float64(x - y) / t), z, y); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.25e+66], N[Not[LessEqual[a, 1.6e-46]], $MachinePrecision]], N[(N[(z - t), $MachinePrecision] * N[(N[(y - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * z + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.25 \cdot 10^{+66} \lor \neg \left(a \leq 1.6 \cdot 10^{-46}\right):\\
\;\;\;\;\mathsf{fma}\left(z - t, \frac{y - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - y}{t}, z, y\right)\\
\end{array}
\end{array}
if a < -1.24999999999999998e66 or 1.6e-46 < a Initial program 74.9%
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--.f6478.9
Applied rewrites78.9%
if -1.24999999999999998e66 < a < 1.6e-46Initial program 71.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6481.9
Applied rewrites81.9%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r*N/A
mul-1-negN/A
associate-*r/N/A
div-subN/A
mul-1-negN/A
associate-*r*N/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
Applied rewrites78.9%
Taylor expanded in a around 0
Applied rewrites70.1%
Final simplification74.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma 1.0 (- y x) x)))
(if (<= t -1.3e+50)
t_1
(if (<= t 2.5e+138)
(fma (/ y a) z x)
(if (<= t 3.7e+165) (* x (/ z t)) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(1.0, (y - x), x);
double tmp;
if (t <= -1.3e+50) {
tmp = t_1;
} else if (t <= 2.5e+138) {
tmp = fma((y / a), z, x);
} else if (t <= 3.7e+165) {
tmp = x * (z / t);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(1.0, Float64(y - x), x) tmp = 0.0 if (t <= -1.3e+50) tmp = t_1; elseif (t <= 2.5e+138) tmp = fma(Float64(y / a), z, x); elseif (t <= 3.7e+165) tmp = Float64(x * Float64(z / t)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(1.0 * N[(y - x), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t, -1.3e+50], t$95$1, If[LessEqual[t, 2.5e+138], N[(N[(y / a), $MachinePrecision] * z + x), $MachinePrecision], If[LessEqual[t, 3.7e+165], N[(x * N[(z / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(1, y - x, x\right)\\
\mathbf{if}\;t \leq -1.3 \cdot 10^{+50}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.5 \cdot 10^{+138}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, z, x\right)\\
\mathbf{elif}\;t \leq 3.7 \cdot 10^{+165}:\\
\;\;\;\;x \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.3000000000000001e50 or 3.70000000000000006e165 < t Initial program 41.8%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6473.9
Applied rewrites73.9%
Taylor expanded in t around inf
Applied rewrites46.0%
if -1.3000000000000001e50 < t < 2.50000000000000008e138Initial program 89.8%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6466.8
Applied rewrites66.8%
Taylor expanded in x around 0
Applied rewrites54.9%
if 2.50000000000000008e138 < t < 3.70000000000000006e165Initial program 42.0%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6460.9
Applied rewrites60.9%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r*N/A
mul-1-negN/A
associate-*r/N/A
div-subN/A
mul-1-negN/A
associate-*r*N/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
Applied rewrites99.7%
Taylor expanded in z around inf
Applied rewrites70.7%
Taylor expanded in x around inf
Applied rewrites70.5%
Final simplification52.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma 1.0 (- y x) x)))
(if (<= t -2.3e+32)
t_1
(if (<= t 6e+113) (/ (* y z) a) (if (<= t 3.7e+165) (* x (/ z t)) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(1.0, (y - x), x);
double tmp;
if (t <= -2.3e+32) {
tmp = t_1;
} else if (t <= 6e+113) {
tmp = (y * z) / a;
} else if (t <= 3.7e+165) {
tmp = x * (z / t);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(1.0, Float64(y - x), x) tmp = 0.0 if (t <= -2.3e+32) tmp = t_1; elseif (t <= 6e+113) tmp = Float64(Float64(y * z) / a); elseif (t <= 3.7e+165) tmp = Float64(x * Float64(z / t)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(1.0 * N[(y - x), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t, -2.3e+32], t$95$1, If[LessEqual[t, 6e+113], N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[t, 3.7e+165], N[(x * N[(z / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(1, y - x, x\right)\\
\mathbf{if}\;t \leq -2.3 \cdot 10^{+32}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 6 \cdot 10^{+113}:\\
\;\;\;\;\frac{y \cdot z}{a}\\
\mathbf{elif}\;t \leq 3.7 \cdot 10^{+165}:\\
\;\;\;\;x \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -2.3e32 or 3.70000000000000006e165 < t Initial program 41.3%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6473.0
Applied rewrites73.0%
Taylor expanded in t around inf
Applied rewrites45.4%
if -2.3e32 < t < 6e113Initial program 90.1%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6467.0
Applied rewrites67.0%
Taylor expanded in x around 0
Applied rewrites24.0%
if 6e113 < t < 3.70000000000000006e165Initial program 58.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6472.0
Applied rewrites72.0%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r*N/A
mul-1-negN/A
associate-*r/N/A
div-subN/A
mul-1-negN/A
associate-*r*N/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
Applied rewrites79.0%
Taylor expanded in z around inf
Applied rewrites51.4%
Taylor expanded in x around inf
Applied rewrites58.1%
Final simplification32.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.25e+66) (not (<= a 1.55e-46))) (fma (/ z a) (- y x) x) (fma (/ (- x y) t) z y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.25e+66) || !(a <= 1.55e-46)) {
tmp = fma((z / a), (y - x), x);
} else {
tmp = fma(((x - y) / t), z, y);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.25e+66) || !(a <= 1.55e-46)) tmp = fma(Float64(z / a), Float64(y - x), x); else tmp = fma(Float64(Float64(x - y) / t), z, y); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.25e+66], N[Not[LessEqual[a, 1.55e-46]], $MachinePrecision]], N[(N[(z / a), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * z + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.25 \cdot 10^{+66} \lor \neg \left(a \leq 1.55 \cdot 10^{-46}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - y}{t}, z, y\right)\\
\end{array}
\end{array}
if a < -1.24999999999999998e66 or 1.55e-46 < a Initial program 74.9%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6491.4
Applied rewrites91.4%
Taylor expanded in t around 0
lower-/.f6473.9
Applied rewrites73.9%
if -1.24999999999999998e66 < a < 1.55e-46Initial program 71.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6481.9
Applied rewrites81.9%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r*N/A
mul-1-negN/A
associate-*r/N/A
div-subN/A
mul-1-negN/A
associate-*r*N/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
Applied rewrites78.9%
Taylor expanded in a around 0
Applied rewrites70.1%
Final simplification71.9%
(FPCore (x y z t a) :precision binary64 (if (<= a -1.26e+60) (fma (- z t) (/ y a) x) (if (<= a 1.6e-46) (fma (/ (- x y) t) z y) (fma (/ (- y x) a) z x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.26e+60) {
tmp = fma((z - t), (y / a), x);
} else if (a <= 1.6e-46) {
tmp = fma(((x - y) / t), z, y);
} else {
tmp = fma(((y - x) / a), z, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.26e+60) tmp = fma(Float64(z - t), Float64(y / a), x); elseif (a <= 1.6e-46) tmp = fma(Float64(Float64(x - y) / t), z, y); else tmp = fma(Float64(Float64(y - x) / a), z, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.26e+60], N[(N[(z - t), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[a, 1.6e-46], N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * z + y), $MachinePrecision], N[(N[(N[(y - x), $MachinePrecision] / a), $MachinePrecision] * z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.26 \cdot 10^{+60}:\\
\;\;\;\;\mathsf{fma}\left(z - t, \frac{y}{a}, x\right)\\
\mathbf{elif}\;a \leq 1.6 \cdot 10^{-46}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - y}{t}, z, y\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y - x}{a}, z, x\right)\\
\end{array}
\end{array}
if a < -1.26e60Initial program 72.9%
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--.f6474.6
Applied rewrites74.6%
Taylor expanded in x around 0
Applied rewrites69.0%
if -1.26e60 < a < 1.6e-46Initial program 71.1%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6481.6
Applied rewrites81.6%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r*N/A
mul-1-negN/A
associate-*r/N/A
div-subN/A
mul-1-negN/A
associate-*r*N/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
Applied rewrites79.3%
Taylor expanded in a around 0
Applied rewrites70.4%
if 1.6e-46 < a Initial program 76.9%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6474.2
Applied rewrites74.2%
Final simplification71.2%
(FPCore (x y z t a) :precision binary64 (if (<= t -1.6e+87) (fma 1.0 (- y x) x) (if (<= t 1.15e+139) (fma (/ (- y x) a) z x) (* (/ (- z a) t) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.6e+87) {
tmp = fma(1.0, (y - x), x);
} else if (t <= 1.15e+139) {
tmp = fma(((y - x) / a), z, x);
} else {
tmp = ((z - a) / t) * x;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.6e+87) tmp = fma(1.0, Float64(y - x), x); elseif (t <= 1.15e+139) tmp = fma(Float64(Float64(y - x) / a), z, x); else tmp = Float64(Float64(Float64(z - a) / t) * x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.6e+87], N[(1.0 * N[(y - x), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t, 1.15e+139], N[(N[(N[(y - x), $MachinePrecision] / a), $MachinePrecision] * z + x), $MachinePrecision], N[(N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision] * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.6 \cdot 10^{+87}:\\
\;\;\;\;\mathsf{fma}\left(1, y - x, x\right)\\
\mathbf{elif}\;t \leq 1.15 \cdot 10^{+139}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y - x}{a}, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z - a}{t} \cdot x\\
\end{array}
\end{array}
if t < -1.6e87Initial program 37.1%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6473.9
Applied rewrites73.9%
Taylor expanded in t around inf
Applied rewrites52.0%
if -1.6e87 < t < 1.15e139Initial program 89.1%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6465.6
Applied rewrites65.6%
if 1.15e139 < t Initial program 41.1%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6466.8
Applied rewrites66.8%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r*N/A
mul-1-negN/A
associate-*r/N/A
div-subN/A
mul-1-negN/A
associate-*r*N/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
Applied rewrites81.3%
Taylor expanded in z around inf
Applied rewrites32.0%
Taylor expanded in x around inf
Applied rewrites40.9%
Final simplification59.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -4.6e-115) (not (<= a 500.0))) (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 <= -4.6e-115) || !(a <= 500.0)) {
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 <= -4.6e-115) || !(a <= 500.0)) 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, -4.6e-115], N[Not[LessEqual[a, 500.0]], $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 -4.6 \cdot 10^{-115} \lor \neg \left(a \leq 500\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x - y}{t} \cdot z\\
\end{array}
\end{array}
if a < -4.59999999999999969e-115 or 500 < a Initial program 73.5%
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%
Taylor expanded in x around 0
Applied rewrites57.8%
if -4.59999999999999969e-115 < a < 500Initial program 72.6%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6481.6
Applied rewrites81.6%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r*N/A
mul-1-negN/A
associate-*r/N/A
div-subN/A
mul-1-negN/A
associate-*r*N/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
Applied rewrites84.0%
Taylor expanded in z around inf
Applied rewrites42.0%
Final simplification51.3%
(FPCore (x y z t a) :precision binary64 (if (<= t -1.3e+50) (fma 1.0 (- y x) x) (if (<= t 2.5e+138) (fma (/ y a) z x) (* (/ (- z a) t) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.3e+50) {
tmp = fma(1.0, (y - x), x);
} else if (t <= 2.5e+138) {
tmp = fma((y / a), z, x);
} else {
tmp = ((z - a) / t) * x;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.3e+50) tmp = fma(1.0, Float64(y - x), x); elseif (t <= 2.5e+138) tmp = fma(Float64(y / a), z, x); else tmp = Float64(Float64(Float64(z - a) / t) * x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.3e+50], N[(1.0 * N[(y - x), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t, 2.5e+138], N[(N[(y / a), $MachinePrecision] * z + x), $MachinePrecision], N[(N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision] * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.3 \cdot 10^{+50}:\\
\;\;\;\;\mathsf{fma}\left(1, y - x, x\right)\\
\mathbf{elif}\;t \leq 2.5 \cdot 10^{+138}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z - a}{t} \cdot x\\
\end{array}
\end{array}
if t < -1.3000000000000001e50Initial program 42.2%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6475.5
Applied rewrites75.5%
Taylor expanded in t around inf
Applied rewrites48.2%
if -1.3000000000000001e50 < t < 2.50000000000000008e138Initial program 89.8%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6466.8
Applied rewrites66.8%
Taylor expanded in x around 0
Applied rewrites54.9%
if 2.50000000000000008e138 < t Initial program 41.1%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6466.8
Applied rewrites66.8%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r*N/A
mul-1-negN/A
associate-*r/N/A
div-subN/A
mul-1-negN/A
associate-*r*N/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
Applied rewrites81.3%
Taylor expanded in z around inf
Applied rewrites32.0%
Taylor expanded in x around inf
Applied rewrites40.9%
Final simplification51.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -2.3e+32) (not (<= t 6.2e-36))) (fma 1.0 (- y x) x) (/ (* y z) a)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -2.3e+32) || !(t <= 6.2e-36)) {
tmp = fma(1.0, (y - x), x);
} else {
tmp = (y * z) / a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -2.3e+32) || !(t <= 6.2e-36)) tmp = fma(1.0, Float64(y - x), x); else tmp = Float64(Float64(y * z) / a); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -2.3e+32], N[Not[LessEqual[t, 6.2e-36]], $MachinePrecision]], N[(1.0 * N[(y - x), $MachinePrecision] + x), $MachinePrecision], N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.3 \cdot 10^{+32} \lor \neg \left(t \leq 6.2 \cdot 10^{-36}\right):\\
\;\;\;\;\mathsf{fma}\left(1, y - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot z}{a}\\
\end{array}
\end{array}
if t < -2.3e32 or 6.1999999999999997e-36 < t Initial program 51.6%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6475.7
Applied rewrites75.7%
Taylor expanded in t around inf
Applied rewrites36.1%
if -2.3e32 < t < 6.1999999999999997e-36Initial program 92.4%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6470.2
Applied rewrites70.2%
Taylor expanded in x around 0
Applied rewrites25.2%
Final simplification30.4%
(FPCore (x y z t a) :precision binary64 (fma 1.0 (- y x) x))
double code(double x, double y, double z, double t, double a) {
return fma(1.0, (y - x), x);
}
function code(x, y, z, t, a) return fma(1.0, Float64(y - x), x) end
code[x_, y_, z_, t_, a_] := N[(1.0 * N[(y - x), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(1, y - x, x\right)
\end{array}
Initial program 73.1%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6486.5
Applied rewrites86.5%
Taylor expanded in t around inf
Applied rewrites20.7%
(FPCore (x y z t a) :precision binary64 (fma 1.0 (- x) x))
double code(double x, double y, double z, double t, double a) {
return fma(1.0, -x, x);
}
function code(x, y, z, t, a) return fma(1.0, Float64(-x), x) end
code[x_, y_, z_, t_, a_] := N[(1.0 * (-x) + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(1, -x, x\right)
\end{array}
Initial program 73.1%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6486.5
Applied rewrites86.5%
Taylor expanded in t around inf
Applied rewrites20.7%
Taylor expanded in x around inf
mul-1-negN/A
lower-neg.f642.8
Applied rewrites2.8%
(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 2025008
(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))))