
(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 21 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.9e+49)
(/ (fma 0.5 (* (/ c b) a) (* -0.6666666666666666 b)) a)
(if (<= b 7.2e-112)
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a))
(/ (* -0.5 c) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -7.9e+49) {
tmp = fma(0.5, ((c / b) * a), (-0.6666666666666666 * b)) / a;
} else if (b <= 7.2e-112) {
tmp = (-b + sqrt(((b * b) - ((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 <= -7.9e+49) tmp = Float64(fma(0.5, Float64(Float64(c / b) * a), Float64(-0.6666666666666666 * b)) / a); elseif (b <= 7.2e-112) tmp = Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c)))) / Float64(3.0 * a)); else tmp = Float64(Float64(-0.5 * c) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -7.9e+49], N[(N[(0.5 * N[(N[(c / b), $MachinePrecision] * a), $MachinePrecision] + N[(-0.6666666666666666 * b), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 7.2e-112], 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], N[(N[(-0.5 * c), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -7.9 \cdot 10^{+49}:\\
\;\;\;\;\frac{\mathsf{fma}\left(0.5, \frac{c}{b} \cdot a, -0.6666666666666666 \cdot b\right)}{a}\\
\mathbf{elif}\;b \leq 7.2 \cdot 10^{-112}:\\
\;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b}\\
\end{array}
\end{array}
if b < -7.9000000000000004e49Initial program 59.7%
Taylor expanded in b around -inf
associate-*r*N/A
mul-1-negN/A
lift-neg.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6493.7
Applied rewrites93.7%
Taylor expanded in a around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f6493.7
Applied rewrites93.7%
if -7.9000000000000004e49 < b < 7.2000000000000002e-112Initial program 80.8%
if 7.2000000000000002e-112 < b Initial program 21.3%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6481.8
Applied rewrites81.8%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6481.8
Applied rewrites81.8%
(FPCore (a b c)
:precision binary64
(if (<= b -7.9e+49)
(/ (fma 0.5 (* (/ c b) a) (* -0.6666666666666666 b)) a)
(if (<= b 7.2e-112)
(/ (+ (sqrt (fma (* -3.0 a) c (* b b))) (- b)) (* a 3.0))
(/ (* -0.5 c) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -7.9e+49) {
tmp = fma(0.5, ((c / b) * a), (-0.6666666666666666 * b)) / a;
} else if (b <= 7.2e-112) {
tmp = (sqrt(fma((-3.0 * a), c, (b * b))) + -b) / (a * 3.0);
} else {
tmp = (-0.5 * c) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -7.9e+49) tmp = Float64(fma(0.5, Float64(Float64(c / b) * a), Float64(-0.6666666666666666 * b)) / a); elseif (b <= 7.2e-112) tmp = Float64(Float64(sqrt(fma(Float64(-3.0 * a), c, Float64(b * b))) + Float64(-b)) / Float64(a * 3.0)); else tmp = Float64(Float64(-0.5 * c) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -7.9e+49], N[(N[(0.5 * N[(N[(c / b), $MachinePrecision] * a), $MachinePrecision] + N[(-0.6666666666666666 * b), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 7.2e-112], N[(N[(N[Sqrt[N[(N[(-3.0 * a), $MachinePrecision] * c + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + (-b)), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(-0.5 * c), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -7.9 \cdot 10^{+49}:\\
\;\;\;\;\frac{\mathsf{fma}\left(0.5, \frac{c}{b} \cdot a, -0.6666666666666666 \cdot b\right)}{a}\\
\mathbf{elif}\;b \leq 7.2 \cdot 10^{-112}:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(-3 \cdot a, c, b \cdot b\right)} + \left(-b\right)}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b}\\
\end{array}
\end{array}
if b < -7.9000000000000004e49Initial program 59.7%
Taylor expanded in b around -inf
associate-*r*N/A
mul-1-negN/A
lift-neg.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6493.7
Applied rewrites93.7%
Taylor expanded in a around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f6493.7
Applied rewrites93.7%
if -7.9000000000000004e49 < b < 7.2000000000000002e-112Initial program 80.8%
Applied rewrites80.8%
if 7.2000000000000002e-112 < b Initial program 21.3%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6481.8
Applied rewrites81.8%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6481.8
Applied rewrites81.8%
(FPCore (a b c)
:precision binary64
(if (<= b -7.9e+49)
(/ (fma 0.5 (* (/ c b) a) (* -0.6666666666666666 b)) a)
(if (<= b 7.2e-112)
(/ (+ (- b) (sqrt (fma (* c a) -3.0 (* b b)))) (* 3.0 a))
(/ (* -0.5 c) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -7.9e+49) {
tmp = fma(0.5, ((c / b) * a), (-0.6666666666666666 * b)) / a;
} else if (b <= 7.2e-112) {
tmp = (-b + sqrt(fma((c * a), -3.0, (b * b)))) / (3.0 * a);
} else {
tmp = (-0.5 * c) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -7.9e+49) tmp = Float64(fma(0.5, Float64(Float64(c / b) * a), Float64(-0.6666666666666666 * b)) / a); elseif (b <= 7.2e-112) tmp = Float64(Float64(Float64(-b) + sqrt(fma(Float64(c * a), -3.0, Float64(b * b)))) / Float64(3.0 * a)); else tmp = Float64(Float64(-0.5 * c) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -7.9e+49], N[(N[(0.5 * N[(N[(c / b), $MachinePrecision] * a), $MachinePrecision] + N[(-0.6666666666666666 * b), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 7.2e-112], N[(N[((-b) + N[Sqrt[N[(N[(c * a), $MachinePrecision] * -3.0 + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(-0.5 * c), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -7.9 \cdot 10^{+49}:\\
\;\;\;\;\frac{\mathsf{fma}\left(0.5, \frac{c}{b} \cdot a, -0.6666666666666666 \cdot b\right)}{a}\\
\mathbf{elif}\;b \leq 7.2 \cdot 10^{-112}:\\
\;\;\;\;\frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)}}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b}\\
\end{array}
\end{array}
if b < -7.9000000000000004e49Initial program 59.7%
Taylor expanded in b around -inf
associate-*r*N/A
mul-1-negN/A
lift-neg.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6493.7
Applied rewrites93.7%
Taylor expanded in a around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f6493.7
Applied rewrites93.7%
if -7.9000000000000004e49 < b < 7.2000000000000002e-112Initial program 80.8%
lift-*.f64N/A
lift--.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6480.7
Applied rewrites80.7%
if 7.2000000000000002e-112 < b Initial program 21.3%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6481.8
Applied rewrites81.8%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6481.8
Applied rewrites81.8%
(FPCore (a b c)
:precision binary64
(if (<= b -2.3e-80)
(/ (* (- b) (fma (/ c (* b b)) -1.5 (/ 2.0 a))) 3.0)
(if (<= b 2.05e-129)
(/ (+ (- b) (sqrt (* (* a -3.0) c))) (* 3.0 a))
(/ (* -0.5 c) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.3e-80) {
tmp = (-b * fma((c / (b * b)), -1.5, (2.0 / a))) / 3.0;
} else if (b <= 2.05e-129) {
tmp = (-b + 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 <= -2.3e-80) tmp = Float64(Float64(Float64(-b) * fma(Float64(c / Float64(b * b)), -1.5, Float64(2.0 / a))) / 3.0); elseif (b <= 2.05e-129) tmp = Float64(Float64(Float64(-b) + sqrt(Float64(Float64(a * -3.0) * c))) / Float64(3.0 * a)); else tmp = Float64(Float64(-0.5 * c) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -2.3e-80], N[(N[((-b) * N[(N[(c / N[(b * b), $MachinePrecision]), $MachinePrecision] * -1.5 + N[(2.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 3.0), $MachinePrecision], If[LessEqual[b, 2.05e-129], N[(N[((-b) + N[Sqrt[N[(N[(a * -3.0), $MachinePrecision] * c), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(-0.5 * c), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.3 \cdot 10^{-80}:\\
\;\;\;\;\frac{\left(-b\right) \cdot \mathsf{fma}\left(\frac{c}{b \cdot b}, -1.5, \frac{2}{a}\right)}{3}\\
\mathbf{elif}\;b \leq 2.05 \cdot 10^{-129}:\\
\;\;\;\;\frac{\left(-b\right) + \sqrt{\left(a \cdot -3\right) \cdot c}}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b}\\
\end{array}
\end{array}
if b < -2.2999999999999998e-80Initial program 68.8%
Applied rewrites68.9%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-neg.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites68.8%
Taylor expanded in b around -inf
associate-*r*N/A
mul-1-negN/A
lift-neg.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6484.4
Applied rewrites84.4%
if -2.2999999999999998e-80 < b < 2.05e-129Initial program 77.1%
Taylor expanded in a around inf
lower-*.f64N/A
*-commutativeN/A
lower-*.f6470.4
Applied rewrites70.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6470.5
Applied rewrites70.5%
if 2.05e-129 < b Initial program 22.8%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6480.1
Applied rewrites80.1%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6480.1
Applied rewrites80.1%
(FPCore (a b c)
:precision binary64
(if (<= b -2.3e-80)
(/ (fma 0.5 (* (/ c b) a) (* -0.6666666666666666 b)) a)
(if (<= b 2.05e-129)
(/ (+ (- b) (sqrt (* (* a -3.0) c))) (* 3.0 a))
(/ (* -0.5 c) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.3e-80) {
tmp = fma(0.5, ((c / b) * a), (-0.6666666666666666 * b)) / a;
} else if (b <= 2.05e-129) {
tmp = (-b + 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 <= -2.3e-80) tmp = Float64(fma(0.5, Float64(Float64(c / b) * a), Float64(-0.6666666666666666 * b)) / a); elseif (b <= 2.05e-129) tmp = Float64(Float64(Float64(-b) + sqrt(Float64(Float64(a * -3.0) * c))) / Float64(3.0 * a)); else tmp = Float64(Float64(-0.5 * c) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -2.3e-80], N[(N[(0.5 * N[(N[(c / b), $MachinePrecision] * a), $MachinePrecision] + N[(-0.6666666666666666 * b), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 2.05e-129], N[(N[((-b) + N[Sqrt[N[(N[(a * -3.0), $MachinePrecision] * c), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(-0.5 * c), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.3 \cdot 10^{-80}:\\
\;\;\;\;\frac{\mathsf{fma}\left(0.5, \frac{c}{b} \cdot a, -0.6666666666666666 \cdot b\right)}{a}\\
\mathbf{elif}\;b \leq 2.05 \cdot 10^{-129}:\\
\;\;\;\;\frac{\left(-b\right) + \sqrt{\left(a \cdot -3\right) \cdot c}}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b}\\
\end{array}
\end{array}
if b < -2.2999999999999998e-80Initial program 68.8%
Taylor expanded in b around -inf
associate-*r*N/A
mul-1-negN/A
lift-neg.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6484.5
Applied rewrites84.5%
Taylor expanded in a around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f6484.5
Applied rewrites84.5%
if -2.2999999999999998e-80 < b < 2.05e-129Initial program 77.1%
Taylor expanded in a around inf
lower-*.f64N/A
*-commutativeN/A
lower-*.f6470.4
Applied rewrites70.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6470.5
Applied rewrites70.5%
if 2.05e-129 < b Initial program 22.8%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6480.1
Applied rewrites80.1%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6480.1
Applied rewrites80.1%
(FPCore (a b c)
:precision binary64
(if (<= b -2.3e-80)
(/ (fma 0.5 (* (/ c b) a) (* -0.6666666666666666 b)) a)
(if (<= b 2.05e-129)
(/ (+ (- b) (sqrt (* -3.0 (* c a)))) (* 3.0 a))
(/ (* -0.5 c) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.3e-80) {
tmp = fma(0.5, ((c / b) * a), (-0.6666666666666666 * b)) / a;
} else if (b <= 2.05e-129) {
tmp = (-b + sqrt((-3.0 * (c * a)))) / (3.0 * a);
} else {
tmp = (-0.5 * c) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -2.3e-80) tmp = Float64(fma(0.5, Float64(Float64(c / b) * a), Float64(-0.6666666666666666 * b)) / a); elseif (b <= 2.05e-129) tmp = Float64(Float64(Float64(-b) + sqrt(Float64(-3.0 * Float64(c * a)))) / Float64(3.0 * a)); else tmp = Float64(Float64(-0.5 * c) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -2.3e-80], N[(N[(0.5 * N[(N[(c / b), $MachinePrecision] * a), $MachinePrecision] + N[(-0.6666666666666666 * b), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 2.05e-129], N[(N[((-b) + N[Sqrt[N[(-3.0 * N[(c * a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(-0.5 * c), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.3 \cdot 10^{-80}:\\
\;\;\;\;\frac{\mathsf{fma}\left(0.5, \frac{c}{b} \cdot a, -0.6666666666666666 \cdot b\right)}{a}\\
\mathbf{elif}\;b \leq 2.05 \cdot 10^{-129}:\\
\;\;\;\;\frac{\left(-b\right) + \sqrt{-3 \cdot \left(c \cdot a\right)}}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b}\\
\end{array}
\end{array}
if b < -2.2999999999999998e-80Initial program 68.8%
Taylor expanded in b around -inf
associate-*r*N/A
mul-1-negN/A
lift-neg.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6484.5
Applied rewrites84.5%
Taylor expanded in a around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f6484.5
Applied rewrites84.5%
if -2.2999999999999998e-80 < b < 2.05e-129Initial program 77.1%
Taylor expanded in a around inf
lower-*.f64N/A
*-commutativeN/A
lower-*.f6470.4
Applied rewrites70.4%
if 2.05e-129 < b Initial program 22.8%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6480.1
Applied rewrites80.1%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6480.1
Applied rewrites80.1%
(FPCore (a b c)
:precision binary64
(if (<= b -2.3e-80)
(/ (fma 0.5 (* (/ c b) a) (* -0.6666666666666666 b)) a)
(if (<= b 7.2e-112)
(/ (sqrt (* (* -3.0 a) c)) (* a 3.0))
(/ (* -0.5 c) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.3e-80) {
tmp = fma(0.5, ((c / b) * a), (-0.6666666666666666 * b)) / a;
} else if (b <= 7.2e-112) {
tmp = sqrt(((-3.0 * a) * c)) / (a * 3.0);
} else {
tmp = (-0.5 * c) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -2.3e-80) tmp = Float64(fma(0.5, Float64(Float64(c / b) * a), Float64(-0.6666666666666666 * b)) / a); elseif (b <= 7.2e-112) tmp = Float64(sqrt(Float64(Float64(-3.0 * a) * c)) / Float64(a * 3.0)); else tmp = Float64(Float64(-0.5 * c) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -2.3e-80], N[(N[(0.5 * N[(N[(c / b), $MachinePrecision] * a), $MachinePrecision] + N[(-0.6666666666666666 * b), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 7.2e-112], N[(N[Sqrt[N[(N[(-3.0 * a), $MachinePrecision] * c), $MachinePrecision]], $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(-0.5 * c), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.3 \cdot 10^{-80}:\\
\;\;\;\;\frac{\mathsf{fma}\left(0.5, \frac{c}{b} \cdot a, -0.6666666666666666 \cdot b\right)}{a}\\
\mathbf{elif}\;b \leq 7.2 \cdot 10^{-112}:\\
\;\;\;\;\frac{\sqrt{\left(-3 \cdot a\right) \cdot c}}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b}\\
\end{array}
\end{array}
if b < -2.2999999999999998e-80Initial program 68.8%
Taylor expanded in b around -inf
associate-*r*N/A
mul-1-negN/A
lift-neg.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6484.5
Applied rewrites84.5%
Taylor expanded in a around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f6484.5
Applied rewrites84.5%
if -2.2999999999999998e-80 < b < 7.2000000000000002e-112Initial program 76.4%
Applied rewrites76.4%
Taylor expanded in a around inf
associate-*l*N/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
pow2N/A
*-commutativeN/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
associate-*l*N/A
pow2N/A
lift-neg.f64N/A
+-commutativeN/A
lift-neg.f64N/A
Applied rewrites68.7%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6468.8
Applied rewrites68.8%
if 7.2000000000000002e-112 < b Initial program 21.3%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6481.8
Applied rewrites81.8%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6481.8
Applied rewrites81.8%
(FPCore (a b c)
:precision binary64
(if (<= b -2.3e-80)
(fma 0.5 (/ c b) (* (/ b a) -0.6666666666666666))
(if (<= b 7.2e-112)
(/ (sqrt (* (* -3.0 a) c)) (* a 3.0))
(/ (* -0.5 c) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.3e-80) {
tmp = fma(0.5, (c / b), ((b / a) * -0.6666666666666666));
} else if (b <= 7.2e-112) {
tmp = sqrt(((-3.0 * a) * c)) / (a * 3.0);
} else {
tmp = (-0.5 * c) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -2.3e-80) tmp = fma(0.5, Float64(c / b), Float64(Float64(b / a) * -0.6666666666666666)); elseif (b <= 7.2e-112) tmp = Float64(sqrt(Float64(Float64(-3.0 * a) * c)) / Float64(a * 3.0)); else tmp = Float64(Float64(-0.5 * c) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -2.3e-80], N[(0.5 * N[(c / b), $MachinePrecision] + N[(N[(b / a), $MachinePrecision] * -0.6666666666666666), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 7.2e-112], N[(N[Sqrt[N[(N[(-3.0 * a), $MachinePrecision] * c), $MachinePrecision]], $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(-0.5 * c), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.3 \cdot 10^{-80}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{b}{a} \cdot -0.6666666666666666\right)\\
\mathbf{elif}\;b \leq 7.2 \cdot 10^{-112}:\\
\;\;\;\;\frac{\sqrt{\left(-3 \cdot a\right) \cdot c}}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b}\\
\end{array}
\end{array}
if b < -2.2999999999999998e-80Initial program 68.8%
Taylor expanded in b around -inf
associate-*r*N/A
mul-1-negN/A
lift-neg.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6484.5
Applied rewrites84.5%
Taylor expanded in a around inf
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6484.6
Applied rewrites84.6%
if -2.2999999999999998e-80 < b < 7.2000000000000002e-112Initial program 76.4%
Applied rewrites76.4%
Taylor expanded in a around inf
associate-*l*N/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
pow2N/A
*-commutativeN/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
associate-*l*N/A
pow2N/A
lift-neg.f64N/A
+-commutativeN/A
lift-neg.f64N/A
Applied rewrites68.7%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6468.8
Applied rewrites68.8%
if 7.2000000000000002e-112 < b Initial program 21.3%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6481.8
Applied rewrites81.8%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6481.8
Applied rewrites81.8%
(FPCore (a b c)
:precision binary64
(if (<= b -2.3e-80)
(/ (* -2.0 b) (* 3.0 a))
(if (<= b 7.2e-112)
(/ (sqrt (* (* -3.0 a) c)) (* a 3.0))
(/ (* -0.5 c) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.3e-80) {
tmp = (-2.0 * b) / (3.0 * a);
} else if (b <= 7.2e-112) {
tmp = sqrt(((-3.0 * a) * 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 <= (-2.3d-80)) then
tmp = ((-2.0d0) * b) / (3.0d0 * a)
else if (b <= 7.2d-112) then
tmp = sqrt((((-3.0d0) * a) * 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 <= -2.3e-80) {
tmp = (-2.0 * b) / (3.0 * a);
} else if (b <= 7.2e-112) {
tmp = Math.sqrt(((-3.0 * a) * c)) / (a * 3.0);
} else {
tmp = (-0.5 * c) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2.3e-80: tmp = (-2.0 * b) / (3.0 * a) elif b <= 7.2e-112: tmp = math.sqrt(((-3.0 * a) * c)) / (a * 3.0) else: tmp = (-0.5 * c) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -2.3e-80) tmp = Float64(Float64(-2.0 * b) / Float64(3.0 * a)); elseif (b <= 7.2e-112) tmp = Float64(sqrt(Float64(Float64(-3.0 * a) * c)) / Float64(a * 3.0)); else tmp = Float64(Float64(-0.5 * c) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -2.3e-80) tmp = (-2.0 * b) / (3.0 * a); elseif (b <= 7.2e-112) tmp = sqrt(((-3.0 * a) * c)) / (a * 3.0); else tmp = (-0.5 * c) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2.3e-80], N[(N[(-2.0 * b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 7.2e-112], N[(N[Sqrt[N[(N[(-3.0 * a), $MachinePrecision] * c), $MachinePrecision]], $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(-0.5 * c), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.3 \cdot 10^{-80}:\\
\;\;\;\;\frac{-2 \cdot b}{3 \cdot a}\\
\mathbf{elif}\;b \leq 7.2 \cdot 10^{-112}:\\
\;\;\;\;\frac{\sqrt{\left(-3 \cdot a\right) \cdot c}}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b}\\
\end{array}
\end{array}
if b < -2.2999999999999998e-80Initial program 68.8%
Taylor expanded in b around -inf
lower-*.f6484.2
Applied rewrites84.2%
if -2.2999999999999998e-80 < b < 7.2000000000000002e-112Initial program 76.4%
Applied rewrites76.4%
Taylor expanded in a around inf
associate-*l*N/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
pow2N/A
*-commutativeN/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
associate-*l*N/A
pow2N/A
lift-neg.f64N/A
+-commutativeN/A
lift-neg.f64N/A
Applied rewrites68.7%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6468.8
Applied rewrites68.8%
if 7.2000000000000002e-112 < b Initial program 21.3%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6481.8
Applied rewrites81.8%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6481.8
Applied rewrites81.8%
(FPCore (a b c)
:precision binary64
(if (<= b -2.3e-80)
(/ (* -2.0 b) (* 3.0 a))
(if (<= b 7.2e-112)
(/ (sqrt (* -3.0 (* c a))) (* 3.0 a))
(/ (* -0.5 c) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.3e-80) {
tmp = (-2.0 * b) / (3.0 * a);
} else if (b <= 7.2e-112) {
tmp = sqrt((-3.0 * (c * a))) / (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 <= (-2.3d-80)) then
tmp = ((-2.0d0) * b) / (3.0d0 * a)
else if (b <= 7.2d-112) then
tmp = sqrt(((-3.0d0) * (c * a))) / (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 <= -2.3e-80) {
tmp = (-2.0 * b) / (3.0 * a);
} else if (b <= 7.2e-112) {
tmp = Math.sqrt((-3.0 * (c * a))) / (3.0 * a);
} else {
tmp = (-0.5 * c) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2.3e-80: tmp = (-2.0 * b) / (3.0 * a) elif b <= 7.2e-112: tmp = math.sqrt((-3.0 * (c * a))) / (3.0 * a) else: tmp = (-0.5 * c) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -2.3e-80) tmp = Float64(Float64(-2.0 * b) / Float64(3.0 * a)); elseif (b <= 7.2e-112) tmp = Float64(sqrt(Float64(-3.0 * Float64(c * a))) / Float64(3.0 * a)); else tmp = Float64(Float64(-0.5 * c) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -2.3e-80) tmp = (-2.0 * b) / (3.0 * a); elseif (b <= 7.2e-112) tmp = sqrt((-3.0 * (c * a))) / (3.0 * a); else tmp = (-0.5 * c) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2.3e-80], N[(N[(-2.0 * b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 7.2e-112], N[(N[Sqrt[N[(-3.0 * N[(c * a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(-0.5 * c), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.3 \cdot 10^{-80}:\\
\;\;\;\;\frac{-2 \cdot b}{3 \cdot a}\\
\mathbf{elif}\;b \leq 7.2 \cdot 10^{-112}:\\
\;\;\;\;\frac{\sqrt{-3 \cdot \left(c \cdot a\right)}}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b}\\
\end{array}
\end{array}
if b < -2.2999999999999998e-80Initial program 68.8%
Taylor expanded in b around -inf
lower-*.f6484.2
Applied rewrites84.2%
if -2.2999999999999998e-80 < b < 7.2000000000000002e-112Initial program 76.4%
Taylor expanded in a around inf
sqrt-unprodN/A
*-commutativeN/A
lower-sqrt.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6468.7
Applied rewrites68.7%
if 7.2000000000000002e-112 < b Initial program 21.3%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6481.8
Applied rewrites81.8%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6481.8
Applied rewrites81.8%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (sqrt (* (/ c a) -3.0))))
(if (<= b -2.15e-146)
(/ (* -2.0 b) (* 3.0 a))
(if (<= b -5e-310)
(/ t_0 3.0)
(if (<= b 7.2e-131) (* t_0 -0.3333333333333333) (/ (* -0.5 c) b))))))
double code(double a, double b, double c) {
double t_0 = sqrt(((c / a) * -3.0));
double tmp;
if (b <= -2.15e-146) {
tmp = (-2.0 * b) / (3.0 * a);
} else if (b <= -5e-310) {
tmp = t_0 / 3.0;
} else if (b <= 7.2e-131) {
tmp = t_0 * -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) :: t_0
real(8) :: tmp
t_0 = sqrt(((c / a) * (-3.0d0)))
if (b <= (-2.15d-146)) then
tmp = ((-2.0d0) * b) / (3.0d0 * a)
else if (b <= (-5d-310)) then
tmp = t_0 / 3.0d0
else if (b <= 7.2d-131) then
tmp = t_0 * (-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 t_0 = Math.sqrt(((c / a) * -3.0));
double tmp;
if (b <= -2.15e-146) {
tmp = (-2.0 * b) / (3.0 * a);
} else if (b <= -5e-310) {
tmp = t_0 / 3.0;
} else if (b <= 7.2e-131) {
tmp = t_0 * -0.3333333333333333;
} else {
tmp = (-0.5 * c) / b;
}
return tmp;
}
def code(a, b, c): t_0 = math.sqrt(((c / a) * -3.0)) tmp = 0 if b <= -2.15e-146: tmp = (-2.0 * b) / (3.0 * a) elif b <= -5e-310: tmp = t_0 / 3.0 elif b <= 7.2e-131: tmp = t_0 * -0.3333333333333333 else: tmp = (-0.5 * c) / b return tmp
function code(a, b, c) t_0 = sqrt(Float64(Float64(c / a) * -3.0)) tmp = 0.0 if (b <= -2.15e-146) tmp = Float64(Float64(-2.0 * b) / Float64(3.0 * a)); elseif (b <= -5e-310) tmp = Float64(t_0 / 3.0); elseif (b <= 7.2e-131) tmp = Float64(t_0 * -0.3333333333333333); else tmp = Float64(Float64(-0.5 * c) / b); end return tmp end
function tmp_2 = code(a, b, c) t_0 = sqrt(((c / a) * -3.0)); tmp = 0.0; if (b <= -2.15e-146) tmp = (-2.0 * b) / (3.0 * a); elseif (b <= -5e-310) tmp = t_0 / 3.0; elseif (b <= 7.2e-131) tmp = t_0 * -0.3333333333333333; else tmp = (-0.5 * c) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := Block[{t$95$0 = N[Sqrt[N[(N[(c / a), $MachinePrecision] * -3.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[b, -2.15e-146], N[(N[(-2.0 * b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, -5e-310], N[(t$95$0 / 3.0), $MachinePrecision], If[LessEqual[b, 7.2e-131], N[(t$95$0 * -0.3333333333333333), $MachinePrecision], N[(N[(-0.5 * c), $MachinePrecision] / b), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{c}{a} \cdot -3}\\
\mathbf{if}\;b \leq -2.15 \cdot 10^{-146}:\\
\;\;\;\;\frac{-2 \cdot b}{3 \cdot a}\\
\mathbf{elif}\;b \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{t\_0}{3}\\
\mathbf{elif}\;b \leq 7.2 \cdot 10^{-131}:\\
\;\;\;\;t\_0 \cdot -0.3333333333333333\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b}\\
\end{array}
\end{array}
if b < -2.15e-146Initial program 70.9%
Taylor expanded in b around -inf
lower-*.f6479.3
Applied rewrites79.3%
if -2.15e-146 < b < -4.999999999999985e-310Initial program 76.9%
Applied rewrites76.9%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-neg.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites76.8%
Taylor expanded in a around inf
sqrt-prodN/A
lift-/.f64N/A
lift-*.f64N/A
lift-sqrt.f6436.9
Applied rewrites36.9%
if -4.999999999999985e-310 < b < 7.1999999999999999e-131Initial program 72.6%
Taylor expanded in a around -inf
*-commutativeN/A
lower-*.f64N/A
sqrt-unprodN/A
metadata-evalN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f6433.8
Applied rewrites33.8%
if 7.1999999999999999e-131 < b Initial program 22.8%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6480.0
Applied rewrites80.0%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6480.0
Applied rewrites80.0%
(FPCore (a b c)
:precision binary64
(if (<= b -2.15e-146)
(/ (* -2.0 b) (* 3.0 a))
(if (<= b -5e-310)
(* (sqrt (/ (* -3.0 c) a)) 0.3333333333333333)
(if (<= b 7.2e-131)
(* (sqrt (* (/ c a) -3.0)) -0.3333333333333333)
(/ (* -0.5 c) b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.15e-146) {
tmp = (-2.0 * b) / (3.0 * a);
} else if (b <= -5e-310) {
tmp = sqrt(((-3.0 * c) / a)) * 0.3333333333333333;
} else if (b <= 7.2e-131) {
tmp = sqrt(((c / a) * -3.0)) * -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 <= (-2.15d-146)) then
tmp = ((-2.0d0) * b) / (3.0d0 * a)
else if (b <= (-5d-310)) then
tmp = sqrt((((-3.0d0) * c) / a)) * 0.3333333333333333d0
else if (b <= 7.2d-131) then
tmp = sqrt(((c / a) * (-3.0d0))) * (-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 <= -2.15e-146) {
tmp = (-2.0 * b) / (3.0 * a);
} else if (b <= -5e-310) {
tmp = Math.sqrt(((-3.0 * c) / a)) * 0.3333333333333333;
} else if (b <= 7.2e-131) {
tmp = Math.sqrt(((c / a) * -3.0)) * -0.3333333333333333;
} else {
tmp = (-0.5 * c) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2.15e-146: tmp = (-2.0 * b) / (3.0 * a) elif b <= -5e-310: tmp = math.sqrt(((-3.0 * c) / a)) * 0.3333333333333333 elif b <= 7.2e-131: tmp = math.sqrt(((c / a) * -3.0)) * -0.3333333333333333 else: tmp = (-0.5 * c) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -2.15e-146) tmp = Float64(Float64(-2.0 * b) / Float64(3.0 * a)); elseif (b <= -5e-310) tmp = Float64(sqrt(Float64(Float64(-3.0 * c) / a)) * 0.3333333333333333); elseif (b <= 7.2e-131) tmp = Float64(sqrt(Float64(Float64(c / a) * -3.0)) * -0.3333333333333333); else tmp = Float64(Float64(-0.5 * c) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -2.15e-146) tmp = (-2.0 * b) / (3.0 * a); elseif (b <= -5e-310) tmp = sqrt(((-3.0 * c) / a)) * 0.3333333333333333; elseif (b <= 7.2e-131) tmp = sqrt(((c / a) * -3.0)) * -0.3333333333333333; else tmp = (-0.5 * c) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2.15e-146], N[(N[(-2.0 * b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, -5e-310], N[(N[Sqrt[N[(N[(-3.0 * c), $MachinePrecision] / a), $MachinePrecision]], $MachinePrecision] * 0.3333333333333333), $MachinePrecision], If[LessEqual[b, 7.2e-131], N[(N[Sqrt[N[(N[(c / a), $MachinePrecision] * -3.0), $MachinePrecision]], $MachinePrecision] * -0.3333333333333333), $MachinePrecision], N[(N[(-0.5 * c), $MachinePrecision] / b), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.15 \cdot 10^{-146}:\\
\;\;\;\;\frac{-2 \cdot b}{3 \cdot a}\\
\mathbf{elif}\;b \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{-3 \cdot c}{a}} \cdot 0.3333333333333333\\
\mathbf{elif}\;b \leq 7.2 \cdot 10^{-131}:\\
\;\;\;\;\sqrt{\frac{c}{a} \cdot -3} \cdot -0.3333333333333333\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b}\\
\end{array}
\end{array}
if b < -2.15e-146Initial program 70.9%
Taylor expanded in b around -inf
lower-*.f6479.3
Applied rewrites79.3%
if -2.15e-146 < b < -4.999999999999985e-310Initial program 76.9%
Taylor expanded in a around inf
*-commutativeN/A
metadata-evalN/A
sqrt-unprodN/A
lower-*.f64N/A
sqrt-unprodN/A
metadata-evalN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f6436.8
Applied rewrites36.8%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6436.8
Applied rewrites36.8%
if -4.999999999999985e-310 < b < 7.1999999999999999e-131Initial program 72.6%
Taylor expanded in a around -inf
*-commutativeN/A
lower-*.f64N/A
sqrt-unprodN/A
metadata-evalN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f6433.8
Applied rewrites33.8%
if 7.1999999999999999e-131 < b Initial program 22.8%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6480.0
Applied rewrites80.0%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6480.0
Applied rewrites80.0%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (sqrt (* (/ c a) -3.0))))
(if (<= b -2.15e-146)
(/ (* -2.0 b) (* 3.0 a))
(if (<= b -5e-310)
(* t_0 0.3333333333333333)
(if (<= b 7.2e-131) (* t_0 -0.3333333333333333) (/ (* -0.5 c) b))))))
double code(double a, double b, double c) {
double t_0 = sqrt(((c / a) * -3.0));
double tmp;
if (b <= -2.15e-146) {
tmp = (-2.0 * b) / (3.0 * a);
} else if (b <= -5e-310) {
tmp = t_0 * 0.3333333333333333;
} else if (b <= 7.2e-131) {
tmp = t_0 * -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) :: t_0
real(8) :: tmp
t_0 = sqrt(((c / a) * (-3.0d0)))
if (b <= (-2.15d-146)) then
tmp = ((-2.0d0) * b) / (3.0d0 * a)
else if (b <= (-5d-310)) then
tmp = t_0 * 0.3333333333333333d0
else if (b <= 7.2d-131) then
tmp = t_0 * (-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 t_0 = Math.sqrt(((c / a) * -3.0));
double tmp;
if (b <= -2.15e-146) {
tmp = (-2.0 * b) / (3.0 * a);
} else if (b <= -5e-310) {
tmp = t_0 * 0.3333333333333333;
} else if (b <= 7.2e-131) {
tmp = t_0 * -0.3333333333333333;
} else {
tmp = (-0.5 * c) / b;
}
return tmp;
}
def code(a, b, c): t_0 = math.sqrt(((c / a) * -3.0)) tmp = 0 if b <= -2.15e-146: tmp = (-2.0 * b) / (3.0 * a) elif b <= -5e-310: tmp = t_0 * 0.3333333333333333 elif b <= 7.2e-131: tmp = t_0 * -0.3333333333333333 else: tmp = (-0.5 * c) / b return tmp
function code(a, b, c) t_0 = sqrt(Float64(Float64(c / a) * -3.0)) tmp = 0.0 if (b <= -2.15e-146) tmp = Float64(Float64(-2.0 * b) / Float64(3.0 * a)); elseif (b <= -5e-310) tmp = Float64(t_0 * 0.3333333333333333); elseif (b <= 7.2e-131) tmp = Float64(t_0 * -0.3333333333333333); else tmp = Float64(Float64(-0.5 * c) / b); end return tmp end
function tmp_2 = code(a, b, c) t_0 = sqrt(((c / a) * -3.0)); tmp = 0.0; if (b <= -2.15e-146) tmp = (-2.0 * b) / (3.0 * a); elseif (b <= -5e-310) tmp = t_0 * 0.3333333333333333; elseif (b <= 7.2e-131) tmp = t_0 * -0.3333333333333333; else tmp = (-0.5 * c) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := Block[{t$95$0 = N[Sqrt[N[(N[(c / a), $MachinePrecision] * -3.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[b, -2.15e-146], N[(N[(-2.0 * b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, -5e-310], N[(t$95$0 * 0.3333333333333333), $MachinePrecision], If[LessEqual[b, 7.2e-131], N[(t$95$0 * -0.3333333333333333), $MachinePrecision], N[(N[(-0.5 * c), $MachinePrecision] / b), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{c}{a} \cdot -3}\\
\mathbf{if}\;b \leq -2.15 \cdot 10^{-146}:\\
\;\;\;\;\frac{-2 \cdot b}{3 \cdot a}\\
\mathbf{elif}\;b \leq -5 \cdot 10^{-310}:\\
\;\;\;\;t\_0 \cdot 0.3333333333333333\\
\mathbf{elif}\;b \leq 7.2 \cdot 10^{-131}:\\
\;\;\;\;t\_0 \cdot -0.3333333333333333\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b}\\
\end{array}
\end{array}
if b < -2.15e-146Initial program 70.9%
Taylor expanded in b around -inf
lower-*.f6479.3
Applied rewrites79.3%
if -2.15e-146 < b < -4.999999999999985e-310Initial program 76.9%
Taylor expanded in a around inf
*-commutativeN/A
metadata-evalN/A
sqrt-unprodN/A
lower-*.f64N/A
sqrt-unprodN/A
metadata-evalN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f6436.8
Applied rewrites36.8%
if -4.999999999999985e-310 < b < 7.1999999999999999e-131Initial program 72.6%
Taylor expanded in a around -inf
*-commutativeN/A
lower-*.f64N/A
sqrt-unprodN/A
metadata-evalN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f6433.8
Applied rewrites33.8%
if 7.1999999999999999e-131 < b Initial program 22.8%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6480.0
Applied rewrites80.0%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6480.0
Applied rewrites80.0%
(FPCore (a b c)
:precision binary64
(if (<= b -2.1e-225)
(/ (* -2.0 b) (* 3.0 a))
(if (<= b 7.2e-131)
(* (sqrt (* (/ c a) -3.0)) -0.3333333333333333)
(/ (* -0.5 c) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.1e-225) {
tmp = (-2.0 * b) / (3.0 * a);
} else if (b <= 7.2e-131) {
tmp = sqrt(((c / a) * -3.0)) * -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 <= (-2.1d-225)) then
tmp = ((-2.0d0) * b) / (3.0d0 * a)
else if (b <= 7.2d-131) then
tmp = sqrt(((c / a) * (-3.0d0))) * (-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 <= -2.1e-225) {
tmp = (-2.0 * b) / (3.0 * a);
} else if (b <= 7.2e-131) {
tmp = Math.sqrt(((c / a) * -3.0)) * -0.3333333333333333;
} else {
tmp = (-0.5 * c) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2.1e-225: tmp = (-2.0 * b) / (3.0 * a) elif b <= 7.2e-131: tmp = math.sqrt(((c / a) * -3.0)) * -0.3333333333333333 else: tmp = (-0.5 * c) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -2.1e-225) tmp = Float64(Float64(-2.0 * b) / Float64(3.0 * a)); elseif (b <= 7.2e-131) tmp = Float64(sqrt(Float64(Float64(c / a) * -3.0)) * -0.3333333333333333); else tmp = Float64(Float64(-0.5 * c) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -2.1e-225) tmp = (-2.0 * b) / (3.0 * a); elseif (b <= 7.2e-131) tmp = sqrt(((c / a) * -3.0)) * -0.3333333333333333; else tmp = (-0.5 * c) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2.1e-225], N[(N[(-2.0 * b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 7.2e-131], N[(N[Sqrt[N[(N[(c / a), $MachinePrecision] * -3.0), $MachinePrecision]], $MachinePrecision] * -0.3333333333333333), $MachinePrecision], N[(N[(-0.5 * c), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.1 \cdot 10^{-225}:\\
\;\;\;\;\frac{-2 \cdot b}{3 \cdot a}\\
\mathbf{elif}\;b \leq 7.2 \cdot 10^{-131}:\\
\;\;\;\;\sqrt{\frac{c}{a} \cdot -3} \cdot -0.3333333333333333\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b}\\
\end{array}
\end{array}
if b < -2.1e-225Initial program 71.3%
Taylor expanded in b around -inf
lower-*.f6473.6
Applied rewrites73.6%
if -2.1e-225 < b < 7.1999999999999999e-131Initial program 74.5%
Taylor expanded in a around -inf
*-commutativeN/A
lower-*.f64N/A
sqrt-unprodN/A
metadata-evalN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f6434.2
Applied rewrites34.2%
if 7.1999999999999999e-131 < b Initial program 22.8%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6480.0
Applied rewrites80.0%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6480.0
Applied rewrites80.0%
(FPCore (a b c) :precision binary64 (if (<= b 4.2e-293) (/ (* -2.0 b) (* 3.0 a)) (/ (* -0.5 c) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 4.2e-293) {
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 <= 4.2d-293) 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 <= 4.2e-293) {
tmp = (-2.0 * b) / (3.0 * a);
} else {
tmp = (-0.5 * c) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 4.2e-293: 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 <= 4.2e-293) tmp = Float64(Float64(-2.0 * b) / Float64(3.0 * a)); else tmp = Float64(Float64(-0.5 * c) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 4.2e-293) 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, 4.2e-293], N[(N[(-2.0 * b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(-0.5 * c), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 4.2 \cdot 10^{-293}:\\
\;\;\;\;\frac{-2 \cdot b}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b}\\
\end{array}
\end{array}
if b < 4.2000000000000001e-293Initial program 72.0%
Taylor expanded in b around -inf
lower-*.f6466.6
Applied rewrites66.6%
if 4.2000000000000001e-293 < b Initial program 32.0%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6468.0
Applied rewrites68.0%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6468.0
Applied rewrites68.0%
(FPCore (a b c) :precision binary64 (if (<= b 4.2e-293) (* (- b) (/ 0.6666666666666666 a)) (/ (* -0.5 c) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 4.2e-293) {
tmp = -b * (0.6666666666666666 / 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 <= 4.2d-293) then
tmp = -b * (0.6666666666666666d0 / 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 <= 4.2e-293) {
tmp = -b * (0.6666666666666666 / a);
} else {
tmp = (-0.5 * c) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 4.2e-293: tmp = -b * (0.6666666666666666 / a) else: tmp = (-0.5 * c) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 4.2e-293) tmp = Float64(Float64(-b) * Float64(0.6666666666666666 / a)); else tmp = Float64(Float64(-0.5 * c) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 4.2e-293) tmp = -b * (0.6666666666666666 / a); else tmp = (-0.5 * c) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 4.2e-293], N[((-b) * N[(0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision], N[(N[(-0.5 * c), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 4.2 \cdot 10^{-293}:\\
\;\;\;\;\left(-b\right) \cdot \frac{0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b}\\
\end{array}
\end{array}
if b < 4.2000000000000001e-293Initial program 72.0%
Taylor expanded in b around -inf
associate-*r*N/A
mul-1-negN/A
lift-neg.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6465.7
Applied rewrites65.7%
Taylor expanded in a around 0
lift-/.f6466.6
Applied rewrites66.6%
if 4.2000000000000001e-293 < b Initial program 32.0%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6468.0
Applied rewrites68.0%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6468.0
Applied rewrites68.0%
(FPCore (a b c) :precision binary64 (if (<= b 4.2e-293) (/ (* -0.6666666666666666 b) a) (/ (* -0.5 c) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 4.2e-293) {
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 <= 4.2d-293) 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 <= 4.2e-293) {
tmp = (-0.6666666666666666 * b) / a;
} else {
tmp = (-0.5 * c) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 4.2e-293: tmp = (-0.6666666666666666 * b) / a else: tmp = (-0.5 * c) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 4.2e-293) tmp = Float64(Float64(-0.6666666666666666 * b) / a); else tmp = Float64(Float64(-0.5 * c) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 4.2e-293) tmp = (-0.6666666666666666 * b) / a; else tmp = (-0.5 * c) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 4.2e-293], N[(N[(-0.6666666666666666 * b), $MachinePrecision] / a), $MachinePrecision], N[(N[(-0.5 * c), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 4.2 \cdot 10^{-293}:\\
\;\;\;\;\frac{-0.6666666666666666 \cdot b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b}\\
\end{array}
\end{array}
if b < 4.2000000000000001e-293Initial program 72.0%
Taylor expanded in b around -inf
lower-*.f64N/A
lower-/.f6466.6
Applied rewrites66.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6466.6
Applied rewrites66.6%
if 4.2000000000000001e-293 < b Initial program 32.0%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6468.0
Applied rewrites68.0%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6468.0
Applied rewrites68.0%
(FPCore (a b c) :precision binary64 (if (<= b 4.2e-293) (/ (* -0.6666666666666666 b) a) (* (/ c b) -0.5)))
double code(double a, double b, double c) {
double tmp;
if (b <= 4.2e-293) {
tmp = (-0.6666666666666666 * b) / a;
} else {
tmp = (c / b) * -0.5;
}
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 <= 4.2d-293) then
tmp = ((-0.6666666666666666d0) * b) / a
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 4.2e-293) {
tmp = (-0.6666666666666666 * b) / a;
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 4.2e-293: tmp = (-0.6666666666666666 * b) / a else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= 4.2e-293) tmp = Float64(Float64(-0.6666666666666666 * b) / a); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 4.2e-293) tmp = (-0.6666666666666666 * b) / a; else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 4.2e-293], N[(N[(-0.6666666666666666 * b), $MachinePrecision] / a), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 4.2 \cdot 10^{-293}:\\
\;\;\;\;\frac{-0.6666666666666666 \cdot b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < 4.2000000000000001e-293Initial program 72.0%
Taylor expanded in b around -inf
lower-*.f64N/A
lower-/.f6466.6
Applied rewrites66.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6466.6
Applied rewrites66.6%
if 4.2000000000000001e-293 < b Initial program 32.0%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6468.0
Applied rewrites68.0%
(FPCore (a b c) :precision binary64 (if (<= b 4.2e-293) (* -0.6666666666666666 (/ b a)) (* (/ c b) -0.5)))
double code(double a, double b, double c) {
double tmp;
if (b <= 4.2e-293) {
tmp = -0.6666666666666666 * (b / a);
} else {
tmp = (c / b) * -0.5;
}
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 <= 4.2d-293) then
tmp = (-0.6666666666666666d0) * (b / a)
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 4.2e-293) {
tmp = -0.6666666666666666 * (b / a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 4.2e-293: tmp = -0.6666666666666666 * (b / a) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= 4.2e-293) tmp = Float64(-0.6666666666666666 * Float64(b / a)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 4.2e-293) tmp = -0.6666666666666666 * (b / a); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 4.2e-293], N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 4.2 \cdot 10^{-293}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < 4.2000000000000001e-293Initial program 72.0%
Taylor expanded in b around -inf
lower-*.f64N/A
lower-/.f6466.6
Applied rewrites66.6%
if 4.2000000000000001e-293 < b Initial program 32.0%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6468.0
Applied rewrites68.0%
(FPCore (a b c) :precision binary64 (if (<= b 8.5e+84) (* -0.6666666666666666 (/ b a)) (* 0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 8.5e+84) {
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 <= 8.5d+84) 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 <= 8.5e+84) {
tmp = -0.6666666666666666 * (b / a);
} else {
tmp = 0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 8.5e+84: tmp = -0.6666666666666666 * (b / a) else: tmp = 0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 8.5e+84) 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 <= 8.5e+84) tmp = -0.6666666666666666 * (b / a); else tmp = 0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 8.5e+84], 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 8.5 \cdot 10^{+84}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < 8.5000000000000008e84Initial program 65.1%
Taylor expanded in b around -inf
lower-*.f64N/A
lower-/.f6444.7
Applied rewrites44.7%
if 8.5000000000000008e84 < b Initial program 9.5%
Taylor expanded in b around -inf
associate-*r*N/A
mul-1-negN/A
lift-neg.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f642.4
Applied rewrites2.4%
Taylor expanded in a around inf
lower-*.f64N/A
lower-/.f6434.9
Applied rewrites34.9%
(FPCore (a b c) :precision binary64 (* 0.5 (/ c b)))
double code(double a, double b, double c) {
return 0.5 * (c / b);
}
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.5d0 * (c / b)
end function
public static double code(double a, double b, double c) {
return 0.5 * (c / b);
}
def code(a, b, c): return 0.5 * (c / b)
function code(a, b, c) return Float64(0.5 * Float64(c / b)) end
function tmp = code(a, b, c) tmp = 0.5 * (c / b); end
code[a_, b_, c_] := N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot \frac{c}{b}
\end{array}
Initial program 52.1%
Taylor expanded in b around -inf
associate-*r*N/A
mul-1-negN/A
lift-neg.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6434.1
Applied rewrites34.1%
Taylor expanded in a around inf
lower-*.f64N/A
lower-/.f6411.0
Applied rewrites11.0%
herbie shell --seed 2025123
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))