
(FPCore (x y z t a b c) :precision binary64 (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)))
double code(double x, double y, double z, double t, double a, double b, double c) {
return ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c);
}
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, b, c)
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), intent (in) :: b
real(8), intent (in) :: c
code = ((((x * 9.0d0) * y) - (((z * 4.0d0) * t) * a)) + b) / (z * c)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c);
}
def code(x, y, z, t, a, b, c): return ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c)
function code(x, y, z, t, a, b, c) return Float64(Float64(Float64(Float64(Float64(x * 9.0) * y) - Float64(Float64(Float64(z * 4.0) * t) * a)) + b) / Float64(z * c)) end
function tmp = code(x, y, z, t, a, b, c) tmp = ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c); end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(N[(N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision] - N[(N[(N[(z * 4.0), $MachinePrecision] * t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}
\end{array}
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b c) :precision binary64 (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)))
double code(double x, double y, double z, double t, double a, double b, double c) {
return ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c);
}
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, b, c)
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), intent (in) :: b
real(8), intent (in) :: c
code = ((((x * 9.0d0) * y) - (((z * 4.0d0) * t) * a)) + b) / (z * c)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c);
}
def code(x, y, z, t, a, b, c): return ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c)
function code(x, y, z, t, a, b, c) return Float64(Float64(Float64(Float64(Float64(x * 9.0) * y) - Float64(Float64(Float64(z * 4.0) * t) * a)) + b) / Float64(z * c)) end
function tmp = code(x, y, z, t, a, b, c) tmp = ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c); end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(N[(N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision] - N[(N[(N[(z * 4.0), $MachinePrecision] * t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}
\end{array}
(FPCore (x y z t a b c)
:precision binary64
(if (<= z -9.5e+78)
(/ (fma (* -4.0 a) t (* (fma (/ y z) 9.0 (/ b (* z x))) x)) c)
(if (<= z 1.55e-59)
(/ (+ (- (* x (* y 9.0)) (* (* (* z 4.0) t) a)) b) (* z c))
(/ (fma (* -4.0 a) t (/ (fma (* x y) 9.0 b) z)) c))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (z <= -9.5e+78) {
tmp = fma((-4.0 * a), t, (fma((y / z), 9.0, (b / (z * x))) * x)) / c;
} else if (z <= 1.55e-59) {
tmp = (((x * (y * 9.0)) - (((z * 4.0) * t) * a)) + b) / (z * c);
} else {
tmp = fma((-4.0 * a), t, (fma((x * y), 9.0, b) / z)) / c;
}
return tmp;
}
function code(x, y, z, t, a, b, c) tmp = 0.0 if (z <= -9.5e+78) tmp = Float64(fma(Float64(-4.0 * a), t, Float64(fma(Float64(y / z), 9.0, Float64(b / Float64(z * x))) * x)) / c); elseif (z <= 1.55e-59) tmp = Float64(Float64(Float64(Float64(x * Float64(y * 9.0)) - Float64(Float64(Float64(z * 4.0) * t) * a)) + b) / Float64(z * c)); else tmp = Float64(fma(Float64(-4.0 * a), t, Float64(fma(Float64(x * y), 9.0, b) / z)) / c); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[z, -9.5e+78], N[(N[(N[(-4.0 * a), $MachinePrecision] * t + N[(N[(N[(y / z), $MachinePrecision] * 9.0 + N[(b / N[(z * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[z, 1.55e-59], N[(N[(N[(N[(x * N[(y * 9.0), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(z * 4.0), $MachinePrecision] * t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-4.0 * a), $MachinePrecision] * t + N[(N[(N[(x * y), $MachinePrecision] * 9.0 + b), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.5 \cdot 10^{+78}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-4 \cdot a, t, \mathsf{fma}\left(\frac{y}{z}, 9, \frac{b}{z \cdot x}\right) \cdot x\right)}{c}\\
\mathbf{elif}\;z \leq 1.55 \cdot 10^{-59}:\\
\;\;\;\;\frac{\left(x \cdot \left(y \cdot 9\right) - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-4 \cdot a, t, \frac{\mathsf{fma}\left(x \cdot y, 9, b\right)}{z}\right)}{c}\\
\end{array}
\end{array}
if z < -9.5000000000000006e78Initial program 55.8%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6461.5
Applied rewrites61.5%
lift-/.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites66.5%
Taylor expanded in x around 0
lift-*.f64N/A
lift-*.f64N/A
associate--r-N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
Applied rewrites87.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6488.7
Applied rewrites88.7%
if -9.5000000000000006e78 < z < 1.55e-59Initial program 93.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6493.6
Applied rewrites93.6%
if 1.55e-59 < z Initial program 68.3%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6471.7
Applied rewrites71.7%
lift-/.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites75.0%
Taylor expanded in x around 0
lift-*.f64N/A
lift-*.f64N/A
associate--r-N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
Applied rewrites88.9%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (/ (fma (* -4.0 a) t (/ (fma (* x y) 9.0 b) z)) c)))
(if (<= z -3.5e-9)
t_1
(if (<= z 1.55e-59)
(/ (+ (- (* x (* y 9.0)) (* (* (* z 4.0) t) a)) b) (* z c))
t_1))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = fma((-4.0 * a), t, (fma((x * y), 9.0, b) / z)) / c;
double tmp;
if (z <= -3.5e-9) {
tmp = t_1;
} else if (z <= 1.55e-59) {
tmp = (((x * (y * 9.0)) - (((z * 4.0) * t) * a)) + b) / (z * c);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = Float64(fma(Float64(-4.0 * a), t, Float64(fma(Float64(x * y), 9.0, b) / z)) / c) tmp = 0.0 if (z <= -3.5e-9) tmp = t_1; elseif (z <= 1.55e-59) tmp = Float64(Float64(Float64(Float64(x * Float64(y * 9.0)) - Float64(Float64(Float64(z * 4.0) * t) * a)) + b) / Float64(z * c)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(N[(-4.0 * a), $MachinePrecision] * t + N[(N[(N[(x * y), $MachinePrecision] * 9.0 + b), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]}, If[LessEqual[z, -3.5e-9], t$95$1, If[LessEqual[z, 1.55e-59], N[(N[(N[(N[(x * N[(y * 9.0), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(z * 4.0), $MachinePrecision] * t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\mathsf{fma}\left(-4 \cdot a, t, \frac{\mathsf{fma}\left(x \cdot y, 9, b\right)}{z}\right)}{c}\\
\mathbf{if}\;z \leq -3.5 \cdot 10^{-9}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.55 \cdot 10^{-59}:\\
\;\;\;\;\frac{\left(x \cdot \left(y \cdot 9\right) - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.4999999999999999e-9 or 1.55e-59 < z Initial program 65.8%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6469.8
Applied rewrites69.8%
lift-/.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites73.3%
Taylor expanded in x around 0
lift-*.f64N/A
lift-*.f64N/A
associate--r-N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
Applied rewrites88.4%
if -3.4999999999999999e-9 < z < 1.55e-59Initial program 95.2%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6495.3
Applied rewrites95.3%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* x 9.0) y)) (t_2 (* (* x (/ (/ y c) z)) 9.0)))
(if (<= t_1 -1e+285)
t_2
(if (<= t_1 5e+267)
(/ (fma (* -4.0 a) t (/ (fma (* x y) 9.0 b) z)) c)
t_2))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (x * 9.0) * y;
double t_2 = (x * ((y / c) / z)) * 9.0;
double tmp;
if (t_1 <= -1e+285) {
tmp = t_2;
} else if (t_1 <= 5e+267) {
tmp = fma((-4.0 * a), t, (fma((x * y), 9.0, b) / z)) / c;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(x * 9.0) * y) t_2 = Float64(Float64(x * Float64(Float64(y / c) / z)) * 9.0) tmp = 0.0 if (t_1 <= -1e+285) tmp = t_2; elseif (t_1 <= 5e+267) tmp = Float64(fma(Float64(-4.0 * a), t, Float64(fma(Float64(x * y), 9.0, b) / z)) / c); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * N[(N[(y / c), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] * 9.0), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+285], t$95$2, If[LessEqual[t$95$1, 5e+267], N[(N[(N[(-4.0 * a), $MachinePrecision] * t + N[(N[(N[(x * y), $MachinePrecision] * 9.0 + b), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x \cdot 9\right) \cdot y\\
t_2 := \left(x \cdot \frac{\frac{y}{c}}{z}\right) \cdot 9\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+285}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+267}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-4 \cdot a, t, \frac{\mathsf{fma}\left(x \cdot y, 9, b\right)}{z}\right)}{c}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -9.9999999999999998e284 or 4.9999999999999999e267 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 64.1%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6463.4
Applied rewrites63.4%
lift-/.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites64.0%
Taylor expanded in x around inf
lift-*.f64N/A
lift-*.f64N/A
associate--r-N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
Applied rewrites79.7%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6486.2
Applied rewrites86.2%
if -9.9999999999999998e284 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 4.9999999999999999e267Initial program 81.6%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6482.4
Applied rewrites82.4%
lift-/.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites80.9%
Taylor expanded in x around 0
lift-*.f64N/A
lift-*.f64N/A
associate--r-N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
Applied rewrites89.9%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* x 9.0) y)) (t_2 (* (* x (/ (/ y c) z)) 9.0)))
(if (<= t_1 -1e+290)
t_2
(if (<= t_1 -4000000.0)
(/ (fma (* y x) 9.0 b) (* z c))
(if (<= t_1 2e-21)
(/ (fma (* -4.0 a) t (/ b z)) c)
(if (<= t_1 5e+267)
(/ (fma (* -4.0 a) t (* (/ (* y x) z) 9.0)) c)
t_2))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (x * 9.0) * y;
double t_2 = (x * ((y / c) / z)) * 9.0;
double tmp;
if (t_1 <= -1e+290) {
tmp = t_2;
} else if (t_1 <= -4000000.0) {
tmp = fma((y * x), 9.0, b) / (z * c);
} else if (t_1 <= 2e-21) {
tmp = fma((-4.0 * a), t, (b / z)) / c;
} else if (t_1 <= 5e+267) {
tmp = fma((-4.0 * a), t, (((y * x) / z) * 9.0)) / c;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(x * 9.0) * y) t_2 = Float64(Float64(x * Float64(Float64(y / c) / z)) * 9.0) tmp = 0.0 if (t_1 <= -1e+290) tmp = t_2; elseif (t_1 <= -4000000.0) tmp = Float64(fma(Float64(y * x), 9.0, b) / Float64(z * c)); elseif (t_1 <= 2e-21) tmp = Float64(fma(Float64(-4.0 * a), t, Float64(b / z)) / c); elseif (t_1 <= 5e+267) tmp = Float64(fma(Float64(-4.0 * a), t, Float64(Float64(Float64(y * x) / z) * 9.0)) / c); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * N[(N[(y / c), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] * 9.0), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+290], t$95$2, If[LessEqual[t$95$1, -4000000.0], N[(N[(N[(y * x), $MachinePrecision] * 9.0 + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e-21], N[(N[(N[(-4.0 * a), $MachinePrecision] * t + N[(b / z), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[t$95$1, 5e+267], N[(N[(N[(-4.0 * a), $MachinePrecision] * t + N[(N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision] * 9.0), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x \cdot 9\right) \cdot y\\
t_2 := \left(x \cdot \frac{\frac{y}{c}}{z}\right) \cdot 9\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+290}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq -4000000:\\
\;\;\;\;\frac{\mathsf{fma}\left(y \cdot x, 9, b\right)}{z \cdot c}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-21}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-4 \cdot a, t, \frac{b}{z}\right)}{c}\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+267}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-4 \cdot a, t, \frac{y \cdot x}{z} \cdot 9\right)}{c}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -1.00000000000000006e290 or 4.9999999999999999e267 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 64.0%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6463.3
Applied rewrites63.3%
lift-/.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites64.0%
Taylor expanded in x around inf
lift-*.f64N/A
lift-*.f64N/A
associate--r-N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
Applied rewrites79.8%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6486.2
Applied rewrites86.2%
if -1.00000000000000006e290 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -4e6Initial program 81.8%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6467.1
Applied rewrites67.1%
if -4e6 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 1.99999999999999982e-21Initial program 80.6%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6481.7
Applied rewrites81.7%
lift-/.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites81.9%
Taylor expanded in x around 0
lift-*.f64N/A
lift-*.f64N/A
associate--r-N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
Applied rewrites91.5%
Taylor expanded in x around 0
Applied rewrites84.1%
if 1.99999999999999982e-21 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 4.9999999999999999e267Initial program 83.7%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6484.7
Applied rewrites84.7%
lift-/.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites81.2%
Taylor expanded in x around 0
lift-*.f64N/A
lift-*.f64N/A
associate--r-N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
Applied rewrites88.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f6471.1
Applied rewrites71.1%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* x 9.0) y)))
(if (<= t_1 -500000000000.0)
(- (* (/ (- (* (/ y c) -9.0) (/ b (* c x))) z) x))
(if (<= t_1 2e-21)
(/ (fma (* -4.0 a) t (/ b z)) c)
(if (<= t_1 5e+267)
(/ (fma (* -4.0 a) t (* (/ (* y x) z) 9.0)) c)
(* (* x (/ (/ y c) z)) 9.0))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (x * 9.0) * y;
double tmp;
if (t_1 <= -500000000000.0) {
tmp = -(((((y / c) * -9.0) - (b / (c * x))) / z) * x);
} else if (t_1 <= 2e-21) {
tmp = fma((-4.0 * a), t, (b / z)) / c;
} else if (t_1 <= 5e+267) {
tmp = fma((-4.0 * a), t, (((y * x) / z) * 9.0)) / c;
} else {
tmp = (x * ((y / c) / z)) * 9.0;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(x * 9.0) * y) tmp = 0.0 if (t_1 <= -500000000000.0) tmp = Float64(-Float64(Float64(Float64(Float64(Float64(y / c) * -9.0) - Float64(b / Float64(c * x))) / z) * x)); elseif (t_1 <= 2e-21) tmp = Float64(fma(Float64(-4.0 * a), t, Float64(b / z)) / c); elseif (t_1 <= 5e+267) tmp = Float64(fma(Float64(-4.0 * a), t, Float64(Float64(Float64(y * x) / z) * 9.0)) / c); else tmp = Float64(Float64(x * Float64(Float64(y / c) / z)) * 9.0); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[t$95$1, -500000000000.0], (-N[(N[(N[(N[(N[(y / c), $MachinePrecision] * -9.0), $MachinePrecision] - N[(b / N[(c * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision]), If[LessEqual[t$95$1, 2e-21], N[(N[(N[(-4.0 * a), $MachinePrecision] * t + N[(b / z), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[t$95$1, 5e+267], N[(N[(N[(-4.0 * a), $MachinePrecision] * t + N[(N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision] * 9.0), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], N[(N[(x * N[(N[(y / c), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] * 9.0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x \cdot 9\right) \cdot y\\
\mathbf{if}\;t\_1 \leq -500000000000:\\
\;\;\;\;-\frac{\frac{y}{c} \cdot -9 - \frac{b}{c \cdot x}}{z} \cdot x\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-21}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-4 \cdot a, t, \frac{b}{z}\right)}{c}\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+267}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-4 \cdot a, t, \frac{y \cdot x}{z} \cdot 9\right)}{c}\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot \frac{\frac{y}{c}}{z}\right) \cdot 9\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -5e11Initial program 76.9%
Taylor expanded in x around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites76.5%
Taylor expanded in z around 0
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f6468.0
Applied rewrites68.0%
if -5e11 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 1.99999999999999982e-21Initial program 80.7%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6481.7
Applied rewrites81.7%
lift-/.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites81.8%
Taylor expanded in x around 0
lift-*.f64N/A
lift-*.f64N/A
associate--r-N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
Applied rewrites91.5%
Taylor expanded in x around 0
Applied rewrites84.0%
if 1.99999999999999982e-21 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 4.9999999999999999e267Initial program 83.7%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6484.7
Applied rewrites84.7%
lift-/.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites81.2%
Taylor expanded in x around 0
lift-*.f64N/A
lift-*.f64N/A
associate--r-N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
Applied rewrites88.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f6471.1
Applied rewrites71.1%
if 4.9999999999999999e267 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 62.9%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6462.7
Applied rewrites62.7%
lift-/.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites63.4%
Taylor expanded in x around inf
lift-*.f64N/A
lift-*.f64N/A
associate--r-N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
Applied rewrites78.7%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6485.6
Applied rewrites85.6%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* x 9.0) y)) (t_2 (* (* x (/ (/ y c) z)) 9.0)))
(if (<= t_1 -1e+290)
t_2
(if (<= t_1 -4000000.0)
(/ (fma (* y x) 9.0 b) (* z c))
(if (<= t_1 5e+243) (/ (fma (* -4.0 a) t (/ b z)) c) t_2)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (x * 9.0) * y;
double t_2 = (x * ((y / c) / z)) * 9.0;
double tmp;
if (t_1 <= -1e+290) {
tmp = t_2;
} else if (t_1 <= -4000000.0) {
tmp = fma((y * x), 9.0, b) / (z * c);
} else if (t_1 <= 5e+243) {
tmp = fma((-4.0 * a), t, (b / z)) / c;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(x * 9.0) * y) t_2 = Float64(Float64(x * Float64(Float64(y / c) / z)) * 9.0) tmp = 0.0 if (t_1 <= -1e+290) tmp = t_2; elseif (t_1 <= -4000000.0) tmp = Float64(fma(Float64(y * x), 9.0, b) / Float64(z * c)); elseif (t_1 <= 5e+243) tmp = Float64(fma(Float64(-4.0 * a), t, Float64(b / z)) / c); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * N[(N[(y / c), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] * 9.0), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+290], t$95$2, If[LessEqual[t$95$1, -4000000.0], N[(N[(N[(y * x), $MachinePrecision] * 9.0 + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+243], N[(N[(N[(-4.0 * a), $MachinePrecision] * t + N[(b / z), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x \cdot 9\right) \cdot y\\
t_2 := \left(x \cdot \frac{\frac{y}{c}}{z}\right) \cdot 9\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+290}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq -4000000:\\
\;\;\;\;\frac{\mathsf{fma}\left(y \cdot x, 9, b\right)}{z \cdot c}\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+243}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-4 \cdot a, t, \frac{b}{z}\right)}{c}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -1.00000000000000006e290 or 5.00000000000000037e243 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 65.1%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6464.7
Applied rewrites64.7%
lift-/.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites64.9%
Taylor expanded in x around inf
lift-*.f64N/A
lift-*.f64N/A
associate--r-N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
Applied rewrites79.2%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6485.4
Applied rewrites85.4%
if -1.00000000000000006e290 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -4e6Initial program 81.8%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6467.1
Applied rewrites67.1%
if -4e6 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 5.00000000000000037e243Initial program 81.5%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6482.5
Applied rewrites82.5%
lift-/.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites81.8%
Taylor expanded in x around 0
lift-*.f64N/A
lift-*.f64N/A
associate--r-N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
Applied rewrites90.8%
Taylor expanded in x around 0
Applied rewrites77.1%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* (/ t c) -4.0) a)))
(if (<= t -2.2e+38)
t_1
(if (<= t 2.95e+23) (/ (fma (* y x) 9.0 b) (* z c)) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = ((t / c) * -4.0) * a;
double tmp;
if (t <= -2.2e+38) {
tmp = t_1;
} else if (t <= 2.95e+23) {
tmp = fma((y * x), 9.0, b) / (z * c);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(Float64(t / c) * -4.0) * a) tmp = 0.0 if (t <= -2.2e+38) tmp = t_1; elseif (t <= 2.95e+23) tmp = Float64(fma(Float64(y * x), 9.0, b) / Float64(z * c)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(N[(t / c), $MachinePrecision] * -4.0), $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[t, -2.2e+38], t$95$1, If[LessEqual[t, 2.95e+23], N[(N[(N[(y * x), $MachinePrecision] * 9.0 + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\frac{t}{c} \cdot -4\right) \cdot a\\
\mathbf{if}\;t \leq -2.2 \cdot 10^{+38}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.95 \cdot 10^{+23}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y \cdot x, 9, b\right)}{z \cdot c}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -2.20000000000000006e38 or 2.94999999999999994e23 < t Initial program 72.1%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites76.7%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lift-/.f6459.9
Applied rewrites59.9%
if -2.20000000000000006e38 < t < 2.94999999999999994e23Initial program 84.4%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6472.3
Applied rewrites72.3%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* x 9.0) y)) (t_2 (* (* x (/ (/ y c) z)) 9.0)))
(if (<= t_1 -500000000000.0)
t_2
(if (<= t_1 5e-138)
(* -4.0 (/ (* a t) c))
(if (<= t_1 2e-21) (/ b (* z c)) t_2)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (x * 9.0) * y;
double t_2 = (x * ((y / c) / z)) * 9.0;
double tmp;
if (t_1 <= -500000000000.0) {
tmp = t_2;
} else if (t_1 <= 5e-138) {
tmp = -4.0 * ((a * t) / c);
} else if (t_1 <= 2e-21) {
tmp = b / (z * c);
} else {
tmp = t_2;
}
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, b, c)
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), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (x * 9.0d0) * y
t_2 = (x * ((y / c) / z)) * 9.0d0
if (t_1 <= (-500000000000.0d0)) then
tmp = t_2
else if (t_1 <= 5d-138) then
tmp = (-4.0d0) * ((a * t) / c)
else if (t_1 <= 2d-21) then
tmp = b / (z * c)
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (x * 9.0) * y;
double t_2 = (x * ((y / c) / z)) * 9.0;
double tmp;
if (t_1 <= -500000000000.0) {
tmp = t_2;
} else if (t_1 <= 5e-138) {
tmp = -4.0 * ((a * t) / c);
} else if (t_1 <= 2e-21) {
tmp = b / (z * c);
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = (x * 9.0) * y t_2 = (x * ((y / c) / z)) * 9.0 tmp = 0 if t_1 <= -500000000000.0: tmp = t_2 elif t_1 <= 5e-138: tmp = -4.0 * ((a * t) / c) elif t_1 <= 2e-21: tmp = b / (z * c) else: tmp = t_2 return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(x * 9.0) * y) t_2 = Float64(Float64(x * Float64(Float64(y / c) / z)) * 9.0) tmp = 0.0 if (t_1 <= -500000000000.0) tmp = t_2; elseif (t_1 <= 5e-138) tmp = Float64(-4.0 * Float64(Float64(a * t) / c)); elseif (t_1 <= 2e-21) tmp = Float64(b / Float64(z * c)); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = (x * 9.0) * y; t_2 = (x * ((y / c) / z)) * 9.0; tmp = 0.0; if (t_1 <= -500000000000.0) tmp = t_2; elseif (t_1 <= 5e-138) tmp = -4.0 * ((a * t) / c); elseif (t_1 <= 2e-21) tmp = b / (z * c); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * N[(N[(y / c), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] * 9.0), $MachinePrecision]}, If[LessEqual[t$95$1, -500000000000.0], t$95$2, If[LessEqual[t$95$1, 5e-138], N[(-4.0 * N[(N[(a * t), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e-21], N[(b / N[(z * c), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x \cdot 9\right) \cdot y\\
t_2 := \left(x \cdot \frac{\frac{y}{c}}{z}\right) \cdot 9\\
\mathbf{if}\;t\_1 \leq -500000000000:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-138}:\\
\;\;\;\;-4 \cdot \frac{a \cdot t}{c}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-21}:\\
\;\;\;\;\frac{b}{z \cdot c}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -5e11 or 1.99999999999999982e-21 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 77.1%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6477.3
Applied rewrites77.3%
lift-/.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites74.8%
Taylor expanded in x around inf
lift-*.f64N/A
lift-*.f64N/A
associate--r-N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
Applied rewrites58.1%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6460.4
Applied rewrites60.4%
if -5e11 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 4.99999999999999989e-138Initial program 80.1%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6448.9
Applied rewrites48.9%
if 4.99999999999999989e-138 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 1.99999999999999982e-21Initial program 83.5%
Taylor expanded in b around inf
Applied rewrites42.5%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* x 9.0) y)) (t_2 (* (* x (/ y (* c z))) 9.0)))
(if (<= t_1 -500000000000.0)
t_2
(if (<= t_1 5e-138)
(* -4.0 (/ (* a t) c))
(if (<= t_1 5e+31) (/ b (* z c)) t_2)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (x * 9.0) * y;
double t_2 = (x * (y / (c * z))) * 9.0;
double tmp;
if (t_1 <= -500000000000.0) {
tmp = t_2;
} else if (t_1 <= 5e-138) {
tmp = -4.0 * ((a * t) / c);
} else if (t_1 <= 5e+31) {
tmp = b / (z * c);
} else {
tmp = t_2;
}
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, b, c)
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), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (x * 9.0d0) * y
t_2 = (x * (y / (c * z))) * 9.0d0
if (t_1 <= (-500000000000.0d0)) then
tmp = t_2
else if (t_1 <= 5d-138) then
tmp = (-4.0d0) * ((a * t) / c)
else if (t_1 <= 5d+31) then
tmp = b / (z * c)
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (x * 9.0) * y;
double t_2 = (x * (y / (c * z))) * 9.0;
double tmp;
if (t_1 <= -500000000000.0) {
tmp = t_2;
} else if (t_1 <= 5e-138) {
tmp = -4.0 * ((a * t) / c);
} else if (t_1 <= 5e+31) {
tmp = b / (z * c);
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = (x * 9.0) * y t_2 = (x * (y / (c * z))) * 9.0 tmp = 0 if t_1 <= -500000000000.0: tmp = t_2 elif t_1 <= 5e-138: tmp = -4.0 * ((a * t) / c) elif t_1 <= 5e+31: tmp = b / (z * c) else: tmp = t_2 return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(x * 9.0) * y) t_2 = Float64(Float64(x * Float64(y / Float64(c * z))) * 9.0) tmp = 0.0 if (t_1 <= -500000000000.0) tmp = t_2; elseif (t_1 <= 5e-138) tmp = Float64(-4.0 * Float64(Float64(a * t) / c)); elseif (t_1 <= 5e+31) tmp = Float64(b / Float64(z * c)); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = (x * 9.0) * y; t_2 = (x * (y / (c * z))) * 9.0; tmp = 0.0; if (t_1 <= -500000000000.0) tmp = t_2; elseif (t_1 <= 5e-138) tmp = -4.0 * ((a * t) / c); elseif (t_1 <= 5e+31) tmp = b / (z * c); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * N[(y / N[(c * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 9.0), $MachinePrecision]}, If[LessEqual[t$95$1, -500000000000.0], t$95$2, If[LessEqual[t$95$1, 5e-138], N[(-4.0 * N[(N[(a * t), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+31], N[(b / N[(z * c), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x \cdot 9\right) \cdot y\\
t_2 := \left(x \cdot \frac{y}{c \cdot z}\right) \cdot 9\\
\mathbf{if}\;t\_1 \leq -500000000000:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-138}:\\
\;\;\;\;-4 \cdot \frac{a \cdot t}{c}\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+31}:\\
\;\;\;\;\frac{b}{z \cdot c}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -5e11 or 5.00000000000000027e31 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 76.2%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6476.3
Applied rewrites76.3%
lift-/.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites73.7%
Taylor expanded in x around inf
lift-*.f64N/A
lift-*.f64N/A
associate--r-N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
Applied rewrites60.1%
if -5e11 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 4.99999999999999989e-138Initial program 80.1%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6448.9
Applied rewrites48.9%
if 4.99999999999999989e-138 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 5.00000000000000027e31Initial program 84.8%
Taylor expanded in b around inf
Applied rewrites41.3%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* x 9.0) y)) (t_2 (* x (* (/ y (* c z)) 9.0))))
(if (<= t_1 -500000000000.0)
t_2
(if (<= t_1 5e-138)
(* -4.0 (/ (* a t) c))
(if (<= t_1 2e-21) (/ b (* z c)) t_2)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (x * 9.0) * y;
double t_2 = x * ((y / (c * z)) * 9.0);
double tmp;
if (t_1 <= -500000000000.0) {
tmp = t_2;
} else if (t_1 <= 5e-138) {
tmp = -4.0 * ((a * t) / c);
} else if (t_1 <= 2e-21) {
tmp = b / (z * c);
} else {
tmp = t_2;
}
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, b, c)
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), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (x * 9.0d0) * y
t_2 = x * ((y / (c * z)) * 9.0d0)
if (t_1 <= (-500000000000.0d0)) then
tmp = t_2
else if (t_1 <= 5d-138) then
tmp = (-4.0d0) * ((a * t) / c)
else if (t_1 <= 2d-21) then
tmp = b / (z * c)
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (x * 9.0) * y;
double t_2 = x * ((y / (c * z)) * 9.0);
double tmp;
if (t_1 <= -500000000000.0) {
tmp = t_2;
} else if (t_1 <= 5e-138) {
tmp = -4.0 * ((a * t) / c);
} else if (t_1 <= 2e-21) {
tmp = b / (z * c);
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = (x * 9.0) * y t_2 = x * ((y / (c * z)) * 9.0) tmp = 0 if t_1 <= -500000000000.0: tmp = t_2 elif t_1 <= 5e-138: tmp = -4.0 * ((a * t) / c) elif t_1 <= 2e-21: tmp = b / (z * c) else: tmp = t_2 return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(x * 9.0) * y) t_2 = Float64(x * Float64(Float64(y / Float64(c * z)) * 9.0)) tmp = 0.0 if (t_1 <= -500000000000.0) tmp = t_2; elseif (t_1 <= 5e-138) tmp = Float64(-4.0 * Float64(Float64(a * t) / c)); elseif (t_1 <= 2e-21) tmp = Float64(b / Float64(z * c)); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = (x * 9.0) * y; t_2 = x * ((y / (c * z)) * 9.0); tmp = 0.0; if (t_1 <= -500000000000.0) tmp = t_2; elseif (t_1 <= 5e-138) tmp = -4.0 * ((a * t) / c); elseif (t_1 <= 2e-21) tmp = b / (z * c); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(N[(y / N[(c * z), $MachinePrecision]), $MachinePrecision] * 9.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -500000000000.0], t$95$2, If[LessEqual[t$95$1, 5e-138], N[(-4.0 * N[(N[(a * t), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e-21], N[(b / N[(z * c), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x \cdot 9\right) \cdot y\\
t_2 := x \cdot \left(\frac{y}{c \cdot z} \cdot 9\right)\\
\mathbf{if}\;t\_1 \leq -500000000000:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-138}:\\
\;\;\;\;-4 \cdot \frac{a \cdot t}{c}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-21}:\\
\;\;\;\;\frac{b}{z \cdot c}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -5e11 or 1.99999999999999982e-21 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 77.1%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6477.3
Applied rewrites77.3%
lift-/.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites74.8%
Taylor expanded in x around inf
lift-*.f64N/A
lift-*.f64N/A
associate--r-N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
Applied rewrites58.1%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f6458.1
Applied rewrites58.1%
if -5e11 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 4.99999999999999989e-138Initial program 80.1%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6448.9
Applied rewrites48.9%
if 4.99999999999999989e-138 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 1.99999999999999982e-21Initial program 83.5%
Taylor expanded in b around inf
Applied rewrites42.5%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* (/ t c) -4.0) a)))
(if (<= t -1.75e+37)
t_1
(if (<= t 118000000.0) (* b (/ 1.0 (* c z))) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = ((t / c) * -4.0) * a;
double tmp;
if (t <= -1.75e+37) {
tmp = t_1;
} else if (t <= 118000000.0) {
tmp = b * (1.0 / (c * 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, b, c)
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), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_1
real(8) :: tmp
t_1 = ((t / c) * (-4.0d0)) * a
if (t <= (-1.75d+37)) then
tmp = t_1
else if (t <= 118000000.0d0) then
tmp = b * (1.0d0 / (c * 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 b, double c) {
double t_1 = ((t / c) * -4.0) * a;
double tmp;
if (t <= -1.75e+37) {
tmp = t_1;
} else if (t <= 118000000.0) {
tmp = b * (1.0 / (c * z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = ((t / c) * -4.0) * a tmp = 0 if t <= -1.75e+37: tmp = t_1 elif t <= 118000000.0: tmp = b * (1.0 / (c * z)) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(Float64(t / c) * -4.0) * a) tmp = 0.0 if (t <= -1.75e+37) tmp = t_1; elseif (t <= 118000000.0) tmp = Float64(b * Float64(1.0 / Float64(c * z))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = ((t / c) * -4.0) * a; tmp = 0.0; if (t <= -1.75e+37) tmp = t_1; elseif (t <= 118000000.0) tmp = b * (1.0 / (c * z)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(N[(t / c), $MachinePrecision] * -4.0), $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[t, -1.75e+37], t$95$1, If[LessEqual[t, 118000000.0], N[(b * N[(1.0 / N[(c * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\frac{t}{c} \cdot -4\right) \cdot a\\
\mathbf{if}\;t \leq -1.75 \cdot 10^{+37}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 118000000:\\
\;\;\;\;b \cdot \frac{1}{c \cdot z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.75e37 or 1.18e8 < t Initial program 72.5%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites76.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lift-/.f6459.5
Applied rewrites59.5%
if -1.75e37 < t < 1.18e8Initial program 84.5%
Taylor expanded in b around inf
Applied rewrites42.4%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate-+l-N/A
associate-*l*N/A
*-commutativeN/A
*-commutativeN/A
associate-+l-N/A
associate-+l-N/A
associate-+l-N/A
Applied rewrites42.6%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (/ b (* z c))))
(if (<= b -1.75e+217)
t_1
(if (<= b 1250000.0) (* (* (/ t c) -4.0) a) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = b / (z * c);
double tmp;
if (b <= -1.75e+217) {
tmp = t_1;
} else if (b <= 1250000.0) {
tmp = ((t / c) * -4.0) * a;
} 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, b, c)
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), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_1
real(8) :: tmp
t_1 = b / (z * c)
if (b <= (-1.75d+217)) then
tmp = t_1
else if (b <= 1250000.0d0) then
tmp = ((t / c) * (-4.0d0)) * a
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 b, double c) {
double t_1 = b / (z * c);
double tmp;
if (b <= -1.75e+217) {
tmp = t_1;
} else if (b <= 1250000.0) {
tmp = ((t / c) * -4.0) * a;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = b / (z * c) tmp = 0 if b <= -1.75e+217: tmp = t_1 elif b <= 1250000.0: tmp = ((t / c) * -4.0) * a else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(b / Float64(z * c)) tmp = 0.0 if (b <= -1.75e+217) tmp = t_1; elseif (b <= 1250000.0) tmp = Float64(Float64(Float64(t / c) * -4.0) * a); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = b / (z * c); tmp = 0.0; if (b <= -1.75e+217) tmp = t_1; elseif (b <= 1250000.0) tmp = ((t / c) * -4.0) * a; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(b / N[(z * c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -1.75e+217], t$95$1, If[LessEqual[b, 1250000.0], N[(N[(N[(t / c), $MachinePrecision] * -4.0), $MachinePrecision] * a), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{b}{z \cdot c}\\
\mathbf{if}\;b \leq -1.75 \cdot 10^{+217}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 1250000:\\
\;\;\;\;\left(\frac{t}{c} \cdot -4\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -1.7499999999999999e217 or 1.25e6 < b Initial program 79.0%
Taylor expanded in b around inf
Applied rewrites53.2%
if -1.7499999999999999e217 < b < 1.25e6Initial program 78.7%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites77.2%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lift-/.f6444.0
Applied rewrites44.0%
(FPCore (x y z t a b c) :precision binary64 (let* ((t_1 (/ b (* z c)))) (if (<= b -1.35e+73) t_1 (if (<= b 1250000.0) (* -4.0 (/ (* a t) c)) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = b / (z * c);
double tmp;
if (b <= -1.35e+73) {
tmp = t_1;
} else if (b <= 1250000.0) {
tmp = -4.0 * ((a * t) / c);
} 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, b, c)
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), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_1
real(8) :: tmp
t_1 = b / (z * c)
if (b <= (-1.35d+73)) then
tmp = t_1
else if (b <= 1250000.0d0) then
tmp = (-4.0d0) * ((a * t) / c)
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 b, double c) {
double t_1 = b / (z * c);
double tmp;
if (b <= -1.35e+73) {
tmp = t_1;
} else if (b <= 1250000.0) {
tmp = -4.0 * ((a * t) / c);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = b / (z * c) tmp = 0 if b <= -1.35e+73: tmp = t_1 elif b <= 1250000.0: tmp = -4.0 * ((a * t) / c) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(b / Float64(z * c)) tmp = 0.0 if (b <= -1.35e+73) tmp = t_1; elseif (b <= 1250000.0) tmp = Float64(-4.0 * Float64(Float64(a * t) / c)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = b / (z * c); tmp = 0.0; if (b <= -1.35e+73) tmp = t_1; elseif (b <= 1250000.0) tmp = -4.0 * ((a * t) / c); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(b / N[(z * c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -1.35e+73], t$95$1, If[LessEqual[b, 1250000.0], N[(-4.0 * N[(N[(a * t), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{b}{z \cdot c}\\
\mathbf{if}\;b \leq -1.35 \cdot 10^{+73}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 1250000:\\
\;\;\;\;-4 \cdot \frac{a \cdot t}{c}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -1.35e73 or 1.25e6 < b Initial program 78.7%
Taylor expanded in b around inf
Applied rewrites52.0%
if -1.35e73 < b < 1.25e6Initial program 78.9%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6445.2
Applied rewrites45.2%
(FPCore (x y z t a b c) :precision binary64 (/ b (* z c)))
double code(double x, double y, double z, double t, double a, double b, double c) {
return b / (z * c);
}
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, b, c)
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), intent (in) :: b
real(8), intent (in) :: c
code = b / (z * c)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return b / (z * c);
}
def code(x, y, z, t, a, b, c): return b / (z * c)
function code(x, y, z, t, a, b, c) return Float64(b / Float64(z * c)) end
function tmp = code(x, y, z, t, a, b, c) tmp = b / (z * c); end
code[x_, y_, z_, t_, a_, b_, c_] := N[(b / N[(z * c), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{b}{z \cdot c}
\end{array}
Initial program 78.8%
Taylor expanded in b around inf
Applied rewrites34.0%
herbie shell --seed 2025128
(FPCore (x y z t a b c)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, J"
:precision binary64
(/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)))