
(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
(let* ((t_1
(/
(- (* (fma (/ x z) -9.0 (- (/ (fma (* a t) -4.0 (/ b z)) y))) y))
c)))
(if (<= z -1.15e+96)
t_1
(if (<= z 8.2e-26)
(/ (+ (- (* (* x 9.0) y) (* (* (* 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((x / z), -9.0, -(fma((a * t), -4.0, (b / z)) / y)) * y) / c;
double tmp;
if (z <= -1.15e+96) {
tmp = t_1;
} else if (z <= 8.2e-26) {
tmp = ((((x * 9.0) * y) - (((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(Float64(-Float64(fma(Float64(x / z), -9.0, Float64(-Float64(fma(Float64(a * t), -4.0, Float64(b / z)) / y))) * y)) / c) tmp = 0.0 if (z <= -1.15e+96) tmp = t_1; elseif (z <= 8.2e-26) tmp = Float64(Float64(Float64(Float64(Float64(x * 9.0) * y) - 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[(N[(x / z), $MachinePrecision] * -9.0 + (-N[(N[(N[(a * t), $MachinePrecision] * -4.0 + N[(b / z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision])), $MachinePrecision] * y), $MachinePrecision]) / c), $MachinePrecision]}, If[LessEqual[z, -1.15e+96], t$95$1, If[LessEqual[z, 8.2e-26], 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], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-\mathsf{fma}\left(\frac{x}{z}, -9, -\frac{\mathsf{fma}\left(a \cdot t, -4, \frac{b}{z}\right)}{y}\right) \cdot y}{c}\\
\mathbf{if}\;z \leq -1.15 \cdot 10^{+96}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 8.2 \cdot 10^{-26}:\\
\;\;\;\;\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}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.15000000000000008e96 or 8.1999999999999997e-26 < z Initial program 62.1%
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 rewrites71.2%
Taylor expanded in y around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites85.5%
if -1.15000000000000008e96 < z < 8.1999999999999997e-26Initial program 93.8%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* x 9.0) y)) (t_2 (* (/ (* 9.0 x) c) (/ y z))))
(if (<= t_1 -4e+172)
t_2
(if (<= t_1 -5e+68)
(* -4.0 (* t (/ a c)))
(if (<= t_1 5e+99)
(/ (fma (* (* t z) a) -4.0 b) (* z c))
(if (<= t_1 2e+298) (/ (fma (* y x) 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 = ((9.0 * x) / c) * (y / z);
double tmp;
if (t_1 <= -4e+172) {
tmp = t_2;
} else if (t_1 <= -5e+68) {
tmp = -4.0 * (t * (a / c));
} else if (t_1 <= 5e+99) {
tmp = fma(((t * z) * a), -4.0, b) / (z * c);
} else if (t_1 <= 2e+298) {
tmp = fma((y * x), 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(Float64(9.0 * x) / c) * Float64(y / z)) tmp = 0.0 if (t_1 <= -4e+172) tmp = t_2; elseif (t_1 <= -5e+68) tmp = Float64(-4.0 * Float64(t * Float64(a / c))); elseif (t_1 <= 5e+99) tmp = Float64(fma(Float64(Float64(t * z) * a), -4.0, b) / Float64(z * c)); elseif (t_1 <= 2e+298) tmp = Float64(fma(Float64(y * x), 9.0, b) / Float64(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[(N[(9.0 * x), $MachinePrecision] / c), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+172], t$95$2, If[LessEqual[t$95$1, -5e+68], N[(-4.0 * N[(t * N[(a / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+99], N[(N[(N[(N[(t * z), $MachinePrecision] * a), $MachinePrecision] * -4.0 + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+298], N[(N[(N[(y * x), $MachinePrecision] * 9.0 + b), $MachinePrecision] / 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 := \frac{9 \cdot x}{c} \cdot \frac{y}{z}\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{+172}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq -5 \cdot 10^{+68}:\\
\;\;\;\;-4 \cdot \left(t \cdot \frac{a}{c}\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+99}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(t \cdot z\right) \cdot a, -4, b\right)}{z \cdot c}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+298}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y \cdot x, 9, b\right)}{z \cdot c}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -4.0000000000000003e172 or 1.9999999999999999e298 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 69.4%
Taylor expanded in x around inf
associate-*r/N/A
associate-*r*N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f6481.5
Applied rewrites81.5%
if -4.0000000000000003e172 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -5.0000000000000004e68Initial program 79.1%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6435.1
Applied rewrites35.1%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6439.2
Applied rewrites39.2%
if -5.0000000000000004e68 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 5.00000000000000008e99Initial program 82.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-*.f6484.2
Applied rewrites84.2%
Taylor expanded in x around 0
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f6471.6
Applied rewrites71.6%
if 5.00000000000000008e99 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 1.9999999999999999e298Initial program 81.2%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6470.6
Applied rewrites70.6%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* x 9.0) y)) (t_2 (* (/ (* 9.0 x) c) (/ y z))))
(if (<= t_1 -4e+172)
t_2
(if (<= t_1 5e+80)
(/ (fma (* a t) -4.0 (/ b z)) c)
(if (<= t_1 2e+298)
(/ (fma -4.0 (* (* t z) a) (* (* y x) 9.0)) (* 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 = ((9.0 * x) / c) * (y / z);
double tmp;
if (t_1 <= -4e+172) {
tmp = t_2;
} else if (t_1 <= 5e+80) {
tmp = fma((a * t), -4.0, (b / z)) / c;
} else if (t_1 <= 2e+298) {
tmp = fma(-4.0, ((t * z) * a), ((y * x) * 9.0)) / (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(Float64(9.0 * x) / c) * Float64(y / z)) tmp = 0.0 if (t_1 <= -4e+172) tmp = t_2; elseif (t_1 <= 5e+80) tmp = Float64(fma(Float64(a * t), -4.0, Float64(b / z)) / c); elseif (t_1 <= 2e+298) tmp = Float64(fma(-4.0, Float64(Float64(t * z) * a), Float64(Float64(y * x) * 9.0)) / Float64(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[(N[(9.0 * x), $MachinePrecision] / c), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+172], t$95$2, If[LessEqual[t$95$1, 5e+80], N[(N[(N[(a * t), $MachinePrecision] * -4.0 + N[(b / z), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[t$95$1, 2e+298], N[(N[(-4.0 * N[(N[(t * z), $MachinePrecision] * a), $MachinePrecision] + N[(N[(y * x), $MachinePrecision] * 9.0), $MachinePrecision]), $MachinePrecision] / 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 := \frac{9 \cdot x}{c} \cdot \frac{y}{z}\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{+172}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+80}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a \cdot t, -4, \frac{b}{z}\right)}{c}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+298}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-4, \left(t \cdot z\right) \cdot a, \left(y \cdot x\right) \cdot 9\right)}{z \cdot c}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -4.0000000000000003e172 or 1.9999999999999999e298 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 69.4%
Taylor expanded in x around inf
associate-*r/N/A
associate-*r*N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f6481.5
Applied rewrites81.5%
if -4.0000000000000003e172 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 4.99999999999999961e80Initial program 82.5%
Taylor expanded in x around 0
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6469.9
Applied rewrites69.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f6476.8
Applied rewrites76.8%
Taylor expanded in c around 0
+-commutativeN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
lower-/.f64N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
lower-/.f6478.3
Applied rewrites78.3%
if 4.99999999999999961e80 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 1.9999999999999999e298Initial program 81.5%
Taylor expanded in b around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6471.0
Applied rewrites71.0%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* x 9.0) y)) (t_2 (* (/ (* 9.0 x) c) (/ y z))))
(if (<= t_1 -4e+172)
t_2
(if (<= t_1 5e+99)
(/ (fma (* a t) -4.0 (/ b z)) c)
(if (<= t_1 2e+298) (/ (fma (* y x) 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 = ((9.0 * x) / c) * (y / z);
double tmp;
if (t_1 <= -4e+172) {
tmp = t_2;
} else if (t_1 <= 5e+99) {
tmp = fma((a * t), -4.0, (b / z)) / c;
} else if (t_1 <= 2e+298) {
tmp = fma((y * x), 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(Float64(9.0 * x) / c) * Float64(y / z)) tmp = 0.0 if (t_1 <= -4e+172) tmp = t_2; elseif (t_1 <= 5e+99) tmp = Float64(fma(Float64(a * t), -4.0, Float64(b / z)) / c); elseif (t_1 <= 2e+298) tmp = Float64(fma(Float64(y * x), 9.0, b) / Float64(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[(N[(9.0 * x), $MachinePrecision] / c), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+172], t$95$2, If[LessEqual[t$95$1, 5e+99], N[(N[(N[(a * t), $MachinePrecision] * -4.0 + N[(b / z), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[t$95$1, 2e+298], N[(N[(N[(y * x), $MachinePrecision] * 9.0 + b), $MachinePrecision] / 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 := \frac{9 \cdot x}{c} \cdot \frac{y}{z}\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{+172}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+99}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a \cdot t, -4, \frac{b}{z}\right)}{c}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+298}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y \cdot x, 9, b\right)}{z \cdot c}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -4.0000000000000003e172 or 1.9999999999999999e298 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 69.4%
Taylor expanded in x around inf
associate-*r/N/A
associate-*r*N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f6481.5
Applied rewrites81.5%
if -4.0000000000000003e172 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 5.00000000000000008e99Initial program 82.5%
Taylor expanded in x around 0
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6469.4
Applied rewrites69.4%
Taylor expanded in z around inf
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f6476.2
Applied rewrites76.2%
Taylor expanded in c around 0
+-commutativeN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
lower-/.f64N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
lower-/.f6477.7
Applied rewrites77.7%
if 5.00000000000000008e99 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 1.9999999999999999e298Initial program 81.2%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6470.6
Applied rewrites70.6%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* x 9.0) y)) (t_2 (* (/ (* 9.0 x) c) (/ y z))))
(if (<= t_1 -5e+269)
t_2
(if (<= t_1 2e+298)
(/ (+ (- t_1 (* (* 4.0 z) (* 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 = ((9.0 * x) / c) * (y / z);
double tmp;
if (t_1 <= -5e+269) {
tmp = t_2;
} else if (t_1 <= 2e+298) {
tmp = ((t_1 - ((4.0 * z) * (a * t))) + 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 = ((9.0d0 * x) / c) * (y / z)
if (t_1 <= (-5d+269)) then
tmp = t_2
else if (t_1 <= 2d+298) then
tmp = ((t_1 - ((4.0d0 * z) * (a * t))) + 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 = ((9.0 * x) / c) * (y / z);
double tmp;
if (t_1 <= -5e+269) {
tmp = t_2;
} else if (t_1 <= 2e+298) {
tmp = ((t_1 - ((4.0 * z) * (a * t))) + 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 = ((9.0 * x) / c) * (y / z) tmp = 0 if t_1 <= -5e+269: tmp = t_2 elif t_1 <= 2e+298: tmp = ((t_1 - ((4.0 * z) * (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(Float64(9.0 * x) / c) * Float64(y / z)) tmp = 0.0 if (t_1 <= -5e+269) tmp = t_2; elseif (t_1 <= 2e+298) tmp = Float64(Float64(Float64(t_1 - Float64(Float64(4.0 * z) * Float64(a * t))) + 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 = ((9.0 * x) / c) * (y / z); tmp = 0.0; if (t_1 <= -5e+269) tmp = t_2; elseif (t_1 <= 2e+298) tmp = ((t_1 - ((4.0 * z) * (a * t))) + 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[(N[(9.0 * x), $MachinePrecision] / c), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+269], t$95$2, If[LessEqual[t$95$1, 2e+298], N[(N[(N[(t$95$1 - N[(N[(4.0 * z), $MachinePrecision] * N[(a * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + b), $MachinePrecision] / 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 := \frac{9 \cdot x}{c} \cdot \frac{y}{z}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+269}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+298}:\\
\;\;\;\;\frac{\left(t\_1 - \left(4 \cdot z\right) \cdot \left(a \cdot t\right)\right) + b}{z \cdot c}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -5.0000000000000002e269 or 1.9999999999999999e298 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 64.8%
Taylor expanded in x around inf
associate-*r/N/A
associate-*r*N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f6486.9
Applied rewrites86.9%
if -5.0000000000000002e269 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 1.9999999999999999e298Initial program 82.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-*.f6483.5
Applied rewrites83.5%
(FPCore (x y z t a b c) :precision binary64 (if (<= t -2.5e-58) (* (fma (/ a c) -4.0 (/ (fma (* y x) 9.0 b) (* (* t z) c))) t) (/ (/ (- (* (* y x) 9.0) (- (* (* (* 4.0 z) t) a) b)) z) c)))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (t <= -2.5e-58) {
tmp = fma((a / c), -4.0, (fma((y * x), 9.0, b) / ((t * z) * c))) * t;
} else {
tmp = ((((y * x) * 9.0) - ((((4.0 * z) * t) * a) - b)) / z) / c;
}
return tmp;
}
function code(x, y, z, t, a, b, c) tmp = 0.0 if (t <= -2.5e-58) tmp = Float64(fma(Float64(a / c), -4.0, Float64(fma(Float64(y * x), 9.0, b) / Float64(Float64(t * z) * c))) * t); else tmp = Float64(Float64(Float64(Float64(Float64(y * x) * 9.0) - Float64(Float64(Float64(Float64(4.0 * z) * t) * a) - b)) / z) / c); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[t, -2.5e-58], N[(N[(N[(a / c), $MachinePrecision] * -4.0 + N[(N[(N[(y * x), $MachinePrecision] * 9.0 + b), $MachinePrecision] / N[(N[(t * z), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], N[(N[(N[(N[(N[(y * x), $MachinePrecision] * 9.0), $MachinePrecision] - N[(N[(N[(N[(4.0 * z), $MachinePrecision] * t), $MachinePrecision] * a), $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] / c), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.5 \cdot 10^{-58}:\\
\;\;\;\;\mathsf{fma}\left(\frac{a}{c}, -4, \frac{\mathsf{fma}\left(y \cdot x, 9, b\right)}{\left(t \cdot z\right) \cdot c}\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\left(y \cdot x\right) \cdot 9 - \left(\left(\left(4 \cdot z\right) \cdot t\right) \cdot a - b\right)}{z}}{c}\\
\end{array}
\end{array}
if t < -2.49999999999999989e-58Initial program 75.2%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites85.2%
if -2.49999999999999989e-58 < t Initial program 81.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 rewrites82.4%
(FPCore (x y z t a b c)
:precision binary64
(if (<= b -4.5e+114)
(/ (/ b c) z)
(if (<= b 1.85e-145)
(* -4.0 (* t (/ a c)))
(if (<= b 650000000000.0)
(/ (* (* y x) 9.0) (* z c))
(if (<= b 8.2e+103) (* (* (/ t c) -4.0) a) (/ (/ b z) c))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (b <= -4.5e+114) {
tmp = (b / c) / z;
} else if (b <= 1.85e-145) {
tmp = -4.0 * (t * (a / c));
} else if (b <= 650000000000.0) {
tmp = ((y * x) * 9.0) / (z * c);
} else if (b <= 8.2e+103) {
tmp = ((t / c) * -4.0) * a;
} else {
tmp = (b / z) / c;
}
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) :: tmp
if (b <= (-4.5d+114)) then
tmp = (b / c) / z
else if (b <= 1.85d-145) then
tmp = (-4.0d0) * (t * (a / c))
else if (b <= 650000000000.0d0) then
tmp = ((y * x) * 9.0d0) / (z * c)
else if (b <= 8.2d+103) then
tmp = ((t / c) * (-4.0d0)) * a
else
tmp = (b / z) / c
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 tmp;
if (b <= -4.5e+114) {
tmp = (b / c) / z;
} else if (b <= 1.85e-145) {
tmp = -4.0 * (t * (a / c));
} else if (b <= 650000000000.0) {
tmp = ((y * x) * 9.0) / (z * c);
} else if (b <= 8.2e+103) {
tmp = ((t / c) * -4.0) * a;
} else {
tmp = (b / z) / c;
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if b <= -4.5e+114: tmp = (b / c) / z elif b <= 1.85e-145: tmp = -4.0 * (t * (a / c)) elif b <= 650000000000.0: tmp = ((y * x) * 9.0) / (z * c) elif b <= 8.2e+103: tmp = ((t / c) * -4.0) * a else: tmp = (b / z) / c return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if (b <= -4.5e+114) tmp = Float64(Float64(b / c) / z); elseif (b <= 1.85e-145) tmp = Float64(-4.0 * Float64(t * Float64(a / c))); elseif (b <= 650000000000.0) tmp = Float64(Float64(Float64(y * x) * 9.0) / Float64(z * c)); elseif (b <= 8.2e+103) tmp = Float64(Float64(Float64(t / c) * -4.0) * a); else tmp = Float64(Float64(b / z) / c); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) tmp = 0.0; if (b <= -4.5e+114) tmp = (b / c) / z; elseif (b <= 1.85e-145) tmp = -4.0 * (t * (a / c)); elseif (b <= 650000000000.0) tmp = ((y * x) * 9.0) / (z * c); elseif (b <= 8.2e+103) tmp = ((t / c) * -4.0) * a; else tmp = (b / z) / c; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[b, -4.5e+114], N[(N[(b / c), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[b, 1.85e-145], N[(-4.0 * N[(t * N[(a / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 650000000000.0], N[(N[(N[(y * x), $MachinePrecision] * 9.0), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 8.2e+103], N[(N[(N[(t / c), $MachinePrecision] * -4.0), $MachinePrecision] * a), $MachinePrecision], N[(N[(b / z), $MachinePrecision] / c), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -4.5 \cdot 10^{+114}:\\
\;\;\;\;\frac{\frac{b}{c}}{z}\\
\mathbf{elif}\;b \leq 1.85 \cdot 10^{-145}:\\
\;\;\;\;-4 \cdot \left(t \cdot \frac{a}{c}\right)\\
\mathbf{elif}\;b \leq 650000000000:\\
\;\;\;\;\frac{\left(y \cdot x\right) \cdot 9}{z \cdot c}\\
\mathbf{elif}\;b \leq 8.2 \cdot 10^{+103}:\\
\;\;\;\;\left(\frac{t}{c} \cdot -4\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{b}{z}}{c}\\
\end{array}
\end{array}
if b < -4.5000000000000001e114Initial program 78.0%
Taylor expanded in x around 0
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6470.1
Applied rewrites70.1%
Taylor expanded in z around 0
Applied rewrites61.7%
if -4.5000000000000001e114 < b < 1.85000000000000006e-145Initial program 79.8%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6445.6
Applied rewrites45.6%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6445.8
Applied rewrites45.8%
if 1.85000000000000006e-145 < b < 6.5e11Initial program 80.5%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6442.4
Applied rewrites42.4%
if 6.5e11 < b < 8.2000000000000003e103Initial program 80.8%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites78.5%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lift-/.f6438.6
Applied rewrites38.6%
if 8.2000000000000003e103 < b Initial program 80.5%
Taylor expanded in b around inf
Applied rewrites61.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6458.5
associate-+l-58.5
associate-*l*58.5
*-commutative58.5
*-commutative58.5
associate-+l-58.5
Applied rewrites58.5%
(FPCore (x y z t a b c)
:precision binary64
(if (<= b -4.5e+114)
(/ (/ b c) z)
(if (<= b -3.4e-183)
(* -4.0 (* t (/ a c)))
(if (<= b 8.2e+103) (* (* (/ t c) -4.0) a) (/ (/ b z) c)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (b <= -4.5e+114) {
tmp = (b / c) / z;
} else if (b <= -3.4e-183) {
tmp = -4.0 * (t * (a / c));
} else if (b <= 8.2e+103) {
tmp = ((t / c) * -4.0) * a;
} else {
tmp = (b / z) / c;
}
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) :: tmp
if (b <= (-4.5d+114)) then
tmp = (b / c) / z
else if (b <= (-3.4d-183)) then
tmp = (-4.0d0) * (t * (a / c))
else if (b <= 8.2d+103) then
tmp = ((t / c) * (-4.0d0)) * a
else
tmp = (b / z) / c
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 tmp;
if (b <= -4.5e+114) {
tmp = (b / c) / z;
} else if (b <= -3.4e-183) {
tmp = -4.0 * (t * (a / c));
} else if (b <= 8.2e+103) {
tmp = ((t / c) * -4.0) * a;
} else {
tmp = (b / z) / c;
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if b <= -4.5e+114: tmp = (b / c) / z elif b <= -3.4e-183: tmp = -4.0 * (t * (a / c)) elif b <= 8.2e+103: tmp = ((t / c) * -4.0) * a else: tmp = (b / z) / c return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if (b <= -4.5e+114) tmp = Float64(Float64(b / c) / z); elseif (b <= -3.4e-183) tmp = Float64(-4.0 * Float64(t * Float64(a / c))); elseif (b <= 8.2e+103) tmp = Float64(Float64(Float64(t / c) * -4.0) * a); else tmp = Float64(Float64(b / z) / c); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) tmp = 0.0; if (b <= -4.5e+114) tmp = (b / c) / z; elseif (b <= -3.4e-183) tmp = -4.0 * (t * (a / c)); elseif (b <= 8.2e+103) tmp = ((t / c) * -4.0) * a; else tmp = (b / z) / c; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[b, -4.5e+114], N[(N[(b / c), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[b, -3.4e-183], N[(-4.0 * N[(t * N[(a / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 8.2e+103], N[(N[(N[(t / c), $MachinePrecision] * -4.0), $MachinePrecision] * a), $MachinePrecision], N[(N[(b / z), $MachinePrecision] / c), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -4.5 \cdot 10^{+114}:\\
\;\;\;\;\frac{\frac{b}{c}}{z}\\
\mathbf{elif}\;b \leq -3.4 \cdot 10^{-183}:\\
\;\;\;\;-4 \cdot \left(t \cdot \frac{a}{c}\right)\\
\mathbf{elif}\;b \leq 8.2 \cdot 10^{+103}:\\
\;\;\;\;\left(\frac{t}{c} \cdot -4\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{b}{z}}{c}\\
\end{array}
\end{array}
if b < -4.5000000000000001e114Initial program 78.0%
Taylor expanded in x around 0
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6470.1
Applied rewrites70.1%
Taylor expanded in z around 0
Applied rewrites61.7%
if -4.5000000000000001e114 < b < -3.40000000000000014e-183Initial program 80.6%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6441.3
Applied rewrites41.3%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6442.0
Applied rewrites42.0%
if -3.40000000000000014e-183 < b < 8.2000000000000003e103Initial program 79.7%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites77.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lift-/.f6446.5
Applied rewrites46.5%
if 8.2000000000000003e103 < b Initial program 80.5%
Taylor expanded in b around inf
Applied rewrites61.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6458.5
associate-+l-58.5
associate-*l*58.5
*-commutative58.5
*-commutative58.5
associate-+l-58.5
Applied rewrites58.5%
(FPCore (x y z t a b c) :precision binary64 (if (<= t -9.2e+111) (* -4.0 (* t (/ a c))) (if (<= t 1e-28) (/ (fma (* 9.0 x) y b) (* z c)) (* (* (/ t c) -4.0) a))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (t <= -9.2e+111) {
tmp = -4.0 * (t * (a / c));
} else if (t <= 1e-28) {
tmp = fma((9.0 * x), y, b) / (z * c);
} else {
tmp = ((t / c) * -4.0) * a;
}
return tmp;
}
function code(x, y, z, t, a, b, c) tmp = 0.0 if (t <= -9.2e+111) tmp = Float64(-4.0 * Float64(t * Float64(a / c))); elseif (t <= 1e-28) tmp = Float64(fma(Float64(9.0 * x), y, b) / Float64(z * c)); else tmp = Float64(Float64(Float64(t / c) * -4.0) * a); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[t, -9.2e+111], N[(-4.0 * N[(t * N[(a / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1e-28], N[(N[(N[(9.0 * x), $MachinePrecision] * y + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t / c), $MachinePrecision] * -4.0), $MachinePrecision] * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9.2 \cdot 10^{+111}:\\
\;\;\;\;-4 \cdot \left(t \cdot \frac{a}{c}\right)\\
\mathbf{elif}\;t \leq 10^{-28}:\\
\;\;\;\;\frac{\mathsf{fma}\left(9 \cdot x, y, b\right)}{z \cdot c}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{t}{c} \cdot -4\right) \cdot a\\
\end{array}
\end{array}
if t < -9.20000000000000008e111Initial program 72.0%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6457.8
Applied rewrites57.8%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6462.7
Applied rewrites62.7%
if -9.20000000000000008e111 < t < 9.99999999999999971e-29Initial program 84.3%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6471.2
Applied rewrites71.2%
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6471.1
Applied rewrites71.1%
if 9.99999999999999971e-29 < t Initial program 75.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-/.f6454.9
Applied rewrites54.9%
(FPCore (x y z t a b c) :precision binary64 (if (<= t -9.2e+111) (* -4.0 (* t (/ a c))) (if (<= t 1e-28) (/ (fma x (* 9.0 y) b) (* z c)) (* (* (/ t c) -4.0) a))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (t <= -9.2e+111) {
tmp = -4.0 * (t * (a / c));
} else if (t <= 1e-28) {
tmp = fma(x, (9.0 * y), b) / (z * c);
} else {
tmp = ((t / c) * -4.0) * a;
}
return tmp;
}
function code(x, y, z, t, a, b, c) tmp = 0.0 if (t <= -9.2e+111) tmp = Float64(-4.0 * Float64(t * Float64(a / c))); elseif (t <= 1e-28) tmp = Float64(fma(x, Float64(9.0 * y), b) / Float64(z * c)); else tmp = Float64(Float64(Float64(t / c) * -4.0) * a); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[t, -9.2e+111], N[(-4.0 * N[(t * N[(a / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1e-28], N[(N[(x * N[(9.0 * y), $MachinePrecision] + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t / c), $MachinePrecision] * -4.0), $MachinePrecision] * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9.2 \cdot 10^{+111}:\\
\;\;\;\;-4 \cdot \left(t \cdot \frac{a}{c}\right)\\
\mathbf{elif}\;t \leq 10^{-28}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, 9 \cdot y, b\right)}{z \cdot c}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{t}{c} \cdot -4\right) \cdot a\\
\end{array}
\end{array}
if t < -9.20000000000000008e111Initial program 72.0%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6457.8
Applied rewrites57.8%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6462.7
Applied rewrites62.7%
if -9.20000000000000008e111 < t < 9.99999999999999971e-29Initial program 84.3%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6471.2
Applied rewrites71.2%
lift-fma.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6471.1
Applied rewrites71.1%
if 9.99999999999999971e-29 < t Initial program 75.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-/.f6454.9
Applied rewrites54.9%
(FPCore (x y z t a b c) :precision binary64 (if (<= t -8.8e+14) (* -4.0 (* t (/ a c))) (if (<= t 2.2e-29) (/ (/ b c) z) (* (* (/ t c) -4.0) a))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (t <= -8.8e+14) {
tmp = -4.0 * (t * (a / c));
} else if (t <= 2.2e-29) {
tmp = (b / c) / z;
} else {
tmp = ((t / c) * -4.0) * a;
}
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) :: tmp
if (t <= (-8.8d+14)) then
tmp = (-4.0d0) * (t * (a / c))
else if (t <= 2.2d-29) then
tmp = (b / c) / z
else
tmp = ((t / c) * (-4.0d0)) * a
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 tmp;
if (t <= -8.8e+14) {
tmp = -4.0 * (t * (a / c));
} else if (t <= 2.2e-29) {
tmp = (b / c) / z;
} else {
tmp = ((t / c) * -4.0) * a;
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if t <= -8.8e+14: tmp = -4.0 * (t * (a / c)) elif t <= 2.2e-29: tmp = (b / c) / z else: tmp = ((t / c) * -4.0) * a return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if (t <= -8.8e+14) tmp = Float64(-4.0 * Float64(t * Float64(a / c))); elseif (t <= 2.2e-29) tmp = Float64(Float64(b / c) / z); else tmp = Float64(Float64(Float64(t / c) * -4.0) * a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) tmp = 0.0; if (t <= -8.8e+14) tmp = -4.0 * (t * (a / c)); elseif (t <= 2.2e-29) tmp = (b / c) / z; else tmp = ((t / c) * -4.0) * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[t, -8.8e+14], N[(-4.0 * N[(t * N[(a / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.2e-29], N[(N[(b / c), $MachinePrecision] / z), $MachinePrecision], N[(N[(N[(t / c), $MachinePrecision] * -4.0), $MachinePrecision] * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.8 \cdot 10^{+14}:\\
\;\;\;\;-4 \cdot \left(t \cdot \frac{a}{c}\right)\\
\mathbf{elif}\;t \leq 2.2 \cdot 10^{-29}:\\
\;\;\;\;\frac{\frac{b}{c}}{z}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{t}{c} \cdot -4\right) \cdot a\\
\end{array}
\end{array}
if t < -8.8e14Initial program 73.3%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6454.2
Applied rewrites54.2%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6458.3
Applied rewrites58.3%
if -8.8e14 < t < 2.1999999999999999e-29Initial program 85.5%
Taylor expanded in x around 0
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6454.2
Applied rewrites54.2%
Taylor expanded in z around 0
Applied rewrites42.5%
if 2.1999999999999999e-29 < t Initial program 75.2%
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-/.f6454.8
Applied rewrites54.8%
(FPCore (x y z t a b c) :precision binary64 (if (<= t -8.8e+14) (* -4.0 (* t (/ a c))) (if (<= t 8.5e-29) (/ b (* z c)) (* (* (/ t c) -4.0) a))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (t <= -8.8e+14) {
tmp = -4.0 * (t * (a / c));
} else if (t <= 8.5e-29) {
tmp = b / (z * c);
} else {
tmp = ((t / c) * -4.0) * a;
}
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) :: tmp
if (t <= (-8.8d+14)) then
tmp = (-4.0d0) * (t * (a / c))
else if (t <= 8.5d-29) then
tmp = b / (z * c)
else
tmp = ((t / c) * (-4.0d0)) * a
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 tmp;
if (t <= -8.8e+14) {
tmp = -4.0 * (t * (a / c));
} else if (t <= 8.5e-29) {
tmp = b / (z * c);
} else {
tmp = ((t / c) * -4.0) * a;
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if t <= -8.8e+14: tmp = -4.0 * (t * (a / c)) elif t <= 8.5e-29: tmp = b / (z * c) else: tmp = ((t / c) * -4.0) * a return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if (t <= -8.8e+14) tmp = Float64(-4.0 * Float64(t * Float64(a / c))); elseif (t <= 8.5e-29) tmp = Float64(b / Float64(z * c)); else tmp = Float64(Float64(Float64(t / c) * -4.0) * a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) tmp = 0.0; if (t <= -8.8e+14) tmp = -4.0 * (t * (a / c)); elseif (t <= 8.5e-29) tmp = b / (z * c); else tmp = ((t / c) * -4.0) * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[t, -8.8e+14], N[(-4.0 * N[(t * N[(a / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 8.5e-29], N[(b / N[(z * c), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t / c), $MachinePrecision] * -4.0), $MachinePrecision] * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.8 \cdot 10^{+14}:\\
\;\;\;\;-4 \cdot \left(t \cdot \frac{a}{c}\right)\\
\mathbf{elif}\;t \leq 8.5 \cdot 10^{-29}:\\
\;\;\;\;\frac{b}{z \cdot c}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{t}{c} \cdot -4\right) \cdot a\\
\end{array}
\end{array}
if t < -8.8e14Initial program 73.3%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6454.2
Applied rewrites54.2%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6458.3
Applied rewrites58.3%
if -8.8e14 < t < 8.5000000000000001e-29Initial program 85.5%
Taylor expanded in b around inf
Applied rewrites42.6%
if 8.5000000000000001e-29 < t Initial program 75.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-/.f6454.9
Applied rewrites54.9%
(FPCore (x y z t a b c) :precision binary64 (let* ((t_1 (* -4.0 (* t (/ a c))))) (if (<= t -8.8e+14) t_1 (if (<= t 8.5e-29) (/ b (* z c)) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = -4.0 * (t * (a / c));
double tmp;
if (t <= -8.8e+14) {
tmp = t_1;
} else if (t <= 8.5e-29) {
tmp = b / (z * 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 = (-4.0d0) * (t * (a / c))
if (t <= (-8.8d+14)) then
tmp = t_1
else if (t <= 8.5d-29) then
tmp = b / (z * 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 = -4.0 * (t * (a / c));
double tmp;
if (t <= -8.8e+14) {
tmp = t_1;
} else if (t <= 8.5e-29) {
tmp = b / (z * c);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = -4.0 * (t * (a / c)) tmp = 0 if t <= -8.8e+14: tmp = t_1 elif t <= 8.5e-29: tmp = b / (z * c) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(-4.0 * Float64(t * Float64(a / c))) tmp = 0.0 if (t <= -8.8e+14) tmp = t_1; elseif (t <= 8.5e-29) tmp = Float64(b / Float64(z * c)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = -4.0 * (t * (a / c)); tmp = 0.0; if (t <= -8.8e+14) tmp = t_1; elseif (t <= 8.5e-29) tmp = b / (z * c); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(-4.0 * N[(t * N[(a / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -8.8e+14], t$95$1, If[LessEqual[t, 8.5e-29], N[(b / N[(z * c), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -4 \cdot \left(t \cdot \frac{a}{c}\right)\\
\mathbf{if}\;t \leq -8.8 \cdot 10^{+14}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 8.5 \cdot 10^{-29}:\\
\;\;\;\;\frac{b}{z \cdot c}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -8.8e14 or 8.5000000000000001e-29 < t Initial program 74.3%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6452.5
Applied rewrites52.5%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6455.6
Applied rewrites55.6%
if -8.8e14 < t < 8.5000000000000001e-29Initial program 85.5%
Taylor expanded in b around inf
Applied rewrites42.6%
(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 79.8%
Taylor expanded in b around inf
Applied rewrites35.5%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (/ b (* c z)))
(t_2 (* 4.0 (/ (* a t) c)))
(t_3 (* (* x 9.0) y))
(t_4 (+ (- t_3 (* (* (* z 4.0) t) a)) b))
(t_5 (/ t_4 (* z c)))
(t_6 (/ (+ (- t_3 (* (* z 4.0) (* t a))) b) (* z c))))
(if (< t_5 -1.100156740804105e-171)
t_6
(if (< t_5 0.0)
(/ (/ t_4 z) c)
(if (< t_5 1.1708877911747488e-53)
t_6
(if (< t_5 2.876823679546137e+130)
(- (+ (* (* 9.0 (/ y c)) (/ x z)) t_1) t_2)
(if (< t_5 1.3838515042456319e+158)
t_6
(- (+ (* 9.0 (* (/ y (* c z)) x)) t_1) t_2))))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = b / (c * z);
double t_2 = 4.0 * ((a * t) / c);
double t_3 = (x * 9.0) * y;
double t_4 = (t_3 - (((z * 4.0) * t) * a)) + b;
double t_5 = t_4 / (z * c);
double t_6 = ((t_3 - ((z * 4.0) * (t * a))) + b) / (z * c);
double tmp;
if (t_5 < -1.100156740804105e-171) {
tmp = t_6;
} else if (t_5 < 0.0) {
tmp = (t_4 / z) / c;
} else if (t_5 < 1.1708877911747488e-53) {
tmp = t_6;
} else if (t_5 < 2.876823679546137e+130) {
tmp = (((9.0 * (y / c)) * (x / z)) + t_1) - t_2;
} else if (t_5 < 1.3838515042456319e+158) {
tmp = t_6;
} else {
tmp = ((9.0 * ((y / (c * z)) * x)) + t_1) - 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) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: t_6
real(8) :: tmp
t_1 = b / (c * z)
t_2 = 4.0d0 * ((a * t) / c)
t_3 = (x * 9.0d0) * y
t_4 = (t_3 - (((z * 4.0d0) * t) * a)) + b
t_5 = t_4 / (z * c)
t_6 = ((t_3 - ((z * 4.0d0) * (t * a))) + b) / (z * c)
if (t_5 < (-1.100156740804105d-171)) then
tmp = t_6
else if (t_5 < 0.0d0) then
tmp = (t_4 / z) / c
else if (t_5 < 1.1708877911747488d-53) then
tmp = t_6
else if (t_5 < 2.876823679546137d+130) then
tmp = (((9.0d0 * (y / c)) * (x / z)) + t_1) - t_2
else if (t_5 < 1.3838515042456319d+158) then
tmp = t_6
else
tmp = ((9.0d0 * ((y / (c * z)) * x)) + t_1) - 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 = b / (c * z);
double t_2 = 4.0 * ((a * t) / c);
double t_3 = (x * 9.0) * y;
double t_4 = (t_3 - (((z * 4.0) * t) * a)) + b;
double t_5 = t_4 / (z * c);
double t_6 = ((t_3 - ((z * 4.0) * (t * a))) + b) / (z * c);
double tmp;
if (t_5 < -1.100156740804105e-171) {
tmp = t_6;
} else if (t_5 < 0.0) {
tmp = (t_4 / z) / c;
} else if (t_5 < 1.1708877911747488e-53) {
tmp = t_6;
} else if (t_5 < 2.876823679546137e+130) {
tmp = (((9.0 * (y / c)) * (x / z)) + t_1) - t_2;
} else if (t_5 < 1.3838515042456319e+158) {
tmp = t_6;
} else {
tmp = ((9.0 * ((y / (c * z)) * x)) + t_1) - t_2;
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = b / (c * z) t_2 = 4.0 * ((a * t) / c) t_3 = (x * 9.0) * y t_4 = (t_3 - (((z * 4.0) * t) * a)) + b t_5 = t_4 / (z * c) t_6 = ((t_3 - ((z * 4.0) * (t * a))) + b) / (z * c) tmp = 0 if t_5 < -1.100156740804105e-171: tmp = t_6 elif t_5 < 0.0: tmp = (t_4 / z) / c elif t_5 < 1.1708877911747488e-53: tmp = t_6 elif t_5 < 2.876823679546137e+130: tmp = (((9.0 * (y / c)) * (x / z)) + t_1) - t_2 elif t_5 < 1.3838515042456319e+158: tmp = t_6 else: tmp = ((9.0 * ((y / (c * z)) * x)) + t_1) - t_2 return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(b / Float64(c * z)) t_2 = Float64(4.0 * Float64(Float64(a * t) / c)) t_3 = Float64(Float64(x * 9.0) * y) t_4 = Float64(Float64(t_3 - Float64(Float64(Float64(z * 4.0) * t) * a)) + b) t_5 = Float64(t_4 / Float64(z * c)) t_6 = Float64(Float64(Float64(t_3 - Float64(Float64(z * 4.0) * Float64(t * a))) + b) / Float64(z * c)) tmp = 0.0 if (t_5 < -1.100156740804105e-171) tmp = t_6; elseif (t_5 < 0.0) tmp = Float64(Float64(t_4 / z) / c); elseif (t_5 < 1.1708877911747488e-53) tmp = t_6; elseif (t_5 < 2.876823679546137e+130) tmp = Float64(Float64(Float64(Float64(9.0 * Float64(y / c)) * Float64(x / z)) + t_1) - t_2); elseif (t_5 < 1.3838515042456319e+158) tmp = t_6; else tmp = Float64(Float64(Float64(9.0 * Float64(Float64(y / Float64(c * z)) * x)) + t_1) - t_2); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = b / (c * z); t_2 = 4.0 * ((a * t) / c); t_3 = (x * 9.0) * y; t_4 = (t_3 - (((z * 4.0) * t) * a)) + b; t_5 = t_4 / (z * c); t_6 = ((t_3 - ((z * 4.0) * (t * a))) + b) / (z * c); tmp = 0.0; if (t_5 < -1.100156740804105e-171) tmp = t_6; elseif (t_5 < 0.0) tmp = (t_4 / z) / c; elseif (t_5 < 1.1708877911747488e-53) tmp = t_6; elseif (t_5 < 2.876823679546137e+130) tmp = (((9.0 * (y / c)) * (x / z)) + t_1) - t_2; elseif (t_5 < 1.3838515042456319e+158) tmp = t_6; else tmp = ((9.0 * ((y / (c * z)) * x)) + t_1) - t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(b / N[(c * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(4.0 * N[(N[(a * t), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$4 = N[(N[(t$95$3 - N[(N[(N[(z * 4.0), $MachinePrecision] * t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] + b), $MachinePrecision]}, Block[{t$95$5 = N[(t$95$4 / N[(z * c), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(N[(N[(t$95$3 - N[(N[(z * 4.0), $MachinePrecision] * N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$5, -1.100156740804105e-171], t$95$6, If[Less[t$95$5, 0.0], N[(N[(t$95$4 / z), $MachinePrecision] / c), $MachinePrecision], If[Less[t$95$5, 1.1708877911747488e-53], t$95$6, If[Less[t$95$5, 2.876823679546137e+130], N[(N[(N[(N[(9.0 * N[(y / c), $MachinePrecision]), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] - t$95$2), $MachinePrecision], If[Less[t$95$5, 1.3838515042456319e+158], t$95$6, N[(N[(N[(9.0 * N[(N[(y / N[(c * z), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] - t$95$2), $MachinePrecision]]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{b}{c \cdot z}\\
t_2 := 4 \cdot \frac{a \cdot t}{c}\\
t_3 := \left(x \cdot 9\right) \cdot y\\
t_4 := \left(t\_3 - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b\\
t_5 := \frac{t\_4}{z \cdot c}\\
t_6 := \frac{\left(t\_3 - \left(z \cdot 4\right) \cdot \left(t \cdot a\right)\right) + b}{z \cdot c}\\
\mathbf{if}\;t\_5 < -1.100156740804105 \cdot 10^{-171}:\\
\;\;\;\;t\_6\\
\mathbf{elif}\;t\_5 < 0:\\
\;\;\;\;\frac{\frac{t\_4}{z}}{c}\\
\mathbf{elif}\;t\_5 < 1.1708877911747488 \cdot 10^{-53}:\\
\;\;\;\;t\_6\\
\mathbf{elif}\;t\_5 < 2.876823679546137 \cdot 10^{+130}:\\
\;\;\;\;\left(\left(9 \cdot \frac{y}{c}\right) \cdot \frac{x}{z} + t\_1\right) - t\_2\\
\mathbf{elif}\;t\_5 < 1.3838515042456319 \cdot 10^{+158}:\\
\;\;\;\;t\_6\\
\mathbf{else}:\\
\;\;\;\;\left(9 \cdot \left(\frac{y}{c \cdot z} \cdot x\right) + t\_1\right) - t\_2\\
\end{array}
\end{array}
herbie shell --seed 2025096
(FPCore (x y z t a b c)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, J"
:precision binary64
:alt
(! :herbie-platform default (if (< (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) (* z c)) -220031348160821/200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (/ (+ (- (* (* x 9) y) (* (* z 4) (* t a))) b) (* z c)) (if (< (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) (* z c)) 0) (/ (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) z) c) (if (< (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) (* z c)) 365902434742109/31250000000000000000000000000000000000000000000000000000000000000000) (/ (+ (- (* (* x 9) y) (* (* z 4) (* t a))) b) (* z c)) (if (< (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) (* z c)) 28768236795461370000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- (+ (* (* 9 (/ y c)) (/ x z)) (/ b (* c z))) (* 4 (/ (* a t) c))) (if (< (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) (* z c)) 138385150424563190000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (/ (+ (- (* (* x 9) y) (* (* z 4) (* t a))) b) (* z c)) (- (+ (* 9 (* (/ y (* c z)) x)) (/ b (* c z))) (* 4 (/ (* a t) c)))))))))
(/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)))