
(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]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
Herbie found 18 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]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
(FPCore (a b c)
:precision binary64
(let* ((t_0
(fma
(/ (fma (/ (* -0.375 c) b) (/ a b) -0.5) (fabs b))
c
(* (/ (- (fabs b) b) a) 0.3333333333333333)))
(t_1 (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a))))
(if (<= t_1 (- INFINITY))
t_0
(if (<= t_1 -1e-222)
(/ (+ (- b) (sqrt (fma (* -3.0 a) c (* b b)))) (* 3.0 a))
(if (<= t_1 0.0)
(* -0.5 (/ c b))
(if (<= t_1 1e+289)
(/ (/ (- (sqrt (fma (* c -3.0) a (* b b))) b) a) 3.0)
t_0))))))double code(double a, double b, double c) {
double t_0 = fma((fma(((-0.375 * c) / b), (a / b), -0.5) / fabs(b)), c, (((fabs(b) - b) / a) * 0.3333333333333333));
double t_1 = (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = t_0;
} else if (t_1 <= -1e-222) {
tmp = (-b + sqrt(fma((-3.0 * a), c, (b * b)))) / (3.0 * a);
} else if (t_1 <= 0.0) {
tmp = -0.5 * (c / b);
} else if (t_1 <= 1e+289) {
tmp = ((sqrt(fma((c * -3.0), a, (b * b))) - b) / a) / 3.0;
} else {
tmp = t_0;
}
return tmp;
}
function code(a, b, c) t_0 = fma(Float64(fma(Float64(Float64(-0.375 * c) / b), Float64(a / b), -0.5) / abs(b)), c, Float64(Float64(Float64(abs(b) - b) / a) * 0.3333333333333333)) t_1 = Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c)))) / Float64(3.0 * a)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = t_0; elseif (t_1 <= -1e-222) tmp = Float64(Float64(Float64(-b) + sqrt(fma(Float64(-3.0 * a), c, Float64(b * b)))) / Float64(3.0 * a)); elseif (t_1 <= 0.0) tmp = Float64(-0.5 * Float64(c / b)); elseif (t_1 <= 1e+289) tmp = Float64(Float64(Float64(sqrt(fma(Float64(c * -3.0), a, Float64(b * b))) - b) / a) / 3.0); else tmp = t_0; end return tmp end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(N[(N[(N[(-0.375 * c), $MachinePrecision] / b), $MachinePrecision] * N[(a / b), $MachinePrecision] + -0.5), $MachinePrecision] / N[Abs[b], $MachinePrecision]), $MachinePrecision] * c + N[(N[(N[(N[Abs[b], $MachinePrecision] - b), $MachinePrecision] / a), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = 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]}, If[LessEqual[t$95$1, (-Infinity)], t$95$0, If[LessEqual[t$95$1, -1e-222], N[(N[((-b) + N[Sqrt[N[(N[(-3.0 * a), $MachinePrecision] * c + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+289], N[(N[(N[(N[Sqrt[N[(N[(c * -3.0), $MachinePrecision] * a + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / a), $MachinePrecision] / 3.0), $MachinePrecision], t$95$0]]]]]]
\begin{array}{l}
t_0 := \mathsf{fma}\left(\frac{\mathsf{fma}\left(\frac{-0.375 \cdot c}{b}, \frac{a}{b}, -0.5\right)}{\left|b\right|}, c, \frac{\left|b\right| - b}{a} \cdot 0.3333333333333333\right)\\
t_1 := \frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq -1 \cdot 10^{-222}:\\
\;\;\;\;\frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(-3 \cdot a, c, b \cdot b\right)}}{3 \cdot a}\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\mathbf{elif}\;t\_1 \leq 10^{+289}:\\
\;\;\;\;\frac{\frac{\sqrt{\mathsf{fma}\left(c \cdot -3, a, b \cdot b\right)} - b}{a}}{3}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 3 binary64) a) c)))) (*.f64 #s(literal 3 binary64) a)) < -inf.0 or 1.0000000000000001e289 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 3 binary64) a) c)))) (*.f64 #s(literal 3 binary64) a)) Initial program 52.0%
Taylor expanded in c around 0
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower--.f64N/A
Applied rewrites37.7%
lift-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites66.1%
if -inf.0 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 3 binary64) a) c)))) (*.f64 #s(literal 3 binary64) a)) < -1e-222Initial program 52.0%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval52.0%
Applied rewrites52.0%
if -1e-222 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 3 binary64) a) c)))) (*.f64 #s(literal 3 binary64) a)) < 0.0Initial program 52.0%
Taylor expanded in b around inf
lower-*.f64N/A
lower-/.f6435.2%
Applied rewrites35.2%
if 0.0 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 3 binary64) a) c)))) (*.f64 #s(literal 3 binary64) a)) < 1.0000000000000001e289Initial program 52.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites52.0%
(FPCore (a b c)
:precision binary64
(if (<= b -1.5e+55)
(/ (/ b a) -1.5)
(if (<= b 5.4e-54)
(/ (+ (- b) (sqrt (fma (* -3.0 a) c (* b b)))) (* 3.0 a))
(* -0.5 (/ c b)))))double code(double a, double b, double c) {
double tmp;
if (b <= -1.5e+55) {
tmp = (b / a) / -1.5;
} else if (b <= 5.4e-54) {
tmp = (-b + sqrt(fma((-3.0 * a), c, (b * b)))) / (3.0 * a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -1.5e+55) tmp = Float64(Float64(b / a) / -1.5); elseif (b <= 5.4e-54) tmp = Float64(Float64(Float64(-b) + sqrt(fma(Float64(-3.0 * a), c, Float64(b * b)))) / Float64(3.0 * a)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -1.5e+55], N[(N[(b / a), $MachinePrecision] / -1.5), $MachinePrecision], If[LessEqual[b, 5.4e-54], N[(N[((-b) + N[Sqrt[N[(N[(-3.0 * a), $MachinePrecision] * c + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;b \leq -1.5 \cdot 10^{+55}:\\
\;\;\;\;\frac{\frac{b}{a}}{-1.5}\\
\mathbf{elif}\;b \leq 5.4 \cdot 10^{-54}:\\
\;\;\;\;\frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(-3 \cdot a, c, b \cdot b\right)}}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
if b < -1.5000000000000001e55Initial program 52.0%
Taylor expanded in b around -inf
lower-*.f64N/A
lower-/.f6434.7%
Applied rewrites34.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
lower-*.f6434.6%
Applied rewrites34.6%
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
div-flip-revN/A
mult-flipN/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f64N/A
metadata-eval34.7%
Applied rewrites34.7%
if -1.5000000000000001e55 < b < 5.4000000000000005e-54Initial program 52.0%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval52.0%
Applied rewrites52.0%
if 5.4000000000000005e-54 < b Initial program 52.0%
Taylor expanded in b around inf
lower-*.f64N/A
lower-/.f6435.2%
Applied rewrites35.2%
(FPCore (a b c)
:precision binary64
(if (<= b -3.1e+96)
(/ (/ b a) -1.5)
(if (<= b 5.4e-54)
(/ (/ (- (sqrt (fma (* c -3.0) a (* b b))) b) a) 3.0)
(* -0.5 (/ c b)))))double code(double a, double b, double c) {
double tmp;
if (b <= -3.1e+96) {
tmp = (b / a) / -1.5;
} else if (b <= 5.4e-54) {
tmp = ((sqrt(fma((c * -3.0), a, (b * b))) - b) / a) / 3.0;
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -3.1e+96) tmp = Float64(Float64(b / a) / -1.5); elseif (b <= 5.4e-54) tmp = Float64(Float64(Float64(sqrt(fma(Float64(c * -3.0), a, Float64(b * b))) - b) / a) / 3.0); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -3.1e+96], N[(N[(b / a), $MachinePrecision] / -1.5), $MachinePrecision], If[LessEqual[b, 5.4e-54], N[(N[(N[(N[Sqrt[N[(N[(c * -3.0), $MachinePrecision] * a + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / a), $MachinePrecision] / 3.0), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;b \leq -3.1 \cdot 10^{+96}:\\
\;\;\;\;\frac{\frac{b}{a}}{-1.5}\\
\mathbf{elif}\;b \leq 5.4 \cdot 10^{-54}:\\
\;\;\;\;\frac{\frac{\sqrt{\mathsf{fma}\left(c \cdot -3, a, b \cdot b\right)} - b}{a}}{3}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
if b < -3.0999999999999998e96Initial program 52.0%
Taylor expanded in b around -inf
lower-*.f64N/A
lower-/.f6434.7%
Applied rewrites34.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
lower-*.f6434.6%
Applied rewrites34.6%
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
div-flip-revN/A
mult-flipN/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f64N/A
metadata-eval34.7%
Applied rewrites34.7%
if -3.0999999999999998e96 < b < 5.4000000000000005e-54Initial program 52.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites52.0%
if 5.4000000000000005e-54 < b Initial program 52.0%
Taylor expanded in b around inf
lower-*.f64N/A
lower-/.f6435.2%
Applied rewrites35.2%
(FPCore (a b c)
:precision binary64
(if (<= b -5.7e+57)
(/ (/ b a) -1.5)
(if (<= b 5.4e-54)
(* (- (sqrt (fma (* c -3.0) a (* b b))) b) (/ 0.3333333333333333 a))
(* -0.5 (/ c b)))))double code(double a, double b, double c) {
double tmp;
if (b <= -5.7e+57) {
tmp = (b / a) / -1.5;
} else if (b <= 5.4e-54) {
tmp = (sqrt(fma((c * -3.0), a, (b * b))) - b) * (0.3333333333333333 / a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -5.7e+57) tmp = Float64(Float64(b / a) / -1.5); elseif (b <= 5.4e-54) tmp = Float64(Float64(sqrt(fma(Float64(c * -3.0), a, Float64(b * b))) - b) * Float64(0.3333333333333333 / a)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -5.7e+57], N[(N[(b / a), $MachinePrecision] / -1.5), $MachinePrecision], If[LessEqual[b, 5.4e-54], N[(N[(N[Sqrt[N[(N[(c * -3.0), $MachinePrecision] * a + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] * N[(0.3333333333333333 / a), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;b \leq -5.7 \cdot 10^{+57}:\\
\;\;\;\;\frac{\frac{b}{a}}{-1.5}\\
\mathbf{elif}\;b \leq 5.4 \cdot 10^{-54}:\\
\;\;\;\;\left(\sqrt{\mathsf{fma}\left(c \cdot -3, a, b \cdot b\right)} - b\right) \cdot \frac{0.3333333333333333}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
if b < -5.6999999999999998e57Initial program 52.0%
Taylor expanded in b around -inf
lower-*.f64N/A
lower-/.f6434.7%
Applied rewrites34.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
lower-*.f6434.6%
Applied rewrites34.6%
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
div-flip-revN/A
mult-flipN/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f64N/A
metadata-eval34.7%
Applied rewrites34.7%
if -5.6999999999999998e57 < b < 5.4000000000000005e-54Initial program 52.0%
lift-/.f64N/A
mult-flipN/A
lower-*.f64N/A
Applied rewrites51.9%
if 5.4000000000000005e-54 < b Initial program 52.0%
Taylor expanded in b around inf
lower-*.f64N/A
lower-/.f6435.2%
Applied rewrites35.2%
(FPCore (a b c)
:precision binary64
(if (<= b -3.6e-54)
(/ (/ b a) -1.5)
(if (<= b 5.4e-54)
(/ (+ (- b) (sqrt (* -3.0 (* a c)))) (* 3.0 a))
(* -0.5 (/ c b)))))double code(double a, double b, double c) {
double tmp;
if (b <= -3.6e-54) {
tmp = (b / a) / -1.5;
} else if (b <= 5.4e-54) {
tmp = (-b + sqrt((-3.0 * (a * c)))) / (3.0 * a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-3.6d-54)) then
tmp = (b / a) / (-1.5d0)
else if (b <= 5.4d-54) then
tmp = (-b + sqrt(((-3.0d0) * (a * c)))) / (3.0d0 * a)
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -3.6e-54) {
tmp = (b / a) / -1.5;
} else if (b <= 5.4e-54) {
tmp = (-b + Math.sqrt((-3.0 * (a * c)))) / (3.0 * a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -3.6e-54: tmp = (b / a) / -1.5 elif b <= 5.4e-54: tmp = (-b + math.sqrt((-3.0 * (a * c)))) / (3.0 * a) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -3.6e-54) tmp = Float64(Float64(b / a) / -1.5); elseif (b <= 5.4e-54) tmp = Float64(Float64(Float64(-b) + sqrt(Float64(-3.0 * Float64(a * c)))) / Float64(3.0 * a)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -3.6e-54) tmp = (b / a) / -1.5; elseif (b <= 5.4e-54) tmp = (-b + sqrt((-3.0 * (a * c)))) / (3.0 * a); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -3.6e-54], N[(N[(b / a), $MachinePrecision] / -1.5), $MachinePrecision], If[LessEqual[b, 5.4e-54], N[(N[((-b) + N[Sqrt[N[(-3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;b \leq -3.6 \cdot 10^{-54}:\\
\;\;\;\;\frac{\frac{b}{a}}{-1.5}\\
\mathbf{elif}\;b \leq 5.4 \cdot 10^{-54}:\\
\;\;\;\;\frac{\left(-b\right) + \sqrt{-3 \cdot \left(a \cdot c\right)}}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
if b < -3.5999999999999998e-54Initial program 52.0%
Taylor expanded in b around -inf
lower-*.f64N/A
lower-/.f6434.7%
Applied rewrites34.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
lower-*.f6434.6%
Applied rewrites34.6%
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
div-flip-revN/A
mult-flipN/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f64N/A
metadata-eval34.7%
Applied rewrites34.7%
if -3.5999999999999998e-54 < b < 5.4000000000000005e-54Initial program 52.0%
Taylor expanded in a around inf
lower-*.f64N/A
lower-*.f6433.8%
Applied rewrites33.8%
if 5.4000000000000005e-54 < b Initial program 52.0%
Taylor expanded in b around inf
lower-*.f64N/A
lower-/.f6435.2%
Applied rewrites35.2%
(FPCore (a b c) :precision binary64 (if (<= b -4.2e-119) (/ (/ b a) -1.5) (if (<= b 5.4e-54) (/ (sqrt (* (* a -3.0) c)) (* 3.0 a)) (* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -4.2e-119) {
tmp = (b / a) / -1.5;
} else if (b <= 5.4e-54) {
tmp = sqrt(((a * -3.0) * c)) / (3.0 * a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-4.2d-119)) then
tmp = (b / a) / (-1.5d0)
else if (b <= 5.4d-54) then
tmp = sqrt(((a * (-3.0d0)) * c)) / (3.0d0 * a)
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -4.2e-119) {
tmp = (b / a) / -1.5;
} else if (b <= 5.4e-54) {
tmp = Math.sqrt(((a * -3.0) * c)) / (3.0 * a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -4.2e-119: tmp = (b / a) / -1.5 elif b <= 5.4e-54: tmp = math.sqrt(((a * -3.0) * c)) / (3.0 * a) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -4.2e-119) tmp = Float64(Float64(b / a) / -1.5); elseif (b <= 5.4e-54) tmp = Float64(sqrt(Float64(Float64(a * -3.0) * c)) / Float64(3.0 * a)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -4.2e-119) tmp = (b / a) / -1.5; elseif (b <= 5.4e-54) tmp = sqrt(((a * -3.0) * c)) / (3.0 * a); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -4.2e-119], N[(N[(b / a), $MachinePrecision] / -1.5), $MachinePrecision], If[LessEqual[b, 5.4e-54], N[(N[Sqrt[N[(N[(a * -3.0), $MachinePrecision] * c), $MachinePrecision]], $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;b \leq -4.2 \cdot 10^{-119}:\\
\;\;\;\;\frac{\frac{b}{a}}{-1.5}\\
\mathbf{elif}\;b \leq 5.4 \cdot 10^{-54}:\\
\;\;\;\;\frac{\sqrt{\left(a \cdot -3\right) \cdot c}}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
if b < -4.1999999999999998e-119Initial program 52.0%
Taylor expanded in b around -inf
lower-*.f64N/A
lower-/.f6434.7%
Applied rewrites34.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
lower-*.f6434.6%
Applied rewrites34.6%
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
div-flip-revN/A
mult-flipN/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f64N/A
metadata-eval34.7%
Applied rewrites34.7%
if -4.1999999999999998e-119 < b < 5.4000000000000005e-54Initial program 52.0%
Taylor expanded in b around 0
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-*.f6429.4%
Applied rewrites29.4%
lift-neg.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
distribute-lft-neg-outN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-outN/A
metadata-evalN/A
lower-*.f6429.4%
Applied rewrites29.4%
if 5.4000000000000005e-54 < b Initial program 52.0%
Taylor expanded in b around inf
lower-*.f64N/A
lower-/.f6435.2%
Applied rewrites35.2%
(FPCore (a b c)
:precision binary64
(if (<= b -4.2e-119)
(/ (/ b a) -1.5)
(if (<= b 5.4e-54)
(* (/ 0.3333333333333333 a) (sqrt (* -3.0 (* c a))))
(* -0.5 (/ c b)))))double code(double a, double b, double c) {
double tmp;
if (b <= -4.2e-119) {
tmp = (b / a) / -1.5;
} else if (b <= 5.4e-54) {
tmp = (0.3333333333333333 / a) * sqrt((-3.0 * (c * a)));
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-4.2d-119)) then
tmp = (b / a) / (-1.5d0)
else if (b <= 5.4d-54) then
tmp = (0.3333333333333333d0 / a) * sqrt(((-3.0d0) * (c * a)))
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -4.2e-119) {
tmp = (b / a) / -1.5;
} else if (b <= 5.4e-54) {
tmp = (0.3333333333333333 / a) * Math.sqrt((-3.0 * (c * a)));
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -4.2e-119: tmp = (b / a) / -1.5 elif b <= 5.4e-54: tmp = (0.3333333333333333 / a) * math.sqrt((-3.0 * (c * a))) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -4.2e-119) tmp = Float64(Float64(b / a) / -1.5); elseif (b <= 5.4e-54) tmp = Float64(Float64(0.3333333333333333 / a) * sqrt(Float64(-3.0 * Float64(c * a)))); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -4.2e-119) tmp = (b / a) / -1.5; elseif (b <= 5.4e-54) tmp = (0.3333333333333333 / a) * sqrt((-3.0 * (c * a))); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -4.2e-119], N[(N[(b / a), $MachinePrecision] / -1.5), $MachinePrecision], If[LessEqual[b, 5.4e-54], N[(N[(0.3333333333333333 / a), $MachinePrecision] * N[Sqrt[N[(-3.0 * N[(c * a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;b \leq -4.2 \cdot 10^{-119}:\\
\;\;\;\;\frac{\frac{b}{a}}{-1.5}\\
\mathbf{elif}\;b \leq 5.4 \cdot 10^{-54}:\\
\;\;\;\;\frac{0.3333333333333333}{a} \cdot \sqrt{-3 \cdot \left(c \cdot a\right)}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
if b < -4.1999999999999998e-119Initial program 52.0%
Taylor expanded in b around -inf
lower-*.f64N/A
lower-/.f6434.7%
Applied rewrites34.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
lower-*.f6434.6%
Applied rewrites34.6%
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
div-flip-revN/A
mult-flipN/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f64N/A
metadata-eval34.7%
Applied rewrites34.7%
if -4.1999999999999998e-119 < b < 5.4000000000000005e-54Initial program 52.0%
Taylor expanded in b around 0
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-*.f6429.4%
Applied rewrites29.4%
lift-sqrt.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
sqrt-prodN/A
lower-unsound-*.f64N/A
lower-unsound-sqrt.f64N/A
lower-unsound-sqrt.f6417.8%
Applied rewrites17.8%
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
associate-/r*N/A
metadata-evalN/A
lower-/.f6417.8%
lift-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-sqrt.f64N/A
*-commutativeN/A
Applied rewrites29.4%
if 5.4000000000000005e-54 < b Initial program 52.0%
Taylor expanded in b around inf
lower-*.f64N/A
lower-/.f6435.2%
Applied rewrites35.2%
(FPCore (a b c)
:precision binary64
(if (<= b -4.2e-119)
(/ (/ b a) -1.5)
(if (<= b 5.4e-54)
(* -0.3333333333333333 (* c (sqrt (/ -3.0 (* a c)))))
(* -0.5 (/ c b)))))double code(double a, double b, double c) {
double tmp;
if (b <= -4.2e-119) {
tmp = (b / a) / -1.5;
} else if (b <= 5.4e-54) {
tmp = -0.3333333333333333 * (c * sqrt((-3.0 / (a * c))));
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-4.2d-119)) then
tmp = (b / a) / (-1.5d0)
else if (b <= 5.4d-54) then
tmp = (-0.3333333333333333d0) * (c * sqrt(((-3.0d0) / (a * c))))
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -4.2e-119) {
tmp = (b / a) / -1.5;
} else if (b <= 5.4e-54) {
tmp = -0.3333333333333333 * (c * Math.sqrt((-3.0 / (a * c))));
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -4.2e-119: tmp = (b / a) / -1.5 elif b <= 5.4e-54: tmp = -0.3333333333333333 * (c * math.sqrt((-3.0 / (a * c)))) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -4.2e-119) tmp = Float64(Float64(b / a) / -1.5); elseif (b <= 5.4e-54) tmp = Float64(-0.3333333333333333 * Float64(c * sqrt(Float64(-3.0 / Float64(a * c))))); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -4.2e-119) tmp = (b / a) / -1.5; elseif (b <= 5.4e-54) tmp = -0.3333333333333333 * (c * sqrt((-3.0 / (a * c)))); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -4.2e-119], N[(N[(b / a), $MachinePrecision] / -1.5), $MachinePrecision], If[LessEqual[b, 5.4e-54], N[(-0.3333333333333333 * N[(c * N[Sqrt[N[(-3.0 / N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;b \leq -4.2 \cdot 10^{-119}:\\
\;\;\;\;\frac{\frac{b}{a}}{-1.5}\\
\mathbf{elif}\;b \leq 5.4 \cdot 10^{-54}:\\
\;\;\;\;-0.3333333333333333 \cdot \left(c \cdot \sqrt{\frac{-3}{a \cdot c}}\right)\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
if b < -4.1999999999999998e-119Initial program 52.0%
Taylor expanded in b around -inf
lower-*.f64N/A
lower-/.f6434.7%
Applied rewrites34.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
lower-*.f6434.6%
Applied rewrites34.6%
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
div-flip-revN/A
mult-flipN/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f64N/A
metadata-eval34.7%
Applied rewrites34.7%
if -4.1999999999999998e-119 < b < 5.4000000000000005e-54Initial program 52.0%
Taylor expanded in a around inf
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f6420.0%
Applied rewrites20.0%
Taylor expanded in c around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6428.0%
Applied rewrites28.0%
if 5.4000000000000005e-54 < b Initial program 52.0%
Taylor expanded in b around inf
lower-*.f64N/A
lower-/.f6435.2%
Applied rewrites35.2%
(FPCore (a b c) :precision binary64 (if (<= b -4.2e-119) (/ (/ b a) -1.5) (if (<= b 8.5e-174) (/ (sqrt (* -3.0 (/ c a))) 3.0) (* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -4.2e-119) {
tmp = (b / a) / -1.5;
} else if (b <= 8.5e-174) {
tmp = sqrt((-3.0 * (c / a))) / 3.0;
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-4.2d-119)) then
tmp = (b / a) / (-1.5d0)
else if (b <= 8.5d-174) then
tmp = sqrt(((-3.0d0) * (c / a))) / 3.0d0
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -4.2e-119) {
tmp = (b / a) / -1.5;
} else if (b <= 8.5e-174) {
tmp = Math.sqrt((-3.0 * (c / a))) / 3.0;
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -4.2e-119: tmp = (b / a) / -1.5 elif b <= 8.5e-174: tmp = math.sqrt((-3.0 * (c / a))) / 3.0 else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -4.2e-119) tmp = Float64(Float64(b / a) / -1.5); elseif (b <= 8.5e-174) tmp = Float64(sqrt(Float64(-3.0 * Float64(c / a))) / 3.0); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -4.2e-119) tmp = (b / a) / -1.5; elseif (b <= 8.5e-174) tmp = sqrt((-3.0 * (c / a))) / 3.0; else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -4.2e-119], N[(N[(b / a), $MachinePrecision] / -1.5), $MachinePrecision], If[LessEqual[b, 8.5e-174], N[(N[Sqrt[N[(-3.0 * N[(c / a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / 3.0), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;b \leq -4.2 \cdot 10^{-119}:\\
\;\;\;\;\frac{\frac{b}{a}}{-1.5}\\
\mathbf{elif}\;b \leq 8.5 \cdot 10^{-174}:\\
\;\;\;\;\frac{\sqrt{-3 \cdot \frac{c}{a}}}{3}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
if b < -4.1999999999999998e-119Initial program 52.0%
Taylor expanded in b around -inf
lower-*.f64N/A
lower-/.f6434.7%
Applied rewrites34.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
lower-*.f6434.6%
Applied rewrites34.6%
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
div-flip-revN/A
mult-flipN/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f64N/A
metadata-eval34.7%
Applied rewrites34.7%
if -4.1999999999999998e-119 < b < 8.4999999999999996e-174Initial program 52.0%
Taylor expanded in b around 0
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-*.f6429.4%
Applied rewrites29.4%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites29.4%
Taylor expanded in a around inf
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f6418.1%
Applied rewrites18.1%
if 8.4999999999999996e-174 < b Initial program 52.0%
Taylor expanded in b around inf
lower-*.f64N/A
lower-/.f6435.2%
Applied rewrites35.2%
(FPCore (a b c)
:precision binary64
(if (<= b -4.2e-119)
(/ (/ b a) -1.5)
(if (<= b 8.5e-174)
(* 0.3333333333333333 (sqrt (* -3.0 (/ c a))))
(* -0.5 (/ c b)))))double code(double a, double b, double c) {
double tmp;
if (b <= -4.2e-119) {
tmp = (b / a) / -1.5;
} else if (b <= 8.5e-174) {
tmp = 0.3333333333333333 * sqrt((-3.0 * (c / a)));
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-4.2d-119)) then
tmp = (b / a) / (-1.5d0)
else if (b <= 8.5d-174) then
tmp = 0.3333333333333333d0 * sqrt(((-3.0d0) * (c / a)))
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -4.2e-119) {
tmp = (b / a) / -1.5;
} else if (b <= 8.5e-174) {
tmp = 0.3333333333333333 * Math.sqrt((-3.0 * (c / a)));
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -4.2e-119: tmp = (b / a) / -1.5 elif b <= 8.5e-174: tmp = 0.3333333333333333 * math.sqrt((-3.0 * (c / a))) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -4.2e-119) tmp = Float64(Float64(b / a) / -1.5); elseif (b <= 8.5e-174) tmp = Float64(0.3333333333333333 * sqrt(Float64(-3.0 * Float64(c / a)))); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -4.2e-119) tmp = (b / a) / -1.5; elseif (b <= 8.5e-174) tmp = 0.3333333333333333 * sqrt((-3.0 * (c / a))); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -4.2e-119], N[(N[(b / a), $MachinePrecision] / -1.5), $MachinePrecision], If[LessEqual[b, 8.5e-174], N[(0.3333333333333333 * N[Sqrt[N[(-3.0 * N[(c / a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;b \leq -4.2 \cdot 10^{-119}:\\
\;\;\;\;\frac{\frac{b}{a}}{-1.5}\\
\mathbf{elif}\;b \leq 8.5 \cdot 10^{-174}:\\
\;\;\;\;0.3333333333333333 \cdot \sqrt{-3 \cdot \frac{c}{a}}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
if b < -4.1999999999999998e-119Initial program 52.0%
Taylor expanded in b around -inf
lower-*.f64N/A
lower-/.f6434.7%
Applied rewrites34.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
lower-*.f6434.6%
Applied rewrites34.6%
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
div-flip-revN/A
mult-flipN/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f64N/A
metadata-eval34.7%
Applied rewrites34.7%
if -4.1999999999999998e-119 < b < 8.4999999999999996e-174Initial program 52.0%
Taylor expanded in a around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f6418.1%
Applied rewrites18.1%
if 8.4999999999999996e-174 < b Initial program 52.0%
Taylor expanded in b around inf
lower-*.f64N/A
lower-/.f6435.2%
Applied rewrites35.2%
(FPCore (a b c)
:precision binary64
(if (<= b -3.8e-190)
(/ (/ b a) -1.5)
(if (<= b 4.4e-179)
(* -0.3333333333333333 (sqrt (/ (* -3.0 c) a)))
(* -0.5 (/ c b)))))double code(double a, double b, double c) {
double tmp;
if (b <= -3.8e-190) {
tmp = (b / a) / -1.5;
} else if (b <= 4.4e-179) {
tmp = -0.3333333333333333 * sqrt(((-3.0 * c) / a));
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-3.8d-190)) then
tmp = (b / a) / (-1.5d0)
else if (b <= 4.4d-179) then
tmp = (-0.3333333333333333d0) * sqrt((((-3.0d0) * c) / a))
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -3.8e-190) {
tmp = (b / a) / -1.5;
} else if (b <= 4.4e-179) {
tmp = -0.3333333333333333 * Math.sqrt(((-3.0 * c) / a));
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -3.8e-190: tmp = (b / a) / -1.5 elif b <= 4.4e-179: tmp = -0.3333333333333333 * math.sqrt(((-3.0 * c) / a)) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -3.8e-190) tmp = Float64(Float64(b / a) / -1.5); elseif (b <= 4.4e-179) tmp = Float64(-0.3333333333333333 * sqrt(Float64(Float64(-3.0 * c) / a))); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -3.8e-190) tmp = (b / a) / -1.5; elseif (b <= 4.4e-179) tmp = -0.3333333333333333 * sqrt(((-3.0 * c) / a)); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -3.8e-190], N[(N[(b / a), $MachinePrecision] / -1.5), $MachinePrecision], If[LessEqual[b, 4.4e-179], N[(-0.3333333333333333 * N[Sqrt[N[(N[(-3.0 * c), $MachinePrecision] / a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;b \leq -3.8 \cdot 10^{-190}:\\
\;\;\;\;\frac{\frac{b}{a}}{-1.5}\\
\mathbf{elif}\;b \leq 4.4 \cdot 10^{-179}:\\
\;\;\;\;-0.3333333333333333 \cdot \sqrt{\frac{-3 \cdot c}{a}}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
if b < -3.7999999999999998e-190Initial program 52.0%
Taylor expanded in b around -inf
lower-*.f64N/A
lower-/.f6434.7%
Applied rewrites34.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
lower-*.f6434.6%
Applied rewrites34.6%
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
div-flip-revN/A
mult-flipN/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f64N/A
metadata-eval34.7%
Applied rewrites34.7%
if -3.7999999999999998e-190 < b < 4.4000000000000001e-179Initial program 52.0%
Taylor expanded in a around -inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f6417.3%
Applied rewrites17.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
lift-*.f64N/A
lower-/.f6417.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6417.3%
Applied rewrites17.3%
if 4.4000000000000001e-179 < b Initial program 52.0%
Taylor expanded in b around inf
lower-*.f64N/A
lower-/.f6435.2%
Applied rewrites35.2%
(FPCore (a b c)
:precision binary64
(if (<= b -3.8e-190)
(/ (/ b a) -1.5)
(if (<= b 4.4e-179)
(* -0.3333333333333333 (sqrt (* c (/ -3.0 a))))
(* -0.5 (/ c b)))))double code(double a, double b, double c) {
double tmp;
if (b <= -3.8e-190) {
tmp = (b / a) / -1.5;
} else if (b <= 4.4e-179) {
tmp = -0.3333333333333333 * sqrt((c * (-3.0 / a)));
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-3.8d-190)) then
tmp = (b / a) / (-1.5d0)
else if (b <= 4.4d-179) then
tmp = (-0.3333333333333333d0) * sqrt((c * ((-3.0d0) / a)))
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -3.8e-190) {
tmp = (b / a) / -1.5;
} else if (b <= 4.4e-179) {
tmp = -0.3333333333333333 * Math.sqrt((c * (-3.0 / a)));
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -3.8e-190: tmp = (b / a) / -1.5 elif b <= 4.4e-179: tmp = -0.3333333333333333 * math.sqrt((c * (-3.0 / a))) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -3.8e-190) tmp = Float64(Float64(b / a) / -1.5); elseif (b <= 4.4e-179) tmp = Float64(-0.3333333333333333 * sqrt(Float64(c * Float64(-3.0 / a)))); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -3.8e-190) tmp = (b / a) / -1.5; elseif (b <= 4.4e-179) tmp = -0.3333333333333333 * sqrt((c * (-3.0 / a))); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -3.8e-190], N[(N[(b / a), $MachinePrecision] / -1.5), $MachinePrecision], If[LessEqual[b, 4.4e-179], N[(-0.3333333333333333 * N[Sqrt[N[(c * N[(-3.0 / a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;b \leq -3.8 \cdot 10^{-190}:\\
\;\;\;\;\frac{\frac{b}{a}}{-1.5}\\
\mathbf{elif}\;b \leq 4.4 \cdot 10^{-179}:\\
\;\;\;\;-0.3333333333333333 \cdot \sqrt{c \cdot \frac{-3}{a}}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
if b < -3.7999999999999998e-190Initial program 52.0%
Taylor expanded in b around -inf
lower-*.f64N/A
lower-/.f6434.7%
Applied rewrites34.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
lower-*.f6434.6%
Applied rewrites34.6%
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
div-flip-revN/A
mult-flipN/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f64N/A
metadata-eval34.7%
Applied rewrites34.7%
if -3.7999999999999998e-190 < b < 4.4000000000000001e-179Initial program 52.0%
Taylor expanded in a around -inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f6417.3%
Applied rewrites17.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6417.3%
Applied rewrites17.3%
if 4.4000000000000001e-179 < b Initial program 52.0%
Taylor expanded in b around inf
lower-*.f64N/A
lower-/.f6435.2%
Applied rewrites35.2%
(FPCore (a b c)
:precision binary64
(if (<= b -3.8e-190)
(/ (/ b a) -1.5)
(if (<= b 4.4e-179)
(* -0.3333333333333333 (sqrt (* -3.0 (/ c a))))
(* -0.5 (/ c b)))))double code(double a, double b, double c) {
double tmp;
if (b <= -3.8e-190) {
tmp = (b / a) / -1.5;
} else if (b <= 4.4e-179) {
tmp = -0.3333333333333333 * sqrt((-3.0 * (c / a)));
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-3.8d-190)) then
tmp = (b / a) / (-1.5d0)
else if (b <= 4.4d-179) then
tmp = (-0.3333333333333333d0) * sqrt(((-3.0d0) * (c / a)))
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -3.8e-190) {
tmp = (b / a) / -1.5;
} else if (b <= 4.4e-179) {
tmp = -0.3333333333333333 * Math.sqrt((-3.0 * (c / a)));
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -3.8e-190: tmp = (b / a) / -1.5 elif b <= 4.4e-179: tmp = -0.3333333333333333 * math.sqrt((-3.0 * (c / a))) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -3.8e-190) tmp = Float64(Float64(b / a) / -1.5); elseif (b <= 4.4e-179) tmp = Float64(-0.3333333333333333 * sqrt(Float64(-3.0 * Float64(c / a)))); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -3.8e-190) tmp = (b / a) / -1.5; elseif (b <= 4.4e-179) tmp = -0.3333333333333333 * sqrt((-3.0 * (c / a))); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -3.8e-190], N[(N[(b / a), $MachinePrecision] / -1.5), $MachinePrecision], If[LessEqual[b, 4.4e-179], N[(-0.3333333333333333 * N[Sqrt[N[(-3.0 * N[(c / a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;b \leq -3.8 \cdot 10^{-190}:\\
\;\;\;\;\frac{\frac{b}{a}}{-1.5}\\
\mathbf{elif}\;b \leq 4.4 \cdot 10^{-179}:\\
\;\;\;\;-0.3333333333333333 \cdot \sqrt{-3 \cdot \frac{c}{a}}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
if b < -3.7999999999999998e-190Initial program 52.0%
Taylor expanded in b around -inf
lower-*.f64N/A
lower-/.f6434.7%
Applied rewrites34.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
lower-*.f6434.6%
Applied rewrites34.6%
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
div-flip-revN/A
mult-flipN/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f64N/A
metadata-eval34.7%
Applied rewrites34.7%
if -3.7999999999999998e-190 < b < 4.4000000000000001e-179Initial program 52.0%
Taylor expanded in a around -inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f6417.3%
Applied rewrites17.3%
if 4.4000000000000001e-179 < b Initial program 52.0%
Taylor expanded in b around inf
lower-*.f64N/A
lower-/.f6435.2%
Applied rewrites35.2%
(FPCore (a b c) :precision binary64 (if (<= b 6e-309) (/ (/ b a) -1.5) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 6e-309) {
tmp = (b / a) / -1.5;
} 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 <= 6d-309) then
tmp = (b / a) / (-1.5d0)
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 <= 6e-309) {
tmp = (b / a) / -1.5;
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 6e-309: tmp = (b / a) / -1.5 else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 6e-309) tmp = Float64(Float64(b / a) / -1.5); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 6e-309) tmp = (b / a) / -1.5; else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 6e-309], N[(N[(b / a), $MachinePrecision] / -1.5), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;b \leq 6 \cdot 10^{-309}:\\
\;\;\;\;\frac{\frac{b}{a}}{-1.5}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
if b < 6.0000000000000014e-309Initial program 52.0%
Taylor expanded in b around -inf
lower-*.f64N/A
lower-/.f6434.7%
Applied rewrites34.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
lower-*.f6434.6%
Applied rewrites34.6%
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
div-flip-revN/A
mult-flipN/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f64N/A
metadata-eval34.7%
Applied rewrites34.7%
if 6.0000000000000014e-309 < b Initial program 52.0%
Taylor expanded in b around inf
lower-*.f64N/A
lower-/.f6435.2%
Applied rewrites35.2%
(FPCore (a b c) :precision binary64 (if (<= b 6e-309) (/ b (* a -1.5)) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 6e-309) {
tmp = b / (a * -1.5);
} 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 <= 6d-309) then
tmp = b / (a * (-1.5d0))
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 <= 6e-309) {
tmp = b / (a * -1.5);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 6e-309: tmp = b / (a * -1.5) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 6e-309) tmp = Float64(b / Float64(a * -1.5)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 6e-309) tmp = b / (a * -1.5); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 6e-309], N[(b / N[(a * -1.5), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;b \leq 6 \cdot 10^{-309}:\\
\;\;\;\;\frac{b}{a \cdot -1.5}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
if b < 6.0000000000000014e-309Initial program 52.0%
Taylor expanded in b around -inf
lower-*.f64N/A
lower-/.f6434.7%
Applied rewrites34.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
lower-*.f6434.6%
Applied rewrites34.6%
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
div-flip-revN/A
lower-/.f64N/A
mult-flipN/A
lower-*.f64N/A
metadata-eval34.7%
Applied rewrites34.7%
if 6.0000000000000014e-309 < b Initial program 52.0%
Taylor expanded in b around inf
lower-*.f64N/A
lower-/.f6435.2%
Applied rewrites35.2%
(FPCore (a b c) :precision binary64 (if (<= b 6e-309) (* -0.6666666666666666 (/ b a)) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 6e-309) {
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 <= 6d-309) 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 <= 6e-309) {
tmp = -0.6666666666666666 * (b / a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 6e-309: tmp = -0.6666666666666666 * (b / a) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 6e-309) 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 <= 6e-309) tmp = -0.6666666666666666 * (b / a); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 6e-309], N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;b \leq 6 \cdot 10^{-309}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
if b < 6.0000000000000014e-309Initial program 52.0%
Taylor expanded in b around -inf
lower-*.f64N/A
lower-/.f6434.7%
Applied rewrites34.7%
if 6.0000000000000014e-309 < b Initial program 52.0%
Taylor expanded in b around inf
lower-*.f64N/A
lower-/.f6435.2%
Applied rewrites35.2%
(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]
-0.6666666666666666 \cdot \frac{b}{a}
Initial program 52.0%
Taylor expanded in b around -inf
lower-*.f64N/A
lower-/.f6434.7%
Applied rewrites34.7%
(FPCore (a b c) :precision binary64 (* -0.3333333333333333 (/ b a)))
double code(double a, double b, double c) {
return -0.3333333333333333 * (b / a);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = (-0.3333333333333333d0) * (b / a)
end function
public static double code(double a, double b, double c) {
return -0.3333333333333333 * (b / a);
}
def code(a, b, c): return -0.3333333333333333 * (b / a)
function code(a, b, c) return Float64(-0.3333333333333333 * Float64(b / a)) end
function tmp = code(a, b, c) tmp = -0.3333333333333333 * (b / a); end
code[a_, b_, c_] := N[(-0.3333333333333333 * N[(b / a), $MachinePrecision]), $MachinePrecision]
-0.3333333333333333 \cdot \frac{b}{a}
Initial program 52.0%
Taylor expanded in a around inf
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f6420.0%
Applied rewrites20.0%
Taylor expanded in b around inf
lower-*.f64N/A
lower-/.f6415.4%
Applied rewrites15.4%
herbie shell --seed 2025189
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))