
(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 17 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 -4e+145)
(/ (* (fma (* (/ c (* b b)) a) 1.5 -2.0) b) (* 3.0 a))
(if (<= b 2.25e-94)
(/ (/ (+ (sqrt (fma (* c a) -3.0 (* b b))) (- b)) 3.0) a)
(/ (* -0.5 c) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -4e+145) {
tmp = (fma(((c / (b * b)) * a), 1.5, -2.0) * b) / (3.0 * a);
} else if (b <= 2.25e-94) {
tmp = ((sqrt(fma((c * a), -3.0, (b * b))) + -b) / 3.0) / a;
} else {
tmp = (-0.5 * c) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -4e+145) tmp = Float64(Float64(fma(Float64(Float64(c / Float64(b * b)) * a), 1.5, -2.0) * b) / Float64(3.0 * a)); elseif (b <= 2.25e-94) tmp = Float64(Float64(Float64(sqrt(fma(Float64(c * a), -3.0, Float64(b * b))) + Float64(-b)) / 3.0) / a); else tmp = Float64(Float64(-0.5 * c) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -4e+145], N[(N[(N[(N[(N[(c / N[(b * b), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision] * 1.5 + -2.0), $MachinePrecision] * b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.25e-94], N[(N[(N[(N[Sqrt[N[(N[(c * a), $MachinePrecision] * -3.0 + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + (-b)), $MachinePrecision] / 3.0), $MachinePrecision] / a), $MachinePrecision], N[(N[(-0.5 * c), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -4 \cdot 10^{+145}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{c}{b \cdot b} \cdot a, 1.5, -2\right) \cdot b}{3 \cdot a}\\
\mathbf{elif}\;b \leq 2.25 \cdot 10^{-94}:\\
\;\;\;\;\frac{\frac{\sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)} + \left(-b\right)}{3}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b}\\
\end{array}
\end{array}
if b < -4e145Initial program 44.6%
Taylor expanded in b around -inf
associate-*r*N/A
mul-1-negN/A
lift-neg.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6497.0
Applied rewrites97.0%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
negate-subN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
associate-*r/N/A
pow2N/A
*-commutativeN/A
pow2N/A
lower-*.f64N/A
pow2N/A
lift-/.f64N/A
lift-*.f6497.0
Applied rewrites97.0%
if -4e145 < b < 2.2500000000000001e-94Initial program 83.1%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-neg.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites83.1%
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
pow2N/A
lower-fma.f64N/A
*-commutativeN/A
lift-*.f64N/A
pow2N/A
lift-*.f6483.1
Applied rewrites83.1%
if 2.2500000000000001e-94 < b Initial program 19.7%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-neg.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites19.7%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6483.9
Applied rewrites83.9%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6483.9
Applied rewrites83.9%
(FPCore (a b c)
:precision binary64
(if (<= b -4e+145)
(/ (fma 1.5 (* a (/ c b)) (* -2.0 b)) (* 3.0 a))
(if (<= b 2.25e-94)
(/ (/ (+ (sqrt (fma (* c a) -3.0 (* b b))) (- b)) 3.0) a)
(/ (* -0.5 c) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -4e+145) {
tmp = fma(1.5, (a * (c / b)), (-2.0 * b)) / (3.0 * a);
} else if (b <= 2.25e-94) {
tmp = ((sqrt(fma((c * a), -3.0, (b * b))) + -b) / 3.0) / a;
} else {
tmp = (-0.5 * c) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -4e+145) tmp = Float64(fma(1.5, Float64(a * Float64(c / b)), Float64(-2.0 * b)) / Float64(3.0 * a)); elseif (b <= 2.25e-94) tmp = Float64(Float64(Float64(sqrt(fma(Float64(c * a), -3.0, Float64(b * b))) + Float64(-b)) / 3.0) / a); else tmp = Float64(Float64(-0.5 * c) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -4e+145], N[(N[(1.5 * N[(a * N[(c / b), $MachinePrecision]), $MachinePrecision] + N[(-2.0 * b), $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.25e-94], N[(N[(N[(N[Sqrt[N[(N[(c * a), $MachinePrecision] * -3.0 + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + (-b)), $MachinePrecision] / 3.0), $MachinePrecision] / a), $MachinePrecision], N[(N[(-0.5 * c), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -4 \cdot 10^{+145}:\\
\;\;\;\;\frac{\mathsf{fma}\left(1.5, a \cdot \frac{c}{b}, -2 \cdot b\right)}{3 \cdot a}\\
\mathbf{elif}\;b \leq 2.25 \cdot 10^{-94}:\\
\;\;\;\;\frac{\frac{\sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)} + \left(-b\right)}{3}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b}\\
\end{array}
\end{array}
if b < -4e145Initial program 44.6%
Taylor expanded in b around -inf
associate-*r*N/A
mul-1-negN/A
lift-neg.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6497.0
Applied rewrites97.0%
Taylor expanded in a around 0
+-commutativeN/A
lower-fma.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-/.f64N/A
lower-*.f6497.2
Applied rewrites97.2%
if -4e145 < b < 2.2500000000000001e-94Initial program 83.1%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-neg.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites83.1%
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
pow2N/A
lower-fma.f64N/A
*-commutativeN/A
lift-*.f64N/A
pow2N/A
lift-*.f6483.1
Applied rewrites83.1%
if 2.2500000000000001e-94 < b Initial program 19.7%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-neg.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites19.7%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6483.9
Applied rewrites83.9%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6483.9
Applied rewrites83.9%
(FPCore (a b c)
:precision binary64
(if (<= b -4e+145)
(/ (fma 1.5 (* a (/ c b)) (* -2.0 b)) (* 3.0 a))
(if (<= b 5.6e-74)
(/ (/ (- (sqrt (fma b b (* (* a -3.0) c))) b) 3.0) a)
(/ (* -0.5 c) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -4e+145) {
tmp = fma(1.5, (a * (c / b)), (-2.0 * b)) / (3.0 * a);
} else if (b <= 5.6e-74) {
tmp = ((sqrt(fma(b, b, ((a * -3.0) * c))) - b) / 3.0) / a;
} else {
tmp = (-0.5 * c) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -4e+145) tmp = Float64(fma(1.5, Float64(a * Float64(c / b)), Float64(-2.0 * b)) / Float64(3.0 * a)); elseif (b <= 5.6e-74) tmp = Float64(Float64(Float64(sqrt(fma(b, b, Float64(Float64(a * -3.0) * c))) - b) / 3.0) / a); else tmp = Float64(Float64(-0.5 * c) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -4e+145], N[(N[(1.5 * N[(a * N[(c / b), $MachinePrecision]), $MachinePrecision] + N[(-2.0 * b), $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 5.6e-74], N[(N[(N[(N[Sqrt[N[(b * b + N[(N[(a * -3.0), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / 3.0), $MachinePrecision] / a), $MachinePrecision], N[(N[(-0.5 * c), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -4 \cdot 10^{+145}:\\
\;\;\;\;\frac{\mathsf{fma}\left(1.5, a \cdot \frac{c}{b}, -2 \cdot b\right)}{3 \cdot a}\\
\mathbf{elif}\;b \leq 5.6 \cdot 10^{-74}:\\
\;\;\;\;\frac{\frac{\sqrt{\mathsf{fma}\left(b, b, \left(a \cdot -3\right) \cdot c\right)} - b}{3}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b}\\
\end{array}
\end{array}
if b < -4e145Initial program 44.6%
Taylor expanded in b around -inf
associate-*r*N/A
mul-1-negN/A
lift-neg.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6497.0
Applied rewrites97.0%
Taylor expanded in a around 0
+-commutativeN/A
lower-fma.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-/.f64N/A
lower-*.f6497.2
Applied rewrites97.2%
if -4e145 < b < 5.59999999999999976e-74Initial program 82.2%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-neg.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites82.1%
Applied rewrites82.1%
if 5.59999999999999976e-74 < b Initial program 18.6%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-neg.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites18.6%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6485.3
Applied rewrites85.3%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6485.4
Applied rewrites85.4%
(FPCore (a b c)
:precision binary64
(if (<= b -1e+153)
(/ (fma 1.5 (* a (/ c b)) (* -2.0 b)) (* 3.0 a))
(if (<= b 5.6e-74)
(/ (- (sqrt (fma b b (* (* a -3.0) c))) b) (* 3.0 a))
(/ (* -0.5 c) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1e+153) {
tmp = fma(1.5, (a * (c / b)), (-2.0 * b)) / (3.0 * a);
} else if (b <= 5.6e-74) {
tmp = (sqrt(fma(b, b, ((a * -3.0) * c))) - b) / (3.0 * a);
} else {
tmp = (-0.5 * c) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -1e+153) tmp = Float64(fma(1.5, Float64(a * Float64(c / b)), Float64(-2.0 * b)) / Float64(3.0 * a)); elseif (b <= 5.6e-74) tmp = Float64(Float64(sqrt(fma(b, b, Float64(Float64(a * -3.0) * c))) - b) / Float64(3.0 * a)); else tmp = Float64(Float64(-0.5 * c) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -1e+153], N[(N[(1.5 * N[(a * N[(c / b), $MachinePrecision]), $MachinePrecision] + N[(-2.0 * b), $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 5.6e-74], N[(N[(N[Sqrt[N[(b * b + N[(N[(a * -3.0), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 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 -1 \cdot 10^{+153}:\\
\;\;\;\;\frac{\mathsf{fma}\left(1.5, a \cdot \frac{c}{b}, -2 \cdot b\right)}{3 \cdot a}\\
\mathbf{elif}\;b \leq 5.6 \cdot 10^{-74}:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, \left(a \cdot -3\right) \cdot c\right)} - b}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b}\\
\end{array}
\end{array}
if b < -1e153Initial program 42.0%
Taylor expanded in b around -inf
associate-*r*N/A
mul-1-negN/A
lift-neg.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6497.1
Applied rewrites97.1%
Taylor expanded in a around 0
+-commutativeN/A
lower-fma.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-/.f64N/A
lower-*.f6497.3
Applied rewrites97.3%
if -1e153 < b < 5.59999999999999976e-74Initial program 82.4%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-neg.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites82.4%
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-/l/N/A
lower-/.f64N/A
Applied rewrites82.4%
if 5.59999999999999976e-74 < b Initial program 18.6%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-neg.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites18.6%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6485.3
Applied rewrites85.3%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6485.4
Applied rewrites85.4%
(FPCore (a b c)
:precision binary64
(if (<= b -4.5e-37)
(/ (fma 1.5 (* a (/ c b)) (* -2.0 b)) (* 3.0 a))
(if (<= b 2.25e-94)
(/ (+ (sqrt (* (* a -3.0) c)) (- b)) (* 3.0 a))
(/ (* -0.5 c) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -4.5e-37) {
tmp = fma(1.5, (a * (c / b)), (-2.0 * b)) / (3.0 * a);
} else if (b <= 2.25e-94) {
tmp = (sqrt(((a * -3.0) * c)) + -b) / (3.0 * a);
} else {
tmp = (-0.5 * c) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -4.5e-37) tmp = Float64(fma(1.5, Float64(a * Float64(c / b)), Float64(-2.0 * b)) / Float64(3.0 * a)); elseif (b <= 2.25e-94) tmp = Float64(Float64(sqrt(Float64(Float64(a * -3.0) * c)) + Float64(-b)) / Float64(3.0 * a)); else tmp = Float64(Float64(-0.5 * c) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -4.5e-37], N[(N[(1.5 * N[(a * N[(c / b), $MachinePrecision]), $MachinePrecision] + N[(-2.0 * b), $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.25e-94], N[(N[(N[Sqrt[N[(N[(a * -3.0), $MachinePrecision] * c), $MachinePrecision]], $MachinePrecision] + (-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.5 \cdot 10^{-37}:\\
\;\;\;\;\frac{\mathsf{fma}\left(1.5, a \cdot \frac{c}{b}, -2 \cdot b\right)}{3 \cdot a}\\
\mathbf{elif}\;b \leq 2.25 \cdot 10^{-94}:\\
\;\;\;\;\frac{\sqrt{\left(a \cdot -3\right) \cdot c} + \left(-b\right)}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b}\\
\end{array}
\end{array}
if b < -4.5000000000000004e-37Initial program 67.4%
Taylor expanded in b around -inf
associate-*r*N/A
mul-1-negN/A
lift-neg.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6488.6
Applied rewrites88.6%
Taylor expanded in a around 0
+-commutativeN/A
lower-fma.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-/.f64N/A
lower-*.f6488.7
Applied rewrites88.7%
if -4.5000000000000004e-37 < b < 2.2500000000000001e-94Initial program 78.2%
Taylor expanded in a around inf
sqrt-unprodN/A
*-commutativeN/A
lower-sqrt.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6466.6
Applied rewrites66.6%
Taylor expanded in b around 0
mul-1-negN/A
lift-neg.f64N/A
+-commutativeN/A
lower-+.f64N/A
sqrt-unprodN/A
*-commutativeN/A
associate-*r*N/A
lower-sqrt.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6468.5
Applied rewrites68.5%
if 2.2500000000000001e-94 < b Initial program 19.7%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-neg.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites19.7%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6483.9
Applied rewrites83.9%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6483.9
Applied rewrites83.9%
(FPCore (a b c)
:precision binary64
(if (<= b -4.5e-37)
(* (- b) (fma (/ c (* b b)) -0.5 (/ 0.6666666666666666 a)))
(if (<= b 2.25e-94)
(/ (+ (sqrt (* (* a -3.0) c)) (- b)) (* 3.0 a))
(/ (* -0.5 c) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -4.5e-37) {
tmp = -b * fma((c / (b * b)), -0.5, (0.6666666666666666 / a));
} else if (b <= 2.25e-94) {
tmp = (sqrt(((a * -3.0) * c)) + -b) / (3.0 * a);
} else {
tmp = (-0.5 * c) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -4.5e-37) tmp = Float64(Float64(-b) * fma(Float64(c / Float64(b * b)), -0.5, Float64(0.6666666666666666 / a))); elseif (b <= 2.25e-94) tmp = Float64(Float64(sqrt(Float64(Float64(a * -3.0) * c)) + Float64(-b)) / Float64(3.0 * a)); else tmp = Float64(Float64(-0.5 * c) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -4.5e-37], N[((-b) * N[(N[(c / N[(b * b), $MachinePrecision]), $MachinePrecision] * -0.5 + N[(0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.25e-94], N[(N[(N[Sqrt[N[(N[(a * -3.0), $MachinePrecision] * c), $MachinePrecision]], $MachinePrecision] + (-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.5 \cdot 10^{-37}:\\
\;\;\;\;\left(-b\right) \cdot \mathsf{fma}\left(\frac{c}{b \cdot b}, -0.5, \frac{0.6666666666666666}{a}\right)\\
\mathbf{elif}\;b \leq 2.25 \cdot 10^{-94}:\\
\;\;\;\;\frac{\sqrt{\left(a \cdot -3\right) \cdot c} + \left(-b\right)}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b}\\
\end{array}
\end{array}
if b < -4.5000000000000004e-37Initial program 67.4%
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-/.f6488.5
Applied rewrites88.5%
if -4.5000000000000004e-37 < b < 2.2500000000000001e-94Initial program 78.2%
Taylor expanded in a around inf
sqrt-unprodN/A
*-commutativeN/A
lower-sqrt.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6466.6
Applied rewrites66.6%
Taylor expanded in b around 0
mul-1-negN/A
lift-neg.f64N/A
+-commutativeN/A
lower-+.f64N/A
sqrt-unprodN/A
*-commutativeN/A
associate-*r*N/A
lower-sqrt.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6468.5
Applied rewrites68.5%
if 2.2500000000000001e-94 < b Initial program 19.7%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-neg.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites19.7%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6483.9
Applied rewrites83.9%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6483.9
Applied rewrites83.9%
(FPCore (a b c)
:precision binary64
(if (<= b -5.8e-37)
(/ (/ (* -2.0 b) 3.0) a)
(if (<= b 2.25e-94)
(/ (+ (sqrt (* (* a -3.0) c)) (- b)) (* 3.0 a))
(/ (* -0.5 c) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -5.8e-37) {
tmp = ((-2.0 * b) / 3.0) / a;
} else if (b <= 2.25e-94) {
tmp = (sqrt(((a * -3.0) * c)) + -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 <= (-5.8d-37)) then
tmp = (((-2.0d0) * b) / 3.0d0) / a
else if (b <= 2.25d-94) then
tmp = (sqrt(((a * (-3.0d0)) * c)) + -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 <= -5.8e-37) {
tmp = ((-2.0 * b) / 3.0) / a;
} else if (b <= 2.25e-94) {
tmp = (Math.sqrt(((a * -3.0) * c)) + -b) / (3.0 * a);
} else {
tmp = (-0.5 * c) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5.8e-37: tmp = ((-2.0 * b) / 3.0) / a elif b <= 2.25e-94: tmp = (math.sqrt(((a * -3.0) * c)) + -b) / (3.0 * a) else: tmp = (-0.5 * c) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5.8e-37) tmp = Float64(Float64(Float64(-2.0 * b) / 3.0) / a); elseif (b <= 2.25e-94) tmp = Float64(Float64(sqrt(Float64(Float64(a * -3.0) * c)) + Float64(-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 <= -5.8e-37) tmp = ((-2.0 * b) / 3.0) / a; elseif (b <= 2.25e-94) tmp = (sqrt(((a * -3.0) * c)) + -b) / (3.0 * a); else tmp = (-0.5 * c) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5.8e-37], N[(N[(N[(-2.0 * b), $MachinePrecision] / 3.0), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 2.25e-94], N[(N[(N[Sqrt[N[(N[(a * -3.0), $MachinePrecision] * c), $MachinePrecision]], $MachinePrecision] + (-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 -5.8 \cdot 10^{-37}:\\
\;\;\;\;\frac{\frac{-2 \cdot b}{3}}{a}\\
\mathbf{elif}\;b \leq 2.25 \cdot 10^{-94}:\\
\;\;\;\;\frac{\sqrt{\left(a \cdot -3\right) \cdot c} + \left(-b\right)}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b}\\
\end{array}
\end{array}
if b < -5.80000000000000009e-37Initial program 67.4%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-neg.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites67.5%
Taylor expanded in b around -inf
lower-*.f6488.4
Applied rewrites88.4%
if -5.80000000000000009e-37 < b < 2.2500000000000001e-94Initial program 78.2%
Taylor expanded in a around inf
sqrt-unprodN/A
*-commutativeN/A
lower-sqrt.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6466.6
Applied rewrites66.6%
Taylor expanded in b around 0
mul-1-negN/A
lift-neg.f64N/A
+-commutativeN/A
lower-+.f64N/A
sqrt-unprodN/A
*-commutativeN/A
associate-*r*N/A
lower-sqrt.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6468.5
Applied rewrites68.5%
if 2.2500000000000001e-94 < b Initial program 19.7%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-neg.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites19.7%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6483.9
Applied rewrites83.9%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6483.9
Applied rewrites83.9%
(FPCore (a b c)
:precision binary64
(if (<= b -5.8e-37)
(/ (/ (* -2.0 b) 3.0) a)
(if (<= b 2.25e-94)
(/ (/ (- (sqrt (* (* c a) -3.0)) b) 3.0) a)
(/ (* -0.5 c) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -5.8e-37) {
tmp = ((-2.0 * b) / 3.0) / a;
} else if (b <= 2.25e-94) {
tmp = ((sqrt(((c * a) * -3.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 <= (-5.8d-37)) then
tmp = (((-2.0d0) * b) / 3.0d0) / a
else if (b <= 2.25d-94) then
tmp = ((sqrt(((c * a) * (-3.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 <= -5.8e-37) {
tmp = ((-2.0 * b) / 3.0) / a;
} else if (b <= 2.25e-94) {
tmp = ((Math.sqrt(((c * a) * -3.0)) - b) / 3.0) / a;
} else {
tmp = (-0.5 * c) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5.8e-37: tmp = ((-2.0 * b) / 3.0) / a elif b <= 2.25e-94: tmp = ((math.sqrt(((c * a) * -3.0)) - b) / 3.0) / a else: tmp = (-0.5 * c) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5.8e-37) tmp = Float64(Float64(Float64(-2.0 * b) / 3.0) / a); elseif (b <= 2.25e-94) tmp = Float64(Float64(Float64(sqrt(Float64(Float64(c * a) * -3.0)) - b) / 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 <= -5.8e-37) tmp = ((-2.0 * b) / 3.0) / a; elseif (b <= 2.25e-94) tmp = ((sqrt(((c * a) * -3.0)) - b) / 3.0) / a; else tmp = (-0.5 * c) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5.8e-37], N[(N[(N[(-2.0 * b), $MachinePrecision] / 3.0), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 2.25e-94], N[(N[(N[(N[Sqrt[N[(N[(c * a), $MachinePrecision] * -3.0), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / 3.0), $MachinePrecision] / a), $MachinePrecision], N[(N[(-0.5 * c), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5.8 \cdot 10^{-37}:\\
\;\;\;\;\frac{\frac{-2 \cdot b}{3}}{a}\\
\mathbf{elif}\;b \leq 2.25 \cdot 10^{-94}:\\
\;\;\;\;\frac{\frac{\sqrt{\left(c \cdot a\right) \cdot -3} - b}{3}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b}\\
\end{array}
\end{array}
if b < -5.80000000000000009e-37Initial program 67.4%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-neg.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites67.5%
Taylor expanded in b around -inf
lower-*.f6488.4
Applied rewrites88.4%
if -5.80000000000000009e-37 < b < 2.2500000000000001e-94Initial program 78.2%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-neg.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites78.1%
Applied rewrites78.1%
Taylor expanded in a around inf
sqrt-prodN/A
lift-*.f64N/A
lift-*.f64N/A
lift-sqrt.f6468.4
lift-*.f64N/A
*-commutativeN/A
lift-*.f6468.4
Applied rewrites68.4%
if 2.2500000000000001e-94 < b Initial program 19.7%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-neg.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites19.7%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6483.9
Applied rewrites83.9%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6483.9
Applied rewrites83.9%
(FPCore (a b c)
:precision binary64
(if (<= b -1.08e-38)
(/ (/ (* -2.0 b) 3.0) a)
(if (<= b 2.25e-94)
(/ (sqrt (* -3.0 (* c a))) (* 3.0 a))
(/ (* -0.5 c) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.08e-38) {
tmp = ((-2.0 * b) / 3.0) / a;
} else if (b <= 2.25e-94) {
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 <= (-1.08d-38)) then
tmp = (((-2.0d0) * b) / 3.0d0) / a
else if (b <= 2.25d-94) 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 <= -1.08e-38) {
tmp = ((-2.0 * b) / 3.0) / a;
} else if (b <= 2.25e-94) {
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 <= -1.08e-38: tmp = ((-2.0 * b) / 3.0) / a elif b <= 2.25e-94: 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 <= -1.08e-38) tmp = Float64(Float64(Float64(-2.0 * b) / 3.0) / a); elseif (b <= 2.25e-94) 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 <= -1.08e-38) tmp = ((-2.0 * b) / 3.0) / a; elseif (b <= 2.25e-94) 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, -1.08e-38], N[(N[(N[(-2.0 * b), $MachinePrecision] / 3.0), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 2.25e-94], 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 -1.08 \cdot 10^{-38}:\\
\;\;\;\;\frac{\frac{-2 \cdot b}{3}}{a}\\
\mathbf{elif}\;b \leq 2.25 \cdot 10^{-94}:\\
\;\;\;\;\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 < -1.08e-38Initial program 67.6%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-neg.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites67.6%
Taylor expanded in b around -inf
lower-*.f6488.3
Applied rewrites88.3%
if -1.08e-38 < b < 2.2500000000000001e-94Initial program 78.1%
Taylor expanded in a around inf
sqrt-unprodN/A
*-commutativeN/A
lower-sqrt.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6466.8
Applied rewrites66.8%
if 2.2500000000000001e-94 < b Initial program 19.7%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-neg.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites19.7%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6483.9
Applied rewrites83.9%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6483.9
Applied rewrites83.9%
(FPCore (a b c)
:precision binary64
(if (<= b -4e-171)
(/ (/ (* -2.0 b) 3.0) a)
(if (<= b 2.1e-143)
(* (sqrt (* (/ c a) -3.0)) 0.3333333333333333)
(/ (* -0.5 c) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -4e-171) {
tmp = ((-2.0 * b) / 3.0) / a;
} else if (b <= 2.1e-143) {
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 <= (-4d-171)) then
tmp = (((-2.0d0) * b) / 3.0d0) / a
else if (b <= 2.1d-143) 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 <= -4e-171) {
tmp = ((-2.0 * b) / 3.0) / a;
} else if (b <= 2.1e-143) {
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 <= -4e-171: tmp = ((-2.0 * b) / 3.0) / a elif b <= 2.1e-143: 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 <= -4e-171) tmp = Float64(Float64(Float64(-2.0 * b) / 3.0) / a); elseif (b <= 2.1e-143) 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 <= -4e-171) tmp = ((-2.0 * b) / 3.0) / a; elseif (b <= 2.1e-143) 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, -4e-171], N[(N[(N[(-2.0 * b), $MachinePrecision] / 3.0), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 2.1e-143], 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 -4 \cdot 10^{-171}:\\
\;\;\;\;\frac{\frac{-2 \cdot b}{3}}{a}\\
\mathbf{elif}\;b \leq 2.1 \cdot 10^{-143}:\\
\;\;\;\;\sqrt{\frac{c}{a} \cdot -3} \cdot 0.3333333333333333\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b}\\
\end{array}
\end{array}
if b < -3.9999999999999999e-171Initial program 72.5%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-neg.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites72.5%
Taylor expanded in b around -inf
lower-*.f6477.6
Applied rewrites77.6%
if -3.9999999999999999e-171 < b < 2.1000000000000001e-143Initial program 74.3%
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-/.f6437.1
Applied rewrites37.1%
if 2.1000000000000001e-143 < b Initial program 22.8%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-neg.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites22.8%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6480.4
Applied rewrites80.4%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6480.4
Applied rewrites80.4%
(FPCore (a b c)
:precision binary64
(if (<= b -1.1e-70)
(/ (/ (* -2.0 b) 3.0) a)
(if (<= b 9.8e-130)
(* (sqrt (* (/ c a) -3.0)) -0.3333333333333333)
(/ (* -0.5 c) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.1e-70) {
tmp = ((-2.0 * b) / 3.0) / a;
} else if (b <= 9.8e-130) {
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 <= (-1.1d-70)) then
tmp = (((-2.0d0) * b) / 3.0d0) / a
else if (b <= 9.8d-130) 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 <= -1.1e-70) {
tmp = ((-2.0 * b) / 3.0) / a;
} else if (b <= 9.8e-130) {
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 <= -1.1e-70: tmp = ((-2.0 * b) / 3.0) / a elif b <= 9.8e-130: 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 <= -1.1e-70) tmp = Float64(Float64(Float64(-2.0 * b) / 3.0) / a); elseif (b <= 9.8e-130) 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 <= -1.1e-70) tmp = ((-2.0 * b) / 3.0) / a; elseif (b <= 9.8e-130) 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, -1.1e-70], N[(N[(N[(-2.0 * b), $MachinePrecision] / 3.0), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 9.8e-130], 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 -1.1 \cdot 10^{-70}:\\
\;\;\;\;\frac{\frac{-2 \cdot b}{3}}{a}\\
\mathbf{elif}\;b \leq 9.8 \cdot 10^{-130}:\\
\;\;\;\;\sqrt{\frac{c}{a} \cdot -3} \cdot -0.3333333333333333\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b}\\
\end{array}
\end{array}
if b < -1.0999999999999999e-70Initial program 69.2%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-neg.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites69.2%
Taylor expanded in b around -inf
lower-*.f6485.4
Applied rewrites85.4%
if -1.0999999999999999e-70 < b < 9.80000000000000036e-130Initial program 78.3%
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-/.f6432.6
Applied rewrites32.6%
if 9.80000000000000036e-130 < b Initial program 21.8%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-neg.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites21.8%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6481.5
Applied rewrites81.5%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6481.5
Applied rewrites81.5%
(FPCore (a b c) :precision binary64 (if (<= b 2.5e-281) (/ (/ (* -2.0 b) 3.0) a) (/ (* -0.5 c) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 2.5e-281) {
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 <= 2.5d-281) 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 <= 2.5e-281) {
tmp = ((-2.0 * b) / 3.0) / a;
} else {
tmp = (-0.5 * c) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 2.5e-281: 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 <= 2.5e-281) tmp = Float64(Float64(Float64(-2.0 * b) / 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.5e-281) 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, 2.5e-281], N[(N[(N[(-2.0 * b), $MachinePrecision] / 3.0), $MachinePrecision] / a), $MachinePrecision], N[(N[(-0.5 * c), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.5 \cdot 10^{-281}:\\
\;\;\;\;\frac{\frac{-2 \cdot b}{3}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b}\\
\end{array}
\end{array}
if b < 2.4999999999999999e-281Initial program 72.6%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-neg.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites72.6%
Taylor expanded in b around -inf
lower-*.f6465.0
Applied rewrites65.0%
if 2.4999999999999999e-281 < b Initial program 31.3%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-neg.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites31.3%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6469.4
Applied rewrites69.4%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6469.5
Applied rewrites69.5%
(FPCore (a b c) :precision binary64 (if (<= b 2.5e-281) (/ (* -2.0 b) (* 3.0 a)) (/ (* -0.5 c) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 2.5e-281) {
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 <= 2.5d-281) 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 <= 2.5e-281) {
tmp = (-2.0 * b) / (3.0 * a);
} else {
tmp = (-0.5 * c) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 2.5e-281: 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 <= 2.5e-281) 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 <= 2.5e-281) 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, 2.5e-281], 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 2.5 \cdot 10^{-281}:\\
\;\;\;\;\frac{-2 \cdot b}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b}\\
\end{array}
\end{array}
if b < 2.4999999999999999e-281Initial program 72.6%
Taylor expanded in b around -inf
lower-*.f6465.0
Applied rewrites65.0%
if 2.4999999999999999e-281 < b Initial program 31.3%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-neg.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites31.3%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6469.4
Applied rewrites69.4%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6469.5
Applied rewrites69.5%
(FPCore (a b c) :precision binary64 (if (<= b 2.5e-281) (/ (* -0.6666666666666666 b) a) (/ (* -0.5 c) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 2.5e-281) {
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 <= 2.5d-281) 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 <= 2.5e-281) {
tmp = (-0.6666666666666666 * b) / a;
} else {
tmp = (-0.5 * c) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 2.5e-281: tmp = (-0.6666666666666666 * b) / a else: tmp = (-0.5 * c) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 2.5e-281) 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 <= 2.5e-281) tmp = (-0.6666666666666666 * b) / a; else tmp = (-0.5 * c) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 2.5e-281], 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 2.5 \cdot 10^{-281}:\\
\;\;\;\;\frac{-0.6666666666666666 \cdot b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b}\\
\end{array}
\end{array}
if b < 2.4999999999999999e-281Initial program 72.6%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-neg.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites72.6%
Taylor expanded in b around -inf
lower-*.f6464.9
Applied rewrites64.9%
if 2.4999999999999999e-281 < b Initial program 31.3%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-neg.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites31.3%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6469.4
Applied rewrites69.4%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6469.5
Applied rewrites69.5%
(FPCore (a b c) :precision binary64 (if (<= b 2.5e-281) (* -0.6666666666666666 (/ b a)) (/ (* -0.5 c) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 2.5e-281) {
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 <= 2.5d-281) 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 <= 2.5e-281) {
tmp = -0.6666666666666666 * (b / a);
} else {
tmp = (-0.5 * c) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 2.5e-281: tmp = -0.6666666666666666 * (b / a) else: tmp = (-0.5 * c) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 2.5e-281) tmp = Float64(-0.6666666666666666 * Float64(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 <= 2.5e-281) tmp = -0.6666666666666666 * (b / a); else tmp = (-0.5 * c) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 2.5e-281], N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision], N[(N[(-0.5 * c), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.5 \cdot 10^{-281}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b}\\
\end{array}
\end{array}
if b < 2.4999999999999999e-281Initial program 72.6%
Taylor expanded in b around -inf
lower-*.f64N/A
lower-/.f6464.9
Applied rewrites64.9%
if 2.4999999999999999e-281 < b Initial program 31.3%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-neg.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites31.3%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6469.4
Applied rewrites69.4%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6469.5
Applied rewrites69.5%
(FPCore (a b c) :precision binary64 (if (<= b 2.5e-281) (* -0.6666666666666666 (/ b a)) (* (/ c b) -0.5)))
double code(double a, double b, double c) {
double tmp;
if (b <= 2.5e-281) {
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 <= 2.5d-281) 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 <= 2.5e-281) {
tmp = -0.6666666666666666 * (b / a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 2.5e-281: tmp = -0.6666666666666666 * (b / a) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= 2.5e-281) 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 <= 2.5e-281) tmp = -0.6666666666666666 * (b / a); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 2.5e-281], 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 2.5 \cdot 10^{-281}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < 2.4999999999999999e-281Initial program 72.6%
Taylor expanded in b around -inf
lower-*.f64N/A
lower-/.f6464.9
Applied rewrites64.9%
if 2.4999999999999999e-281 < b Initial program 31.3%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6469.4
Applied rewrites69.4%
(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.6%
Taylor expanded in b around -inf
lower-*.f64N/A
lower-/.f6434.7
Applied rewrites34.7%
herbie shell --seed 2025110
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))