
(FPCore (a b c) :precision binary64 (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))
double code(double a, double b, double c) {
return (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
}
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(a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = (-b + sqrt(((b * b) - ((3.0d0 * a) * c)))) / (3.0d0 * a)
end function
public static double code(double a, double b, double c) {
return (-b + Math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
}
def code(a, b, c): return (-b + math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a)
function code(a, b, c) return Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c)))) / Float64(3.0 * a)) end
function tmp = code(a, b, c) tmp = (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a); end
code[a_, b_, c_] := N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\end{array}
Herbie found 22 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b c) :precision binary64 (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))
double code(double a, double b, double c) {
return (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
}
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(a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = (-b + sqrt(((b * b) - ((3.0d0 * a) * c)))) / (3.0d0 * a)
end function
public static double code(double a, double b, double c) {
return (-b + Math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
}
def code(a, b, c): return (-b + math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a)
function code(a, b, c) return Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c)))) / Float64(3.0 * a)) end
function tmp = code(a, b, c) tmp = (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a); end
code[a_, b_, c_] := N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\end{array}
(FPCore (a b c)
:precision binary64
(if (<= b -7.2e+143)
(/ (/ (* -2.0 b) a) 3.0)
(if (<= b 3.4e-44)
(/
(fma
(sqrt (fma (* a c) -3.0 (* b b)))
-0.3333333333333333
(* 0.3333333333333333 b))
(- a))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -7.2e+143) {
tmp = ((-2.0 * b) / a) / 3.0;
} else if (b <= 3.4e-44) {
tmp = fma(sqrt(fma((a * c), -3.0, (b * b))), -0.3333333333333333, (0.3333333333333333 * b)) / -a;
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -7.2e+143) tmp = Float64(Float64(Float64(-2.0 * b) / a) / 3.0); elseif (b <= 3.4e-44) tmp = Float64(fma(sqrt(fma(Float64(a * c), -3.0, Float64(b * b))), -0.3333333333333333, Float64(0.3333333333333333 * b)) / Float64(-a)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -7.2e+143], N[(N[(N[(-2.0 * b), $MachinePrecision] / a), $MachinePrecision] / 3.0), $MachinePrecision], If[LessEqual[b, 3.4e-44], N[(N[(N[Sqrt[N[(N[(a * c), $MachinePrecision] * -3.0 + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * -0.3333333333333333 + N[(0.3333333333333333 * b), $MachinePrecision]), $MachinePrecision] / (-a)), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -7.2 \cdot 10^{+143}:\\
\;\;\;\;\frac{\frac{-2 \cdot b}{a}}{3}\\
\mathbf{elif}\;b \leq 3.4 \cdot 10^{-44}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)}, -0.3333333333333333, 0.3333333333333333 \cdot b\right)}{-a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -7.1999999999999998e143Initial program 52.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites52.0%
Taylor expanded in b around -inf
lower-*.f6434.7
Applied rewrites34.7%
if -7.1999999999999998e143 < b < 3.40000000000000016e-44Initial program 52.0%
Applied rewrites51.2%
Applied rewrites49.7%
if 3.40000000000000016e-44 < b Initial program 52.0%
Taylor expanded in b around inf
lower-*.f64N/A
lower-/.f6435.0
Applied rewrites35.0%
(FPCore (a b c)
:precision binary64
(if (<= b -2e+153)
(/ (/ (* -2.0 b) a) 3.0)
(if (<= b 3.4e-44)
(/ (/ (- (sqrt (fma (* c -3.0) a (* b b))) b) a) 3.0)
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2e+153) {
tmp = ((-2.0 * b) / a) / 3.0;
} else if (b <= 3.4e-44) {
tmp = ((sqrt(fma((c * -3.0), a, (b * b))) - b) / a) / 3.0;
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -2e+153) tmp = Float64(Float64(Float64(-2.0 * b) / a) / 3.0); elseif (b <= 3.4e-44) tmp = Float64(Float64(Float64(sqrt(fma(Float64(c * -3.0), a, Float64(b * b))) - b) / a) / 3.0); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -2e+153], N[(N[(N[(-2.0 * b), $MachinePrecision] / a), $MachinePrecision] / 3.0), $MachinePrecision], If[LessEqual[b, 3.4e-44], N[(N[(N[(N[Sqrt[N[(N[(c * -3.0), $MachinePrecision] * a + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / a), $MachinePrecision] / 3.0), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2 \cdot 10^{+153}:\\
\;\;\;\;\frac{\frac{-2 \cdot b}{a}}{3}\\
\mathbf{elif}\;b \leq 3.4 \cdot 10^{-44}:\\
\;\;\;\;\frac{\frac{\sqrt{\mathsf{fma}\left(c \cdot -3, a, b \cdot b\right)} - b}{a}}{3}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -2e153Initial program 52.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites52.0%
Taylor expanded in b around -inf
lower-*.f6434.7
Applied rewrites34.7%
if -2e153 < b < 3.40000000000000016e-44Initial program 52.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites52.0%
if 3.40000000000000016e-44 < b Initial program 52.0%
Taylor expanded in b around inf
lower-*.f64N/A
lower-/.f6435.0
Applied rewrites35.0%
(FPCore (a b c)
:precision binary64
(if (<= b -7.2e+143)
(/ (/ (* -2.0 b) a) 3.0)
(if (<= b 3.4e-44)
(/ (* (- b (sqrt (fma (* c -3.0) a (* b b)))) -0.3333333333333333) a)
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -7.2e+143) {
tmp = ((-2.0 * b) / a) / 3.0;
} else if (b <= 3.4e-44) {
tmp = ((b - sqrt(fma((c * -3.0), a, (b * b)))) * -0.3333333333333333) / a;
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -7.2e+143) tmp = Float64(Float64(Float64(-2.0 * b) / a) / 3.0); elseif (b <= 3.4e-44) tmp = Float64(Float64(Float64(b - sqrt(fma(Float64(c * -3.0), a, Float64(b * b)))) * -0.3333333333333333) / a); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -7.2e+143], N[(N[(N[(-2.0 * b), $MachinePrecision] / a), $MachinePrecision] / 3.0), $MachinePrecision], If[LessEqual[b, 3.4e-44], N[(N[(N[(b - N[Sqrt[N[(N[(c * -3.0), $MachinePrecision] * a + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * -0.3333333333333333), $MachinePrecision] / a), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -7.2 \cdot 10^{+143}:\\
\;\;\;\;\frac{\frac{-2 \cdot b}{a}}{3}\\
\mathbf{elif}\;b \leq 3.4 \cdot 10^{-44}:\\
\;\;\;\;\frac{\left(b - \sqrt{\mathsf{fma}\left(c \cdot -3, a, b \cdot b\right)}\right) \cdot -0.3333333333333333}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -7.1999999999999998e143Initial program 52.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites52.0%
Taylor expanded in b around -inf
lower-*.f6434.7
Applied rewrites34.7%
if -7.1999999999999998e143 < b < 3.40000000000000016e-44Initial program 52.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites52.0%
if 3.40000000000000016e-44 < b Initial program 52.0%
Taylor expanded in b around inf
lower-*.f64N/A
lower-/.f6435.0
Applied rewrites35.0%
(FPCore (a b c)
:precision binary64
(if (<= b -7.2e+143)
(/ (/ (* -2.0 b) a) 3.0)
(if (<= b 3.4e-44)
(* (/ (- (sqrt (fma (* c -3.0) a (* b b))) b) a) 0.3333333333333333)
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -7.2e+143) {
tmp = ((-2.0 * b) / a) / 3.0;
} else if (b <= 3.4e-44) {
tmp = ((sqrt(fma((c * -3.0), a, (b * b))) - b) / a) * 0.3333333333333333;
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -7.2e+143) tmp = Float64(Float64(Float64(-2.0 * b) / a) / 3.0); elseif (b <= 3.4e-44) tmp = Float64(Float64(Float64(sqrt(fma(Float64(c * -3.0), a, Float64(b * b))) - b) / a) * 0.3333333333333333); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -7.2e+143], N[(N[(N[(-2.0 * b), $MachinePrecision] / a), $MachinePrecision] / 3.0), $MachinePrecision], If[LessEqual[b, 3.4e-44], N[(N[(N[(N[Sqrt[N[(N[(c * -3.0), $MachinePrecision] * a + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / a), $MachinePrecision] * 0.3333333333333333), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -7.2 \cdot 10^{+143}:\\
\;\;\;\;\frac{\frac{-2 \cdot b}{a}}{3}\\
\mathbf{elif}\;b \leq 3.4 \cdot 10^{-44}:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(c \cdot -3, a, b \cdot b\right)} - b}{a} \cdot 0.3333333333333333\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -7.1999999999999998e143Initial program 52.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites52.0%
Taylor expanded in b around -inf
lower-*.f6434.7
Applied rewrites34.7%
if -7.1999999999999998e143 < b < 3.40000000000000016e-44Initial program 52.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
mult-flipN/A
lower-*.f64N/A
Applied rewrites51.9%
if 3.40000000000000016e-44 < b Initial program 52.0%
Taylor expanded in b around inf
lower-*.f64N/A
lower-/.f6435.0
Applied rewrites35.0%
(FPCore (a b c)
:precision binary64
(if (<= b -7.2e+143)
(/ (/ (* -2.0 b) a) 3.0)
(if (<= b 3.4e-44)
(* (- (sqrt (fma (* c -3.0) a (* b b))) b) (/ 0.3333333333333333 a))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -7.2e+143) {
tmp = ((-2.0 * b) / a) / 3.0;
} else if (b <= 3.4e-44) {
tmp = (sqrt(fma((c * -3.0), a, (b * b))) - b) * (0.3333333333333333 / a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -7.2e+143) tmp = Float64(Float64(Float64(-2.0 * b) / a) / 3.0); elseif (b <= 3.4e-44) tmp = Float64(Float64(sqrt(fma(Float64(c * -3.0), a, Float64(b * b))) - b) * Float64(0.3333333333333333 / a)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -7.2e+143], N[(N[(N[(-2.0 * b), $MachinePrecision] / a), $MachinePrecision] / 3.0), $MachinePrecision], If[LessEqual[b, 3.4e-44], N[(N[(N[Sqrt[N[(N[(c * -3.0), $MachinePrecision] * a + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] * N[(0.3333333333333333 / a), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -7.2 \cdot 10^{+143}:\\
\;\;\;\;\frac{\frac{-2 \cdot b}{a}}{3}\\
\mathbf{elif}\;b \leq 3.4 \cdot 10^{-44}:\\
\;\;\;\;\left(\sqrt{\mathsf{fma}\left(c \cdot -3, a, b \cdot b\right)} - b\right) \cdot \frac{0.3333333333333333}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -7.1999999999999998e143Initial program 52.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites52.0%
Taylor expanded in b around -inf
lower-*.f6434.7
Applied rewrites34.7%
if -7.1999999999999998e143 < b < 3.40000000000000016e-44Initial program 52.0%
lift-/.f64N/A
mult-flipN/A
lower-*.f64N/A
Applied rewrites52.0%
if 3.40000000000000016e-44 < b Initial program 52.0%
Taylor expanded in b around inf
lower-*.f64N/A
lower-/.f6435.0
Applied rewrites35.0%
(FPCore (a b c)
:precision binary64
(if (<= b -5.8e-168)
(/ (/ (* -2.0 b) a) 3.0)
(if (<= b 1.2e-44)
(/ (+ (- b) (sqrt (* -3.0 (* a c)))) (* 3.0 a))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -5.8e-168) {
tmp = ((-2.0 * b) / a) / 3.0;
} else if (b <= 1.2e-44) {
tmp = (-b + sqrt((-3.0 * (a * c)))) / (3.0 * a);
} else {
tmp = -0.5 * (c / b);
}
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(a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-5.8d-168)) then
tmp = (((-2.0d0) * b) / a) / 3.0d0
else if (b <= 1.2d-44) then
tmp = (-b + sqrt(((-3.0d0) * (a * c)))) / (3.0d0 * a)
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -5.8e-168) {
tmp = ((-2.0 * b) / a) / 3.0;
} else if (b <= 1.2e-44) {
tmp = (-b + Math.sqrt((-3.0 * (a * c)))) / (3.0 * a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5.8e-168: tmp = ((-2.0 * b) / a) / 3.0 elif b <= 1.2e-44: tmp = (-b + math.sqrt((-3.0 * (a * c)))) / (3.0 * a) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5.8e-168) tmp = Float64(Float64(Float64(-2.0 * b) / a) / 3.0); elseif (b <= 1.2e-44) tmp = Float64(Float64(Float64(-b) + sqrt(Float64(-3.0 * Float64(a * c)))) / Float64(3.0 * a)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5.8e-168) tmp = ((-2.0 * b) / a) / 3.0; elseif (b <= 1.2e-44) tmp = (-b + sqrt((-3.0 * (a * c)))) / (3.0 * a); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5.8e-168], N[(N[(N[(-2.0 * b), $MachinePrecision] / a), $MachinePrecision] / 3.0), $MachinePrecision], If[LessEqual[b, 1.2e-44], N[(N[((-b) + N[Sqrt[N[(-3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5.8 \cdot 10^{-168}:\\
\;\;\;\;\frac{\frac{-2 \cdot b}{a}}{3}\\
\mathbf{elif}\;b \leq 1.2 \cdot 10^{-44}:\\
\;\;\;\;\frac{\left(-b\right) + \sqrt{-3 \cdot \left(a \cdot c\right)}}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -5.7999999999999997e-168Initial program 52.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites52.0%
Taylor expanded in b around -inf
lower-*.f6434.7
Applied rewrites34.7%
if -5.7999999999999997e-168 < b < 1.20000000000000004e-44Initial program 52.0%
Taylor expanded in a around inf
lower-*.f64N/A
lower-*.f6433.4
Applied rewrites33.4%
if 1.20000000000000004e-44 < b Initial program 52.0%
Taylor expanded in b around inf
lower-*.f64N/A
lower-/.f6435.0
Applied rewrites35.0%
(FPCore (a b c)
:precision binary64
(if (<= b -5.8e-168)
(/ (/ (* -2.0 b) a) 3.0)
(if (<= b 1.2e-44)
(* (- (sqrt (* -3.0 (* a c))) b) (/ 0.3333333333333333 a))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -5.8e-168) {
tmp = ((-2.0 * b) / a) / 3.0;
} else if (b <= 1.2e-44) {
tmp = (sqrt((-3.0 * (a * c))) - b) * (0.3333333333333333 / a);
} else {
tmp = -0.5 * (c / b);
}
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(a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-5.8d-168)) then
tmp = (((-2.0d0) * b) / a) / 3.0d0
else if (b <= 1.2d-44) then
tmp = (sqrt(((-3.0d0) * (a * c))) - b) * (0.3333333333333333d0 / a)
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -5.8e-168) {
tmp = ((-2.0 * b) / a) / 3.0;
} else if (b <= 1.2e-44) {
tmp = (Math.sqrt((-3.0 * (a * c))) - b) * (0.3333333333333333 / a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5.8e-168: tmp = ((-2.0 * b) / a) / 3.0 elif b <= 1.2e-44: tmp = (math.sqrt((-3.0 * (a * c))) - b) * (0.3333333333333333 / a) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5.8e-168) tmp = Float64(Float64(Float64(-2.0 * b) / a) / 3.0); elseif (b <= 1.2e-44) tmp = Float64(Float64(sqrt(Float64(-3.0 * Float64(a * c))) - b) * Float64(0.3333333333333333 / a)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5.8e-168) tmp = ((-2.0 * b) / a) / 3.0; elseif (b <= 1.2e-44) tmp = (sqrt((-3.0 * (a * c))) - b) * (0.3333333333333333 / a); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5.8e-168], N[(N[(N[(-2.0 * b), $MachinePrecision] / a), $MachinePrecision] / 3.0), $MachinePrecision], If[LessEqual[b, 1.2e-44], N[(N[(N[Sqrt[N[(-3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] * N[(0.3333333333333333 / a), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5.8 \cdot 10^{-168}:\\
\;\;\;\;\frac{\frac{-2 \cdot b}{a}}{3}\\
\mathbf{elif}\;b \leq 1.2 \cdot 10^{-44}:\\
\;\;\;\;\left(\sqrt{-3 \cdot \left(a \cdot c\right)} - b\right) \cdot \frac{0.3333333333333333}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -5.7999999999999997e-168Initial program 52.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites52.0%
Taylor expanded in b around -inf
lower-*.f6434.7
Applied rewrites34.7%
if -5.7999999999999997e-168 < b < 1.20000000000000004e-44Initial program 52.0%
lift-/.f64N/A
mult-flipN/A
lower-*.f64N/A
Applied rewrites52.0%
Taylor expanded in a around inf
lower-*.f64N/A
lower-*.f6433.4
Applied rewrites33.4%
if 1.20000000000000004e-44 < b Initial program 52.0%
Taylor expanded in b around inf
lower-*.f64N/A
lower-/.f6435.0
Applied rewrites35.0%
(FPCore (a b c)
:precision binary64
(if (<= b -5.8e-168)
(/ (/ (* -2.0 b) a) 3.0)
(if (<= b 1.2e-44)
(* (/ (- (sqrt (* -3.0 (* a c))) b) a) 0.3333333333333333)
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -5.8e-168) {
tmp = ((-2.0 * b) / a) / 3.0;
} else if (b <= 1.2e-44) {
tmp = ((sqrt((-3.0 * (a * c))) - b) / a) * 0.3333333333333333;
} else {
tmp = -0.5 * (c / b);
}
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(a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-5.8d-168)) then
tmp = (((-2.0d0) * b) / a) / 3.0d0
else if (b <= 1.2d-44) then
tmp = ((sqrt(((-3.0d0) * (a * c))) - b) / a) * 0.3333333333333333d0
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -5.8e-168) {
tmp = ((-2.0 * b) / a) / 3.0;
} else if (b <= 1.2e-44) {
tmp = ((Math.sqrt((-3.0 * (a * c))) - b) / a) * 0.3333333333333333;
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5.8e-168: tmp = ((-2.0 * b) / a) / 3.0 elif b <= 1.2e-44: tmp = ((math.sqrt((-3.0 * (a * c))) - b) / a) * 0.3333333333333333 else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5.8e-168) tmp = Float64(Float64(Float64(-2.0 * b) / a) / 3.0); elseif (b <= 1.2e-44) tmp = Float64(Float64(Float64(sqrt(Float64(-3.0 * Float64(a * c))) - b) / a) * 0.3333333333333333); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5.8e-168) tmp = ((-2.0 * b) / a) / 3.0; elseif (b <= 1.2e-44) tmp = ((sqrt((-3.0 * (a * c))) - b) / a) * 0.3333333333333333; else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5.8e-168], N[(N[(N[(-2.0 * b), $MachinePrecision] / a), $MachinePrecision] / 3.0), $MachinePrecision], If[LessEqual[b, 1.2e-44], N[(N[(N[(N[Sqrt[N[(-3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / a), $MachinePrecision] * 0.3333333333333333), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5.8 \cdot 10^{-168}:\\
\;\;\;\;\frac{\frac{-2 \cdot b}{a}}{3}\\
\mathbf{elif}\;b \leq 1.2 \cdot 10^{-44}:\\
\;\;\;\;\frac{\sqrt{-3 \cdot \left(a \cdot c\right)} - b}{a} \cdot 0.3333333333333333\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -5.7999999999999997e-168Initial program 52.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites52.0%
Taylor expanded in b around -inf
lower-*.f6434.7
Applied rewrites34.7%
if -5.7999999999999997e-168 < b < 1.20000000000000004e-44Initial program 52.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
mult-flipN/A
lower-*.f64N/A
Applied rewrites51.9%
Taylor expanded in a around inf
lower-*.f64N/A
lower-*.f6433.4
Applied rewrites33.4%
if 1.20000000000000004e-44 < b Initial program 52.0%
Taylor expanded in b around inf
lower-*.f64N/A
lower-/.f6435.0
Applied rewrites35.0%
(FPCore (a b c) :precision binary64 (if (<= b -6.8e-171) (/ (/ (* -2.0 b) a) 3.0) (if (<= b 1.2e-44) (/ (/ (sqrt (* (* a c) -3.0)) a) 3.0) (* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -6.8e-171) {
tmp = ((-2.0 * b) / a) / 3.0;
} else if (b <= 1.2e-44) {
tmp = (sqrt(((a * c) * -3.0)) / a) / 3.0;
} else {
tmp = -0.5 * (c / b);
}
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(a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-6.8d-171)) then
tmp = (((-2.0d0) * b) / a) / 3.0d0
else if (b <= 1.2d-44) then
tmp = (sqrt(((a * c) * (-3.0d0))) / a) / 3.0d0
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -6.8e-171) {
tmp = ((-2.0 * b) / a) / 3.0;
} else if (b <= 1.2e-44) {
tmp = (Math.sqrt(((a * c) * -3.0)) / a) / 3.0;
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -6.8e-171: tmp = ((-2.0 * b) / a) / 3.0 elif b <= 1.2e-44: tmp = (math.sqrt(((a * c) * -3.0)) / a) / 3.0 else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -6.8e-171) tmp = Float64(Float64(Float64(-2.0 * b) / a) / 3.0); elseif (b <= 1.2e-44) tmp = Float64(Float64(sqrt(Float64(Float64(a * c) * -3.0)) / a) / 3.0); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -6.8e-171) tmp = ((-2.0 * b) / a) / 3.0; elseif (b <= 1.2e-44) tmp = (sqrt(((a * c) * -3.0)) / a) / 3.0; else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -6.8e-171], N[(N[(N[(-2.0 * b), $MachinePrecision] / a), $MachinePrecision] / 3.0), $MachinePrecision], If[LessEqual[b, 1.2e-44], N[(N[(N[Sqrt[N[(N[(a * c), $MachinePrecision] * -3.0), $MachinePrecision]], $MachinePrecision] / a), $MachinePrecision] / 3.0), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -6.8 \cdot 10^{-171}:\\
\;\;\;\;\frac{\frac{-2 \cdot b}{a}}{3}\\
\mathbf{elif}\;b \leq 1.2 \cdot 10^{-44}:\\
\;\;\;\;\frac{\frac{\sqrt{\left(a \cdot c\right) \cdot -3}}{a}}{3}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -6.7999999999999997e-171Initial program 52.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites52.0%
Taylor expanded in b around -inf
lower-*.f6434.7
Applied rewrites34.7%
if -6.7999999999999997e-171 < b < 1.20000000000000004e-44Initial program 52.0%
Taylor expanded in b around 0
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-*.f6429.4
Applied rewrites29.4%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites29.4%
if 1.20000000000000004e-44 < b Initial program 52.0%
Taylor expanded in b around inf
lower-*.f64N/A
lower-/.f6435.0
Applied rewrites35.0%
(FPCore (a b c) :precision binary64 (if (<= b -6.8e-171) (/ (/ (* -2.0 b) a) 3.0) (if (<= b 1.2e-44) (/ (sqrt (* (* a -3.0) c)) (* 3.0 a)) (* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -6.8e-171) {
tmp = ((-2.0 * b) / a) / 3.0;
} else if (b <= 1.2e-44) {
tmp = sqrt(((a * -3.0) * c)) / (3.0 * a);
} else {
tmp = -0.5 * (c / b);
}
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(a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-6.8d-171)) then
tmp = (((-2.0d0) * b) / a) / 3.0d0
else if (b <= 1.2d-44) then
tmp = sqrt(((a * (-3.0d0)) * c)) / (3.0d0 * a)
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -6.8e-171) {
tmp = ((-2.0 * b) / a) / 3.0;
} else if (b <= 1.2e-44) {
tmp = Math.sqrt(((a * -3.0) * c)) / (3.0 * a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -6.8e-171: tmp = ((-2.0 * b) / a) / 3.0 elif b <= 1.2e-44: tmp = math.sqrt(((a * -3.0) * c)) / (3.0 * a) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -6.8e-171) tmp = Float64(Float64(Float64(-2.0 * b) / a) / 3.0); elseif (b <= 1.2e-44) tmp = Float64(sqrt(Float64(Float64(a * -3.0) * c)) / Float64(3.0 * a)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -6.8e-171) tmp = ((-2.0 * b) / a) / 3.0; elseif (b <= 1.2e-44) tmp = sqrt(((a * -3.0) * c)) / (3.0 * a); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -6.8e-171], N[(N[(N[(-2.0 * b), $MachinePrecision] / a), $MachinePrecision] / 3.0), $MachinePrecision], If[LessEqual[b, 1.2e-44], N[(N[Sqrt[N[(N[(a * -3.0), $MachinePrecision] * c), $MachinePrecision]], $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -6.8 \cdot 10^{-171}:\\
\;\;\;\;\frac{\frac{-2 \cdot b}{a}}{3}\\
\mathbf{elif}\;b \leq 1.2 \cdot 10^{-44}:\\
\;\;\;\;\frac{\sqrt{\left(a \cdot -3\right) \cdot c}}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -6.7999999999999997e-171Initial program 52.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites52.0%
Taylor expanded in b around -inf
lower-*.f6434.7
Applied rewrites34.7%
if -6.7999999999999997e-171 < b < 1.20000000000000004e-44Initial program 52.0%
Taylor expanded in b around 0
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-*.f6429.4
Applied rewrites29.4%
lift-neg.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
distribute-lft-neg-outN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
lower-*.f6429.4
Applied rewrites29.4%
if 1.20000000000000004e-44 < b Initial program 52.0%
Taylor expanded in b around inf
lower-*.f64N/A
lower-/.f6435.0
Applied rewrites35.0%
(FPCore (a b c)
:precision binary64
(if (<= b -6.8e-171)
(/ (/ (* -2.0 b) a) 3.0)
(if (<= b 1.2e-44)
(* (/ 0.3333333333333333 a) (sqrt (* (* a c) -3.0)))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -6.8e-171) {
tmp = ((-2.0 * b) / a) / 3.0;
} else if (b <= 1.2e-44) {
tmp = (0.3333333333333333 / a) * sqrt(((a * c) * -3.0));
} else {
tmp = -0.5 * (c / b);
}
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(a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-6.8d-171)) then
tmp = (((-2.0d0) * b) / a) / 3.0d0
else if (b <= 1.2d-44) then
tmp = (0.3333333333333333d0 / a) * sqrt(((a * c) * (-3.0d0)))
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -6.8e-171) {
tmp = ((-2.0 * b) / a) / 3.0;
} else if (b <= 1.2e-44) {
tmp = (0.3333333333333333 / a) * Math.sqrt(((a * c) * -3.0));
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -6.8e-171: tmp = ((-2.0 * b) / a) / 3.0 elif b <= 1.2e-44: tmp = (0.3333333333333333 / a) * math.sqrt(((a * c) * -3.0)) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -6.8e-171) tmp = Float64(Float64(Float64(-2.0 * b) / a) / 3.0); elseif (b <= 1.2e-44) tmp = Float64(Float64(0.3333333333333333 / a) * sqrt(Float64(Float64(a * c) * -3.0))); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -6.8e-171) tmp = ((-2.0 * b) / a) / 3.0; elseif (b <= 1.2e-44) tmp = (0.3333333333333333 / a) * sqrt(((a * c) * -3.0)); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -6.8e-171], N[(N[(N[(-2.0 * b), $MachinePrecision] / a), $MachinePrecision] / 3.0), $MachinePrecision], If[LessEqual[b, 1.2e-44], N[(N[(0.3333333333333333 / a), $MachinePrecision] * N[Sqrt[N[(N[(a * c), $MachinePrecision] * -3.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -6.8 \cdot 10^{-171}:\\
\;\;\;\;\frac{\frac{-2 \cdot b}{a}}{3}\\
\mathbf{elif}\;b \leq 1.2 \cdot 10^{-44}:\\
\;\;\;\;\frac{0.3333333333333333}{a} \cdot \sqrt{\left(a \cdot c\right) \cdot -3}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -6.7999999999999997e-171Initial program 52.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites52.0%
Taylor expanded in b around -inf
lower-*.f6434.7
Applied rewrites34.7%
if -6.7999999999999997e-171 < b < 1.20000000000000004e-44Initial program 52.0%
Taylor expanded in b around 0
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-*.f6429.4
Applied rewrites29.4%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
metadata-evalN/A
lower-/.f6429.4
lift-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
lower-*.f6429.4
Applied rewrites29.4%
if 1.20000000000000004e-44 < b Initial program 52.0%
Taylor expanded in b around inf
lower-*.f64N/A
lower-/.f6435.0
Applied rewrites35.0%
(FPCore (a b c)
:precision binary64
(if (<= b -6.8e-171)
(/ (/ (* -2.0 b) a) 3.0)
(if (<= b 1.2e-44)
(* c (* -0.3333333333333333 (sqrt (/ -3.0 (* a c)))))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -6.8e-171) {
tmp = ((-2.0 * b) / a) / 3.0;
} else if (b <= 1.2e-44) {
tmp = c * (-0.3333333333333333 * sqrt((-3.0 / (a * c))));
} else {
tmp = -0.5 * (c / b);
}
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(a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-6.8d-171)) then
tmp = (((-2.0d0) * b) / a) / 3.0d0
else if (b <= 1.2d-44) then
tmp = c * ((-0.3333333333333333d0) * sqrt(((-3.0d0) / (a * c))))
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -6.8e-171) {
tmp = ((-2.0 * b) / a) / 3.0;
} else if (b <= 1.2e-44) {
tmp = c * (-0.3333333333333333 * Math.sqrt((-3.0 / (a * c))));
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -6.8e-171: tmp = ((-2.0 * b) / a) / 3.0 elif b <= 1.2e-44: tmp = c * (-0.3333333333333333 * math.sqrt((-3.0 / (a * c)))) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -6.8e-171) tmp = Float64(Float64(Float64(-2.0 * b) / a) / 3.0); elseif (b <= 1.2e-44) tmp = Float64(c * Float64(-0.3333333333333333 * sqrt(Float64(-3.0 / Float64(a * c))))); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -6.8e-171) tmp = ((-2.0 * b) / a) / 3.0; elseif (b <= 1.2e-44) tmp = c * (-0.3333333333333333 * sqrt((-3.0 / (a * c)))); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -6.8e-171], N[(N[(N[(-2.0 * b), $MachinePrecision] / a), $MachinePrecision] / 3.0), $MachinePrecision], If[LessEqual[b, 1.2e-44], N[(c * N[(-0.3333333333333333 * N[Sqrt[N[(-3.0 / N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -6.8 \cdot 10^{-171}:\\
\;\;\;\;\frac{\frac{-2 \cdot b}{a}}{3}\\
\mathbf{elif}\;b \leq 1.2 \cdot 10^{-44}:\\
\;\;\;\;c \cdot \left(-0.3333333333333333 \cdot \sqrt{\frac{-3}{a \cdot c}}\right)\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -6.7999999999999997e-171Initial program 52.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites52.0%
Taylor expanded in b around -inf
lower-*.f6434.7
Applied rewrites34.7%
if -6.7999999999999997e-171 < b < 1.20000000000000004e-44Initial program 52.0%
Taylor expanded in c around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f6419.8
Applied rewrites19.8%
Taylor expanded in a around -inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6427.8
Applied rewrites27.8%
if 1.20000000000000004e-44 < b Initial program 52.0%
Taylor expanded in b around inf
lower-*.f64N/A
lower-/.f6435.0
Applied rewrites35.0%
(FPCore (a b c)
:precision binary64
(if (<= b -6.5e-211)
(/ (/ (* -2.0 b) a) 3.0)
(if (<= b 1e-54)
(* -0.3333333333333333 (/ (sqrt (* c 3.0)) (sqrt (- a))))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -6.5e-211) {
tmp = ((-2.0 * b) / a) / 3.0;
} else if (b <= 1e-54) {
tmp = -0.3333333333333333 * (sqrt((c * 3.0)) / sqrt(-a));
} else {
tmp = -0.5 * (c / b);
}
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(a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-6.5d-211)) then
tmp = (((-2.0d0) * b) / a) / 3.0d0
else if (b <= 1d-54) then
tmp = (-0.3333333333333333d0) * (sqrt((c * 3.0d0)) / sqrt(-a))
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -6.5e-211) {
tmp = ((-2.0 * b) / a) / 3.0;
} else if (b <= 1e-54) {
tmp = -0.3333333333333333 * (Math.sqrt((c * 3.0)) / Math.sqrt(-a));
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -6.5e-211: tmp = ((-2.0 * b) / a) / 3.0 elif b <= 1e-54: tmp = -0.3333333333333333 * (math.sqrt((c * 3.0)) / math.sqrt(-a)) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -6.5e-211) tmp = Float64(Float64(Float64(-2.0 * b) / a) / 3.0); elseif (b <= 1e-54) tmp = Float64(-0.3333333333333333 * Float64(sqrt(Float64(c * 3.0)) / sqrt(Float64(-a)))); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -6.5e-211) tmp = ((-2.0 * b) / a) / 3.0; elseif (b <= 1e-54) tmp = -0.3333333333333333 * (sqrt((c * 3.0)) / sqrt(-a)); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -6.5e-211], N[(N[(N[(-2.0 * b), $MachinePrecision] / a), $MachinePrecision] / 3.0), $MachinePrecision], If[LessEqual[b, 1e-54], N[(-0.3333333333333333 * N[(N[Sqrt[N[(c * 3.0), $MachinePrecision]], $MachinePrecision] / N[Sqrt[(-a)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -6.5 \cdot 10^{-211}:\\
\;\;\;\;\frac{\frac{-2 \cdot b}{a}}{3}\\
\mathbf{elif}\;b \leq 10^{-54}:\\
\;\;\;\;-0.3333333333333333 \cdot \frac{\sqrt{c \cdot 3}}{\sqrt{-a}}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -6.4999999999999996e-211Initial program 52.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites52.0%
Taylor expanded in b around -inf
lower-*.f6434.7
Applied rewrites34.7%
if -6.4999999999999996e-211 < b < 1e-54Initial program 52.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites52.0%
Taylor expanded in a around -inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f6417.3
Applied rewrites17.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
lift-*.f64N/A
lower-/.f6417.3
lift-*.f64N/A
*-commutativeN/A
lift-*.f6417.3
Applied rewrites17.3%
lift-sqrt.f64N/A
lift-/.f64N/A
frac-2negN/A
lift-neg.f64N/A
sqrt-divN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-unsound-sqrt.f6417.5
Applied rewrites17.5%
if 1e-54 < b Initial program 52.0%
Taylor expanded in b around inf
lower-*.f64N/A
lower-/.f6435.0
Applied rewrites35.0%
(FPCore (a b c)
:precision binary64
(if (<= b -6.5e-211)
(/ (/ (* -2.0 b) a) 3.0)
(if (<= b 1e-54)
(* -0.3333333333333333 (* (sqrt c) (sqrt (/ -3.0 a))))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -6.5e-211) {
tmp = ((-2.0 * b) / a) / 3.0;
} else if (b <= 1e-54) {
tmp = -0.3333333333333333 * (sqrt(c) * sqrt((-3.0 / a)));
} else {
tmp = -0.5 * (c / b);
}
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(a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-6.5d-211)) then
tmp = (((-2.0d0) * b) / a) / 3.0d0
else if (b <= 1d-54) then
tmp = (-0.3333333333333333d0) * (sqrt(c) * sqrt(((-3.0d0) / a)))
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -6.5e-211) {
tmp = ((-2.0 * b) / a) / 3.0;
} else if (b <= 1e-54) {
tmp = -0.3333333333333333 * (Math.sqrt(c) * Math.sqrt((-3.0 / a)));
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -6.5e-211: tmp = ((-2.0 * b) / a) / 3.0 elif b <= 1e-54: tmp = -0.3333333333333333 * (math.sqrt(c) * math.sqrt((-3.0 / a))) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -6.5e-211) tmp = Float64(Float64(Float64(-2.0 * b) / a) / 3.0); elseif (b <= 1e-54) tmp = Float64(-0.3333333333333333 * Float64(sqrt(c) * sqrt(Float64(-3.0 / a)))); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -6.5e-211) tmp = ((-2.0 * b) / a) / 3.0; elseif (b <= 1e-54) tmp = -0.3333333333333333 * (sqrt(c) * sqrt((-3.0 / a))); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -6.5e-211], N[(N[(N[(-2.0 * b), $MachinePrecision] / a), $MachinePrecision] / 3.0), $MachinePrecision], If[LessEqual[b, 1e-54], N[(-0.3333333333333333 * N[(N[Sqrt[c], $MachinePrecision] * N[Sqrt[N[(-3.0 / a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -6.5 \cdot 10^{-211}:\\
\;\;\;\;\frac{\frac{-2 \cdot b}{a}}{3}\\
\mathbf{elif}\;b \leq 10^{-54}:\\
\;\;\;\;-0.3333333333333333 \cdot \left(\sqrt{c} \cdot \sqrt{\frac{-3}{a}}\right)\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -6.4999999999999996e-211Initial program 52.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites52.0%
Taylor expanded in b around -inf
lower-*.f6434.7
Applied rewrites34.7%
if -6.4999999999999996e-211 < b < 1e-54Initial program 52.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites52.0%
Taylor expanded in a around -inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f6417.3
Applied rewrites17.3%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
sqrt-prodN/A
lower-unsound-*.f64N/A
lower-unsound-sqrt.f64N/A
lower-unsound-sqrt.f64N/A
lower-/.f6417.5
Applied rewrites17.5%
if 1e-54 < b Initial program 52.0%
Taylor expanded in b around inf
lower-*.f64N/A
lower-/.f6435.0
Applied rewrites35.0%
(FPCore (a b c) :precision binary64 (if (<= b -1.15e-125) (/ (/ (* -2.0 b) a) 3.0) (if (<= b 3.8e-129) (/ (sqrt (* -3.0 (/ c a))) 3.0) (* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.15e-125) {
tmp = ((-2.0 * b) / a) / 3.0;
} else if (b <= 3.8e-129) {
tmp = sqrt((-3.0 * (c / a))) / 3.0;
} else {
tmp = -0.5 * (c / b);
}
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(a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-1.15d-125)) then
tmp = (((-2.0d0) * b) / a) / 3.0d0
else if (b <= 3.8d-129) then
tmp = sqrt(((-3.0d0) * (c / a))) / 3.0d0
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1.15e-125) {
tmp = ((-2.0 * b) / a) / 3.0;
} else if (b <= 3.8e-129) {
tmp = Math.sqrt((-3.0 * (c / a))) / 3.0;
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.15e-125: tmp = ((-2.0 * b) / a) / 3.0 elif b <= 3.8e-129: tmp = math.sqrt((-3.0 * (c / a))) / 3.0 else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.15e-125) tmp = Float64(Float64(Float64(-2.0 * b) / a) / 3.0); elseif (b <= 3.8e-129) tmp = Float64(sqrt(Float64(-3.0 * Float64(c / a))) / 3.0); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.15e-125) tmp = ((-2.0 * b) / a) / 3.0; elseif (b <= 3.8e-129) tmp = sqrt((-3.0 * (c / a))) / 3.0; else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.15e-125], N[(N[(N[(-2.0 * b), $MachinePrecision] / a), $MachinePrecision] / 3.0), $MachinePrecision], If[LessEqual[b, 3.8e-129], N[(N[Sqrt[N[(-3.0 * N[(c / a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / 3.0), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.15 \cdot 10^{-125}:\\
\;\;\;\;\frac{\frac{-2 \cdot b}{a}}{3}\\
\mathbf{elif}\;b \leq 3.8 \cdot 10^{-129}:\\
\;\;\;\;\frac{\sqrt{-3 \cdot \frac{c}{a}}}{3}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -1.15e-125Initial program 52.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites52.0%
Taylor expanded in b around -inf
lower-*.f6434.7
Applied rewrites34.7%
if -1.15e-125 < b < 3.79999999999999985e-129Initial program 52.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites52.0%
Taylor expanded in a around inf
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f6417.7
Applied rewrites17.7%
if 3.79999999999999985e-129 < b Initial program 52.0%
Taylor expanded in b around inf
lower-*.f64N/A
lower-/.f6435.0
Applied rewrites35.0%
(FPCore (a b c)
:precision binary64
(if (<= b -1.15e-125)
(/ (/ (* -2.0 b) a) 3.0)
(if (<= b 3.8e-129)
(* 0.3333333333333333 (sqrt (* -3.0 (/ c a))))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.15e-125) {
tmp = ((-2.0 * b) / a) / 3.0;
} else if (b <= 3.8e-129) {
tmp = 0.3333333333333333 * sqrt((-3.0 * (c / a)));
} else {
tmp = -0.5 * (c / b);
}
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(a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-1.15d-125)) then
tmp = (((-2.0d0) * b) / a) / 3.0d0
else if (b <= 3.8d-129) then
tmp = 0.3333333333333333d0 * sqrt(((-3.0d0) * (c / a)))
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1.15e-125) {
tmp = ((-2.0 * b) / a) / 3.0;
} else if (b <= 3.8e-129) {
tmp = 0.3333333333333333 * Math.sqrt((-3.0 * (c / a)));
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.15e-125: tmp = ((-2.0 * b) / a) / 3.0 elif b <= 3.8e-129: tmp = 0.3333333333333333 * math.sqrt((-3.0 * (c / a))) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.15e-125) tmp = Float64(Float64(Float64(-2.0 * b) / a) / 3.0); elseif (b <= 3.8e-129) tmp = Float64(0.3333333333333333 * sqrt(Float64(-3.0 * Float64(c / a)))); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.15e-125) tmp = ((-2.0 * b) / a) / 3.0; elseif (b <= 3.8e-129) tmp = 0.3333333333333333 * sqrt((-3.0 * (c / a))); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.15e-125], N[(N[(N[(-2.0 * b), $MachinePrecision] / a), $MachinePrecision] / 3.0), $MachinePrecision], If[LessEqual[b, 3.8e-129], N[(0.3333333333333333 * N[Sqrt[N[(-3.0 * N[(c / a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.15 \cdot 10^{-125}:\\
\;\;\;\;\frac{\frac{-2 \cdot b}{a}}{3}\\
\mathbf{elif}\;b \leq 3.8 \cdot 10^{-129}:\\
\;\;\;\;0.3333333333333333 \cdot \sqrt{-3 \cdot \frac{c}{a}}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -1.15e-125Initial program 52.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites52.0%
Taylor expanded in b around -inf
lower-*.f6434.7
Applied rewrites34.7%
if -1.15e-125 < b < 3.79999999999999985e-129Initial program 52.0%
Taylor expanded in a around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f6417.7
Applied rewrites17.7%
if 3.79999999999999985e-129 < b Initial program 52.0%
Taylor expanded in b around inf
lower-*.f64N/A
lower-/.f6435.0
Applied rewrites35.0%
(FPCore (a b c)
:precision binary64
(if (<= b -8.9e-216)
(/ (/ (* -2.0 b) a) 3.0)
(if (<= b 1.9e-168)
(* -0.3333333333333333 (sqrt (* -3.0 (/ c a))))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -8.9e-216) {
tmp = ((-2.0 * b) / a) / 3.0;
} else if (b <= 1.9e-168) {
tmp = -0.3333333333333333 * sqrt((-3.0 * (c / a)));
} else {
tmp = -0.5 * (c / b);
}
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(a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-8.9d-216)) then
tmp = (((-2.0d0) * b) / a) / 3.0d0
else if (b <= 1.9d-168) then
tmp = (-0.3333333333333333d0) * sqrt(((-3.0d0) * (c / a)))
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -8.9e-216) {
tmp = ((-2.0 * b) / a) / 3.0;
} else if (b <= 1.9e-168) {
tmp = -0.3333333333333333 * Math.sqrt((-3.0 * (c / a)));
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -8.9e-216: tmp = ((-2.0 * b) / a) / 3.0 elif b <= 1.9e-168: tmp = -0.3333333333333333 * math.sqrt((-3.0 * (c / a))) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -8.9e-216) tmp = Float64(Float64(Float64(-2.0 * b) / a) / 3.0); elseif (b <= 1.9e-168) tmp = Float64(-0.3333333333333333 * sqrt(Float64(-3.0 * Float64(c / a)))); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -8.9e-216) tmp = ((-2.0 * b) / a) / 3.0; elseif (b <= 1.9e-168) tmp = -0.3333333333333333 * sqrt((-3.0 * (c / a))); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -8.9e-216], N[(N[(N[(-2.0 * b), $MachinePrecision] / a), $MachinePrecision] / 3.0), $MachinePrecision], If[LessEqual[b, 1.9e-168], N[(-0.3333333333333333 * N[Sqrt[N[(-3.0 * N[(c / a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -8.9 \cdot 10^{-216}:\\
\;\;\;\;\frac{\frac{-2 \cdot b}{a}}{3}\\
\mathbf{elif}\;b \leq 1.9 \cdot 10^{-168}:\\
\;\;\;\;-0.3333333333333333 \cdot \sqrt{-3 \cdot \frac{c}{a}}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -8.90000000000000031e-216Initial program 52.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites52.0%
Taylor expanded in b around -inf
lower-*.f6434.7
Applied rewrites34.7%
if -8.90000000000000031e-216 < b < 1.9e-168Initial program 52.0%
Taylor expanded in a around -inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f6417.3
Applied rewrites17.3%
if 1.9e-168 < b Initial program 52.0%
Taylor expanded in b around inf
lower-*.f64N/A
lower-/.f6435.0
Applied rewrites35.0%
(FPCore (a b c) :precision binary64 (if (<= b 3e-297) (/ (/ (* -2.0 b) a) 3.0) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 3e-297) {
tmp = ((-2.0 * b) / a) / 3.0;
} else {
tmp = -0.5 * (c / b);
}
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(a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= 3d-297) then
tmp = (((-2.0d0) * b) / a) / 3.0d0
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 3e-297) {
tmp = ((-2.0 * b) / a) / 3.0;
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 3e-297: tmp = ((-2.0 * b) / a) / 3.0 else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 3e-297) tmp = Float64(Float64(Float64(-2.0 * b) / a) / 3.0); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 3e-297) tmp = ((-2.0 * b) / a) / 3.0; else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 3e-297], N[(N[(N[(-2.0 * b), $MachinePrecision] / a), $MachinePrecision] / 3.0), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 3 \cdot 10^{-297}:\\
\;\;\;\;\frac{\frac{-2 \cdot b}{a}}{3}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < 2.99999999999999995e-297Initial program 52.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites52.0%
Taylor expanded in b around -inf
lower-*.f6434.7
Applied rewrites34.7%
if 2.99999999999999995e-297 < b Initial program 52.0%
Taylor expanded in b around inf
lower-*.f64N/A
lower-/.f6435.0
Applied rewrites35.0%
(FPCore (a b c) :precision binary64 (if (<= b 3e-297) (/ (* -2.0 b) (* 3.0 a)) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 3e-297) {
tmp = (-2.0 * b) / (3.0 * a);
} else {
tmp = -0.5 * (c / b);
}
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(a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= 3d-297) then
tmp = ((-2.0d0) * b) / (3.0d0 * a)
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 3e-297) {
tmp = (-2.0 * b) / (3.0 * a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 3e-297: tmp = (-2.0 * b) / (3.0 * a) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 3e-297) tmp = Float64(Float64(-2.0 * b) / Float64(3.0 * a)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 3e-297) tmp = (-2.0 * b) / (3.0 * a); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 3e-297], N[(N[(-2.0 * b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 3 \cdot 10^{-297}:\\
\;\;\;\;\frac{-2 \cdot b}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < 2.99999999999999995e-297Initial program 52.0%
Taylor expanded in b around -inf
lower-*.f6434.8
Applied rewrites34.8%
if 2.99999999999999995e-297 < b Initial program 52.0%
Taylor expanded in b around inf
lower-*.f64N/A
lower-/.f6435.0
Applied rewrites35.0%
(FPCore (a b c) :precision binary64 (if (<= b 3e-297) (* -0.6666666666666666 (/ b a)) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 3e-297) {
tmp = -0.6666666666666666 * (b / a);
} else {
tmp = -0.5 * (c / b);
}
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(a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= 3d-297) then
tmp = (-0.6666666666666666d0) * (b / a)
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 3e-297) {
tmp = -0.6666666666666666 * (b / a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 3e-297: tmp = -0.6666666666666666 * (b / a) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 3e-297) tmp = Float64(-0.6666666666666666 * Float64(b / a)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 3e-297) tmp = -0.6666666666666666 * (b / a); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 3e-297], N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 3 \cdot 10^{-297}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < 2.99999999999999995e-297Initial program 52.0%
Taylor expanded in b around -inf
lower-*.f64N/A
lower-/.f6434.7
Applied rewrites34.7%
if 2.99999999999999995e-297 < b Initial program 52.0%
Taylor expanded in b around inf
lower-*.f64N/A
lower-/.f6435.0
Applied rewrites35.0%
(FPCore (a b c) :precision binary64 (* -0.6666666666666666 (/ b a)))
double code(double a, double b, double c) {
return -0.6666666666666666 * (b / a);
}
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(a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = (-0.6666666666666666d0) * (b / a)
end function
public static double code(double a, double b, double c) {
return -0.6666666666666666 * (b / a);
}
def code(a, b, c): return -0.6666666666666666 * (b / a)
function code(a, b, c) return Float64(-0.6666666666666666 * Float64(b / a)) end
function tmp = code(a, b, c) tmp = -0.6666666666666666 * (b / a); end
code[a_, b_, c_] := N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-0.6666666666666666 \cdot \frac{b}{a}
\end{array}
Initial program 52.0%
Taylor expanded in b around -inf
lower-*.f64N/A
lower-/.f6434.7
Applied rewrites34.7%
(FPCore (a b c) :precision binary64 (* -0.3333333333333333 (/ b a)))
double code(double a, double b, double c) {
return -0.3333333333333333 * (b / a);
}
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(a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = (-0.3333333333333333d0) * (b / a)
end function
public static double code(double a, double b, double c) {
return -0.3333333333333333 * (b / a);
}
def code(a, b, c): return -0.3333333333333333 * (b / a)
function code(a, b, c) return Float64(-0.3333333333333333 * Float64(b / a)) end
function tmp = code(a, b, c) tmp = -0.3333333333333333 * (b / a); end
code[a_, b_, c_] := N[(-0.3333333333333333 * N[(b / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-0.3333333333333333 \cdot \frac{b}{a}
\end{array}
Initial program 52.0%
Taylor expanded in c around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f6419.8
Applied rewrites19.8%
Taylor expanded in b around inf
lower-*.f64N/A
lower-/.f6415.2
Applied rewrites15.2%
herbie shell --seed 2025159
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))