
(FPCore (x y z t a) :precision binary64 (+ x (* (- y z) (/ (- t x) (- a z)))))
double code(double x, double y, double z, double t, double a) {
return x + ((y - z) * ((t - x) / (a - z)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + ((y - z) * ((t - x) / (a - z)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y - z) * ((t - x) / (a - z)));
}
def code(x, y, z, t, a): return x + ((y - z) * ((t - x) / (a - z)))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y - z) * ((t - x) / (a - z))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\end{array}
Herbie found 23 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (* (- y z) (/ (- t x) (- a z)))))
double code(double x, double y, double z, double t, double a) {
return x + ((y - z) * ((t - x) / (a - z)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + ((y - z) * ((t - x) / (a - z)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y - z) * ((t - x) / (a - z)));
}
def code(x, y, z, t, a): return x + ((y - z) * ((t - x) / (a - z)))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y - z) * ((t - x) / (a - z))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- t x) (- a z)))
(t_2 (+ x (* (- y z) t_1)))
(t_3 (fma t_1 (- y z) x)))
(if (<= t_2 (- INFINITY))
(+ x (fma (/ (- y z) (- a z)) t (- (/ (* (- y z) x) (- a z)))))
(if (<= t_2 -2e-296)
t_3
(if (<= t_2 4e-271) (fma (/ (* (- t x) (- y a)) z) -1.0 t) t_3)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t - x) / (a - z);
double t_2 = x + ((y - z) * t_1);
double t_3 = fma(t_1, (y - z), x);
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = x + fma(((y - z) / (a - z)), t, -(((y - z) * x) / (a - z)));
} else if (t_2 <= -2e-296) {
tmp = t_3;
} else if (t_2 <= 4e-271) {
tmp = fma((((t - x) * (y - a)) / z), -1.0, t);
} else {
tmp = t_3;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(t - x) / Float64(a - z)) t_2 = Float64(x + Float64(Float64(y - z) * t_1)) t_3 = fma(t_1, Float64(y - z), x) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = Float64(x + fma(Float64(Float64(y - z) / Float64(a - z)), t, Float64(-Float64(Float64(Float64(y - z) * x) / Float64(a - z))))); elseif (t_2 <= -2e-296) tmp = t_3; elseif (t_2 <= 4e-271) tmp = fma(Float64(Float64(Float64(t - x) * Float64(y - a)) / z), -1.0, t); else tmp = t_3; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(y - z), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 * N[(y - z), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(x + N[(N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * t + (-N[(N[(N[(y - z), $MachinePrecision] * x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision])), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -2e-296], t$95$3, If[LessEqual[t$95$2, 4e-271], N[(N[(N[(N[(t - x), $MachinePrecision] * N[(y - a), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] * -1.0 + t), $MachinePrecision], t$95$3]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - x}{a - z}\\
t_2 := x + \left(y - z\right) \cdot t\_1\\
t_3 := \mathsf{fma}\left(t\_1, y - z, x\right)\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;x + \mathsf{fma}\left(\frac{y - z}{a - z}, t, -\frac{\left(y - z\right) \cdot x}{a - z}\right)\\
\mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-296}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{-271}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(t - x\right) \cdot \left(y - a\right)}{z}, -1, t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -inf.0Initial program 84.0%
Taylor expanded in x around 0
+-commutativeN/A
associate-/l*N/A
sub-divN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6485.6
Applied rewrites85.6%
if -inf.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -2e-296 or 3.99999999999999985e-271 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 91.9%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f6491.9
Applied rewrites91.9%
if -2e-296 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 3.99999999999999985e-271Initial program 6.7%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites79.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* (- y z) (/ (- t x) (- a z))))))
(if (<= t_1 -5e+306)
(/ (* t y) a)
(if (<= t_1 -1e-68)
(+ x t)
(if (<= t_1 -2e-296)
x
(if (<= t_1 0.0)
(* (/ (- y a) z) x)
(if (<= t_1 2e+300) (+ x t) (/ (* t y) (- a z)))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_1 <= -5e+306) {
tmp = (t * y) / a;
} else if (t_1 <= -1e-68) {
tmp = x + t;
} else if (t_1 <= -2e-296) {
tmp = x;
} else if (t_1 <= 0.0) {
tmp = ((y - a) / z) * x;
} else if (t_1 <= 2e+300) {
tmp = x + t;
} else {
tmp = (t * y) / (a - z);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = x + ((y - z) * ((t - x) / (a - z)))
if (t_1 <= (-5d+306)) then
tmp = (t * y) / a
else if (t_1 <= (-1d-68)) then
tmp = x + t
else if (t_1 <= (-2d-296)) then
tmp = x
else if (t_1 <= 0.0d0) then
tmp = ((y - a) / z) * x
else if (t_1 <= 2d+300) then
tmp = x + t
else
tmp = (t * y) / (a - z)
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 - z) * ((t - x) / (a - z)));
double tmp;
if (t_1 <= -5e+306) {
tmp = (t * y) / a;
} else if (t_1 <= -1e-68) {
tmp = x + t;
} else if (t_1 <= -2e-296) {
tmp = x;
} else if (t_1 <= 0.0) {
tmp = ((y - a) / z) * x;
} else if (t_1 <= 2e+300) {
tmp = x + t;
} else {
tmp = (t * y) / (a - z);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + ((y - z) * ((t - x) / (a - z))) tmp = 0 if t_1 <= -5e+306: tmp = (t * y) / a elif t_1 <= -1e-68: tmp = x + t elif t_1 <= -2e-296: tmp = x elif t_1 <= 0.0: tmp = ((y - a) / z) * x elif t_1 <= 2e+300: tmp = x + t else: tmp = (t * y) / (a - z) return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) tmp = 0.0 if (t_1 <= -5e+306) tmp = Float64(Float64(t * y) / a); elseif (t_1 <= -1e-68) tmp = Float64(x + t); elseif (t_1 <= -2e-296) tmp = x; elseif (t_1 <= 0.0) tmp = Float64(Float64(Float64(y - a) / z) * x); elseif (t_1 <= 2e+300) tmp = Float64(x + t); else tmp = Float64(Float64(t * y) / Float64(a - z)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + ((y - z) * ((t - x) / (a - z))); tmp = 0.0; if (t_1 <= -5e+306) tmp = (t * y) / a; elseif (t_1 <= -1e-68) tmp = x + t; elseif (t_1 <= -2e-296) tmp = x; elseif (t_1 <= 0.0) tmp = ((y - a) / z) * x; elseif (t_1 <= 2e+300) tmp = x + t; else tmp = (t * y) / (a - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+306], N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[t$95$1, -1e-68], N[(x + t), $MachinePrecision], If[LessEqual[t$95$1, -2e-296], x, If[LessEqual[t$95$1, 0.0], N[(N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[t$95$1, 2e+300], N[(x + t), $MachinePrecision], N[(N[(t * y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+306}:\\
\;\;\;\;\frac{t \cdot y}{a}\\
\mathbf{elif}\;t\_1 \leq -1 \cdot 10^{-68}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;t\_1 \leq -2 \cdot 10^{-296}:\\
\;\;\;\;x\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\frac{y - a}{z} \cdot x\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+300}:\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;\frac{t \cdot y}{a - z}\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -4.99999999999999993e306Initial program 84.1%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f6484.1
Applied rewrites84.1%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6458.7
Applied rewrites58.7%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6443.9
Applied rewrites43.9%
if -4.99999999999999993e306 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -1.00000000000000007e-68 or 0.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 2.0000000000000001e300Initial program 94.1%
Taylor expanded in z around inf
lift--.f6425.8
Applied rewrites25.8%
Taylor expanded in x around 0
Applied rewrites46.1%
if -1.00000000000000007e-68 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -2e-296Initial program 74.2%
Taylor expanded in a around inf
Applied rewrites44.5%
if -2e-296 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 0.0Initial program 4.3%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
sub-divN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f644.2
Applied rewrites4.2%
Taylor expanded in z around -inf
lower-/.f64N/A
lift--.f6460.5
Applied rewrites60.5%
if 2.0000000000000001e300 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 86.9%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f6486.9
Applied rewrites86.9%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6453.4
Applied rewrites53.4%
Taylor expanded in y around inf
Applied rewrites49.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* t y) a)) (t_2 (+ x (* (- y z) (/ (- t x) (- a z))))))
(if (<= t_2 -5e+306)
t_1
(if (<= t_2 -1e-68)
(+ x t)
(if (<= t_2 -2e-296)
x
(if (<= t_2 0.0)
(* (/ (- y a) z) x)
(if (<= t_2 5e+304) (+ x t) t_1)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t * y) / a;
double t_2 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_2 <= -5e+306) {
tmp = t_1;
} else if (t_2 <= -1e-68) {
tmp = x + t;
} else if (t_2 <= -2e-296) {
tmp = x;
} else if (t_2 <= 0.0) {
tmp = ((y - a) / z) * x;
} else if (t_2 <= 5e+304) {
tmp = x + t;
} 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) :: t_2
real(8) :: tmp
t_1 = (t * y) / a
t_2 = x + ((y - z) * ((t - x) / (a - z)))
if (t_2 <= (-5d+306)) then
tmp = t_1
else if (t_2 <= (-1d-68)) then
tmp = x + t
else if (t_2 <= (-2d-296)) then
tmp = x
else if (t_2 <= 0.0d0) then
tmp = ((y - a) / z) * x
else if (t_2 <= 5d+304) then
tmp = x + t
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 = (t * y) / a;
double t_2 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_2 <= -5e+306) {
tmp = t_1;
} else if (t_2 <= -1e-68) {
tmp = x + t;
} else if (t_2 <= -2e-296) {
tmp = x;
} else if (t_2 <= 0.0) {
tmp = ((y - a) / z) * x;
} else if (t_2 <= 5e+304) {
tmp = x + t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (t * y) / a t_2 = x + ((y - z) * ((t - x) / (a - z))) tmp = 0 if t_2 <= -5e+306: tmp = t_1 elif t_2 <= -1e-68: tmp = x + t elif t_2 <= -2e-296: tmp = x elif t_2 <= 0.0: tmp = ((y - a) / z) * x elif t_2 <= 5e+304: tmp = x + t else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(t * y) / a) t_2 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) tmp = 0.0 if (t_2 <= -5e+306) tmp = t_1; elseif (t_2 <= -1e-68) tmp = Float64(x + t); elseif (t_2 <= -2e-296) tmp = x; elseif (t_2 <= 0.0) tmp = Float64(Float64(Float64(y - a) / z) * x); elseif (t_2 <= 5e+304) tmp = Float64(x + t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (t * y) / a; t_2 = x + ((y - z) * ((t - x) / (a - z))); tmp = 0.0; if (t_2 <= -5e+306) tmp = t_1; elseif (t_2 <= -1e-68) tmp = x + t; elseif (t_2 <= -2e-296) tmp = x; elseif (t_2 <= 0.0) tmp = ((y - a) / z) * x; elseif (t_2 <= 5e+304) tmp = x + t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+306], t$95$1, If[LessEqual[t$95$2, -1e-68], N[(x + t), $MachinePrecision], If[LessEqual[t$95$2, -2e-296], x, If[LessEqual[t$95$2, 0.0], N[(N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[t$95$2, 5e+304], N[(x + t), $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t \cdot y}{a}\\
t_2 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+306}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -1 \cdot 10^{-68}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-296}:\\
\;\;\;\;x\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\frac{y - a}{z} \cdot x\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+304}:\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -4.99999999999999993e306 or 4.9999999999999997e304 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 85.3%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f6485.3
Applied rewrites85.3%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6456.7
Applied rewrites56.7%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6442.7
Applied rewrites42.7%
if -4.99999999999999993e306 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -1.00000000000000007e-68 or 0.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 4.9999999999999997e304Initial program 94.1%
Taylor expanded in z around inf
lift--.f6425.8
Applied rewrites25.8%
Taylor expanded in x around 0
Applied rewrites46.1%
if -1.00000000000000007e-68 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -2e-296Initial program 74.2%
Taylor expanded in a around inf
Applied rewrites44.5%
if -2e-296 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 0.0Initial program 4.3%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
sub-divN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f644.2
Applied rewrites4.2%
Taylor expanded in z around -inf
lower-/.f64N/A
lift--.f6460.5
Applied rewrites60.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* t y) a)) (t_2 (+ x (* (- y z) (/ (- t x) (- a z))))))
(if (<= t_2 -5e+306)
t_1
(if (<= t_2 -1e-68)
(+ x t)
(if (<= t_2 -2e-296)
x
(if (<= t_2 0.0)
(/ (* x (- y a)) z)
(if (<= t_2 5e+304) (+ x t) t_1)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t * y) / a;
double t_2 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_2 <= -5e+306) {
tmp = t_1;
} else if (t_2 <= -1e-68) {
tmp = x + t;
} else if (t_2 <= -2e-296) {
tmp = x;
} else if (t_2 <= 0.0) {
tmp = (x * (y - a)) / z;
} else if (t_2 <= 5e+304) {
tmp = x + t;
} 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) :: t_2
real(8) :: tmp
t_1 = (t * y) / a
t_2 = x + ((y - z) * ((t - x) / (a - z)))
if (t_2 <= (-5d+306)) then
tmp = t_1
else if (t_2 <= (-1d-68)) then
tmp = x + t
else if (t_2 <= (-2d-296)) then
tmp = x
else if (t_2 <= 0.0d0) then
tmp = (x * (y - a)) / z
else if (t_2 <= 5d+304) then
tmp = x + t
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 = (t * y) / a;
double t_2 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_2 <= -5e+306) {
tmp = t_1;
} else if (t_2 <= -1e-68) {
tmp = x + t;
} else if (t_2 <= -2e-296) {
tmp = x;
} else if (t_2 <= 0.0) {
tmp = (x * (y - a)) / z;
} else if (t_2 <= 5e+304) {
tmp = x + t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (t * y) / a t_2 = x + ((y - z) * ((t - x) / (a - z))) tmp = 0 if t_2 <= -5e+306: tmp = t_1 elif t_2 <= -1e-68: tmp = x + t elif t_2 <= -2e-296: tmp = x elif t_2 <= 0.0: tmp = (x * (y - a)) / z elif t_2 <= 5e+304: tmp = x + t else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(t * y) / a) t_2 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) tmp = 0.0 if (t_2 <= -5e+306) tmp = t_1; elseif (t_2 <= -1e-68) tmp = Float64(x + t); elseif (t_2 <= -2e-296) tmp = x; elseif (t_2 <= 0.0) tmp = Float64(Float64(x * Float64(y - a)) / z); elseif (t_2 <= 5e+304) tmp = Float64(x + t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (t * y) / a; t_2 = x + ((y - z) * ((t - x) / (a - z))); tmp = 0.0; if (t_2 <= -5e+306) tmp = t_1; elseif (t_2 <= -1e-68) tmp = x + t; elseif (t_2 <= -2e-296) tmp = x; elseif (t_2 <= 0.0) tmp = (x * (y - a)) / z; elseif (t_2 <= 5e+304) tmp = x + t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+306], t$95$1, If[LessEqual[t$95$2, -1e-68], N[(x + t), $MachinePrecision], If[LessEqual[t$95$2, -2e-296], x, If[LessEqual[t$95$2, 0.0], N[(N[(x * N[(y - a), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[t$95$2, 5e+304], N[(x + t), $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t \cdot y}{a}\\
t_2 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+306}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -1 \cdot 10^{-68}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-296}:\\
\;\;\;\;x\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\frac{x \cdot \left(y - a\right)}{z}\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+304}:\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -4.99999999999999993e306 or 4.9999999999999997e304 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 85.3%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f6485.3
Applied rewrites85.3%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6456.7
Applied rewrites56.7%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6442.7
Applied rewrites42.7%
if -4.99999999999999993e306 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -1.00000000000000007e-68 or 0.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 4.9999999999999997e304Initial program 94.1%
Taylor expanded in z around inf
lift--.f6425.8
Applied rewrites25.8%
Taylor expanded in x around 0
Applied rewrites46.1%
if -1.00000000000000007e-68 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -2e-296Initial program 74.2%
Taylor expanded in a around inf
Applied rewrites44.5%
if -2e-296 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 0.0Initial program 4.3%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
sub-divN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f644.2
Applied rewrites4.2%
Taylor expanded in z around -inf
lower-/.f64N/A
lower-*.f64N/A
lift--.f6448.5
Applied rewrites48.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* t y) a)) (t_2 (+ x (* (- y z) (/ (- t x) (- a z))))))
(if (<= t_2 -5e+306)
t_1
(if (<= t_2 -1e-68)
(+ x t)
(if (<= t_2 -2e-296)
x
(if (<= t_2 0.0) (* (/ y z) x) (if (<= t_2 5e+304) (+ x t) t_1)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t * y) / a;
double t_2 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_2 <= -5e+306) {
tmp = t_1;
} else if (t_2 <= -1e-68) {
tmp = x + t;
} else if (t_2 <= -2e-296) {
tmp = x;
} else if (t_2 <= 0.0) {
tmp = (y / z) * x;
} else if (t_2 <= 5e+304) {
tmp = x + t;
} 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) :: t_2
real(8) :: tmp
t_1 = (t * y) / a
t_2 = x + ((y - z) * ((t - x) / (a - z)))
if (t_2 <= (-5d+306)) then
tmp = t_1
else if (t_2 <= (-1d-68)) then
tmp = x + t
else if (t_2 <= (-2d-296)) then
tmp = x
else if (t_2 <= 0.0d0) then
tmp = (y / z) * x
else if (t_2 <= 5d+304) then
tmp = x + t
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 = (t * y) / a;
double t_2 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_2 <= -5e+306) {
tmp = t_1;
} else if (t_2 <= -1e-68) {
tmp = x + t;
} else if (t_2 <= -2e-296) {
tmp = x;
} else if (t_2 <= 0.0) {
tmp = (y / z) * x;
} else if (t_2 <= 5e+304) {
tmp = x + t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (t * y) / a t_2 = x + ((y - z) * ((t - x) / (a - z))) tmp = 0 if t_2 <= -5e+306: tmp = t_1 elif t_2 <= -1e-68: tmp = x + t elif t_2 <= -2e-296: tmp = x elif t_2 <= 0.0: tmp = (y / z) * x elif t_2 <= 5e+304: tmp = x + t else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(t * y) / a) t_2 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) tmp = 0.0 if (t_2 <= -5e+306) tmp = t_1; elseif (t_2 <= -1e-68) tmp = Float64(x + t); elseif (t_2 <= -2e-296) tmp = x; elseif (t_2 <= 0.0) tmp = Float64(Float64(y / z) * x); elseif (t_2 <= 5e+304) tmp = Float64(x + t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (t * y) / a; t_2 = x + ((y - z) * ((t - x) / (a - z))); tmp = 0.0; if (t_2 <= -5e+306) tmp = t_1; elseif (t_2 <= -1e-68) tmp = x + t; elseif (t_2 <= -2e-296) tmp = x; elseif (t_2 <= 0.0) tmp = (y / z) * x; elseif (t_2 <= 5e+304) tmp = x + t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+306], t$95$1, If[LessEqual[t$95$2, -1e-68], N[(x + t), $MachinePrecision], If[LessEqual[t$95$2, -2e-296], x, If[LessEqual[t$95$2, 0.0], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[t$95$2, 5e+304], N[(x + t), $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t \cdot y}{a}\\
t_2 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+306}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -1 \cdot 10^{-68}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-296}:\\
\;\;\;\;x\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+304}:\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -4.99999999999999993e306 or 4.9999999999999997e304 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 85.3%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f6485.3
Applied rewrites85.3%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6456.7
Applied rewrites56.7%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6442.7
Applied rewrites42.7%
if -4.99999999999999993e306 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -1.00000000000000007e-68 or 0.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 4.9999999999999997e304Initial program 94.1%
Taylor expanded in z around inf
lift--.f6425.8
Applied rewrites25.8%
Taylor expanded in x around 0
Applied rewrites46.1%
if -1.00000000000000007e-68 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -2e-296Initial program 74.2%
Taylor expanded in a around inf
Applied rewrites44.5%
if -2e-296 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 0.0Initial program 4.3%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
sub-divN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f644.2
Applied rewrites4.2%
Taylor expanded in a around 0
lower-/.f6431.6
Applied rewrites31.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ t (- a z)) (- y z) x))
(t_2 (/ (- t x) (- a z)))
(t_3 (+ x (* (- y z) t_2))))
(if (<= t_3 (- INFINITY))
(/ (* (- t x) y) (- a z))
(if (<= t_3 -2e-296)
t_1
(if (<= t_3 4e-271)
(fma (/ (* y (- t x)) z) -1.0 t)
(if (<= t_3 1e+224) t_1 (+ x (* y t_2))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((t / (a - z)), (y - z), x);
double t_2 = (t - x) / (a - z);
double t_3 = x + ((y - z) * t_2);
double tmp;
if (t_3 <= -((double) INFINITY)) {
tmp = ((t - x) * y) / (a - z);
} else if (t_3 <= -2e-296) {
tmp = t_1;
} else if (t_3 <= 4e-271) {
tmp = fma(((y * (t - x)) / z), -1.0, t);
} else if (t_3 <= 1e+224) {
tmp = t_1;
} else {
tmp = x + (y * t_2);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(t / Float64(a - z)), Float64(y - z), x) t_2 = Float64(Float64(t - x) / Float64(a - z)) t_3 = Float64(x + Float64(Float64(y - z) * t_2)) tmp = 0.0 if (t_3 <= Float64(-Inf)) tmp = Float64(Float64(Float64(t - x) * y) / Float64(a - z)); elseif (t_3 <= -2e-296) tmp = t_1; elseif (t_3 <= 4e-271) tmp = fma(Float64(Float64(y * Float64(t - x)) / z), -1.0, t); elseif (t_3 <= 1e+224) tmp = t_1; else tmp = Float64(x + Float64(y * t_2)); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(x + N[(N[(y - z), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, (-Infinity)], N[(N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, -2e-296], t$95$1, If[LessEqual[t$95$3, 4e-271], N[(N[(N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] * -1.0 + t), $MachinePrecision], If[LessEqual[t$95$3, 1e+224], t$95$1, N[(x + N[(y * t$95$2), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{t}{a - z}, y - z, x\right)\\
t_2 := \frac{t - x}{a - z}\\
t_3 := x + \left(y - z\right) \cdot t\_2\\
\mathbf{if}\;t\_3 \leq -\infty:\\
\;\;\;\;\frac{\left(t - x\right) \cdot y}{a - z}\\
\mathbf{elif}\;t\_3 \leq -2 \cdot 10^{-296}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_3 \leq 4 \cdot 10^{-271}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y \cdot \left(t - x\right)}{z}, -1, t\right)\\
\mathbf{elif}\;t\_3 \leq 10^{+224}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot t\_2\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -inf.0Initial program 84.0%
Taylor expanded in y around inf
sub-divN/A
associate-/l*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6491.9
Applied rewrites91.9%
if -inf.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -2e-296 or 3.99999999999999985e-271 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 9.9999999999999997e223Initial program 91.9%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f6491.9
Applied rewrites91.9%
Taylor expanded in x around 0
Applied rewrites77.7%
if -2e-296 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 3.99999999999999985e-271Initial program 6.7%
Taylor expanded in z around -inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites78.8%
Taylor expanded in a around 0
lower-*.f64N/A
lift--.f6457.2
Applied rewrites57.2%
if 9.9999999999999997e223 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 91.7%
Taylor expanded in y around inf
Applied rewrites78.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* (- t x) y) (- a z)))
(t_2 (+ x (* (- y z) (/ (- t x) (- a z)))))
(t_3 (fma (/ t (- a z)) (- y z) x)))
(if (<= t_2 (- INFINITY))
t_1
(if (<= t_2 -2e-296)
t_3
(if (<= t_2 4e-271)
(fma (/ (* y (- t x)) z) -1.0 t)
(if (<= t_2 5e+304) t_3 t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((t - x) * y) / (a - z);
double t_2 = x + ((y - z) * ((t - x) / (a - z)));
double t_3 = fma((t / (a - z)), (y - z), x);
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= -2e-296) {
tmp = t_3;
} else if (t_2 <= 4e-271) {
tmp = fma(((y * (t - x)) / z), -1.0, t);
} else if (t_2 <= 5e+304) {
tmp = t_3;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(t - x) * y) / Float64(a - z)) t_2 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) t_3 = fma(Float64(t / Float64(a - z)), Float64(y - z), x) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= -2e-296) tmp = t_3; elseif (t_2 <= 4e-271) tmp = fma(Float64(Float64(y * Float64(t - x)) / z), -1.0, t); elseif (t_2 <= 5e+304) tmp = t_3; else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, -2e-296], t$95$3, If[LessEqual[t$95$2, 4e-271], N[(N[(N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] * -1.0 + t), $MachinePrecision], If[LessEqual[t$95$2, 5e+304], t$95$3, t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(t - x\right) \cdot y}{a - z}\\
t_2 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
t_3 := \mathsf{fma}\left(\frac{t}{a - z}, y - z, x\right)\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-296}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{-271}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y \cdot \left(t - x\right)}{z}, -1, t\right)\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+304}:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -inf.0 or 4.9999999999999997e304 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 85.2%
Taylor expanded in y around inf
sub-divN/A
associate-/l*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6491.3
Applied rewrites91.3%
if -inf.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -2e-296 or 3.99999999999999985e-271 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 4.9999999999999997e304Initial program 92.5%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f6492.5
Applied rewrites92.5%
Taylor expanded in x around 0
Applied rewrites77.6%
if -2e-296 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 3.99999999999999985e-271Initial program 6.7%
Taylor expanded in z around -inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites78.8%
Taylor expanded in a around 0
lower-*.f64N/A
lift--.f6457.2
Applied rewrites57.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* (- t x) y) (- a z)))
(t_2 (+ x (* (- y z) (/ (- t x) (- a z)))))
(t_3 (fma (/ t (- a z)) (- y z) x)))
(if (<= t_2 (- INFINITY))
t_1
(if (<= t_2 -2e-296)
t_3
(if (<= t_2 4e-271)
(* (/ (- y a) z) x)
(if (<= t_2 5e+304) t_3 t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((t - x) * y) / (a - z);
double t_2 = x + ((y - z) * ((t - x) / (a - z)));
double t_3 = fma((t / (a - z)), (y - z), x);
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= -2e-296) {
tmp = t_3;
} else if (t_2 <= 4e-271) {
tmp = ((y - a) / z) * x;
} else if (t_2 <= 5e+304) {
tmp = t_3;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(t - x) * y) / Float64(a - z)) t_2 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) t_3 = fma(Float64(t / Float64(a - z)), Float64(y - z), x) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= -2e-296) tmp = t_3; elseif (t_2 <= 4e-271) tmp = Float64(Float64(Float64(y - a) / z) * x); elseif (t_2 <= 5e+304) tmp = t_3; else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, -2e-296], t$95$3, If[LessEqual[t$95$2, 4e-271], N[(N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[t$95$2, 5e+304], t$95$3, t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(t - x\right) \cdot y}{a - z}\\
t_2 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
t_3 := \mathsf{fma}\left(\frac{t}{a - z}, y - z, x\right)\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-296}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{-271}:\\
\;\;\;\;\frac{y - a}{z} \cdot x\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+304}:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -inf.0 or 4.9999999999999997e304 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 85.2%
Taylor expanded in y around inf
sub-divN/A
associate-/l*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6491.3
Applied rewrites91.3%
if -inf.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -2e-296 or 3.99999999999999985e-271 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 4.9999999999999997e304Initial program 92.5%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f6492.5
Applied rewrites92.5%
Taylor expanded in x around 0
Applied rewrites77.6%
if -2e-296 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 3.99999999999999985e-271Initial program 6.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
sub-divN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f646.4
Applied rewrites6.4%
Taylor expanded in z around -inf
lower-/.f64N/A
lift--.f6457.7
Applied rewrites57.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- t x) (- a z)))
(t_2 (fma t_1 (- y z) x))
(t_3 (+ x (* (- y z) t_1))))
(if (<= t_3 -2e-296)
t_2
(if (<= t_3 4e-271) (fma (/ (* (- t x) (- y a)) z) -1.0 t) t_2))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t - x) / (a - z);
double t_2 = fma(t_1, (y - z), x);
double t_3 = x + ((y - z) * t_1);
double tmp;
if (t_3 <= -2e-296) {
tmp = t_2;
} else if (t_3 <= 4e-271) {
tmp = fma((((t - x) * (y - a)) / z), -1.0, t);
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(t - x) / Float64(a - z)) t_2 = fma(t_1, Float64(y - z), x) t_3 = Float64(x + Float64(Float64(y - z) * t_1)) tmp = 0.0 if (t_3 <= -2e-296) tmp = t_2; elseif (t_3 <= 4e-271) tmp = fma(Float64(Float64(Float64(t - x) * Float64(y - a)) / z), -1.0, t); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * N[(y - z), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$3 = N[(x + N[(N[(y - z), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -2e-296], t$95$2, If[LessEqual[t$95$3, 4e-271], N[(N[(N[(N[(t - x), $MachinePrecision] * N[(y - a), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] * -1.0 + t), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - x}{a - z}\\
t_2 := \mathsf{fma}\left(t\_1, y - z, x\right)\\
t_3 := x + \left(y - z\right) \cdot t\_1\\
\mathbf{if}\;t\_3 \leq -2 \cdot 10^{-296}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_3 \leq 4 \cdot 10^{-271}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(t - x\right) \cdot \left(y - a\right)}{z}, -1, t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -2e-296 or 3.99999999999999985e-271 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 91.1%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f6491.1
Applied rewrites91.1%
if -2e-296 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 3.99999999999999985e-271Initial program 6.7%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites79.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- t x) (- a z)))
(t_2 (fma t_1 (- y z) x))
(t_3 (+ x (* (- y z) t_1))))
(if (<= t_3 -2e-296)
t_2
(if (<= t_3 4e-271) (fma (/ (* y (- t x)) z) -1.0 t) t_2))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t - x) / (a - z);
double t_2 = fma(t_1, (y - z), x);
double t_3 = x + ((y - z) * t_1);
double tmp;
if (t_3 <= -2e-296) {
tmp = t_2;
} else if (t_3 <= 4e-271) {
tmp = fma(((y * (t - x)) / z), -1.0, t);
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(t - x) / Float64(a - z)) t_2 = fma(t_1, Float64(y - z), x) t_3 = Float64(x + Float64(Float64(y - z) * t_1)) tmp = 0.0 if (t_3 <= -2e-296) tmp = t_2; elseif (t_3 <= 4e-271) tmp = fma(Float64(Float64(y * Float64(t - x)) / z), -1.0, t); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * N[(y - z), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$3 = N[(x + N[(N[(y - z), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -2e-296], t$95$2, If[LessEqual[t$95$3, 4e-271], N[(N[(N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] * -1.0 + t), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - x}{a - z}\\
t_2 := \mathsf{fma}\left(t\_1, y - z, x\right)\\
t_3 := x + \left(y - z\right) \cdot t\_1\\
\mathbf{if}\;t\_3 \leq -2 \cdot 10^{-296}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_3 \leq 4 \cdot 10^{-271}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y \cdot \left(t - x\right)}{z}, -1, t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -2e-296 or 3.99999999999999985e-271 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 91.1%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f6491.1
Applied rewrites91.1%
if -2e-296 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 3.99999999999999985e-271Initial program 6.7%
Taylor expanded in z around -inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites78.8%
Taylor expanded in a around 0
lower-*.f64N/A
lift--.f6457.2
Applied rewrites57.2%
(FPCore (x y z t a) :precision binary64 (fma -1.0 (* x (- (/ y (- a z)) (+ 1.0 (/ z (- a z))))) (* t (/ (- y z) (- a z)))))
double code(double x, double y, double z, double t, double a) {
return fma(-1.0, (x * ((y / (a - z)) - (1.0 + (z / (a - z))))), (t * ((y - z) / (a - z))));
}
function code(x, y, z, t, a) return fma(-1.0, Float64(x * Float64(Float64(y / Float64(a - z)) - Float64(1.0 + Float64(z / Float64(a - z))))), Float64(t * Float64(Float64(y - z) / Float64(a - z)))) end
code[x_, y_, z_, t_, a_] := N[(-1.0 * N[(x * N[(N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision] - N[(1.0 + N[(z / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t * N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(-1, x \cdot \left(\frac{y}{a - z} - \left(1 + \frac{z}{a - z}\right)\right), t \cdot \frac{y - z}{a - z}\right)
\end{array}
Initial program 81.0%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f6481.1
Applied rewrites81.1%
Taylor expanded in x around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
Applied rewrites80.2%
Taylor expanded in t around 0
lower-fma.f64N/A
lower-*.f64N/A
lower--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-+.f64N/A
sub-divN/A
lower-*.f64N/A
lift-/.f64N/A
Applied rewrites91.1%
(FPCore (x y z t a)
:precision binary64
(if (<= a -5.8e+79)
x
(if (<= a -0.6)
(/ (* t (- y z)) a)
(if (<= a 1.3e-91)
(* (/ (- y a) z) x)
(if (<= a 1.7e+26) (/ (* t y) (- a z)) x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -5.8e+79) {
tmp = x;
} else if (a <= -0.6) {
tmp = (t * (y - z)) / a;
} else if (a <= 1.3e-91) {
tmp = ((y - a) / z) * x;
} else if (a <= 1.7e+26) {
tmp = (t * y) / (a - z);
} 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 <= (-5.8d+79)) then
tmp = x
else if (a <= (-0.6d0)) then
tmp = (t * (y - z)) / a
else if (a <= 1.3d-91) then
tmp = ((y - a) / z) * x
else if (a <= 1.7d+26) then
tmp = (t * y) / (a - z)
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 <= -5.8e+79) {
tmp = x;
} else if (a <= -0.6) {
tmp = (t * (y - z)) / a;
} else if (a <= 1.3e-91) {
tmp = ((y - a) / z) * x;
} else if (a <= 1.7e+26) {
tmp = (t * y) / (a - z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -5.8e+79: tmp = x elif a <= -0.6: tmp = (t * (y - z)) / a elif a <= 1.3e-91: tmp = ((y - a) / z) * x elif a <= 1.7e+26: tmp = (t * y) / (a - z) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -5.8e+79) tmp = x; elseif (a <= -0.6) tmp = Float64(Float64(t * Float64(y - z)) / a); elseif (a <= 1.3e-91) tmp = Float64(Float64(Float64(y - a) / z) * x); elseif (a <= 1.7e+26) tmp = Float64(Float64(t * y) / Float64(a - z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -5.8e+79) tmp = x; elseif (a <= -0.6) tmp = (t * (y - z)) / a; elseif (a <= 1.3e-91) tmp = ((y - a) / z) * x; elseif (a <= 1.7e+26) tmp = (t * y) / (a - z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -5.8e+79], x, If[LessEqual[a, -0.6], N[(N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[a, 1.3e-91], N[(N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[a, 1.7e+26], N[(N[(t * y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.8 \cdot 10^{+79}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq -0.6:\\
\;\;\;\;\frac{t \cdot \left(y - z\right)}{a}\\
\mathbf{elif}\;a \leq 1.3 \cdot 10^{-91}:\\
\;\;\;\;\frac{y - a}{z} \cdot x\\
\mathbf{elif}\;a \leq 1.7 \cdot 10^{+26}:\\
\;\;\;\;\frac{t \cdot y}{a - z}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -5.79999999999999984e79 or 1.7000000000000001e26 < a Initial program 88.3%
Taylor expanded in a around inf
Applied rewrites47.2%
if -5.79999999999999984e79 < a < -0.599999999999999978Initial program 82.6%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f6482.9
Applied rewrites82.9%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6441.6
Applied rewrites41.6%
Taylor expanded in z around 0
Applied rewrites23.4%
if -0.599999999999999978 < a < 1.30000000000000007e-91Initial program 74.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
sub-divN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6432.3
Applied rewrites32.3%
Taylor expanded in z around -inf
lower-/.f64N/A
lift--.f6432.6
Applied rewrites32.6%
if 1.30000000000000007e-91 < a < 1.7000000000000001e26Initial program 79.4%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f6479.5
Applied rewrites79.5%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6448.3
Applied rewrites48.3%
Taylor expanded in y around inf
Applied rewrites26.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* t (/ (- y z) a)))))
(if (<= a -1.1e+84)
t_1
(if (<= a 6.2e-215)
(* t (/ (- y z) (- a z)))
(if (<= a 1.15e+31) (/ (* (- t x) y) (- a z)) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (t * ((y - z) / a));
double tmp;
if (a <= -1.1e+84) {
tmp = t_1;
} else if (a <= 6.2e-215) {
tmp = t * ((y - z) / (a - z));
} else if (a <= 1.15e+31) {
tmp = ((t - x) * y) / (a - z);
} 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 + (t * ((y - z) / a))
if (a <= (-1.1d+84)) then
tmp = t_1
else if (a <= 6.2d-215) then
tmp = t * ((y - z) / (a - z))
else if (a <= 1.15d+31) then
tmp = ((t - x) * y) / (a - z)
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 + (t * ((y - z) / a));
double tmp;
if (a <= -1.1e+84) {
tmp = t_1;
} else if (a <= 6.2e-215) {
tmp = t * ((y - z) / (a - z));
} else if (a <= 1.15e+31) {
tmp = ((t - x) * y) / (a - z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (t * ((y - z) / a)) tmp = 0 if a <= -1.1e+84: tmp = t_1 elif a <= 6.2e-215: tmp = t * ((y - z) / (a - z)) elif a <= 1.15e+31: tmp = ((t - x) * y) / (a - z) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(t * Float64(Float64(y - z) / a))) tmp = 0.0 if (a <= -1.1e+84) tmp = t_1; elseif (a <= 6.2e-215) tmp = Float64(t * Float64(Float64(y - z) / Float64(a - z))); elseif (a <= 1.15e+31) tmp = Float64(Float64(Float64(t - x) * y) / Float64(a - z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (t * ((y - z) / a)); tmp = 0.0; if (a <= -1.1e+84) tmp = t_1; elseif (a <= 6.2e-215) tmp = t * ((y - z) / (a - z)); elseif (a <= 1.15e+31) tmp = ((t - x) * y) / (a - z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(t * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -1.1e+84], t$95$1, If[LessEqual[a, 6.2e-215], N[(t * N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.15e+31], N[(N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + t \cdot \frac{y - z}{a}\\
\mathbf{if}\;a \leq -1.1 \cdot 10^{+84}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 6.2 \cdot 10^{-215}:\\
\;\;\;\;t \cdot \frac{y - z}{a - z}\\
\mathbf{elif}\;a \leq 1.15 \cdot 10^{+31}:\\
\;\;\;\;\frac{\left(t - x\right) \cdot y}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.0999999999999999e84 or 1.15e31 < a Initial program 88.2%
Taylor expanded in a around inf
associate-/l*N/A
lower-*.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6479.2
Applied rewrites79.2%
Taylor expanded in x around 0
Applied rewrites71.7%
if -1.0999999999999999e84 < a < 6.19999999999999987e-215Initial program 75.8%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f6475.9
Applied rewrites75.9%
Taylor expanded in t around inf
sub-divN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f6461.4
Applied rewrites61.4%
if 6.19999999999999987e-215 < a < 1.15e31Initial program 76.5%
Taylor expanded in y around inf
sub-divN/A
associate-/l*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6450.5
Applied rewrites50.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma y (/ (- t x) a) x)))
(if (<= a -3.4e+79)
t_1
(if (<= a -2.7e-122)
(/ (* (- y z) t) (- a z))
(if (<= a 3.8e-35) (/ (* (- t x) y) (- a z)) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(y, ((t - x) / a), x);
double tmp;
if (a <= -3.4e+79) {
tmp = t_1;
} else if (a <= -2.7e-122) {
tmp = ((y - z) * t) / (a - z);
} else if (a <= 3.8e-35) {
tmp = ((t - x) * y) / (a - z);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(y, Float64(Float64(t - x) / a), x) tmp = 0.0 if (a <= -3.4e+79) tmp = t_1; elseif (a <= -2.7e-122) tmp = Float64(Float64(Float64(y - z) * t) / Float64(a - z)); elseif (a <= 3.8e-35) tmp = Float64(Float64(Float64(t - x) * y) / Float64(a - z)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -3.4e+79], t$95$1, If[LessEqual[a, -2.7e-122], N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 3.8e-35], N[(N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\mathbf{if}\;a \leq -3.4 \cdot 10^{+79}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq -2.7 \cdot 10^{-122}:\\
\;\;\;\;\frac{\left(y - z\right) \cdot t}{a - z}\\
\mathbf{elif}\;a \leq 3.8 \cdot 10^{-35}:\\
\;\;\;\;\frac{\left(t - x\right) \cdot y}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -3.40000000000000032e79 or 3.8000000000000001e-35 < a Initial program 87.5%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6466.8
Applied rewrites66.8%
if -3.40000000000000032e79 < a < -2.70000000000000009e-122Initial program 80.3%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6444.8
Applied rewrites44.8%
if -2.70000000000000009e-122 < a < 3.8000000000000001e-35Initial program 73.3%
Taylor expanded in y around inf
sub-divN/A
associate-/l*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6454.7
Applied rewrites54.7%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma (- t x) (/ (- y z) a) x))) (if (<= a -1.1e+84) t_1 (if (<= a 9e-35) (* t (/ (- y z) (- a z))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((t - x), ((y - z) / a), x);
double tmp;
if (a <= -1.1e+84) {
tmp = t_1;
} else if (a <= 9e-35) {
tmp = t * ((y - z) / (a - z));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(t - x), Float64(Float64(y - z) / a), x) tmp = 0.0 if (a <= -1.1e+84) tmp = t_1; elseif (a <= 9e-35) tmp = Float64(t * Float64(Float64(y - z) / Float64(a - z))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -1.1e+84], t$95$1, If[LessEqual[a, 9e-35], N[(t * N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(t - x, \frac{y - z}{a}, x\right)\\
\mathbf{if}\;a \leq -1.1 \cdot 10^{+84}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 9 \cdot 10^{-35}:\\
\;\;\;\;t \cdot \frac{y - z}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.0999999999999999e84 or 9.0000000000000002e-35 < a Initial program 87.4%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6475.7
Applied rewrites75.7%
if -1.0999999999999999e84 < a < 9.0000000000000002e-35Initial program 75.4%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f6475.4
Applied rewrites75.4%
Taylor expanded in t around inf
sub-divN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f6461.4
Applied rewrites61.4%
(FPCore (x y z t a)
:precision binary64
(if (<= a -1.1e+84)
x
(if (<= a -8.2e-106)
t
(if (<= a 2.8e-104) (* (/ y z) x) (if (<= a 3.5e+118) (+ x t) x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.1e+84) {
tmp = x;
} else if (a <= -8.2e-106) {
tmp = t;
} else if (a <= 2.8e-104) {
tmp = (y / z) * x;
} else if (a <= 3.5e+118) {
tmp = x + t;
} 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 <= (-1.1d+84)) then
tmp = x
else if (a <= (-8.2d-106)) then
tmp = t
else if (a <= 2.8d-104) then
tmp = (y / z) * x
else if (a <= 3.5d+118) then
tmp = x + t
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 <= -1.1e+84) {
tmp = x;
} else if (a <= -8.2e-106) {
tmp = t;
} else if (a <= 2.8e-104) {
tmp = (y / z) * x;
} else if (a <= 3.5e+118) {
tmp = x + t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -1.1e+84: tmp = x elif a <= -8.2e-106: tmp = t elif a <= 2.8e-104: tmp = (y / z) * x elif a <= 3.5e+118: tmp = x + t else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.1e+84) tmp = x; elseif (a <= -8.2e-106) tmp = t; elseif (a <= 2.8e-104) tmp = Float64(Float64(y / z) * x); elseif (a <= 3.5e+118) tmp = Float64(x + t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -1.1e+84) tmp = x; elseif (a <= -8.2e-106) tmp = t; elseif (a <= 2.8e-104) tmp = (y / z) * x; elseif (a <= 3.5e+118) tmp = x + t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.1e+84], x, If[LessEqual[a, -8.2e-106], t, If[LessEqual[a, 2.8e-104], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[a, 3.5e+118], N[(x + t), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.1 \cdot 10^{+84}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq -8.2 \cdot 10^{-106}:\\
\;\;\;\;t\\
\mathbf{elif}\;a \leq 2.8 \cdot 10^{-104}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\mathbf{elif}\;a \leq 3.5 \cdot 10^{+118}:\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -1.0999999999999999e84 or 3.50000000000000016e118 < a Initial program 89.4%
Taylor expanded in a around inf
Applied rewrites51.5%
if -1.0999999999999999e84 < a < -8.1999999999999998e-106Initial program 80.8%
Taylor expanded in z around inf
Applied rewrites29.6%
if -8.1999999999999998e-106 < a < 2.8e-104Initial program 73.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
sub-divN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6431.2
Applied rewrites31.2%
Taylor expanded in a around 0
lower-/.f6432.0
Applied rewrites32.0%
if 2.8e-104 < a < 3.50000000000000016e118Initial program 80.2%
Taylor expanded in z around inf
lift--.f6420.2
Applied rewrites20.2%
Taylor expanded in x around 0
Applied rewrites32.5%
(FPCore (x y z t a)
:precision binary64
(if (<= a -1.1e+84)
x
(if (<= a 9.4e-213)
t
(if (<= a 2.85e-176) (/ (* x y) z) (if (<= a 3.5e+118) (+ x t) x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.1e+84) {
tmp = x;
} else if (a <= 9.4e-213) {
tmp = t;
} else if (a <= 2.85e-176) {
tmp = (x * y) / z;
} else if (a <= 3.5e+118) {
tmp = x + t;
} 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 <= (-1.1d+84)) then
tmp = x
else if (a <= 9.4d-213) then
tmp = t
else if (a <= 2.85d-176) then
tmp = (x * y) / z
else if (a <= 3.5d+118) then
tmp = x + t
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 <= -1.1e+84) {
tmp = x;
} else if (a <= 9.4e-213) {
tmp = t;
} else if (a <= 2.85e-176) {
tmp = (x * y) / z;
} else if (a <= 3.5e+118) {
tmp = x + t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -1.1e+84: tmp = x elif a <= 9.4e-213: tmp = t elif a <= 2.85e-176: tmp = (x * y) / z elif a <= 3.5e+118: tmp = x + t else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.1e+84) tmp = x; elseif (a <= 9.4e-213) tmp = t; elseif (a <= 2.85e-176) tmp = Float64(Float64(x * y) / z); elseif (a <= 3.5e+118) tmp = Float64(x + t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -1.1e+84) tmp = x; elseif (a <= 9.4e-213) tmp = t; elseif (a <= 2.85e-176) tmp = (x * y) / z; elseif (a <= 3.5e+118) tmp = x + t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.1e+84], x, If[LessEqual[a, 9.4e-213], t, If[LessEqual[a, 2.85e-176], N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[a, 3.5e+118], N[(x + t), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.1 \cdot 10^{+84}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 9.4 \cdot 10^{-213}:\\
\;\;\;\;t\\
\mathbf{elif}\;a \leq 2.85 \cdot 10^{-176}:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\mathbf{elif}\;a \leq 3.5 \cdot 10^{+118}:\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -1.0999999999999999e84 or 3.50000000000000016e118 < a Initial program 89.4%
Taylor expanded in a around inf
Applied rewrites51.5%
if -1.0999999999999999e84 < a < 9.4e-213Initial program 75.8%
Taylor expanded in z around inf
Applied rewrites34.3%
if 9.4e-213 < a < 2.84999999999999992e-176Initial program 70.9%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
sub-divN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6428.6
Applied rewrites28.6%
Taylor expanded in a around 0
lower-/.f64N/A
lower-*.f6427.0
Applied rewrites27.0%
if 2.84999999999999992e-176 < a < 3.50000000000000016e118Initial program 78.9%
Taylor expanded in z around inf
lift--.f6421.5
Applied rewrites21.5%
Taylor expanded in x around 0
Applied rewrites31.8%
(FPCore (x y z t a) :precision binary64 (if (<= a -2.1e+165) (* (+ 1.0 (/ z (- a z))) x) (if (<= a 9.2e-35) (* t (/ (- y z) (- a z))) (fma y (/ (- t x) a) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2.1e+165) {
tmp = (1.0 + (z / (a - z))) * x;
} else if (a <= 9.2e-35) {
tmp = t * ((y - z) / (a - z));
} else {
tmp = fma(y, ((t - x) / a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -2.1e+165) tmp = Float64(Float64(1.0 + Float64(z / Float64(a - z))) * x); elseif (a <= 9.2e-35) tmp = Float64(t * Float64(Float64(y - z) / Float64(a - z))); else tmp = fma(y, Float64(Float64(t - x) / a), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -2.1e+165], N[(N[(1.0 + N[(z / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[a, 9.2e-35], N[(t * N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.1 \cdot 10^{+165}:\\
\;\;\;\;\left(1 + \frac{z}{a - z}\right) \cdot x\\
\mathbf{elif}\;a \leq 9.2 \cdot 10^{-35}:\\
\;\;\;\;t \cdot \frac{y - z}{a - z}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\end{array}
\end{array}
if a < -2.1000000000000001e165Initial program 92.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
sub-divN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6463.2
Applied rewrites63.2%
Taylor expanded in y around 0
lower-+.f64N/A
lower-/.f64N/A
lift--.f6457.7
Applied rewrites57.7%
if -2.1000000000000001e165 < a < 9.1999999999999996e-35Initial program 76.3%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f6476.4
Applied rewrites76.4%
Taylor expanded in t around inf
sub-divN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f6459.1
Applied rewrites59.1%
if 9.1999999999999996e-35 < a Initial program 86.4%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6464.7
Applied rewrites64.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma y (/ (- t x) a) x)))
(if (<= a -1.85e+59)
t_1
(if (<= a 3.8e-35) (/ (* (- t x) y) (- a z)) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(y, ((t - x) / a), x);
double tmp;
if (a <= -1.85e+59) {
tmp = t_1;
} else if (a <= 3.8e-35) {
tmp = ((t - x) * y) / (a - z);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(y, Float64(Float64(t - x) / a), x) tmp = 0.0 if (a <= -1.85e+59) tmp = t_1; elseif (a <= 3.8e-35) tmp = Float64(Float64(Float64(t - x) * y) / Float64(a - z)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -1.85e+59], t$95$1, If[LessEqual[a, 3.8e-35], N[(N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\mathbf{if}\;a \leq -1.85 \cdot 10^{+59}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 3.8 \cdot 10^{-35}:\\
\;\;\;\;\frac{\left(t - x\right) \cdot y}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.84999999999999999e59 or 3.8000000000000001e-35 < a Initial program 87.3%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6466.6
Applied rewrites66.6%
if -1.84999999999999999e59 < a < 3.8000000000000001e-35Initial program 75.1%
Taylor expanded in y around inf
sub-divN/A
associate-/l*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6452.6
Applied rewrites52.6%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma y (/ (- t x) a) x))) (if (<= a -5.5e-136) t_1 (if (<= a 4.2e-78) (* (/ (- y a) z) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(y, ((t - x) / a), x);
double tmp;
if (a <= -5.5e-136) {
tmp = t_1;
} else if (a <= 4.2e-78) {
tmp = ((y - a) / z) * x;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(y, Float64(Float64(t - x) / a), x) tmp = 0.0 if (a <= -5.5e-136) tmp = t_1; elseif (a <= 4.2e-78) tmp = Float64(Float64(Float64(y - a) / z) * x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -5.5e-136], t$95$1, If[LessEqual[a, 4.2e-78], N[(N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\mathbf{if}\;a \leq -5.5 \cdot 10^{-136}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 4.2 \cdot 10^{-78}:\\
\;\;\;\;\frac{y - a}{z} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -5.4999999999999999e-136 or 4.2000000000000001e-78 < a Initial program 84.8%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6459.9
Applied rewrites59.9%
if -5.4999999999999999e-136 < a < 4.2000000000000001e-78Initial program 73.4%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
sub-divN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6431.5
Applied rewrites31.5%
Taylor expanded in z around -inf
lower-/.f64N/A
lift--.f6433.8
Applied rewrites33.8%
(FPCore (x y z t a) :precision binary64 (if (<= z -8e+140) t (if (<= z 9.8e+90) (+ x (/ (* t y) a)) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -8e+140) {
tmp = t;
} else if (z <= 9.8e+90) {
tmp = x + ((t * y) / a);
} else {
tmp = t;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z <= (-8d+140)) then
tmp = t
else if (z <= 9.8d+90) then
tmp = x + ((t * y) / a)
else
tmp = t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -8e+140) {
tmp = t;
} else if (z <= 9.8e+90) {
tmp = x + ((t * y) / a);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -8e+140: tmp = t elif z <= 9.8e+90: tmp = x + ((t * y) / a) else: tmp = t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -8e+140) tmp = t; elseif (z <= 9.8e+90) tmp = Float64(x + Float64(Float64(t * y) / a)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -8e+140) tmp = t; elseif (z <= 9.8e+90) tmp = x + ((t * y) / a); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -8e+140], t, If[LessEqual[z, 9.8e+90], N[(x + N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8 \cdot 10^{+140}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq 9.8 \cdot 10^{+90}:\\
\;\;\;\;x + \frac{t \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -8.00000000000000047e140 or 9.8000000000000006e90 < z Initial program 62.6%
Taylor expanded in z around inf
Applied rewrites51.3%
if -8.00000000000000047e140 < z < 9.8000000000000006e90Initial program 89.4%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6459.5
Applied rewrites59.5%
Taylor expanded in x around 0
Applied rewrites49.8%
(FPCore (x y z t a) :precision binary64 (if (<= a -1.1e+84) x (if (<= a 1.7e-9) t x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.1e+84) {
tmp = x;
} else if (a <= 1.7e-9) {
tmp = t;
} 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 <= (-1.1d+84)) then
tmp = x
else if (a <= 1.7d-9) then
tmp = t
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 <= -1.1e+84) {
tmp = x;
} else if (a <= 1.7e-9) {
tmp = t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -1.1e+84: tmp = x elif a <= 1.7e-9: tmp = t else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.1e+84) tmp = x; elseif (a <= 1.7e-9) tmp = t; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -1.1e+84) tmp = x; elseif (a <= 1.7e-9) tmp = t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.1e+84], x, If[LessEqual[a, 1.7e-9], t, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.1 \cdot 10^{+84}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 1.7 \cdot 10^{-9}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -1.0999999999999999e84 or 1.6999999999999999e-9 < a Initial program 87.8%
Taylor expanded in a around inf
Applied rewrites45.2%
if -1.0999999999999999e84 < a < 1.6999999999999999e-9Initial program 75.6%
Taylor expanded in z around inf
Applied rewrites33.6%
(FPCore (x y z t a) :precision binary64 t)
double code(double x, double y, double z, double t, double a) {
return 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 = t
end function
public static double code(double x, double y, double z, double t, double a) {
return t;
}
def code(x, y, z, t, a): return t
function code(x, y, z, t, a) return t end
function tmp = code(x, y, z, t, a) tmp = t; end
code[x_, y_, z_, t_, a_] := t
\begin{array}{l}
\\
t
\end{array}
Initial program 81.0%
Taylor expanded in z around inf
Applied rewrites24.8%
herbie shell --seed 2025105
(FPCore (x y z t a)
:name "Numeric.Signal:interpolate from hsignal-0.2.7.1"
:precision binary64
(+ x (* (- y z) (/ (- t x) (- a z)))))