
(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 16 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))))
(if (<= t_2 -5e-244)
(fma t_1 (- y z) x)
(if (<= t_2 1e-257) (+ (- (/ (* (- t x) (- y a)) z)) 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 = x + ((y - z) * t_1);
double tmp;
if (t_2 <= -5e-244) {
tmp = fma(t_1, (y - z), x);
} else if (t_2 <= 1e-257) {
tmp = -(((t - x) * (y - a)) / z) + 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 = Float64(x + Float64(Float64(y - z) * t_1)) tmp = 0.0 if (t_2 <= -5e-244) tmp = fma(t_1, Float64(y - z), x); elseif (t_2 <= 1e-257) tmp = Float64(Float64(-Float64(Float64(Float64(t - x) * Float64(y - a)) / z)) + 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[(x + N[(N[(y - z), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e-244], N[(t$95$1 * N[(y - z), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$2, 1e-257], N[((-N[(N[(N[(t - x), $MachinePrecision] * N[(y - a), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]) + t), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - x}{a - z}\\
t_2 := x + \left(y - z\right) \cdot t\_1\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{-244}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, y - z, x\right)\\
\mathbf{elif}\;t\_2 \leq 10^{-257}:\\
\;\;\;\;\left(-\frac{\left(t - x\right) \cdot \left(y - a\right)}{z}\right) + t\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -4.99999999999999998e-244Initial program 80.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--.f6480.2
Applied rewrites80.2%
if -4.99999999999999998e-244 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 9.9999999999999998e-258Initial program 80.1%
Taylor expanded in z around -inf
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6446.2
Applied rewrites46.2%
if 9.9999999999999998e-258 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 80.1%
(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 -5e-244)
t_2
(if (<= t_3 1e-257) (+ (- (/ (* (- t x) (- y a)) z)) 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 <= -5e-244) {
tmp = t_2;
} else if (t_3 <= 1e-257) {
tmp = -(((t - x) * (y - a)) / z) + 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 <= -5e-244) tmp = t_2; elseif (t_3 <= 1e-257) tmp = Float64(Float64(-Float64(Float64(Float64(t - x) * Float64(y - a)) / z)) + 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, -5e-244], t$95$2, If[LessEqual[t$95$3, 1e-257], N[((-N[(N[(N[(t - x), $MachinePrecision] * N[(y - a), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]) + 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 -5 \cdot 10^{-244}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_3 \leq 10^{-257}:\\
\;\;\;\;\left(-\frac{\left(t - x\right) \cdot \left(y - a\right)}{z}\right) + t\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -4.99999999999999998e-244 or 9.9999999999999998e-258 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 80.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--.f6480.2
Applied rewrites80.2%
if -4.99999999999999998e-244 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 9.9999999999999998e-258Initial program 80.1%
Taylor expanded in z around -inf
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6446.2
Applied rewrites46.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (- (/ (* (- t x) (- y a)) z)) t)))
(if (<= z -9.5e-7)
t_1
(if (<= z 750000.0) (fma (- t x) (/ (- y z) a) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = -(((t - x) * (y - a)) / z) + t;
double tmp;
if (z <= -9.5e-7) {
tmp = t_1;
} else if (z <= 750000.0) {
tmp = fma((t - x), ((y - z) / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(-Float64(Float64(Float64(t - x) * Float64(y - a)) / z)) + t) tmp = 0.0 if (z <= -9.5e-7) tmp = t_1; elseif (z <= 750000.0) tmp = fma(Float64(t - x), Float64(Float64(y - z) / a), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[((-N[(N[(N[(t - x), $MachinePrecision] * N[(y - a), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]) + t), $MachinePrecision]}, If[LessEqual[z, -9.5e-7], t$95$1, If[LessEqual[z, 750000.0], N[(N[(t - x), $MachinePrecision] * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-\frac{\left(t - x\right) \cdot \left(y - a\right)}{z}\right) + t\\
\mathbf{if}\;z \leq -9.5 \cdot 10^{-7}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 750000:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y - z}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -9.5000000000000001e-7 or 7.5e5 < z Initial program 80.1%
Taylor expanded in z around -inf
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6446.2
Applied rewrites46.2%
if -9.5000000000000001e-7 < z < 7.5e5Initial program 80.1%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6453.4
Applied rewrites53.4%
(FPCore (x y z t a)
:precision binary64
(if (<= z -9.5e-7)
(- t (/ (* y (- t x)) z))
(if (<= z 1.2e-63)
(fma (- t x) (/ (- y z) a) x)
(if (<= z 5.6e+82) (* y (/ (- t x) (- a z))) (* t (/ (- y z) (- a z)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -9.5e-7) {
tmp = t - ((y * (t - x)) / z);
} else if (z <= 1.2e-63) {
tmp = fma((t - x), ((y - z) / a), x);
} else if (z <= 5.6e+82) {
tmp = y * ((t - x) / (a - z));
} else {
tmp = t * ((y - z) / (a - z));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -9.5e-7) tmp = Float64(t - Float64(Float64(y * Float64(t - x)) / z)); elseif (z <= 1.2e-63) tmp = fma(Float64(t - x), Float64(Float64(y - z) / a), x); elseif (z <= 5.6e+82) tmp = Float64(y * Float64(Float64(t - x) / Float64(a - z))); else tmp = Float64(t * Float64(Float64(y - z) / Float64(a - z))); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -9.5e-7], N[(t - N[(N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.2e-63], N[(N[(t - x), $MachinePrecision] * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 5.6e+82], N[(y * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.5 \cdot 10^{-7}:\\
\;\;\;\;t - \frac{y \cdot \left(t - x\right)}{z}\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{-63}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y - z}{a}, x\right)\\
\mathbf{elif}\;z \leq 5.6 \cdot 10^{+82}:\\
\;\;\;\;y \cdot \frac{t - x}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y - z}{a - z}\\
\end{array}
\end{array}
if z < -9.5000000000000001e-7Initial program 80.1%
Taylor expanded in z around -inf
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6446.2
Applied rewrites46.2%
Taylor expanded in a around 0
lower--.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f6443.6
Applied rewrites43.6%
if -9.5000000000000001e-7 < z < 1.2e-63Initial program 80.1%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6453.4
Applied rewrites53.4%
if 1.2e-63 < z < 5.6000000000000001e82Initial program 80.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--.f6480.2
Applied rewrites80.2%
Taylor expanded in y around inf
sub-divN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f6442.7
Applied rewrites42.7%
if 5.6000000000000001e82 < z Initial program 80.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--.f6480.2
Applied rewrites80.2%
Taylor expanded in t around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6451.7
Applied rewrites51.7%
(FPCore (x y z t a)
:precision binary64
(if (<= z -2.05e-6)
(- t (/ (* y (- t x)) z))
(if (<= z 4.2e-64)
(fma y (/ (- t x) a) x)
(if (<= z 5.6e+82) (* y (/ (- t x) (- a z))) (* t (/ (- y z) (- a z)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.05e-6) {
tmp = t - ((y * (t - x)) / z);
} else if (z <= 4.2e-64) {
tmp = fma(y, ((t - x) / a), x);
} else if (z <= 5.6e+82) {
tmp = y * ((t - x) / (a - z));
} else {
tmp = t * ((y - z) / (a - z));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.05e-6) tmp = Float64(t - Float64(Float64(y * Float64(t - x)) / z)); elseif (z <= 4.2e-64) tmp = fma(y, Float64(Float64(t - x) / a), x); elseif (z <= 5.6e+82) tmp = Float64(y * Float64(Float64(t - x) / Float64(a - z))); else tmp = Float64(t * Float64(Float64(y - z) / Float64(a - z))); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.05e-6], N[(t - N[(N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.2e-64], N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 5.6e+82], N[(y * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.05 \cdot 10^{-6}:\\
\;\;\;\;t - \frac{y \cdot \left(t - x\right)}{z}\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{-64}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\mathbf{elif}\;z \leq 5.6 \cdot 10^{+82}:\\
\;\;\;\;y \cdot \frac{t - x}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y - z}{a - z}\\
\end{array}
\end{array}
if z < -2.0499999999999999e-6Initial program 80.1%
Taylor expanded in z around -inf
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6446.2
Applied rewrites46.2%
Taylor expanded in a around 0
lower--.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f6443.6
Applied rewrites43.6%
if -2.0499999999999999e-6 < z < 4.20000000000000023e-64Initial program 80.1%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6447.7
Applied rewrites47.7%
if 4.20000000000000023e-64 < z < 5.6000000000000001e82Initial program 80.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--.f6480.2
Applied rewrites80.2%
Taylor expanded in y around inf
sub-divN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f6442.7
Applied rewrites42.7%
if 5.6000000000000001e82 < z Initial program 80.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--.f6480.2
Applied rewrites80.2%
Taylor expanded in t around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6451.7
Applied rewrites51.7%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.05e-6) (- t (/ (* y (- t x)) z)) (if (<= z 7.1e+78) (fma y (/ (- t x) a) x) (* t (/ (- y z) (- a z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.05e-6) {
tmp = t - ((y * (t - x)) / z);
} else if (z <= 7.1e+78) {
tmp = fma(y, ((t - x) / a), x);
} else {
tmp = t * ((y - z) / (a - z));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.05e-6) tmp = Float64(t - Float64(Float64(y * Float64(t - x)) / z)); elseif (z <= 7.1e+78) tmp = fma(y, Float64(Float64(t - x) / a), x); else tmp = Float64(t * Float64(Float64(y - z) / Float64(a - z))); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.05e-6], N[(t - N[(N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.1e+78], N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], N[(t * N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.05 \cdot 10^{-6}:\\
\;\;\;\;t - \frac{y \cdot \left(t - x\right)}{z}\\
\mathbf{elif}\;z \leq 7.1 \cdot 10^{+78}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y - z}{a - z}\\
\end{array}
\end{array}
if z < -2.0499999999999999e-6Initial program 80.1%
Taylor expanded in z around -inf
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6446.2
Applied rewrites46.2%
Taylor expanded in a around 0
lower--.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f6443.6
Applied rewrites43.6%
if -2.0499999999999999e-6 < z < 7.09999999999999992e78Initial program 80.1%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6447.7
Applied rewrites47.7%
if 7.09999999999999992e78 < z Initial program 80.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--.f6480.2
Applied rewrites80.2%
Taylor expanded in t around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6451.7
Applied rewrites51.7%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (- t (/ (* y (- t x)) z)))) (if (<= z -2.05e-6) t_1 (if (<= z 750000.0) (fma y (/ (- t x) a) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t - ((y * (t - x)) / z);
double tmp;
if (z <= -2.05e-6) {
tmp = t_1;
} else if (z <= 750000.0) {
tmp = fma(y, ((t - x) / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(t - Float64(Float64(y * Float64(t - x)) / z)) tmp = 0.0 if (z <= -2.05e-6) tmp = t_1; elseif (z <= 750000.0) tmp = fma(y, Float64(Float64(t - x) / a), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t - N[(N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.05e-6], t$95$1, If[LessEqual[z, 750000.0], N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t - \frac{y \cdot \left(t - x\right)}{z}\\
\mathbf{if}\;z \leq -2.05 \cdot 10^{-6}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 750000:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.0499999999999999e-6 or 7.5e5 < z Initial program 80.1%
Taylor expanded in z around -inf
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6446.2
Applied rewrites46.2%
Taylor expanded in a around 0
lower--.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f6443.6
Applied rewrites43.6%
if -2.0499999999999999e-6 < z < 7.5e5Initial program 80.1%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6447.7
Applied rewrites47.7%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (+ (* t (/ (- y) z)) t))) (if (<= z -6e-5) t_1 (if (<= z 2.3e+104) (fma y (/ (- t x) a) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t * (-y / z)) + t;
double tmp;
if (z <= -6e-5) {
tmp = t_1;
} else if (z <= 2.3e+104) {
tmp = fma(y, ((t - x) / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(t * Float64(Float64(-y) / z)) + t) tmp = 0.0 if (z <= -6e-5) tmp = t_1; elseif (z <= 2.3e+104) tmp = fma(y, Float64(Float64(t - x) / a), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t * N[((-y) / z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]}, If[LessEqual[z, -6e-5], t$95$1, If[LessEqual[z, 2.3e+104], N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \frac{-y}{z} + t\\
\mathbf{if}\;z \leq -6 \cdot 10^{-5}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.3 \cdot 10^{+104}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -6.00000000000000015e-5 or 2.29999999999999985e104 < z Initial program 80.1%
Taylor expanded in z around -inf
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6446.2
Applied rewrites46.2%
Taylor expanded in t around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6436.1
Applied rewrites36.1%
Taylor expanded in y around 0
Applied rewrites26.2%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6436.3
Applied rewrites36.3%
if -6.00000000000000015e-5 < z < 2.29999999999999985e104Initial program 80.1%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6447.7
Applied rewrites47.7%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (+ (* t (/ (- y) z)) t))) (if (<= z -4.3e-15) t_1 (if (<= z 2.1e+104) (fma y (/ t a) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t * (-y / z)) + t;
double tmp;
if (z <= -4.3e-15) {
tmp = t_1;
} else if (z <= 2.1e+104) {
tmp = fma(y, (t / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(t * Float64(Float64(-y) / z)) + t) tmp = 0.0 if (z <= -4.3e-15) tmp = t_1; elseif (z <= 2.1e+104) tmp = fma(y, Float64(t / a), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t * N[((-y) / z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]}, If[LessEqual[z, -4.3e-15], t$95$1, If[LessEqual[z, 2.1e+104], N[(y * N[(t / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \frac{-y}{z} + t\\
\mathbf{if}\;z \leq -4.3 \cdot 10^{-15}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.1 \cdot 10^{+104}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -4.2999999999999997e-15 or 2.0999999999999998e104 < z Initial program 80.1%
Taylor expanded in z around -inf
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6446.2
Applied rewrites46.2%
Taylor expanded in t around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6436.1
Applied rewrites36.1%
Taylor expanded in y around 0
Applied rewrites26.2%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6436.3
Applied rewrites36.3%
if -4.2999999999999997e-15 < z < 2.0999999999999998e104Initial program 80.1%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6447.7
Applied rewrites47.7%
Taylor expanded in x around 0
lower-/.f6439.8
Applied rewrites39.8%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (+ (* t (/ a z)) t))) (if (<= z -5.7e-15) t_1 (if (<= z 7.5e+104) (fma y (/ t a) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t * (a / z)) + t;
double tmp;
if (z <= -5.7e-15) {
tmp = t_1;
} else if (z <= 7.5e+104) {
tmp = fma(y, (t / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(t * Float64(a / z)) + t) tmp = 0.0 if (z <= -5.7e-15) tmp = t_1; elseif (z <= 7.5e+104) tmp = fma(y, Float64(t / a), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t * N[(a / z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]}, If[LessEqual[z, -5.7e-15], t$95$1, If[LessEqual[z, 7.5e+104], N[(y * N[(t / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \frac{a}{z} + t\\
\mathbf{if}\;z \leq -5.7 \cdot 10^{-15}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 7.5 \cdot 10^{+104}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -5.7000000000000003e-15 or 7.5000000000000002e104 < z Initial program 80.1%
Taylor expanded in z around -inf
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6446.2
Applied rewrites46.2%
Taylor expanded in t around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6436.1
Applied rewrites36.1%
Taylor expanded in y around 0
Applied rewrites26.2%
if -5.7000000000000003e-15 < z < 7.5000000000000002e104Initial program 80.1%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6447.7
Applied rewrites47.7%
Taylor expanded in x around 0
lower-/.f6439.8
Applied rewrites39.8%
(FPCore (x y z t a)
:precision binary64
(if (<= z -2.35e+52)
(+ x t)
(if (<= z -5.7e-5)
(* y (/ (- x t) z))
(if (<= z 1.55e+104) (fma y (/ t a) x) (+ x t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.35e+52) {
tmp = x + t;
} else if (z <= -5.7e-5) {
tmp = y * ((x - t) / z);
} else if (z <= 1.55e+104) {
tmp = fma(y, (t / a), x);
} else {
tmp = x + t;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.35e+52) tmp = Float64(x + t); elseif (z <= -5.7e-5) tmp = Float64(y * Float64(Float64(x - t) / z)); elseif (z <= 1.55e+104) tmp = fma(y, Float64(t / a), x); else tmp = Float64(x + t); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.35e+52], N[(x + t), $MachinePrecision], If[LessEqual[z, -5.7e-5], N[(y * N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.55e+104], N[(y * N[(t / a), $MachinePrecision] + x), $MachinePrecision], N[(x + t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.35 \cdot 10^{+52}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;z \leq -5.7 \cdot 10^{-5}:\\
\;\;\;\;y \cdot \frac{x - t}{z}\\
\mathbf{elif}\;z \leq 1.55 \cdot 10^{+104}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + t\\
\end{array}
\end{array}
if z < -2.35e52 or 1.55000000000000008e104 < z Initial program 80.1%
Taylor expanded in z around inf
lift--.f6419.3
Applied rewrites19.3%
Taylor expanded in x around 0
Applied rewrites33.5%
if -2.35e52 < z < -5.7000000000000003e-5Initial program 80.1%
Taylor expanded in z around -inf
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6446.2
Applied rewrites46.2%
Taylor expanded in y around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6425.5
Applied rewrites25.5%
if -5.7000000000000003e-5 < z < 1.55000000000000008e104Initial program 80.1%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6447.7
Applied rewrites47.7%
Taylor expanded in x around 0
lower-/.f6439.8
Applied rewrites39.8%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.8e-40) (+ x t) (if (<= z 1.55e+104) (fma y (/ t a) x) (+ x t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.8e-40) {
tmp = x + t;
} else if (z <= 1.55e+104) {
tmp = fma(y, (t / a), x);
} else {
tmp = x + t;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.8e-40) tmp = Float64(x + t); elseif (z <= 1.55e+104) tmp = fma(y, Float64(t / a), x); else tmp = Float64(x + t); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.8e-40], N[(x + t), $MachinePrecision], If[LessEqual[z, 1.55e+104], N[(y * N[(t / a), $MachinePrecision] + x), $MachinePrecision], N[(x + t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.8 \cdot 10^{-40}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;z \leq 1.55 \cdot 10^{+104}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + t\\
\end{array}
\end{array}
if z < -1.8e-40 or 1.55000000000000008e104 < z Initial program 80.1%
Taylor expanded in z around inf
lift--.f6419.3
Applied rewrites19.3%
Taylor expanded in x around 0
Applied rewrites33.5%
if -1.8e-40 < z < 1.55000000000000008e104Initial program 80.1%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6447.7
Applied rewrites47.7%
Taylor expanded in x around 0
lower-/.f6439.8
Applied rewrites39.8%
(FPCore (x y z t a) :precision binary64 (if (<= y -1.95e+219) (/ (* t y) a) (if (<= y 5e+79) (+ x t) (* x (/ y z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -1.95e+219) {
tmp = (t * y) / a;
} else if (y <= 5e+79) {
tmp = x + t;
} else {
tmp = x * (y / z);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (y <= (-1.95d+219)) then
tmp = (t * y) / a
else if (y <= 5d+79) then
tmp = x + t
else
tmp = x * (y / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -1.95e+219) {
tmp = (t * y) / a;
} else if (y <= 5e+79) {
tmp = x + t;
} else {
tmp = x * (y / z);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -1.95e+219: tmp = (t * y) / a elif y <= 5e+79: tmp = x + t else: tmp = x * (y / z) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -1.95e+219) tmp = Float64(Float64(t * y) / a); elseif (y <= 5e+79) tmp = Float64(x + t); else tmp = Float64(x * Float64(y / z)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -1.95e+219) tmp = (t * y) / a; elseif (y <= 5e+79) tmp = x + t; else tmp = x * (y / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -1.95e+219], N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[y, 5e+79], N[(x + t), $MachinePrecision], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.95 \cdot 10^{+219}:\\
\;\;\;\;\frac{t \cdot y}{a}\\
\mathbf{elif}\;y \leq 5 \cdot 10^{+79}:\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\end{array}
\end{array}
if y < -1.95e219Initial program 80.1%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6447.7
Applied rewrites47.7%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f6416.5
Applied rewrites16.5%
if -1.95e219 < y < 5e79Initial program 80.1%
Taylor expanded in z around inf
lift--.f6419.3
Applied rewrites19.3%
Taylor expanded in x around 0
Applied rewrites33.5%
if 5e79 < y Initial program 80.1%
Taylor expanded in x around -inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6442.5
Applied rewrites42.5%
Taylor expanded in a around 0
lower-/.f64N/A
lower-*.f6416.3
Applied rewrites16.3%
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6418.9
Applied rewrites18.9%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* x (/ y z)))) (if (<= y -3.9e+154) t_1 (if (<= y 5e+79) (+ x t) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x * (y / z);
double tmp;
if (y <= -3.9e+154) {
tmp = t_1;
} else if (y <= 5e+79) {
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) :: tmp
t_1 = x * (y / z)
if (y <= (-3.9d+154)) then
tmp = t_1
else if (y <= 5d+79) 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 = x * (y / z);
double tmp;
if (y <= -3.9e+154) {
tmp = t_1;
} else if (y <= 5e+79) {
tmp = x + t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x * (y / z) tmp = 0 if y <= -3.9e+154: tmp = t_1 elif y <= 5e+79: tmp = x + t else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x * Float64(y / z)) tmp = 0.0 if (y <= -3.9e+154) tmp = t_1; elseif (y <= 5e+79) tmp = Float64(x + t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x * (y / z); tmp = 0.0; if (y <= -3.9e+154) tmp = t_1; elseif (y <= 5e+79) tmp = x + t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.9e+154], t$95$1, If[LessEqual[y, 5e+79], N[(x + t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{y}{z}\\
\mathbf{if}\;y \leq -3.9 \cdot 10^{+154}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 5 \cdot 10^{+79}:\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -3.9000000000000003e154 or 5e79 < y Initial program 80.1%
Taylor expanded in x around -inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6442.5
Applied rewrites42.5%
Taylor expanded in a around 0
lower-/.f64N/A
lower-*.f6416.3
Applied rewrites16.3%
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6418.9
Applied rewrites18.9%
if -3.9000000000000003e154 < y < 5e79Initial program 80.1%
Taylor expanded in z around inf
lift--.f6419.3
Applied rewrites19.3%
Taylor expanded in x around 0
Applied rewrites33.5%
(FPCore (x y z t a) :precision binary64 (if (<= z -5.8e-38) (+ x t) (if (<= z 8.2e-91) (* x 1.0) (+ x t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5.8e-38) {
tmp = x + t;
} else if (z <= 8.2e-91) {
tmp = x * 1.0;
} else {
tmp = x + 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 <= (-5.8d-38)) then
tmp = x + t
else if (z <= 8.2d-91) then
tmp = x * 1.0d0
else
tmp = x + 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 <= -5.8e-38) {
tmp = x + t;
} else if (z <= 8.2e-91) {
tmp = x * 1.0;
} else {
tmp = x + t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -5.8e-38: tmp = x + t elif z <= 8.2e-91: tmp = x * 1.0 else: tmp = x + t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -5.8e-38) tmp = Float64(x + t); elseif (z <= 8.2e-91) tmp = Float64(x * 1.0); else tmp = Float64(x + t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -5.8e-38) tmp = x + t; elseif (z <= 8.2e-91) tmp = x * 1.0; else tmp = x + t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -5.8e-38], N[(x + t), $MachinePrecision], If[LessEqual[z, 8.2e-91], N[(x * 1.0), $MachinePrecision], N[(x + t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{-38}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;z \leq 8.2 \cdot 10^{-91}:\\
\;\;\;\;x \cdot 1\\
\mathbf{else}:\\
\;\;\;\;x + t\\
\end{array}
\end{array}
if z < -5.79999999999999988e-38 or 8.20000000000000048e-91 < z Initial program 80.1%
Taylor expanded in z around inf
lift--.f6419.3
Applied rewrites19.3%
Taylor expanded in x around 0
Applied rewrites33.5%
if -5.79999999999999988e-38 < z < 8.20000000000000048e-91Initial program 80.1%
Taylor expanded in x around -inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6442.5
Applied rewrites42.5%
Taylor expanded in y around 0
lower-*.f64N/A
lower-+.f64N/A
lift-/.f64N/A
lift--.f6424.9
Applied rewrites24.9%
Taylor expanded in z around 0
Applied rewrites24.6%
(FPCore (x y z t a) :precision binary64 (+ x t))
double code(double x, double y, double z, double t, double a) {
return x + t;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + t
end function
public static double code(double x, double y, double z, double t, double a) {
return x + t;
}
def code(x, y, z, t, a): return x + t
function code(x, y, z, t, a) return Float64(x + t) end
function tmp = code(x, y, z, t, a) tmp = x + t; end
code[x_, y_, z_, t_, a_] := N[(x + t), $MachinePrecision]
\begin{array}{l}
\\
x + t
\end{array}
Initial program 80.1%
Taylor expanded in z around inf
lift--.f6419.3
Applied rewrites19.3%
Taylor expanded in x around 0
Applied rewrites33.5%
herbie shell --seed 2025131
(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)))))