
(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 20 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 (* (/ (- x y) t) (- z a))) (t_2 (* (- y x) (/ (fma -1.0 z a) t))))
(if (<= t -4.5e+182)
(+ (fma t_1 (/ a t) t_1) y)
(if (<= t 8e+168)
(fma (/ (- z t) (- a t)) (- y x) x)
(+ y (fma t_2 (/ a t) t_2))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((x - y) / t) * (z - a);
double t_2 = (y - x) * (fma(-1.0, z, a) / t);
double tmp;
if (t <= -4.5e+182) {
tmp = fma(t_1, (a / t), t_1) + y;
} else if (t <= 8e+168) {
tmp = fma(((z - t) / (a - t)), (y - x), x);
} else {
tmp = y + fma(t_2, (a / t), t_2);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(x - y) / t) * Float64(z - a)) t_2 = Float64(Float64(y - x) * Float64(fma(-1.0, z, a) / t)) tmp = 0.0 if (t <= -4.5e+182) tmp = Float64(fma(t_1, Float64(a / t), t_1) + y); elseif (t <= 8e+168) tmp = fma(Float64(Float64(z - t) / Float64(a - t)), Float64(y - x), x); else tmp = Float64(y + fma(t_2, Float64(a / t), t_2)); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * N[(z - a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y - x), $MachinePrecision] * N[(N[(-1.0 * z + a), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -4.5e+182], N[(N[(t$95$1 * N[(a / t), $MachinePrecision] + t$95$1), $MachinePrecision] + y), $MachinePrecision], If[LessEqual[t, 8e+168], N[(N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision], N[(y + N[(t$95$2 * N[(a / t), $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x - y}{t} \cdot \left(z - a\right)\\
t_2 := \left(y - x\right) \cdot \frac{\mathsf{fma}\left(-1, z, a\right)}{t}\\
\mathbf{if}\;t \leq -4.5 \cdot 10^{+182}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, \frac{a}{t}, t\_1\right) + y\\
\mathbf{elif}\;t \leq 8 \cdot 10^{+168}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - t}{a - t}, y - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;y + \mathsf{fma}\left(t\_2, \frac{a}{t}, t\_2\right)\\
\end{array}
\end{array}
if t < -4.50000000000000029e182Initial program 18.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6461.0
Applied rewrites61.0%
Taylor expanded in a around -inf
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6438.1
Applied rewrites38.1%
Taylor expanded in a around inf
Applied rewrites38.1%
Taylor expanded in t around inf
Applied rewrites96.9%
if -4.50000000000000029e182 < t < 7.9999999999999995e168Initial program 81.4%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6490.9
Applied rewrites90.9%
if 7.9999999999999995e168 < t Initial program 26.0%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6461.1
Applied rewrites61.1%
Taylor expanded in a around -inf
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6453.9
Applied rewrites53.9%
Taylor expanded in t around inf
Applied rewrites91.5%
Final simplification91.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (/ (* (- y x) (- z t)) (- a t))))
(t_2 (+ x (/ (* (- z t) y) (- a t)))))
(if (<= t_1 -1e+307)
(* (- z t) (/ y (- a t)))
(if (<= t_1 -1e-259)
t_2
(if (<= t_1 2e-288)
(fma (/ x t) (- z a) y)
(if (<= t_1 4e+300) t_2 (fma (/ (- x y) t) z y)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - x) * (z - t)) / (a - t));
double t_2 = x + (((z - t) * y) / (a - t));
double tmp;
if (t_1 <= -1e+307) {
tmp = (z - t) * (y / (a - t));
} else if (t_1 <= -1e-259) {
tmp = t_2;
} else if (t_1 <= 2e-288) {
tmp = fma((x / t), (z - a), y);
} else if (t_1 <= 4e+300) {
tmp = t_2;
} else {
tmp = fma(((x - y) / t), z, y);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(Float64(y - x) * Float64(z - t)) / Float64(a - t))) t_2 = Float64(x + Float64(Float64(Float64(z - t) * y) / Float64(a - t))) tmp = 0.0 if (t_1 <= -1e+307) tmp = Float64(Float64(z - t) * Float64(y / Float64(a - t))); elseif (t_1 <= -1e-259) tmp = t_2; elseif (t_1 <= 2e-288) tmp = fma(Float64(x / t), Float64(z - a), y); elseif (t_1 <= 4e+300) tmp = t_2; else tmp = fma(Float64(Float64(x - y) / t), z, y); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(N[(y - x), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+307], N[(N[(z - t), $MachinePrecision] * N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -1e-259], t$95$2, If[LessEqual[t$95$1, 2e-288], N[(N[(x / t), $MachinePrecision] * N[(z - a), $MachinePrecision] + y), $MachinePrecision], If[LessEqual[t$95$1, 4e+300], t$95$2, N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * z + y), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\\
t_2 := x + \frac{\left(z - t\right) \cdot y}{a - t}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+307}:\\
\;\;\;\;\left(z - t\right) \cdot \frac{y}{a - t}\\
\mathbf{elif}\;t\_1 \leq -1 \cdot 10^{-259}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-288}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{t}, z - a, y\right)\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+300}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - y}{t}, z, y\right)\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < -9.99999999999999986e306Initial program 33.5%
Taylor expanded in x around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6466.0
Applied rewrites66.0%
if -9.99999999999999986e306 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < -1.0000000000000001e-259 or 2.00000000000000012e-288 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < 4.0000000000000002e300Initial program 95.2%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f6480.6
Applied rewrites80.6%
if -1.0000000000000001e-259 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < 2.00000000000000012e-288Initial program 15.5%
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 rewrites94.4%
Taylor expanded in x around inf
Applied rewrites94.4%
if 4.0000000000000002e300 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) Initial program 39.6%
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 rewrites85.9%
Taylor expanded in x around inf
Applied rewrites70.4%
Taylor expanded in a around 0
Applied rewrites76.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ (- x y) t) (- z a))))
(if (or (<= t -4.5e+182) (not (<= t 1.4e+170)))
(+ (fma t_1 (/ a t) t_1) y)
(fma (/ (- z t) (- a t)) (- y x) x))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((x - y) / t) * (z - a);
double tmp;
if ((t <= -4.5e+182) || !(t <= 1.4e+170)) {
tmp = fma(t_1, (a / t), t_1) + y;
} else {
tmp = fma(((z - t) / (a - t)), (y - x), x);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(x - y) / t) * Float64(z - a)) tmp = 0.0 if ((t <= -4.5e+182) || !(t <= 1.4e+170)) tmp = Float64(fma(t_1, Float64(a / t), t_1) + y); else tmp = fma(Float64(Float64(z - t) / Float64(a - t)), Float64(y - x), x); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t, -4.5e+182], N[Not[LessEqual[t, 1.4e+170]], $MachinePrecision]], N[(N[(t$95$1 * N[(a / t), $MachinePrecision] + t$95$1), $MachinePrecision] + y), $MachinePrecision], N[(N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x - y}{t} \cdot \left(z - a\right)\\
\mathbf{if}\;t \leq -4.5 \cdot 10^{+182} \lor \neg \left(t \leq 1.4 \cdot 10^{+170}\right):\\
\;\;\;\;\mathsf{fma}\left(t\_1, \frac{a}{t}, t\_1\right) + y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - t}{a - t}, y - x, x\right)\\
\end{array}
\end{array}
if t < -4.50000000000000029e182 or 1.40000000000000008e170 < t Initial program 21.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6461.0
Applied rewrites61.0%
Taylor expanded in a around -inf
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6444.5
Applied rewrites44.5%
Taylor expanded in a around inf
Applied rewrites44.5%
Taylor expanded in t around inf
Applied rewrites94.1%
if -4.50000000000000029e182 < t < 1.40000000000000008e170Initial program 81.4%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6490.9
Applied rewrites90.9%
Final simplification91.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ y a) z x)))
(if (<= a -4.2e+117)
t_1
(if (<= a -6.4e-276)
(* (/ (- x y) t) z)
(if (<= a 8.8e-274)
(fma 1.0 (- y x) x)
(if (<= a 4.6e-77) (* (- x y) (/ z t)) t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y / a), z, x);
double tmp;
if (a <= -4.2e+117) {
tmp = t_1;
} else if (a <= -6.4e-276) {
tmp = ((x - y) / t) * z;
} else if (a <= 8.8e-274) {
tmp = fma(1.0, (y - x), x);
} else if (a <= 4.6e-77) {
tmp = (x - y) * (z / t);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y / a), z, x) tmp = 0.0 if (a <= -4.2e+117) tmp = t_1; elseif (a <= -6.4e-276) tmp = Float64(Float64(Float64(x - y) / t) * z); elseif (a <= 8.8e-274) tmp = fma(1.0, Float64(y - x), x); elseif (a <= 4.6e-77) tmp = Float64(Float64(x - y) * Float64(z / t)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / a), $MachinePrecision] * z + x), $MachinePrecision]}, If[LessEqual[a, -4.2e+117], t$95$1, If[LessEqual[a, -6.4e-276], N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[a, 8.8e-274], N[(1.0 * N[(y - x), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[a, 4.6e-77], N[(N[(x - y), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{y}{a}, z, x\right)\\
\mathbf{if}\;a \leq -4.2 \cdot 10^{+117}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq -6.4 \cdot 10^{-276}:\\
\;\;\;\;\frac{x - y}{t} \cdot z\\
\mathbf{elif}\;a \leq 8.8 \cdot 10^{-274}:\\
\;\;\;\;\mathsf{fma}\left(1, y - x, x\right)\\
\mathbf{elif}\;a \leq 4.6 \cdot 10^{-77}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -4.2000000000000002e117 or 4.59999999999999997e-77 < a Initial program 65.1%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6459.0
Applied rewrites59.0%
Taylor expanded in x around 0
Applied rewrites55.0%
if -4.2000000000000002e117 < a < -6.3999999999999998e-276Initial program 67.4%
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 rewrites75.8%
Taylor expanded in x around inf
Applied rewrites69.0%
Taylor expanded in z around inf
Applied rewrites43.5%
if -6.3999999999999998e-276 < a < 8.7999999999999998e-274Initial program 65.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6477.9
Applied rewrites77.9%
Taylor expanded in t around inf
Applied rewrites66.1%
if 8.7999999999999998e-274 < a < 4.59999999999999997e-77Initial program 69.2%
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 rewrites85.5%
Taylor expanded in x around inf
Applied rewrites63.3%
Taylor expanded in t around 0
Applied rewrites57.3%
Taylor expanded in z around inf
Applied rewrites52.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1.95e+157) (not (<= t 1.4e+170))) (fma (/ (fma -1.0 y x) t) (- z a) y) (fma (/ (- z t) (- a t)) (- y x) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.95e+157) || !(t <= 1.4e+170)) {
tmp = fma((fma(-1.0, y, x) / t), (z - a), y);
} else {
tmp = fma(((z - t) / (a - t)), (y - x), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1.95e+157) || !(t <= 1.4e+170)) tmp = fma(Float64(fma(-1.0, y, x) / t), Float64(z - a), y); else tmp = fma(Float64(Float64(z - t) / Float64(a - t)), Float64(y - x), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1.95e+157], N[Not[LessEqual[t, 1.4e+170]], $MachinePrecision]], N[(N[(N[(-1.0 * y + x), $MachinePrecision] / t), $MachinePrecision] * N[(z - a), $MachinePrecision] + y), $MachinePrecision], N[(N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.95 \cdot 10^{+157} \lor \neg \left(t \leq 1.4 \cdot 10^{+170}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{\mathsf{fma}\left(-1, y, x\right)}{t}, z - a, y\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - t}{a - t}, y - x, x\right)\\
\end{array}
\end{array}
if t < -1.94999999999999985e157 or 1.40000000000000008e170 < t Initial program 23.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 rewrites90.4%
if -1.94999999999999985e157 < t < 1.40000000000000008e170Initial program 82.4%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6491.6
Applied rewrites91.6%
Final simplification91.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -2.8e-29) (not (<= t 5.4e-63))) (fma (/ (fma -1.0 y x) t) (- z a) y) (+ x (* (/ (- z t) a) (- y x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -2.8e-29) || !(t <= 5.4e-63)) {
tmp = fma((fma(-1.0, y, x) / t), (z - a), y);
} else {
tmp = x + (((z - t) / a) * (y - x));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -2.8e-29) || !(t <= 5.4e-63)) tmp = fma(Float64(fma(-1.0, y, x) / t), Float64(z - a), y); else tmp = Float64(x + Float64(Float64(Float64(z - t) / a) * Float64(y - x))); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -2.8e-29], N[Not[LessEqual[t, 5.4e-63]], $MachinePrecision]], N[(N[(N[(-1.0 * y + x), $MachinePrecision] / t), $MachinePrecision] * N[(z - a), $MachinePrecision] + y), $MachinePrecision], N[(x + N[(N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision] * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.8 \cdot 10^{-29} \lor \neg \left(t \leq 5.4 \cdot 10^{-63}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{\mathsf{fma}\left(-1, y, x\right)}{t}, z - a, y\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z - t}{a} \cdot \left(y - x\right)\\
\end{array}
\end{array}
if t < -2.8000000000000002e-29 or 5.4000000000000004e-63 < t Initial program 53.3%
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 rewrites73.6%
if -2.8000000000000002e-29 < t < 5.4000000000000004e-63Initial program 90.3%
Taylor expanded in a around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6484.5
Applied rewrites84.5%
Final simplification77.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ x t) (- z a) y)))
(if (<= t -6700000000.0)
t_1
(if (<= t -4.2e-185)
(/ (* (- z t) y) (- a t))
(if (<= t 2.15e+57) (fma (/ z a) (- y x) x) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((x / t), (z - a), y);
double tmp;
if (t <= -6700000000.0) {
tmp = t_1;
} else if (t <= -4.2e-185) {
tmp = ((z - t) * y) / (a - t);
} else if (t <= 2.15e+57) {
tmp = fma((z / a), (y - x), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(x / t), Float64(z - a), y) tmp = 0.0 if (t <= -6700000000.0) tmp = t_1; elseif (t <= -4.2e-185) tmp = Float64(Float64(Float64(z - t) * y) / Float64(a - t)); elseif (t <= 2.15e+57) tmp = fma(Float64(z / a), Float64(y - x), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x / t), $MachinePrecision] * N[(z - a), $MachinePrecision] + y), $MachinePrecision]}, If[LessEqual[t, -6700000000.0], t$95$1, If[LessEqual[t, -4.2e-185], N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.15e+57], N[(N[(z / a), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{x}{t}, z - a, y\right)\\
\mathbf{if}\;t \leq -6700000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -4.2 \cdot 10^{-185}:\\
\;\;\;\;\frac{\left(z - t\right) \cdot y}{a - t}\\
\mathbf{elif}\;t \leq 2.15 \cdot 10^{+57}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -6.7e9 or 2.15000000000000016e57 < t Initial program 45.2%
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 rewrites78.5%
Taylor expanded in x around inf
Applied rewrites70.8%
if -6.7e9 < t < -4.2e-185Initial program 87.3%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6484.1
Applied rewrites84.1%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6464.2
Applied rewrites64.2%
if -4.2e-185 < t < 2.15000000000000016e57Initial program 89.1%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6496.0
Applied rewrites96.0%
Taylor expanded in t around 0
lower-/.f6480.0
Applied rewrites80.0%
Final simplification73.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ x t) (- z a) y)))
(if (<= t -1.95e+133)
t_1
(if (<= t -3.8e-172)
(fma (/ (- x y) t) z y)
(if (<= t 2.15e+57) (fma (/ z a) (- y x) x) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((x / t), (z - a), y);
double tmp;
if (t <= -1.95e+133) {
tmp = t_1;
} else if (t <= -3.8e-172) {
tmp = fma(((x - y) / t), z, y);
} else if (t <= 2.15e+57) {
tmp = fma((z / a), (y - x), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(x / t), Float64(z - a), y) tmp = 0.0 if (t <= -1.95e+133) tmp = t_1; elseif (t <= -3.8e-172) tmp = fma(Float64(Float64(x - y) / t), z, y); elseif (t <= 2.15e+57) tmp = fma(Float64(z / a), Float64(y - x), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x / t), $MachinePrecision] * N[(z - a), $MachinePrecision] + y), $MachinePrecision]}, If[LessEqual[t, -1.95e+133], t$95$1, If[LessEqual[t, -3.8e-172], N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * z + y), $MachinePrecision], If[LessEqual[t, 2.15e+57], N[(N[(z / a), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{x}{t}, z - a, y\right)\\
\mathbf{if}\;t \leq -1.95 \cdot 10^{+133}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -3.8 \cdot 10^{-172}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - y}{t}, z, y\right)\\
\mathbf{elif}\;t \leq 2.15 \cdot 10^{+57}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.95000000000000007e133 or 2.15000000000000016e57 < t Initial program 40.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 rewrites80.2%
Taylor expanded in x around inf
Applied rewrites74.7%
if -1.95000000000000007e133 < t < -3.79999999999999987e-172Initial program 77.4%
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 rewrites61.2%
Taylor expanded in x around inf
Applied rewrites46.8%
Taylor expanded in a around 0
Applied rewrites58.0%
if -3.79999999999999987e-172 < t < 2.15000000000000016e57Initial program 89.3%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6496.1
Applied rewrites96.1%
Taylor expanded in t around 0
lower-/.f6479.4
Applied rewrites79.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ x t) (- z a) y)))
(if (<= t -1.95e+133)
t_1
(if (<= t -3.2e-176)
(fma (/ (- x y) t) z y)
(if (<= t 2.15e+57) (fma (/ (- y x) a) z x) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((x / t), (z - a), y);
double tmp;
if (t <= -1.95e+133) {
tmp = t_1;
} else if (t <= -3.2e-176) {
tmp = fma(((x - y) / t), z, y);
} else if (t <= 2.15e+57) {
tmp = fma(((y - x) / a), z, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(x / t), Float64(z - a), y) tmp = 0.0 if (t <= -1.95e+133) tmp = t_1; elseif (t <= -3.2e-176) tmp = fma(Float64(Float64(x - y) / t), z, y); elseif (t <= 2.15e+57) tmp = fma(Float64(Float64(y - x) / a), z, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x / t), $MachinePrecision] * N[(z - a), $MachinePrecision] + y), $MachinePrecision]}, If[LessEqual[t, -1.95e+133], t$95$1, If[LessEqual[t, -3.2e-176], N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * z + y), $MachinePrecision], If[LessEqual[t, 2.15e+57], N[(N[(N[(y - x), $MachinePrecision] / a), $MachinePrecision] * z + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{x}{t}, z - a, y\right)\\
\mathbf{if}\;t \leq -1.95 \cdot 10^{+133}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -3.2 \cdot 10^{-176}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - y}{t}, z, y\right)\\
\mathbf{elif}\;t \leq 2.15 \cdot 10^{+57}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y - x}{a}, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.95000000000000007e133 or 2.15000000000000016e57 < t Initial program 40.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 rewrites80.2%
Taylor expanded in x around inf
Applied rewrites74.7%
if -1.95000000000000007e133 < t < -3.19999999999999985e-176Initial program 77.9%
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 rewrites60.0%
Taylor expanded in x around inf
Applied rewrites47.9%
Taylor expanded in a around 0
Applied rewrites56.9%
if -3.19999999999999985e-176 < t < 2.15000000000000016e57Initial program 89.2%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6475.9
Applied rewrites75.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- z t) (/ y a) x)))
(if (<= a -6.2e+117)
t_1
(if (<= a -2.8e-186)
(fma (/ x t) (- z a) y)
(if (<= a 4e+51) (fma (/ (- x y) t) z y) 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 <= -6.2e+117) {
tmp = t_1;
} else if (a <= -2.8e-186) {
tmp = fma((x / t), (z - a), y);
} else if (a <= 4e+51) {
tmp = fma(((x - y) / t), z, y);
} 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 <= -6.2e+117) tmp = t_1; elseif (a <= -2.8e-186) tmp = fma(Float64(x / t), Float64(z - a), y); elseif (a <= 4e+51) tmp = fma(Float64(Float64(x - y) / t), z, y); 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, -6.2e+117], t$95$1, If[LessEqual[a, -2.8e-186], N[(N[(x / t), $MachinePrecision] * N[(z - a), $MachinePrecision] + y), $MachinePrecision], If[LessEqual[a, 4e+51], N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * z + y), $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 -6.2 \cdot 10^{+117}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq -2.8 \cdot 10^{-186}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{t}, z - a, y\right)\\
\mathbf{elif}\;a \leq 4 \cdot 10^{+51}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - y}{t}, z, y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -6.1999999999999995e117 or 4e51 < a Initial program 66.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--.f6474.3
Applied rewrites74.3%
Taylor expanded in x around 0
Applied rewrites70.9%
if -6.1999999999999995e117 < a < -2.79999999999999983e-186Initial program 65.9%
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 rewrites69.2%
Taylor expanded in x around inf
Applied rewrites69.5%
if -2.79999999999999983e-186 < a < 4e51Initial program 66.9%
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 rewrites77.8%
Taylor expanded in x around inf
Applied rewrites63.9%
Taylor expanded in a around 0
Applied rewrites72.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ x t) (- z a) y)))
(if (<= t -1.95e+133)
t_1
(if (<= t -3.2e-172)
(fma (/ (- x y) t) z y)
(if (<= t 2.55e-64) (fma (/ y a) z x) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((x / t), (z - a), y);
double tmp;
if (t <= -1.95e+133) {
tmp = t_1;
} else if (t <= -3.2e-172) {
tmp = fma(((x - y) / t), z, y);
} else if (t <= 2.55e-64) {
tmp = fma((y / a), z, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(x / t), Float64(z - a), y) tmp = 0.0 if (t <= -1.95e+133) tmp = t_1; elseif (t <= -3.2e-172) tmp = fma(Float64(Float64(x - y) / t), z, y); elseif (t <= 2.55e-64) tmp = fma(Float64(y / a), z, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x / t), $MachinePrecision] * N[(z - a), $MachinePrecision] + y), $MachinePrecision]}, If[LessEqual[t, -1.95e+133], t$95$1, If[LessEqual[t, -3.2e-172], N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * z + y), $MachinePrecision], If[LessEqual[t, 2.55e-64], N[(N[(y / a), $MachinePrecision] * z + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{x}{t}, z - a, y\right)\\
\mathbf{if}\;t \leq -1.95 \cdot 10^{+133}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -3.2 \cdot 10^{-172}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - y}{t}, z, y\right)\\
\mathbf{elif}\;t \leq 2.55 \cdot 10^{-64}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.95000000000000007e133 or 2.54999999999999992e-64 < t Initial program 48.5%
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 rewrites75.2%
Taylor expanded in x around inf
Applied rewrites69.0%
if -1.95000000000000007e133 < t < -3.2000000000000001e-172Initial program 77.4%
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 rewrites61.2%
Taylor expanded in x around inf
Applied rewrites46.8%
Taylor expanded in a around 0
Applied rewrites58.0%
if -3.2000000000000001e-172 < t < 2.54999999999999992e-64Initial program 90.9%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6483.4
Applied rewrites83.4%
Taylor expanded in x around 0
Applied rewrites72.6%
(FPCore (x y z t a)
:precision binary64
(if (<= t -9.2e+191)
(fma (/ x t) (- a) y)
(if (<= t -5.2e-54)
(* (- x y) (/ z t))
(if (<= t 3.25e+100) (fma (/ y a) z x) (fma (- y x) (/ a t) y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -9.2e+191) {
tmp = fma((x / t), -a, y);
} else if (t <= -5.2e-54) {
tmp = (x - y) * (z / t);
} else if (t <= 3.25e+100) {
tmp = fma((y / a), z, x);
} else {
tmp = fma((y - x), (a / t), y);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -9.2e+191) tmp = fma(Float64(x / t), Float64(-a), y); elseif (t <= -5.2e-54) tmp = Float64(Float64(x - y) * Float64(z / t)); elseif (t <= 3.25e+100) tmp = fma(Float64(y / a), z, x); else tmp = fma(Float64(y - x), Float64(a / t), y); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -9.2e+191], N[(N[(x / t), $MachinePrecision] * (-a) + y), $MachinePrecision], If[LessEqual[t, -5.2e-54], N[(N[(x - y), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.25e+100], N[(N[(y / a), $MachinePrecision] * z + x), $MachinePrecision], N[(N[(y - x), $MachinePrecision] * N[(a / t), $MachinePrecision] + y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9.2 \cdot 10^{+191}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{t}, -a, y\right)\\
\mathbf{elif}\;t \leq -5.2 \cdot 10^{-54}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{z}{t}\\
\mathbf{elif}\;t \leq 3.25 \cdot 10^{+100}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{a}{t}, y\right)\\
\end{array}
\end{array}
if t < -9.1999999999999997e191Initial program 17.6%
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 rewrites95.5%
Taylor expanded in x around inf
Applied rewrites89.3%
Taylor expanded in z around 0
Applied rewrites69.3%
if -9.1999999999999997e191 < t < -5.20000000000000004e-54Initial program 66.5%
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 rewrites66.9%
Taylor expanded in x around inf
Applied rewrites52.8%
Taylor expanded in t around 0
Applied rewrites48.7%
Taylor expanded in z around inf
Applied rewrites44.1%
if -5.20000000000000004e-54 < t < 3.25e100Initial program 87.5%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6467.5
Applied rewrites67.5%
Taylor expanded in x around 0
Applied rewrites57.7%
if 3.25e100 < t Initial program 39.2%
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 rewrites75.8%
Taylor expanded in x around inf
Applied rewrites70.8%
Taylor expanded in t around 0
Applied rewrites22.4%
Taylor expanded in z around 0
Applied rewrites64.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -7500000000.0) (not (<= t 5e+57))) (fma (/ x t) (- z a) y) (+ x (* (/ (- z t) a) (- y x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -7500000000.0) || !(t <= 5e+57)) {
tmp = fma((x / t), (z - a), y);
} else {
tmp = x + (((z - t) / a) * (y - x));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -7500000000.0) || !(t <= 5e+57)) tmp = fma(Float64(x / t), Float64(z - a), y); else tmp = Float64(x + Float64(Float64(Float64(z - t) / a) * Float64(y - x))); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -7500000000.0], N[Not[LessEqual[t, 5e+57]], $MachinePrecision]], N[(N[(x / t), $MachinePrecision] * N[(z - a), $MachinePrecision] + y), $MachinePrecision], N[(x + N[(N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision] * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7500000000 \lor \neg \left(t \leq 5 \cdot 10^{+57}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{t}, z - a, y\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z - t}{a} \cdot \left(y - x\right)\\
\end{array}
\end{array}
if t < -7.5e9 or 4.99999999999999972e57 < t Initial program 45.2%
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 rewrites78.5%
Taylor expanded in x around inf
Applied rewrites70.8%
if -7.5e9 < t < 4.99999999999999972e57Initial program 88.7%
Taylor expanded in a around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6475.0
Applied rewrites75.0%
Final simplification72.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ x t) (- a) y)))
(if (<= t -9.2e+191)
t_1
(if (<= t -5.2e-54)
(* (- x y) (/ z t))
(if (<= t 3.25e+100) (fma (/ y a) z x) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((x / t), -a, y);
double tmp;
if (t <= -9.2e+191) {
tmp = t_1;
} else if (t <= -5.2e-54) {
tmp = (x - y) * (z / t);
} else if (t <= 3.25e+100) {
tmp = fma((y / a), z, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(x / t), Float64(-a), y) tmp = 0.0 if (t <= -9.2e+191) tmp = t_1; elseif (t <= -5.2e-54) tmp = Float64(Float64(x - y) * Float64(z / t)); elseif (t <= 3.25e+100) tmp = fma(Float64(y / a), z, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x / t), $MachinePrecision] * (-a) + y), $MachinePrecision]}, If[LessEqual[t, -9.2e+191], t$95$1, If[LessEqual[t, -5.2e-54], N[(N[(x - y), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.25e+100], N[(N[(y / a), $MachinePrecision] * z + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{x}{t}, -a, y\right)\\
\mathbf{if}\;t \leq -9.2 \cdot 10^{+191}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -5.2 \cdot 10^{-54}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{z}{t}\\
\mathbf{elif}\;t \leq 3.25 \cdot 10^{+100}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -9.1999999999999997e191 or 3.25e100 < t Initial program 29.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 rewrites85.1%
Taylor expanded in x around inf
Applied rewrites79.5%
Taylor expanded in z around 0
Applied rewrites66.2%
if -9.1999999999999997e191 < t < -5.20000000000000004e-54Initial program 66.5%
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 rewrites66.9%
Taylor expanded in x around inf
Applied rewrites52.8%
Taylor expanded in t around 0
Applied rewrites48.7%
Taylor expanded in z around inf
Applied rewrites44.1%
if -5.20000000000000004e-54 < t < 3.25e100Initial program 87.5%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6467.5
Applied rewrites67.5%
Taylor expanded in x around 0
Applied rewrites57.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma 1.0 (- y x) x)))
(if (<= t -1.35e+207)
t_1
(if (<= t -5.2e-54)
(* (- x y) (/ z t))
(if (<= t 4.5e+170) (fma (/ y a) z x) 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.35e+207) {
tmp = t_1;
} else if (t <= -5.2e-54) {
tmp = (x - y) * (z / t);
} else if (t <= 4.5e+170) {
tmp = fma((y / a), z, x);
} 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.35e+207) tmp = t_1; elseif (t <= -5.2e-54) tmp = Float64(Float64(x - y) * Float64(z / t)); elseif (t <= 4.5e+170) tmp = fma(Float64(y / a), z, x); 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.35e+207], t$95$1, If[LessEqual[t, -5.2e-54], N[(N[(x - y), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 4.5e+170], N[(N[(y / a), $MachinePrecision] * z + x), $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.35 \cdot 10^{+207}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -5.2 \cdot 10^{-54}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{z}{t}\\
\mathbf{elif}\;t \leq 4.5 \cdot 10^{+170}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.35000000000000012e207 or 4.50000000000000022e170 < t Initial program 22.2%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6465.4
Applied rewrites65.4%
Taylor expanded in t around inf
Applied rewrites47.0%
if -1.35000000000000012e207 < t < -5.20000000000000004e-54Initial program 64.4%
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 rewrites68.0%
Taylor expanded in x around inf
Applied rewrites54.4%
Taylor expanded in t around 0
Applied rewrites48.9%
Taylor expanded in z around inf
Applied rewrites42.8%
if -5.20000000000000004e-54 < t < 4.50000000000000022e170Initial program 85.2%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6463.9
Applied rewrites63.9%
Taylor expanded in x around 0
Applied rewrites55.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -3.2e-172) (not (<= t 5.6e-65))) (fma (/ (- x y) t) z y) (fma (/ y a) z x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -3.2e-172) || !(t <= 5.6e-65)) {
tmp = fma(((x - y) / t), z, y);
} else {
tmp = fma((y / a), z, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -3.2e-172) || !(t <= 5.6e-65)) tmp = fma(Float64(Float64(x - y) / t), z, y); else tmp = fma(Float64(y / a), z, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -3.2e-172], N[Not[LessEqual[t, 5.6e-65]], $MachinePrecision]], N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * z + y), $MachinePrecision], N[(N[(y / a), $MachinePrecision] * z + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.2 \cdot 10^{-172} \lor \neg \left(t \leq 5.6 \cdot 10^{-65}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{x - y}{t}, z, y\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, z, x\right)\\
\end{array}
\end{array}
if t < -3.2000000000000001e-172 or 5.6000000000000001e-65 < t Initial program 56.3%
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 rewrites71.4%
Taylor expanded in x around inf
Applied rewrites63.0%
Taylor expanded in a around 0
Applied rewrites63.2%
if -3.2000000000000001e-172 < t < 5.6000000000000001e-65Initial program 90.9%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6483.4
Applied rewrites83.4%
Taylor expanded in x around 0
Applied rewrites72.6%
Final simplification65.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1.6e+78) (not (<= t 4.5e+170))) (fma 1.0 (- y x) x) (fma (/ y a) z x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.6e+78) || !(t <= 4.5e+170)) {
tmp = fma(1.0, (y - x), x);
} else {
tmp = fma((y / a), z, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1.6e+78) || !(t <= 4.5e+170)) tmp = fma(1.0, Float64(y - x), x); else tmp = fma(Float64(y / a), z, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1.6e+78], N[Not[LessEqual[t, 4.5e+170]], $MachinePrecision]], N[(1.0 * N[(y - x), $MachinePrecision] + x), $MachinePrecision], N[(N[(y / a), $MachinePrecision] * z + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.6 \cdot 10^{+78} \lor \neg \left(t \leq 4.5 \cdot 10^{+170}\right):\\
\;\;\;\;\mathsf{fma}\left(1, y - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, z, x\right)\\
\end{array}
\end{array}
if t < -1.59999999999999997e78 or 4.50000000000000022e170 < t Initial program 34.1%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6470.1
Applied rewrites70.1%
Taylor expanded in t around inf
Applied rewrites38.5%
if -1.59999999999999997e78 < t < 4.50000000000000022e170Initial program 84.6%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6459.9
Applied rewrites59.9%
Taylor expanded in x around 0
Applied rewrites51.8%
Final simplification47.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -5000000000.0) (not (<= t 7.1e+28))) (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 <= -5000000000.0) || !(t <= 7.1e+28)) {
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 <= -5000000000.0) || !(t <= 7.1e+28)) tmp = fma(1.0, Float64(y - x), x); else tmp = Float64(y * Float64(z / a)); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -5000000000.0], N[Not[LessEqual[t, 7.1e+28]], $MachinePrecision]], N[(1.0 * N[(y - x), $MachinePrecision] + x), $MachinePrecision], N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5000000000 \lor \neg \left(t \leq 7.1 \cdot 10^{+28}\right):\\
\;\;\;\;\mathsf{fma}\left(1, y - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z}{a}\\
\end{array}
\end{array}
if t < -5e9 or 7.0999999999999999e28 < t Initial program 46.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6474.8
Applied rewrites74.8%
Taylor expanded in t around inf
Applied rewrites32.7%
if -5e9 < t < 7.0999999999999999e28Initial program 89.0%
Taylor expanded in x around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6442.6
Applied rewrites42.6%
Taylor expanded in t around 0
Applied rewrites32.4%
Final simplification32.5%
(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 66.4%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6483.4
Applied rewrites83.4%
Taylor expanded in t around inf
Applied rewrites20.6%
(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 66.4%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6483.4
Applied rewrites83.4%
Taylor expanded in t around inf
Applied rewrites20.6%
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 2025007
(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))))