
(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}
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
(let* ((t_1 (/ (- z t) (- a t))))
(if (or (<= x -3.9e-12) (not (<= x 2.15e-92)))
(*
(- x)
(- (fma -1.0 (* (/ y x) t_1) (/ z (- a t))) (+ 1.0 (/ t (- a t)))))
(fma (- y x) t_1 x))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (a - t);
double tmp;
if ((x <= -3.9e-12) || !(x <= 2.15e-92)) {
tmp = -x * (fma(-1.0, ((y / x) * t_1), (z / (a - t))) - (1.0 + (t / (a - t))));
} else {
tmp = fma((y - x), t_1, x);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(a - t)) tmp = 0.0 if ((x <= -3.9e-12) || !(x <= 2.15e-92)) tmp = Float64(Float64(-x) * Float64(fma(-1.0, Float64(Float64(y / x) * t_1), Float64(z / Float64(a - t))) - Float64(1.0 + Float64(t / Float64(a - t))))); else tmp = fma(Float64(y - x), t_1, x); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[x, -3.9e-12], N[Not[LessEqual[x, 2.15e-92]], $MachinePrecision]], N[((-x) * N[(N[(-1.0 * N[(N[(y / x), $MachinePrecision] * t$95$1), $MachinePrecision] + N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(1.0 + N[(t / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y - x), $MachinePrecision] * t$95$1 + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{a - t}\\
\mathbf{if}\;x \leq -3.9 \cdot 10^{-12} \lor \neg \left(x \leq 2.15 \cdot 10^{-92}\right):\\
\;\;\;\;\left(-x\right) \cdot \left(\mathsf{fma}\left(-1, \frac{y}{x} \cdot t\_1, \frac{z}{a - t}\right) - \left(1 + \frac{t}{a - t}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y - x, t\_1, x\right)\\
\end{array}
\end{array}
if x < -3.89999999999999994e-12 or 2.15000000000000007e-92 < x Initial program 61.0%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6478.7
Applied rewrites78.7%
Taylor expanded in x around -inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower--.f64N/A
Applied rewrites88.3%
if -3.89999999999999994e-12 < x < 2.15000000000000007e-92Initial program 79.6%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6491.8
Applied rewrites91.8%
Final simplification89.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (/ (* (- y x) (- z t)) (- a t)))))
(if (or (<= t_1 -2e-254) (not (<= t_1 0.0)))
(fma (- y x) (/ (- z t) (- a t)) x)
(+ y (/ (* x (- z a)) t)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - x) * (z - t)) / (a - t));
double tmp;
if ((t_1 <= -2e-254) || !(t_1 <= 0.0)) {
tmp = fma((y - x), ((z - t) / (a - t)), x);
} else {
tmp = y + ((x * (z - a)) / t);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(Float64(y - x) * Float64(z - t)) / Float64(a - t))) tmp = 0.0 if ((t_1 <= -2e-254) || !(t_1 <= 0.0)) tmp = fma(Float64(y - x), Float64(Float64(z - t) / Float64(a - t)), x); else tmp = Float64(y + Float64(Float64(x * Float64(z - a)) / t)); 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]}, If[Or[LessEqual[t$95$1, -2e-254], N[Not[LessEqual[t$95$1, 0.0]], $MachinePrecision]], N[(N[(y - x), $MachinePrecision] * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(y + N[(N[(x * N[(z - a), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-254} \lor \neg \left(t\_1 \leq 0\right):\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{z - t}{a - t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x \cdot \left(z - a\right)}{t}\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < -1.9999999999999998e-254 or 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) Initial program 74.1%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6490.7
Applied rewrites90.7%
if -1.9999999999999998e-254 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < 0.0Initial program 10.0%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6410.8
Applied rewrites10.8%
Taylor expanded in t around -inf
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6494.5
Applied rewrites94.5%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f64N/A
lift--.f6494.6
Applied rewrites94.6%
Final simplification91.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* y (/ (- z t) (- a t)))) (t_2 (fma (- y x) (/ z a) x)))
(if (<= a -5.3e+82)
t_2
(if (<= a -2.9e-38)
t_1
(if (<= a 4e-255)
(* z (/ (- y x) (- a t)))
(if (<= a 5.2e+95) t_1 t_2))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * ((z - t) / (a - t));
double t_2 = fma((y - x), (z / a), x);
double tmp;
if (a <= -5.3e+82) {
tmp = t_2;
} else if (a <= -2.9e-38) {
tmp = t_1;
} else if (a <= 4e-255) {
tmp = z * ((y - x) / (a - t));
} else if (a <= 5.2e+95) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(y * Float64(Float64(z - t) / Float64(a - t))) t_2 = fma(Float64(y - x), Float64(z / a), x) tmp = 0.0 if (a <= -5.3e+82) tmp = t_2; elseif (a <= -2.9e-38) tmp = t_1; elseif (a <= 4e-255) tmp = Float64(z * Float64(Float64(y - x) / Float64(a - t))); elseif (a <= 5.2e+95) tmp = t_1; else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y - x), $MachinePrecision] * N[(z / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -5.3e+82], t$95$2, If[LessEqual[a, -2.9e-38], t$95$1, If[LessEqual[a, 4e-255], N[(z * N[(N[(y - x), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 5.2e+95], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z - t}{a - t}\\
t_2 := \mathsf{fma}\left(y - x, \frac{z}{a}, x\right)\\
\mathbf{if}\;a \leq -5.3 \cdot 10^{+82}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;a \leq -2.9 \cdot 10^{-38}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 4 \cdot 10^{-255}:\\
\;\;\;\;z \cdot \frac{y - x}{a - t}\\
\mathbf{elif}\;a \leq 5.2 \cdot 10^{+95}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if a < -5.29999999999999977e82 or 5.19999999999999981e95 < a Initial program 68.3%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6492.1
Applied rewrites92.1%
Taylor expanded in t around 0
lower-/.f6472.5
Applied rewrites72.5%
if -5.29999999999999977e82 < a < -2.89999999999999994e-38 or 4e-255 < a < 5.19999999999999981e95Initial program 69.6%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6481.3
Applied rewrites81.3%
Taylor expanded in y around inf
sub-divN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f6459.1
Applied rewrites59.1%
if -2.89999999999999994e-38 < a < 4e-255Initial program 68.7%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6478.0
Applied rewrites78.0%
Taylor expanded in z around inf
sub-divN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f6455.4
Applied rewrites55.4%
Final simplification62.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* y (/ (- z t) (- a t)))) (t_2 (fma (- y x) (/ z a) x)))
(if (<= a -5.3e+82)
t_2
(if (<= a -2.25e-41)
t_1
(if (<= a 4e-255)
(/ (* (- y x) z) (- a t))
(if (<= a 5.2e+95) t_1 t_2))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * ((z - t) / (a - t));
double t_2 = fma((y - x), (z / a), x);
double tmp;
if (a <= -5.3e+82) {
tmp = t_2;
} else if (a <= -2.25e-41) {
tmp = t_1;
} else if (a <= 4e-255) {
tmp = ((y - x) * z) / (a - t);
} else if (a <= 5.2e+95) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(y * Float64(Float64(z - t) / Float64(a - t))) t_2 = fma(Float64(y - x), Float64(z / a), x) tmp = 0.0 if (a <= -5.3e+82) tmp = t_2; elseif (a <= -2.25e-41) tmp = t_1; elseif (a <= 4e-255) tmp = Float64(Float64(Float64(y - x) * z) / Float64(a - t)); elseif (a <= 5.2e+95) tmp = t_1; else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y - x), $MachinePrecision] * N[(z / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -5.3e+82], t$95$2, If[LessEqual[a, -2.25e-41], t$95$1, If[LessEqual[a, 4e-255], N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 5.2e+95], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z - t}{a - t}\\
t_2 := \mathsf{fma}\left(y - x, \frac{z}{a}, x\right)\\
\mathbf{if}\;a \leq -5.3 \cdot 10^{+82}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;a \leq -2.25 \cdot 10^{-41}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 4 \cdot 10^{-255}:\\
\;\;\;\;\frac{\left(y - x\right) \cdot z}{a - t}\\
\mathbf{elif}\;a \leq 5.2 \cdot 10^{+95}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if a < -5.29999999999999977e82 or 5.19999999999999981e95 < a Initial program 68.3%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6492.1
Applied rewrites92.1%
Taylor expanded in t around 0
lower-/.f6472.5
Applied rewrites72.5%
if -5.29999999999999977e82 < a < -2.25e-41 or 4e-255 < a < 5.19999999999999981e95Initial program 69.6%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6481.3
Applied rewrites81.3%
Taylor expanded in y around inf
sub-divN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f6459.1
Applied rewrites59.1%
if -2.25e-41 < a < 4e-255Initial program 68.6%
Taylor expanded in z around inf
sub-divN/A
associate-/l*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6455.2
Applied rewrites55.2%
Final simplification62.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- y x) (/ z a) x)))
(if (<= a -2.8e-66)
t_1
(if (<= a -1.7e-279)
(/ (* (- y x) z) (- a t))
(if (<= a 4.5e-193)
(+ y (/ (* x z) t))
(if (<= a 2.3e+92) (/ (* (- z t) y) (- a t)) t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y - x), (z / a), x);
double tmp;
if (a <= -2.8e-66) {
tmp = t_1;
} else if (a <= -1.7e-279) {
tmp = ((y - x) * z) / (a - t);
} else if (a <= 4.5e-193) {
tmp = y + ((x * z) / t);
} else if (a <= 2.3e+92) {
tmp = ((z - t) * y) / (a - t);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y - x), Float64(z / a), x) tmp = 0.0 if (a <= -2.8e-66) tmp = t_1; elseif (a <= -1.7e-279) tmp = Float64(Float64(Float64(y - x) * z) / Float64(a - t)); elseif (a <= 4.5e-193) tmp = Float64(y + Float64(Float64(x * z) / t)); elseif (a <= 2.3e+92) tmp = Float64(Float64(Float64(z - t) * y) / Float64(a - t)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - x), $MachinePrecision] * N[(z / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -2.8e-66], t$95$1, If[LessEqual[a, -1.7e-279], N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 4.5e-193], N[(y + N[(N[(x * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 2.3e+92], N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y - x, \frac{z}{a}, x\right)\\
\mathbf{if}\;a \leq -2.8 \cdot 10^{-66}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq -1.7 \cdot 10^{-279}:\\
\;\;\;\;\frac{\left(y - x\right) \cdot z}{a - t}\\
\mathbf{elif}\;a \leq 4.5 \cdot 10^{-193}:\\
\;\;\;\;y + \frac{x \cdot z}{t}\\
\mathbf{elif}\;a \leq 2.3 \cdot 10^{+92}:\\
\;\;\;\;\frac{\left(z - t\right) \cdot y}{a - t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -2.8e-66 or 2.29999999999999998e92 < a Initial program 69.3%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6489.7
Applied rewrites89.7%
Taylor expanded in t around 0
lower-/.f6466.2
Applied rewrites66.2%
if -2.8e-66 < a < -1.70000000000000007e-279Initial program 67.6%
Taylor expanded in z around inf
sub-divN/A
associate-/l*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6454.5
Applied rewrites54.5%
if -1.70000000000000007e-279 < a < 4.4999999999999999e-193Initial program 67.6%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6477.0
Applied rewrites77.0%
Taylor expanded in t around -inf
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6488.1
Applied rewrites88.1%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f64N/A
lift--.f6471.4
Applied rewrites71.4%
Taylor expanded in z around inf
Applied rewrites69.7%
if 4.4999999999999999e-193 < a < 2.29999999999999998e92Initial program 69.6%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6447.0
Applied rewrites47.0%
Final simplification60.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- y x) (/ z a) x)))
(if (<= a -2.8e-66)
t_1
(if (<= a -1.7e-279)
(/ (* (- y x) z) (- a t))
(if (<= a 9.5e-84)
(+ y (/ (* x z) t))
(if (<= a 2.3e+90) (+ x y) t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y - x), (z / a), x);
double tmp;
if (a <= -2.8e-66) {
tmp = t_1;
} else if (a <= -1.7e-279) {
tmp = ((y - x) * z) / (a - t);
} else if (a <= 9.5e-84) {
tmp = y + ((x * z) / t);
} else if (a <= 2.3e+90) {
tmp = x + y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y - x), Float64(z / a), x) tmp = 0.0 if (a <= -2.8e-66) tmp = t_1; elseif (a <= -1.7e-279) tmp = Float64(Float64(Float64(y - x) * z) / Float64(a - t)); elseif (a <= 9.5e-84) tmp = Float64(y + Float64(Float64(x * z) / t)); elseif (a <= 2.3e+90) tmp = Float64(x + y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - x), $MachinePrecision] * N[(z / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -2.8e-66], t$95$1, If[LessEqual[a, -1.7e-279], N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 9.5e-84], N[(y + N[(N[(x * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 2.3e+90], N[(x + y), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y - x, \frac{z}{a}, x\right)\\
\mathbf{if}\;a \leq -2.8 \cdot 10^{-66}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq -1.7 \cdot 10^{-279}:\\
\;\;\;\;\frac{\left(y - x\right) \cdot z}{a - t}\\
\mathbf{elif}\;a \leq 9.5 \cdot 10^{-84}:\\
\;\;\;\;y + \frac{x \cdot z}{t}\\
\mathbf{elif}\;a \leq 2.3 \cdot 10^{+90}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -2.8e-66 or 2.3e90 < a Initial program 69.4%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6489.8
Applied rewrites89.8%
Taylor expanded in t around 0
lower-/.f6466.2
Applied rewrites66.2%
if -2.8e-66 < a < -1.70000000000000007e-279Initial program 67.6%
Taylor expanded in z around inf
sub-divN/A
associate-/l*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6454.5
Applied rewrites54.5%
if -1.70000000000000007e-279 < a < 9.49999999999999941e-84Initial program 68.3%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6478.2
Applied rewrites78.2%
Taylor expanded in t around -inf
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6480.5
Applied rewrites80.5%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f64N/A
lift--.f6465.5
Applied rewrites65.5%
Taylor expanded in z around inf
Applied rewrites62.7%
if 9.49999999999999941e-84 < a < 2.3e90Initial program 69.7%
Taylor expanded in t around inf
lift--.f6420.1
Applied rewrites20.1%
Taylor expanded in x around 0
Applied rewrites30.8%
Final simplification58.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- y x) (/ (- z t) a) x)))
(if (<= a -3.8e+88)
t_1
(if (<= a 6.6e-107)
(+ y (* z (/ (- x y) t)))
(if (<= a 4.6e+92) (* y (/ (- z t) (- a t))) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y - x), ((z - t) / a), x);
double tmp;
if (a <= -3.8e+88) {
tmp = t_1;
} else if (a <= 6.6e-107) {
tmp = y + (z * ((x - y) / t));
} else if (a <= 4.6e+92) {
tmp = y * ((z - t) / (a - t));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y - x), Float64(Float64(z - t) / a), x) tmp = 0.0 if (a <= -3.8e+88) tmp = t_1; elseif (a <= 6.6e-107) tmp = Float64(y + Float64(z * Float64(Float64(x - y) / t))); elseif (a <= 4.6e+92) tmp = Float64(y * Float64(Float64(z - t) / Float64(a - t))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - x), $MachinePrecision] * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -3.8e+88], t$95$1, If[LessEqual[a, 6.6e-107], N[(y + N[(z * N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 4.6e+92], N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y - x, \frac{z - t}{a}, x\right)\\
\mathbf{if}\;a \leq -3.8 \cdot 10^{+88}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 6.6 \cdot 10^{-107}:\\
\;\;\;\;y + z \cdot \frac{x - y}{t}\\
\mathbf{elif}\;a \leq 4.6 \cdot 10^{+92}:\\
\;\;\;\;y \cdot \frac{z - t}{a - t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -3.7999999999999997e88 or 4.59999999999999997e92 < a Initial program 68.2%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6480.7
Applied rewrites80.7%
if -3.7999999999999997e88 < a < 6.60000000000000007e-107Initial program 69.3%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6479.4
Applied rewrites79.4%
Taylor expanded in t around -inf
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6471.3
Applied rewrites71.3%
Taylor expanded in z around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6470.7
Applied rewrites70.7%
if 6.60000000000000007e-107 < a < 4.59999999999999997e92Initial program 69.3%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6481.9
Applied rewrites81.9%
Taylor expanded in y around inf
sub-divN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f6456.5
Applied rewrites56.5%
Final simplification72.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- y x) (/ z a) x)))
(if (<= a -3.8e+88)
t_1
(if (<= a 6.6e-107)
(+ y (* z (/ (- x y) t)))
(if (<= a 5.2e+95) (* y (/ (- z t) (- a t))) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y - x), (z / a), x);
double tmp;
if (a <= -3.8e+88) {
tmp = t_1;
} else if (a <= 6.6e-107) {
tmp = y + (z * ((x - y) / t));
} else if (a <= 5.2e+95) {
tmp = y * ((z - t) / (a - t));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y - x), Float64(z / a), x) tmp = 0.0 if (a <= -3.8e+88) tmp = t_1; elseif (a <= 6.6e-107) tmp = Float64(y + Float64(z * Float64(Float64(x - y) / t))); elseif (a <= 5.2e+95) tmp = Float64(y * Float64(Float64(z - t) / Float64(a - t))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - x), $MachinePrecision] * N[(z / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -3.8e+88], t$95$1, If[LessEqual[a, 6.6e-107], N[(y + N[(z * N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 5.2e+95], N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y - x, \frac{z}{a}, x\right)\\
\mathbf{if}\;a \leq -3.8 \cdot 10^{+88}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 6.6 \cdot 10^{-107}:\\
\;\;\;\;y + z \cdot \frac{x - y}{t}\\
\mathbf{elif}\;a \leq 5.2 \cdot 10^{+95}:\\
\;\;\;\;y \cdot \frac{z - t}{a - t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -3.7999999999999997e88 or 5.19999999999999981e95 < a Initial program 68.2%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6492.1
Applied rewrites92.1%
Taylor expanded in t around 0
lower-/.f6472.6
Applied rewrites72.6%
if -3.7999999999999997e88 < a < 6.60000000000000007e-107Initial program 69.3%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6479.4
Applied rewrites79.4%
Taylor expanded in t around -inf
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6471.3
Applied rewrites71.3%
Taylor expanded in z around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6470.7
Applied rewrites70.7%
if 6.60000000000000007e-107 < a < 5.19999999999999981e95Initial program 69.2%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6481.9
Applied rewrites81.9%
Taylor expanded in y around inf
sub-divN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f6456.7
Applied rewrites56.7%
Final simplification69.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -3.9e+211) (not (<= t 3.7e+198))) (+ y (* (- x) (/ (- a z) t))) (fma (- y x) (/ (- z t) (- a t)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -3.9e+211) || !(t <= 3.7e+198)) {
tmp = y + (-x * ((a - z) / t));
} else {
tmp = fma((y - x), ((z - t) / (a - t)), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -3.9e+211) || !(t <= 3.7e+198)) tmp = Float64(y + Float64(Float64(-x) * Float64(Float64(a - z) / t))); else tmp = fma(Float64(y - x), Float64(Float64(z - t) / Float64(a - t)), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -3.9e+211], N[Not[LessEqual[t, 3.7e+198]], $MachinePrecision]], N[(y + N[((-x) * N[(N[(a - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y - x), $MachinePrecision] * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.9 \cdot 10^{+211} \lor \neg \left(t \leq 3.7 \cdot 10^{+198}\right):\\
\;\;\;\;y + \left(-x\right) \cdot \frac{a - z}{t}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{z - t}{a - t}, x\right)\\
\end{array}
\end{array}
if t < -3.90000000000000023e211 or 3.6999999999999998e198 < t Initial program 25.2%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6464.6
Applied rewrites64.6%
Taylor expanded in t around -inf
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6464.0
Applied rewrites64.0%
Taylor expanded in x around -inf
lower-*.f64N/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6484.6
Applied rewrites84.6%
if -3.90000000000000023e211 < t < 3.6999999999999998e198Initial program 77.6%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6488.1
Applied rewrites88.1%
Final simplification87.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- y x) (/ z a) x)))
(if (<= a -2.35e-57)
t_1
(if (<= a 9.5e-84) (+ y (/ (* x z) t)) (if (<= a 2.3e+90) (+ x y) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y - x), (z / a), x);
double tmp;
if (a <= -2.35e-57) {
tmp = t_1;
} else if (a <= 9.5e-84) {
tmp = y + ((x * z) / t);
} else if (a <= 2.3e+90) {
tmp = x + y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y - x), Float64(z / a), x) tmp = 0.0 if (a <= -2.35e-57) tmp = t_1; elseif (a <= 9.5e-84) tmp = Float64(y + Float64(Float64(x * z) / t)); elseif (a <= 2.3e+90) tmp = Float64(x + y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - x), $MachinePrecision] * N[(z / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -2.35e-57], t$95$1, If[LessEqual[a, 9.5e-84], N[(y + N[(N[(x * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 2.3e+90], N[(x + y), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y - x, \frac{z}{a}, x\right)\\
\mathbf{if}\;a \leq -2.35 \cdot 10^{-57}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 9.5 \cdot 10^{-84}:\\
\;\;\;\;y + \frac{x \cdot z}{t}\\
\mathbf{elif}\;a \leq 2.3 \cdot 10^{+90}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -2.3499999999999999e-57 or 2.3e90 < a Initial program 69.3%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6489.9
Applied rewrites89.9%
Taylor expanded in t around 0
lower-/.f6466.6
Applied rewrites66.6%
if -2.3499999999999999e-57 < a < 9.49999999999999941e-84Initial program 68.1%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6478.0
Applied rewrites78.0%
Taylor expanded in t around -inf
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6478.4
Applied rewrites78.4%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f64N/A
lift--.f6464.3
Applied rewrites64.3%
Taylor expanded in z around inf
Applied rewrites61.0%
if 9.49999999999999941e-84 < a < 2.3e90Initial program 69.7%
Taylor expanded in t around inf
lift--.f6420.1
Applied rewrites20.1%
Taylor expanded in x around 0
Applied rewrites30.8%
Final simplification59.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma z (/ (- y x) a) x)))
(if (<= a -9.5e-98)
t_1
(if (<= a 9.5e-84) (+ y (/ (* x z) t)) (if (<= a 2.3e+90) (+ x y) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(z, ((y - x) / a), x);
double tmp;
if (a <= -9.5e-98) {
tmp = t_1;
} else if (a <= 9.5e-84) {
tmp = y + ((x * z) / t);
} else if (a <= 2.3e+90) {
tmp = x + y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(z, Float64(Float64(y - x) / a), x) tmp = 0.0 if (a <= -9.5e-98) tmp = t_1; elseif (a <= 9.5e-84) tmp = Float64(y + Float64(Float64(x * z) / t)); elseif (a <= 2.3e+90) tmp = Float64(x + y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(z * N[(N[(y - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -9.5e-98], t$95$1, If[LessEqual[a, 9.5e-84], N[(y + N[(N[(x * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 2.3e+90], N[(x + y), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(z, \frac{y - x}{a}, x\right)\\
\mathbf{if}\;a \leq -9.5 \cdot 10^{-98}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 9.5 \cdot 10^{-84}:\\
\;\;\;\;y + \frac{x \cdot z}{t}\\
\mathbf{elif}\;a \leq 2.3 \cdot 10^{+90}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -9.5000000000000001e-98 or 2.3e90 < a Initial program 69.4%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6463.7
Applied rewrites63.7%
if -9.5000000000000001e-98 < a < 9.49999999999999941e-84Initial program 67.8%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6478.0
Applied rewrites78.0%
Taylor expanded in t around -inf
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6479.8
Applied rewrites79.8%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f64N/A
lift--.f6465.3
Applied rewrites65.3%
Taylor expanded in z around inf
Applied rewrites62.3%
if 9.49999999999999941e-84 < a < 2.3e90Initial program 69.7%
Taylor expanded in t around inf
lift--.f6420.1
Applied rewrites20.1%
Taylor expanded in x around 0
Applied rewrites30.8%
Final simplification58.7%
(FPCore (x y z t a) :precision binary64 (if (<= t -8.5e+242) y (if (or (<= t -8e-5) (not (<= t 5.8e-46))) (+ x y) (fma y (/ z a) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -8.5e+242) {
tmp = y;
} else if ((t <= -8e-5) || !(t <= 5.8e-46)) {
tmp = x + y;
} else {
tmp = fma(y, (z / a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -8.5e+242) tmp = y; elseif ((t <= -8e-5) || !(t <= 5.8e-46)) tmp = Float64(x + y); else tmp = fma(y, Float64(z / a), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -8.5e+242], y, If[Or[LessEqual[t, -8e-5], N[Not[LessEqual[t, 5.8e-46]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(y * N[(z / a), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.5 \cdot 10^{+242}:\\
\;\;\;\;y\\
\mathbf{elif}\;t \leq -8 \cdot 10^{-5} \lor \neg \left(t \leq 5.8 \cdot 10^{-46}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z}{a}, x\right)\\
\end{array}
\end{array}
if t < -8.5000000000000003e242Initial program 18.6%
Taylor expanded in t around inf
Applied rewrites64.5%
if -8.5000000000000003e242 < t < -8.00000000000000065e-5 or 5.80000000000000009e-46 < t Initial program 53.6%
Taylor expanded in t around inf
lift--.f6428.7
Applied rewrites28.7%
Taylor expanded in x around 0
Applied rewrites39.0%
if -8.00000000000000065e-5 < t < 5.80000000000000009e-46Initial program 90.4%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6494.7
Applied rewrites94.7%
Taylor expanded in t around 0
lower-/.f6475.3
Applied rewrites75.3%
Taylor expanded in x around 0
Applied rewrites62.0%
Final simplification51.1%
(FPCore (x y z t a) :precision binary64 (if (<= t -8.5e+242) y (if (or (<= t -8e-5) (not (<= t 5.8e-46))) (+ x y) (fma z (/ y a) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -8.5e+242) {
tmp = y;
} else if ((t <= -8e-5) || !(t <= 5.8e-46)) {
tmp = x + y;
} else {
tmp = fma(z, (y / a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -8.5e+242) tmp = y; elseif ((t <= -8e-5) || !(t <= 5.8e-46)) tmp = Float64(x + y); else tmp = fma(z, Float64(y / a), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -8.5e+242], y, If[Or[LessEqual[t, -8e-5], N[Not[LessEqual[t, 5.8e-46]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(z * N[(y / a), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.5 \cdot 10^{+242}:\\
\;\;\;\;y\\
\mathbf{elif}\;t \leq -8 \cdot 10^{-5} \lor \neg \left(t \leq 5.8 \cdot 10^{-46}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{y}{a}, x\right)\\
\end{array}
\end{array}
if t < -8.5000000000000003e242Initial program 18.6%
Taylor expanded in t around inf
Applied rewrites64.5%
if -8.5000000000000003e242 < t < -8.00000000000000065e-5 or 5.80000000000000009e-46 < t Initial program 53.6%
Taylor expanded in t around inf
lift--.f6428.7
Applied rewrites28.7%
Taylor expanded in x around 0
Applied rewrites39.0%
if -8.00000000000000065e-5 < t < 5.80000000000000009e-46Initial program 90.4%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6473.2
Applied rewrites73.2%
Taylor expanded in x around 0
Applied rewrites60.3%
Final simplification50.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma y (/ z a) x)))
(if (<= a -4e+88)
t_1
(if (<= a 9.5e-84)
(+ y (/ (* x z) t))
(if (<= a 1.4e+100) (+ x y) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(y, (z / a), x);
double tmp;
if (a <= -4e+88) {
tmp = t_1;
} else if (a <= 9.5e-84) {
tmp = y + ((x * z) / t);
} else if (a <= 1.4e+100) {
tmp = x + y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(y, Float64(z / a), x) tmp = 0.0 if (a <= -4e+88) tmp = t_1; elseif (a <= 9.5e-84) tmp = Float64(y + Float64(Float64(x * z) / t)); elseif (a <= 1.4e+100) tmp = Float64(x + y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(z / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -4e+88], t$95$1, If[LessEqual[a, 9.5e-84], N[(y + N[(N[(x * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.4e+100], N[(x + y), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, \frac{z}{a}, x\right)\\
\mathbf{if}\;a \leq -4 \cdot 10^{+88}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 9.5 \cdot 10^{-84}:\\
\;\;\;\;y + \frac{x \cdot z}{t}\\
\mathbf{elif}\;a \leq 1.4 \cdot 10^{+100}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -3.99999999999999984e88 or 1.3999999999999999e100 < a Initial program 68.3%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6492.3
Applied rewrites92.3%
Taylor expanded in t around 0
lower-/.f6472.8
Applied rewrites72.8%
Taylor expanded in x around 0
Applied rewrites65.9%
if -3.99999999999999984e88 < a < 9.49999999999999941e-84Initial program 69.1%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6479.3
Applied rewrites79.3%
Taylor expanded in t around -inf
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6471.0
Applied rewrites71.0%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f64N/A
lift--.f6459.2
Applied rewrites59.2%
Taylor expanded in z around inf
Applied rewrites55.0%
if 9.49999999999999941e-84 < a < 1.3999999999999999e100Initial program 69.4%
Taylor expanded in t around inf
lift--.f6420.0
Applied rewrites20.0%
Taylor expanded in x around 0
Applied rewrites30.7%
Final simplification55.3%
(FPCore (x y z t a)
:precision binary64
(if (<= t -3.8e+46)
(+ y (* z (/ (- x y) t)))
(if (<= t 8.6e+75)
(fma (- y x) (/ z (- a t)) x)
(+ y (/ (* x (- z a)) t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -3.8e+46) {
tmp = y + (z * ((x - y) / t));
} else if (t <= 8.6e+75) {
tmp = fma((y - x), (z / (a - t)), x);
} else {
tmp = y + ((x * (z - a)) / t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -3.8e+46) tmp = Float64(y + Float64(z * Float64(Float64(x - y) / t))); elseif (t <= 8.6e+75) tmp = fma(Float64(y - x), Float64(z / Float64(a - t)), x); else tmp = Float64(y + Float64(Float64(x * Float64(z - a)) / t)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -3.8e+46], N[(y + N[(z * N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 8.6e+75], N[(N[(y - x), $MachinePrecision] * N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(y + N[(N[(x * N[(z - a), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.8 \cdot 10^{+46}:\\
\;\;\;\;y + z \cdot \frac{x - y}{t}\\
\mathbf{elif}\;t \leq 8.6 \cdot 10^{+75}:\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{z}{a - t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x \cdot \left(z - a\right)}{t}\\
\end{array}
\end{array}
if t < -3.7999999999999999e46Initial program 41.2%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6471.7
Applied rewrites71.7%
Taylor expanded in t around -inf
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6460.8
Applied rewrites60.8%
Taylor expanded in z around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6467.4
Applied rewrites67.4%
if -3.7999999999999999e46 < t < 8.6000000000000002e75Initial program 87.6%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6492.8
Applied rewrites92.8%
Taylor expanded in z around inf
Applied rewrites81.1%
if 8.6000000000000002e75 < t Initial program 39.1%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6470.3
Applied rewrites70.3%
Taylor expanded in t around -inf
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6463.0
Applied rewrites63.0%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f64N/A
lift--.f6463.3
Applied rewrites63.3%
Final simplification75.0%
(FPCore (x y z t a) :precision binary64 (if (<= a -2.4e+81) x (if (<= a 8.5e-84) y (if (<= a 5.2e+218) (+ x y) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2.4e+81) {
tmp = x;
} else if (a <= 8.5e-84) {
tmp = y;
} else if (a <= 5.2e+218) {
tmp = x + y;
} else {
tmp = x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (a <= (-2.4d+81)) then
tmp = x
else if (a <= 8.5d-84) then
tmp = y
else if (a <= 5.2d+218) then
tmp = x + y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2.4e+81) {
tmp = x;
} else if (a <= 8.5e-84) {
tmp = y;
} else if (a <= 5.2e+218) {
tmp = x + y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -2.4e+81: tmp = x elif a <= 8.5e-84: tmp = y elif a <= 5.2e+218: tmp = x + y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -2.4e+81) tmp = x; elseif (a <= 8.5e-84) tmp = y; elseif (a <= 5.2e+218) tmp = Float64(x + y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -2.4e+81) tmp = x; elseif (a <= 8.5e-84) tmp = y; elseif (a <= 5.2e+218) tmp = x + y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -2.4e+81], x, If[LessEqual[a, 8.5e-84], y, If[LessEqual[a, 5.2e+218], N[(x + y), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.4 \cdot 10^{+81}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 8.5 \cdot 10^{-84}:\\
\;\;\;\;y\\
\mathbf{elif}\;a \leq 5.2 \cdot 10^{+218}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -2.3999999999999999e81 or 5.20000000000000004e218 < a Initial program 67.8%
Taylor expanded in a around inf
Applied rewrites52.9%
if -2.3999999999999999e81 < a < 8.4999999999999994e-84Initial program 69.1%
Taylor expanded in t around inf
Applied rewrites33.4%
if 8.4999999999999994e-84 < a < 5.20000000000000004e218Initial program 69.6%
Taylor expanded in t around inf
lift--.f6417.0
Applied rewrites17.0%
Taylor expanded in x around 0
Applied rewrites34.4%
(FPCore (x y z t a) :precision binary64 (if (<= a -2.4e+81) x (if (<= a 1.4e+100) y x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2.4e+81) {
tmp = x;
} else if (a <= 1.4e+100) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (a <= (-2.4d+81)) then
tmp = x
else if (a <= 1.4d+100) then
tmp = y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2.4e+81) {
tmp = x;
} else if (a <= 1.4e+100) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -2.4e+81: tmp = x elif a <= 1.4e+100: tmp = y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -2.4e+81) tmp = x; elseif (a <= 1.4e+100) tmp = y; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -2.4e+81) tmp = x; elseif (a <= 1.4e+100) tmp = y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -2.4e+81], x, If[LessEqual[a, 1.4e+100], y, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.4 \cdot 10^{+81}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 1.4 \cdot 10^{+100}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -2.3999999999999999e81 or 1.3999999999999999e100 < a Initial program 68.4%
Taylor expanded in a around inf
Applied rewrites50.3%
if -2.3999999999999999e81 < a < 1.3999999999999999e100Initial program 69.2%
Taylor expanded in t around inf
Applied rewrites31.7%
(FPCore (x y z t a) :precision binary64 x)
double code(double x, double y, double z, double t, double a) {
return x;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x
end function
public static double code(double x, double y, double z, double t, double a) {
return x;
}
def code(x, y, z, t, a): return x
function code(x, y, z, t, a) return x end
function tmp = code(x, y, z, t, a) tmp = x; end
code[x_, y_, z_, t_, a_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 68.9%
Taylor expanded in a around inf
Applied rewrites24.6%
(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 2025086
(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))))