
(FPCore (a b c) :precision binary64 (pow (/ (- (* 3.0 (* a c)) (pow b 2.0)) (* 9.0 (pow a 2.0))) 3.0))
double code(double a, double b, double c) {
return pow((((3.0 * (a * c)) - pow(b, 2.0)) / (9.0 * pow(a, 2.0))), 3.0);
}
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 = (((3.0d0 * (a * c)) - (b ** 2.0d0)) / (9.0d0 * (a ** 2.0d0))) ** 3.0d0
end function
public static double code(double a, double b, double c) {
return Math.pow((((3.0 * (a * c)) - Math.pow(b, 2.0)) / (9.0 * Math.pow(a, 2.0))), 3.0);
}
def code(a, b, c): return math.pow((((3.0 * (a * c)) - math.pow(b, 2.0)) / (9.0 * math.pow(a, 2.0))), 3.0)
function code(a, b, c) return Float64(Float64(Float64(3.0 * Float64(a * c)) - (b ^ 2.0)) / Float64(9.0 * (a ^ 2.0))) ^ 3.0 end
function tmp = code(a, b, c) tmp = (((3.0 * (a * c)) - (b ^ 2.0)) / (9.0 * (a ^ 2.0))) ^ 3.0; end
code[a_, b_, c_] := N[Power[N[(N[(N[(3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision] - N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision] / N[(9.0 * N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision]
{\left(\frac{3 \cdot \left(a \cdot c\right) - {b}^{2}}{9 \cdot {a}^{2}}\right)}^{3}
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b c) :precision binary64 (pow (/ (- (* 3.0 (* a c)) (pow b 2.0)) (* 9.0 (pow a 2.0))) 3.0))
double code(double a, double b, double c) {
return pow((((3.0 * (a * c)) - pow(b, 2.0)) / (9.0 * pow(a, 2.0))), 3.0);
}
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 = (((3.0d0 * (a * c)) - (b ** 2.0d0)) / (9.0d0 * (a ** 2.0d0))) ** 3.0d0
end function
public static double code(double a, double b, double c) {
return Math.pow((((3.0 * (a * c)) - Math.pow(b, 2.0)) / (9.0 * Math.pow(a, 2.0))), 3.0);
}
def code(a, b, c): return math.pow((((3.0 * (a * c)) - math.pow(b, 2.0)) / (9.0 * math.pow(a, 2.0))), 3.0)
function code(a, b, c) return Float64(Float64(Float64(3.0 * Float64(a * c)) - (b ^ 2.0)) / Float64(9.0 * (a ^ 2.0))) ^ 3.0 end
function tmp = code(a, b, c) tmp = (((3.0 * (a * c)) - (b ^ 2.0)) / (9.0 * (a ^ 2.0))) ^ 3.0; end
code[a_, b_, c_] := N[Power[N[(N[(N[(3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision] - N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision] / N[(9.0 * N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision]
{\left(\frac{3 \cdot \left(a \cdot c\right) - {b}^{2}}{9 \cdot {a}^{2}}\right)}^{3}
(FPCore (a b c)
:precision binary64
(let* ((t_0
(/
(-
(* -0.1111111111111111 (* (/ b a) b))
(* -0.3333333333333333 c))
a)))
(* (* t_0 t_0) t_0)))double code(double a, double b, double c) {
double t_0 = ((-0.1111111111111111 * ((b / a) * b)) - (-0.3333333333333333 * c)) / a;
return (t_0 * t_0) * t_0;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_0
t_0 = (((-0.1111111111111111d0) * ((b / a) * b)) - ((-0.3333333333333333d0) * c)) / a
code = (t_0 * t_0) * t_0
end function
public static double code(double a, double b, double c) {
double t_0 = ((-0.1111111111111111 * ((b / a) * b)) - (-0.3333333333333333 * c)) / a;
return (t_0 * t_0) * t_0;
}
def code(a, b, c): t_0 = ((-0.1111111111111111 * ((b / a) * b)) - (-0.3333333333333333 * c)) / a return (t_0 * t_0) * t_0
function code(a, b, c) t_0 = Float64(Float64(Float64(-0.1111111111111111 * Float64(Float64(b / a) * b)) - Float64(-0.3333333333333333 * c)) / a) return Float64(Float64(t_0 * t_0) * t_0) end
function tmp = code(a, b, c) t_0 = ((-0.1111111111111111 * ((b / a) * b)) - (-0.3333333333333333 * c)) / a; tmp = (t_0 * t_0) * t_0; end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(N[(-0.1111111111111111 * N[(N[(b / a), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision] - N[(-0.3333333333333333 * c), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]}, N[(N[(t$95$0 * t$95$0), $MachinePrecision] * t$95$0), $MachinePrecision]]
\begin{array}{l}
t_0 := \frac{-0.1111111111111111 \cdot \left(\frac{b}{a} \cdot b\right) - -0.3333333333333333 \cdot c}{a}\\
\left(t\_0 \cdot t\_0\right) \cdot t\_0
\end{array}
Initial program 81.1%
Taylor expanded in a around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-*.f6494.0%
Applied rewrites94.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
metadata-evalN/A
lower-*.f6494.0%
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6499.3%
Applied rewrites99.3%
lift-pow.f64N/A
unpow3N/A
lower-*.f64N/A
Applied rewrites99.3%
(FPCore (a b c)
:precision binary64
(let* ((t_0
(/
(-
(* (* c a) 0.3333333333333333)
(* 0.1111111111111111 (* b b)))
(* a a))))
(if (<= (pow b 2.0) 2e-305)
(pow (/ (* 0.3333333333333333 c) a) 3.0)
(* (* t_0 t_0) t_0))))double code(double a, double b, double c) {
double t_0 = (((c * a) * 0.3333333333333333) - (0.1111111111111111 * (b * b))) / (a * a);
double tmp;
if (pow(b, 2.0) <= 2e-305) {
tmp = pow(((0.3333333333333333 * c) / a), 3.0);
} else {
tmp = (t_0 * t_0) * t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_0
real(8) :: tmp
t_0 = (((c * a) * 0.3333333333333333d0) - (0.1111111111111111d0 * (b * b))) / (a * a)
if ((b ** 2.0d0) <= 2d-305) then
tmp = ((0.3333333333333333d0 * c) / a) ** 3.0d0
else
tmp = (t_0 * t_0) * t_0
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double t_0 = (((c * a) * 0.3333333333333333) - (0.1111111111111111 * (b * b))) / (a * a);
double tmp;
if (Math.pow(b, 2.0) <= 2e-305) {
tmp = Math.pow(((0.3333333333333333 * c) / a), 3.0);
} else {
tmp = (t_0 * t_0) * t_0;
}
return tmp;
}
def code(a, b, c): t_0 = (((c * a) * 0.3333333333333333) - (0.1111111111111111 * (b * b))) / (a * a) tmp = 0 if math.pow(b, 2.0) <= 2e-305: tmp = math.pow(((0.3333333333333333 * c) / a), 3.0) else: tmp = (t_0 * t_0) * t_0 return tmp
function code(a, b, c) t_0 = Float64(Float64(Float64(Float64(c * a) * 0.3333333333333333) - Float64(0.1111111111111111 * Float64(b * b))) / Float64(a * a)) tmp = 0.0 if ((b ^ 2.0) <= 2e-305) tmp = Float64(Float64(0.3333333333333333 * c) / a) ^ 3.0; else tmp = Float64(Float64(t_0 * t_0) * t_0); end return tmp end
function tmp_2 = code(a, b, c) t_0 = (((c * a) * 0.3333333333333333) - (0.1111111111111111 * (b * b))) / (a * a); tmp = 0.0; if ((b ^ 2.0) <= 2e-305) tmp = ((0.3333333333333333 * c) / a) ^ 3.0; else tmp = (t_0 * t_0) * t_0; end tmp_2 = tmp; end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(N[(N[(c * a), $MachinePrecision] * 0.3333333333333333), $MachinePrecision] - N[(0.1111111111111111 * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[b, 2.0], $MachinePrecision], 2e-305], N[Power[N[(N[(0.3333333333333333 * c), $MachinePrecision] / a), $MachinePrecision], 3.0], $MachinePrecision], N[(N[(t$95$0 * t$95$0), $MachinePrecision] * t$95$0), $MachinePrecision]]]
\begin{array}{l}
t_0 := \frac{\left(c \cdot a\right) \cdot 0.3333333333333333 - 0.1111111111111111 \cdot \left(b \cdot b\right)}{a \cdot a}\\
\mathbf{if}\;{b}^{2} \leq 2 \cdot 10^{-305}:\\
\;\;\;\;{\left(\frac{0.3333333333333333 \cdot c}{a}\right)}^{3}\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 \cdot t\_0\right) \cdot t\_0\\
\end{array}
if (pow.f64 b #s(literal 2 binary64)) < 2e-305Initial program 81.1%
Taylor expanded in a around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-*.f6494.0%
Applied rewrites94.0%
Taylor expanded in a around inf
lower-*.f6458.9%
Applied rewrites58.9%
if 2e-305 < (pow.f64 b #s(literal 2 binary64)) Initial program 81.1%
Taylor expanded in a around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-*.f6494.0%
Applied rewrites94.0%
lift-pow.f64N/A
unpow3N/A
lower-*.f64N/A
Applied rewrites81.1%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (* (fabs b) (fabs b))))
(if (<= (fabs b) 4.5e-153)
(pow (/ (* 0.3333333333333333 c) a) 3.0)
(*
(/
(*
(- (* (* c a) 3.0) t_0)
(/
(/ (* 0.012345679012345678 (- (* (* c 3.0) a) t_0)) (* a a))
(* a a)))
(* a a))
(- (* (* c a) 0.3333333333333333) (* t_0 0.1111111111111111))))))double code(double a, double b, double c) {
double t_0 = fabs(b) * fabs(b);
double tmp;
if (fabs(b) <= 4.5e-153) {
tmp = pow(((0.3333333333333333 * c) / a), 3.0);
} else {
tmp = (((((c * a) * 3.0) - t_0) * (((0.012345679012345678 * (((c * 3.0) * a) - t_0)) / (a * a)) / (a * a))) / (a * a)) * (((c * a) * 0.3333333333333333) - (t_0 * 0.1111111111111111));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_0
real(8) :: tmp
t_0 = abs(b) * abs(b)
if (abs(b) <= 4.5d-153) then
tmp = ((0.3333333333333333d0 * c) / a) ** 3.0d0
else
tmp = (((((c * a) * 3.0d0) - t_0) * (((0.012345679012345678d0 * (((c * 3.0d0) * a) - t_0)) / (a * a)) / (a * a))) / (a * a)) * (((c * a) * 0.3333333333333333d0) - (t_0 * 0.1111111111111111d0))
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double t_0 = Math.abs(b) * Math.abs(b);
double tmp;
if (Math.abs(b) <= 4.5e-153) {
tmp = Math.pow(((0.3333333333333333 * c) / a), 3.0);
} else {
tmp = (((((c * a) * 3.0) - t_0) * (((0.012345679012345678 * (((c * 3.0) * a) - t_0)) / (a * a)) / (a * a))) / (a * a)) * (((c * a) * 0.3333333333333333) - (t_0 * 0.1111111111111111));
}
return tmp;
}
def code(a, b, c): t_0 = math.fabs(b) * math.fabs(b) tmp = 0 if math.fabs(b) <= 4.5e-153: tmp = math.pow(((0.3333333333333333 * c) / a), 3.0) else: tmp = (((((c * a) * 3.0) - t_0) * (((0.012345679012345678 * (((c * 3.0) * a) - t_0)) / (a * a)) / (a * a))) / (a * a)) * (((c * a) * 0.3333333333333333) - (t_0 * 0.1111111111111111)) return tmp
function code(a, b, c) t_0 = Float64(abs(b) * abs(b)) tmp = 0.0 if (abs(b) <= 4.5e-153) tmp = Float64(Float64(0.3333333333333333 * c) / a) ^ 3.0; else tmp = Float64(Float64(Float64(Float64(Float64(Float64(c * a) * 3.0) - t_0) * Float64(Float64(Float64(0.012345679012345678 * Float64(Float64(Float64(c * 3.0) * a) - t_0)) / Float64(a * a)) / Float64(a * a))) / Float64(a * a)) * Float64(Float64(Float64(c * a) * 0.3333333333333333) - Float64(t_0 * 0.1111111111111111))); end return tmp end
function tmp_2 = code(a, b, c) t_0 = abs(b) * abs(b); tmp = 0.0; if (abs(b) <= 4.5e-153) tmp = ((0.3333333333333333 * c) / a) ^ 3.0; else tmp = (((((c * a) * 3.0) - t_0) * (((0.012345679012345678 * (((c * 3.0) * a) - t_0)) / (a * a)) / (a * a))) / (a * a)) * (((c * a) * 0.3333333333333333) - (t_0 * 0.1111111111111111)); end tmp_2 = tmp; end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[Abs[b], $MachinePrecision] * N[Abs[b], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[b], $MachinePrecision], 4.5e-153], N[Power[N[(N[(0.3333333333333333 * c), $MachinePrecision] / a), $MachinePrecision], 3.0], $MachinePrecision], N[(N[(N[(N[(N[(N[(c * a), $MachinePrecision] * 3.0), $MachinePrecision] - t$95$0), $MachinePrecision] * N[(N[(N[(0.012345679012345678 * N[(N[(N[(c * 3.0), $MachinePrecision] * a), $MachinePrecision] - t$95$0), $MachinePrecision]), $MachinePrecision] / N[(a * a), $MachinePrecision]), $MachinePrecision] / N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * a), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(c * a), $MachinePrecision] * 0.3333333333333333), $MachinePrecision] - N[(t$95$0 * 0.1111111111111111), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \left|b\right| \cdot \left|b\right|\\
\mathbf{if}\;\left|b\right| \leq 4.5 \cdot 10^{-153}:\\
\;\;\;\;{\left(\frac{0.3333333333333333 \cdot c}{a}\right)}^{3}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\left(c \cdot a\right) \cdot 3 - t\_0\right) \cdot \frac{\frac{0.012345679012345678 \cdot \left(\left(c \cdot 3\right) \cdot a - t\_0\right)}{a \cdot a}}{a \cdot a}}{a \cdot a} \cdot \left(\left(c \cdot a\right) \cdot 0.3333333333333333 - t\_0 \cdot 0.1111111111111111\right)\\
\end{array}
if b < 4.5e-153Initial program 81.1%
Taylor expanded in a around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-*.f6494.0%
Applied rewrites94.0%
Taylor expanded in a around inf
lower-*.f6458.9%
Applied rewrites58.9%
if 4.5e-153 < b Initial program 81.1%
Applied rewrites66.2%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites76.2%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (* (fabs b) (fabs b))))
(if (<= (fabs b) 4.5e-153)
(pow (/ (* 0.3333333333333333 c) a) 3.0)
(*
(/
(*
(- (* (* c a) 3.0) t_0)
(*
(- (* c 3.0) (* (/ (fabs b) a) (fabs b)))
(/ 0.012345679012345678 (* (* a a) a))))
(* a a))
(- (* (* c a) 0.3333333333333333) (* t_0 0.1111111111111111))))))double code(double a, double b, double c) {
double t_0 = fabs(b) * fabs(b);
double tmp;
if (fabs(b) <= 4.5e-153) {
tmp = pow(((0.3333333333333333 * c) / a), 3.0);
} else {
tmp = (((((c * a) * 3.0) - t_0) * (((c * 3.0) - ((fabs(b) / a) * fabs(b))) * (0.012345679012345678 / ((a * a) * a)))) / (a * a)) * (((c * a) * 0.3333333333333333) - (t_0 * 0.1111111111111111));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_0
real(8) :: tmp
t_0 = abs(b) * abs(b)
if (abs(b) <= 4.5d-153) then
tmp = ((0.3333333333333333d0 * c) / a) ** 3.0d0
else
tmp = (((((c * a) * 3.0d0) - t_0) * (((c * 3.0d0) - ((abs(b) / a) * abs(b))) * (0.012345679012345678d0 / ((a * a) * a)))) / (a * a)) * (((c * a) * 0.3333333333333333d0) - (t_0 * 0.1111111111111111d0))
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double t_0 = Math.abs(b) * Math.abs(b);
double tmp;
if (Math.abs(b) <= 4.5e-153) {
tmp = Math.pow(((0.3333333333333333 * c) / a), 3.0);
} else {
tmp = (((((c * a) * 3.0) - t_0) * (((c * 3.0) - ((Math.abs(b) / a) * Math.abs(b))) * (0.012345679012345678 / ((a * a) * a)))) / (a * a)) * (((c * a) * 0.3333333333333333) - (t_0 * 0.1111111111111111));
}
return tmp;
}
def code(a, b, c): t_0 = math.fabs(b) * math.fabs(b) tmp = 0 if math.fabs(b) <= 4.5e-153: tmp = math.pow(((0.3333333333333333 * c) / a), 3.0) else: tmp = (((((c * a) * 3.0) - t_0) * (((c * 3.0) - ((math.fabs(b) / a) * math.fabs(b))) * (0.012345679012345678 / ((a * a) * a)))) / (a * a)) * (((c * a) * 0.3333333333333333) - (t_0 * 0.1111111111111111)) return tmp
function code(a, b, c) t_0 = Float64(abs(b) * abs(b)) tmp = 0.0 if (abs(b) <= 4.5e-153) tmp = Float64(Float64(0.3333333333333333 * c) / a) ^ 3.0; else tmp = Float64(Float64(Float64(Float64(Float64(Float64(c * a) * 3.0) - t_0) * Float64(Float64(Float64(c * 3.0) - Float64(Float64(abs(b) / a) * abs(b))) * Float64(0.012345679012345678 / Float64(Float64(a * a) * a)))) / Float64(a * a)) * Float64(Float64(Float64(c * a) * 0.3333333333333333) - Float64(t_0 * 0.1111111111111111))); end return tmp end
function tmp_2 = code(a, b, c) t_0 = abs(b) * abs(b); tmp = 0.0; if (abs(b) <= 4.5e-153) tmp = ((0.3333333333333333 * c) / a) ^ 3.0; else tmp = (((((c * a) * 3.0) - t_0) * (((c * 3.0) - ((abs(b) / a) * abs(b))) * (0.012345679012345678 / ((a * a) * a)))) / (a * a)) * (((c * a) * 0.3333333333333333) - (t_0 * 0.1111111111111111)); end tmp_2 = tmp; end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[Abs[b], $MachinePrecision] * N[Abs[b], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[b], $MachinePrecision], 4.5e-153], N[Power[N[(N[(0.3333333333333333 * c), $MachinePrecision] / a), $MachinePrecision], 3.0], $MachinePrecision], N[(N[(N[(N[(N[(N[(c * a), $MachinePrecision] * 3.0), $MachinePrecision] - t$95$0), $MachinePrecision] * N[(N[(N[(c * 3.0), $MachinePrecision] - N[(N[(N[Abs[b], $MachinePrecision] / a), $MachinePrecision] * N[Abs[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.012345679012345678 / N[(N[(a * a), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * a), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(c * a), $MachinePrecision] * 0.3333333333333333), $MachinePrecision] - N[(t$95$0 * 0.1111111111111111), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \left|b\right| \cdot \left|b\right|\\
\mathbf{if}\;\left|b\right| \leq 4.5 \cdot 10^{-153}:\\
\;\;\;\;{\left(\frac{0.3333333333333333 \cdot c}{a}\right)}^{3}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\left(c \cdot a\right) \cdot 3 - t\_0\right) \cdot \left(\left(c \cdot 3 - \frac{\left|b\right|}{a} \cdot \left|b\right|\right) \cdot \frac{0.012345679012345678}{\left(a \cdot a\right) \cdot a}\right)}{a \cdot a} \cdot \left(\left(c \cdot a\right) \cdot 0.3333333333333333 - t\_0 \cdot 0.1111111111111111\right)\\
\end{array}
if b < 4.5e-153Initial program 81.1%
Taylor expanded in a around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-*.f6494.0%
Applied rewrites94.0%
Taylor expanded in a around inf
lower-*.f6458.9%
Applied rewrites58.9%
if 4.5e-153 < b Initial program 81.1%
Applied rewrites66.2%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites71.6%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (* (fabs b) (fabs b)))
(t_1 (/ (* 0.3333333333333333 c) a)))
(if (<= (fabs b) 4.5e-153)
(* (* t_1 t_1) t_1)
(*
(/
(*
(- (* (* c a) 3.0) t_0)
(*
(- (* c 3.0) (* (/ (fabs b) a) (fabs b)))
(/ 0.012345679012345678 (* (* a a) a))))
(* a a))
(- (* (* c a) 0.3333333333333333) (* t_0 0.1111111111111111))))))double code(double a, double b, double c) {
double t_0 = fabs(b) * fabs(b);
double t_1 = (0.3333333333333333 * c) / a;
double tmp;
if (fabs(b) <= 4.5e-153) {
tmp = (t_1 * t_1) * t_1;
} else {
tmp = (((((c * a) * 3.0) - t_0) * (((c * 3.0) - ((fabs(b) / a) * fabs(b))) * (0.012345679012345678 / ((a * a) * a)))) / (a * a)) * (((c * a) * 0.3333333333333333) - (t_0 * 0.1111111111111111));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = abs(b) * abs(b)
t_1 = (0.3333333333333333d0 * c) / a
if (abs(b) <= 4.5d-153) then
tmp = (t_1 * t_1) * t_1
else
tmp = (((((c * a) * 3.0d0) - t_0) * (((c * 3.0d0) - ((abs(b) / a) * abs(b))) * (0.012345679012345678d0 / ((a * a) * a)))) / (a * a)) * (((c * a) * 0.3333333333333333d0) - (t_0 * 0.1111111111111111d0))
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double t_0 = Math.abs(b) * Math.abs(b);
double t_1 = (0.3333333333333333 * c) / a;
double tmp;
if (Math.abs(b) <= 4.5e-153) {
tmp = (t_1 * t_1) * t_1;
} else {
tmp = (((((c * a) * 3.0) - t_0) * (((c * 3.0) - ((Math.abs(b) / a) * Math.abs(b))) * (0.012345679012345678 / ((a * a) * a)))) / (a * a)) * (((c * a) * 0.3333333333333333) - (t_0 * 0.1111111111111111));
}
return tmp;
}
def code(a, b, c): t_0 = math.fabs(b) * math.fabs(b) t_1 = (0.3333333333333333 * c) / a tmp = 0 if math.fabs(b) <= 4.5e-153: tmp = (t_1 * t_1) * t_1 else: tmp = (((((c * a) * 3.0) - t_0) * (((c * 3.0) - ((math.fabs(b) / a) * math.fabs(b))) * (0.012345679012345678 / ((a * a) * a)))) / (a * a)) * (((c * a) * 0.3333333333333333) - (t_0 * 0.1111111111111111)) return tmp
function code(a, b, c) t_0 = Float64(abs(b) * abs(b)) t_1 = Float64(Float64(0.3333333333333333 * c) / a) tmp = 0.0 if (abs(b) <= 4.5e-153) tmp = Float64(Float64(t_1 * t_1) * t_1); else tmp = Float64(Float64(Float64(Float64(Float64(Float64(c * a) * 3.0) - t_0) * Float64(Float64(Float64(c * 3.0) - Float64(Float64(abs(b) / a) * abs(b))) * Float64(0.012345679012345678 / Float64(Float64(a * a) * a)))) / Float64(a * a)) * Float64(Float64(Float64(c * a) * 0.3333333333333333) - Float64(t_0 * 0.1111111111111111))); end return tmp end
function tmp_2 = code(a, b, c) t_0 = abs(b) * abs(b); t_1 = (0.3333333333333333 * c) / a; tmp = 0.0; if (abs(b) <= 4.5e-153) tmp = (t_1 * t_1) * t_1; else tmp = (((((c * a) * 3.0) - t_0) * (((c * 3.0) - ((abs(b) / a) * abs(b))) * (0.012345679012345678 / ((a * a) * a)))) / (a * a)) * (((c * a) * 0.3333333333333333) - (t_0 * 0.1111111111111111)); end tmp_2 = tmp; end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[Abs[b], $MachinePrecision] * N[Abs[b], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(0.3333333333333333 * c), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[N[Abs[b], $MachinePrecision], 4.5e-153], N[(N[(t$95$1 * t$95$1), $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[(N[(N[(N[(N[(c * a), $MachinePrecision] * 3.0), $MachinePrecision] - t$95$0), $MachinePrecision] * N[(N[(N[(c * 3.0), $MachinePrecision] - N[(N[(N[Abs[b], $MachinePrecision] / a), $MachinePrecision] * N[Abs[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.012345679012345678 / N[(N[(a * a), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * a), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(c * a), $MachinePrecision] * 0.3333333333333333), $MachinePrecision] - N[(t$95$0 * 0.1111111111111111), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \left|b\right| \cdot \left|b\right|\\
t_1 := \frac{0.3333333333333333 \cdot c}{a}\\
\mathbf{if}\;\left|b\right| \leq 4.5 \cdot 10^{-153}:\\
\;\;\;\;\left(t\_1 \cdot t\_1\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\left(c \cdot a\right) \cdot 3 - t\_0\right) \cdot \left(\left(c \cdot 3 - \frac{\left|b\right|}{a} \cdot \left|b\right|\right) \cdot \frac{0.012345679012345678}{\left(a \cdot a\right) \cdot a}\right)}{a \cdot a} \cdot \left(\left(c \cdot a\right) \cdot 0.3333333333333333 - t\_0 \cdot 0.1111111111111111\right)\\
\end{array}
if b < 4.5e-153Initial program 81.1%
Taylor expanded in a around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-*.f6494.0%
Applied rewrites94.0%
Taylor expanded in a around inf
lower-*.f6458.9%
Applied rewrites58.9%
lift-pow.f64N/A
unpow3N/A
lower-*.f64N/A
Applied rewrites58.9%
if 4.5e-153 < b Initial program 81.1%
Applied rewrites66.2%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites71.6%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (* (* c a) 3.0))
(t_1 (* (fabs b) (fabs b)))
(t_2 (- t_0 t_1))
(t_3 (/ (* 0.3333333333333333 c) a)))
(if (<= (fabs b) 2.2e-131)
(* (* t_3 t_3) t_3)
(*
(/ t_2 (* 81.0 (* (* a a) (* a a))))
(* (- t_1 t_0) (* (/ -0.1111111111111111 (* a a)) t_2))))))double code(double a, double b, double c) {
double t_0 = (c * a) * 3.0;
double t_1 = fabs(b) * fabs(b);
double t_2 = t_0 - t_1;
double t_3 = (0.3333333333333333 * c) / a;
double tmp;
if (fabs(b) <= 2.2e-131) {
tmp = (t_3 * t_3) * t_3;
} else {
tmp = (t_2 / (81.0 * ((a * a) * (a * a)))) * ((t_1 - t_0) * ((-0.1111111111111111 / (a * a)) * t_2));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = (c * a) * 3.0d0
t_1 = abs(b) * abs(b)
t_2 = t_0 - t_1
t_3 = (0.3333333333333333d0 * c) / a
if (abs(b) <= 2.2d-131) then
tmp = (t_3 * t_3) * t_3
else
tmp = (t_2 / (81.0d0 * ((a * a) * (a * a)))) * ((t_1 - t_0) * (((-0.1111111111111111d0) / (a * a)) * t_2))
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double t_0 = (c * a) * 3.0;
double t_1 = Math.abs(b) * Math.abs(b);
double t_2 = t_0 - t_1;
double t_3 = (0.3333333333333333 * c) / a;
double tmp;
if (Math.abs(b) <= 2.2e-131) {
tmp = (t_3 * t_3) * t_3;
} else {
tmp = (t_2 / (81.0 * ((a * a) * (a * a)))) * ((t_1 - t_0) * ((-0.1111111111111111 / (a * a)) * t_2));
}
return tmp;
}
def code(a, b, c): t_0 = (c * a) * 3.0 t_1 = math.fabs(b) * math.fabs(b) t_2 = t_0 - t_1 t_3 = (0.3333333333333333 * c) / a tmp = 0 if math.fabs(b) <= 2.2e-131: tmp = (t_3 * t_3) * t_3 else: tmp = (t_2 / (81.0 * ((a * a) * (a * a)))) * ((t_1 - t_0) * ((-0.1111111111111111 / (a * a)) * t_2)) return tmp
function code(a, b, c) t_0 = Float64(Float64(c * a) * 3.0) t_1 = Float64(abs(b) * abs(b)) t_2 = Float64(t_0 - t_1) t_3 = Float64(Float64(0.3333333333333333 * c) / a) tmp = 0.0 if (abs(b) <= 2.2e-131) tmp = Float64(Float64(t_3 * t_3) * t_3); else tmp = Float64(Float64(t_2 / Float64(81.0 * Float64(Float64(a * a) * Float64(a * a)))) * Float64(Float64(t_1 - t_0) * Float64(Float64(-0.1111111111111111 / Float64(a * a)) * t_2))); end return tmp end
function tmp_2 = code(a, b, c) t_0 = (c * a) * 3.0; t_1 = abs(b) * abs(b); t_2 = t_0 - t_1; t_3 = (0.3333333333333333 * c) / a; tmp = 0.0; if (abs(b) <= 2.2e-131) tmp = (t_3 * t_3) * t_3; else tmp = (t_2 / (81.0 * ((a * a) * (a * a)))) * ((t_1 - t_0) * ((-0.1111111111111111 / (a * a)) * t_2)); end tmp_2 = tmp; end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(c * a), $MachinePrecision] * 3.0), $MachinePrecision]}, Block[{t$95$1 = N[(N[Abs[b], $MachinePrecision] * N[Abs[b], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 - t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(0.3333333333333333 * c), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[N[Abs[b], $MachinePrecision], 2.2e-131], N[(N[(t$95$3 * t$95$3), $MachinePrecision] * t$95$3), $MachinePrecision], N[(N[(t$95$2 / N[(81.0 * N[(N[(a * a), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$1 - t$95$0), $MachinePrecision] * N[(N[(-0.1111111111111111 / N[(a * a), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_0 := \left(c \cdot a\right) \cdot 3\\
t_1 := \left|b\right| \cdot \left|b\right|\\
t_2 := t\_0 - t\_1\\
t_3 := \frac{0.3333333333333333 \cdot c}{a}\\
\mathbf{if}\;\left|b\right| \leq 2.2 \cdot 10^{-131}:\\
\;\;\;\;\left(t\_3 \cdot t\_3\right) \cdot t\_3\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_2}{81 \cdot \left(\left(a \cdot a\right) \cdot \left(a \cdot a\right)\right)} \cdot \left(\left(t\_1 - t\_0\right) \cdot \left(\frac{-0.1111111111111111}{a \cdot a} \cdot t\_2\right)\right)\\
\end{array}
if b < 2.2e-131Initial program 81.1%
Taylor expanded in a around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-*.f6494.0%
Applied rewrites94.0%
Taylor expanded in a around inf
lower-*.f6458.9%
Applied rewrites58.9%
lift-pow.f64N/A
unpow3N/A
lower-*.f64N/A
Applied rewrites58.9%
if 2.2e-131 < b Initial program 81.1%
Applied rewrites66.6%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (* (fabs b) (fabs b)))
(t_1 (- (* (* c a) 3.0) t_0))
(t_2 (/ (* 0.3333333333333333 c) a)))
(if (<= (fabs b) 4.5e-153)
(* (* t_2 t_2) t_2)
(*
(/
(* t_1 (* t_1 (/ 0.012345679012345678 (* (* a a) (* a a)))))
(* a a))
(- (* (* c a) 0.3333333333333333) (* t_0 0.1111111111111111))))))double code(double a, double b, double c) {
double t_0 = fabs(b) * fabs(b);
double t_1 = ((c * a) * 3.0) - t_0;
double t_2 = (0.3333333333333333 * c) / a;
double tmp;
if (fabs(b) <= 4.5e-153) {
tmp = (t_2 * t_2) * t_2;
} else {
tmp = ((t_1 * (t_1 * (0.012345679012345678 / ((a * a) * (a * a))))) / (a * a)) * (((c * a) * 0.3333333333333333) - (t_0 * 0.1111111111111111));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = abs(b) * abs(b)
t_1 = ((c * a) * 3.0d0) - t_0
t_2 = (0.3333333333333333d0 * c) / a
if (abs(b) <= 4.5d-153) then
tmp = (t_2 * t_2) * t_2
else
tmp = ((t_1 * (t_1 * (0.012345679012345678d0 / ((a * a) * (a * a))))) / (a * a)) * (((c * a) * 0.3333333333333333d0) - (t_0 * 0.1111111111111111d0))
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double t_0 = Math.abs(b) * Math.abs(b);
double t_1 = ((c * a) * 3.0) - t_0;
double t_2 = (0.3333333333333333 * c) / a;
double tmp;
if (Math.abs(b) <= 4.5e-153) {
tmp = (t_2 * t_2) * t_2;
} else {
tmp = ((t_1 * (t_1 * (0.012345679012345678 / ((a * a) * (a * a))))) / (a * a)) * (((c * a) * 0.3333333333333333) - (t_0 * 0.1111111111111111));
}
return tmp;
}
def code(a, b, c): t_0 = math.fabs(b) * math.fabs(b) t_1 = ((c * a) * 3.0) - t_0 t_2 = (0.3333333333333333 * c) / a tmp = 0 if math.fabs(b) <= 4.5e-153: tmp = (t_2 * t_2) * t_2 else: tmp = ((t_1 * (t_1 * (0.012345679012345678 / ((a * a) * (a * a))))) / (a * a)) * (((c * a) * 0.3333333333333333) - (t_0 * 0.1111111111111111)) return tmp
function code(a, b, c) t_0 = Float64(abs(b) * abs(b)) t_1 = Float64(Float64(Float64(c * a) * 3.0) - t_0) t_2 = Float64(Float64(0.3333333333333333 * c) / a) tmp = 0.0 if (abs(b) <= 4.5e-153) tmp = Float64(Float64(t_2 * t_2) * t_2); else tmp = Float64(Float64(Float64(t_1 * Float64(t_1 * Float64(0.012345679012345678 / Float64(Float64(a * a) * Float64(a * a))))) / Float64(a * a)) * Float64(Float64(Float64(c * a) * 0.3333333333333333) - Float64(t_0 * 0.1111111111111111))); end return tmp end
function tmp_2 = code(a, b, c) t_0 = abs(b) * abs(b); t_1 = ((c * a) * 3.0) - t_0; t_2 = (0.3333333333333333 * c) / a; tmp = 0.0; if (abs(b) <= 4.5e-153) tmp = (t_2 * t_2) * t_2; else tmp = ((t_1 * (t_1 * (0.012345679012345678 / ((a * a) * (a * a))))) / (a * a)) * (((c * a) * 0.3333333333333333) - (t_0 * 0.1111111111111111)); end tmp_2 = tmp; end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[Abs[b], $MachinePrecision] * N[Abs[b], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(c * a), $MachinePrecision] * 3.0), $MachinePrecision] - t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(0.3333333333333333 * c), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[N[Abs[b], $MachinePrecision], 4.5e-153], N[(N[(t$95$2 * t$95$2), $MachinePrecision] * t$95$2), $MachinePrecision], N[(N[(N[(t$95$1 * N[(t$95$1 * N[(0.012345679012345678 / N[(N[(a * a), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * a), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(c * a), $MachinePrecision] * 0.3333333333333333), $MachinePrecision] - N[(t$95$0 * 0.1111111111111111), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \left|b\right| \cdot \left|b\right|\\
t_1 := \left(c \cdot a\right) \cdot 3 - t\_0\\
t_2 := \frac{0.3333333333333333 \cdot c}{a}\\
\mathbf{if}\;\left|b\right| \leq 4.5 \cdot 10^{-153}:\\
\;\;\;\;\left(t\_2 \cdot t\_2\right) \cdot t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1 \cdot \left(t\_1 \cdot \frac{0.012345679012345678}{\left(a \cdot a\right) \cdot \left(a \cdot a\right)}\right)}{a \cdot a} \cdot \left(\left(c \cdot a\right) \cdot 0.3333333333333333 - t\_0 \cdot 0.1111111111111111\right)\\
\end{array}
if b < 4.5e-153Initial program 81.1%
Taylor expanded in a around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-*.f6494.0%
Applied rewrites94.0%
Taylor expanded in a around inf
lower-*.f6458.9%
Applied rewrites58.9%
lift-pow.f64N/A
unpow3N/A
lower-*.f64N/A
Applied rewrites58.9%
if 4.5e-153 < b Initial program 81.1%
Applied rewrites66.2%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (- (* (* c 3.0) a) (* (fabs b) (fabs b))))
(t_1 (/ (* 0.3333333333333333 c) a)))
(if (<= (fabs b) 2.2e-131)
(* (* t_1 t_1) t_1)
(*
(*
t_0
(/ (* 0.012345679012345678 t_0) (* (* (* (* a a) a) a) a)))
(-
(* 0.3333333333333333 c)
(* 0.1111111111111111 (* (/ (fabs b) a) (fabs b))))))))double code(double a, double b, double c) {
double t_0 = ((c * 3.0) * a) - (fabs(b) * fabs(b));
double t_1 = (0.3333333333333333 * c) / a;
double tmp;
if (fabs(b) <= 2.2e-131) {
tmp = (t_1 * t_1) * t_1;
} else {
tmp = (t_0 * ((0.012345679012345678 * t_0) / ((((a * a) * a) * a) * a))) * ((0.3333333333333333 * c) - (0.1111111111111111 * ((fabs(b) / a) * fabs(b))));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = ((c * 3.0d0) * a) - (abs(b) * abs(b))
t_1 = (0.3333333333333333d0 * c) / a
if (abs(b) <= 2.2d-131) then
tmp = (t_1 * t_1) * t_1
else
tmp = (t_0 * ((0.012345679012345678d0 * t_0) / ((((a * a) * a) * a) * a))) * ((0.3333333333333333d0 * c) - (0.1111111111111111d0 * ((abs(b) / a) * abs(b))))
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double t_0 = ((c * 3.0) * a) - (Math.abs(b) * Math.abs(b));
double t_1 = (0.3333333333333333 * c) / a;
double tmp;
if (Math.abs(b) <= 2.2e-131) {
tmp = (t_1 * t_1) * t_1;
} else {
tmp = (t_0 * ((0.012345679012345678 * t_0) / ((((a * a) * a) * a) * a))) * ((0.3333333333333333 * c) - (0.1111111111111111 * ((Math.abs(b) / a) * Math.abs(b))));
}
return tmp;
}
def code(a, b, c): t_0 = ((c * 3.0) * a) - (math.fabs(b) * math.fabs(b)) t_1 = (0.3333333333333333 * c) / a tmp = 0 if math.fabs(b) <= 2.2e-131: tmp = (t_1 * t_1) * t_1 else: tmp = (t_0 * ((0.012345679012345678 * t_0) / ((((a * a) * a) * a) * a))) * ((0.3333333333333333 * c) - (0.1111111111111111 * ((math.fabs(b) / a) * math.fabs(b)))) return tmp
function code(a, b, c) t_0 = Float64(Float64(Float64(c * 3.0) * a) - Float64(abs(b) * abs(b))) t_1 = Float64(Float64(0.3333333333333333 * c) / a) tmp = 0.0 if (abs(b) <= 2.2e-131) tmp = Float64(Float64(t_1 * t_1) * t_1); else tmp = Float64(Float64(t_0 * Float64(Float64(0.012345679012345678 * t_0) / Float64(Float64(Float64(Float64(a * a) * a) * a) * a))) * Float64(Float64(0.3333333333333333 * c) - Float64(0.1111111111111111 * Float64(Float64(abs(b) / a) * abs(b))))); end return tmp end
function tmp_2 = code(a, b, c) t_0 = ((c * 3.0) * a) - (abs(b) * abs(b)); t_1 = (0.3333333333333333 * c) / a; tmp = 0.0; if (abs(b) <= 2.2e-131) tmp = (t_1 * t_1) * t_1; else tmp = (t_0 * ((0.012345679012345678 * t_0) / ((((a * a) * a) * a) * a))) * ((0.3333333333333333 * c) - (0.1111111111111111 * ((abs(b) / a) * abs(b)))); end tmp_2 = tmp; end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(N[(c * 3.0), $MachinePrecision] * a), $MachinePrecision] - N[(N[Abs[b], $MachinePrecision] * N[Abs[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(0.3333333333333333 * c), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[N[Abs[b], $MachinePrecision], 2.2e-131], N[(N[(t$95$1 * t$95$1), $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[(t$95$0 * N[(N[(0.012345679012345678 * t$95$0), $MachinePrecision] / N[(N[(N[(N[(a * a), $MachinePrecision] * a), $MachinePrecision] * a), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(0.3333333333333333 * c), $MachinePrecision] - N[(0.1111111111111111 * N[(N[(N[Abs[b], $MachinePrecision] / a), $MachinePrecision] * N[Abs[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \left(c \cdot 3\right) \cdot a - \left|b\right| \cdot \left|b\right|\\
t_1 := \frac{0.3333333333333333 \cdot c}{a}\\
\mathbf{if}\;\left|b\right| \leq 2.2 \cdot 10^{-131}:\\
\;\;\;\;\left(t\_1 \cdot t\_1\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 \cdot \frac{0.012345679012345678 \cdot t\_0}{\left(\left(\left(a \cdot a\right) \cdot a\right) \cdot a\right) \cdot a}\right) \cdot \left(0.3333333333333333 \cdot c - 0.1111111111111111 \cdot \left(\frac{\left|b\right|}{a} \cdot \left|b\right|\right)\right)\\
\end{array}
if b < 2.2e-131Initial program 81.1%
Taylor expanded in a around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-*.f6494.0%
Applied rewrites94.0%
Taylor expanded in a around inf
lower-*.f6458.9%
Applied rewrites58.9%
lift-pow.f64N/A
unpow3N/A
lower-*.f64N/A
Applied rewrites58.9%
if 2.2e-131 < b Initial program 81.1%
Applied rewrites66.2%
Applied rewrites62.6%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (* (* a a) a))
(t_1 (/ (* 0.3333333333333333 c) a))
(t_2 (* (fabs b) (fabs b)))
(t_3 (- (* (* c 3.0) a) t_2))
(t_4 (* (* c a) 3.0))
(t_5 (- t_2 t_4)))
(if (<= (fabs b) 2.6e-131)
(* (* t_1 t_1) t_1)
(if (<= (fabs b) 1.25e-81)
(*
(- (* (* c a) 0.3333333333333333) (* 0.1111111111111111 t_2))
(* (/ (* 0.012345679012345678 t_3) (* (* t_0 a) (* a a))) t_3))
(*
(* t_5 t_5)
(* (/ (- t_4 t_2) t_0) (/ 0.0013717421124828531 t_0)))))))double code(double a, double b, double c) {
double t_0 = (a * a) * a;
double t_1 = (0.3333333333333333 * c) / a;
double t_2 = fabs(b) * fabs(b);
double t_3 = ((c * 3.0) * a) - t_2;
double t_4 = (c * a) * 3.0;
double t_5 = t_2 - t_4;
double tmp;
if (fabs(b) <= 2.6e-131) {
tmp = (t_1 * t_1) * t_1;
} else if (fabs(b) <= 1.25e-81) {
tmp = (((c * a) * 0.3333333333333333) - (0.1111111111111111 * t_2)) * (((0.012345679012345678 * t_3) / ((t_0 * a) * (a * a))) * t_3);
} else {
tmp = (t_5 * t_5) * (((t_4 - t_2) / t_0) * (0.0013717421124828531 / t_0));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: tmp
t_0 = (a * a) * a
t_1 = (0.3333333333333333d0 * c) / a
t_2 = abs(b) * abs(b)
t_3 = ((c * 3.0d0) * a) - t_2
t_4 = (c * a) * 3.0d0
t_5 = t_2 - t_4
if (abs(b) <= 2.6d-131) then
tmp = (t_1 * t_1) * t_1
else if (abs(b) <= 1.25d-81) then
tmp = (((c * a) * 0.3333333333333333d0) - (0.1111111111111111d0 * t_2)) * (((0.012345679012345678d0 * t_3) / ((t_0 * a) * (a * a))) * t_3)
else
tmp = (t_5 * t_5) * (((t_4 - t_2) / t_0) * (0.0013717421124828531d0 / t_0))
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double t_0 = (a * a) * a;
double t_1 = (0.3333333333333333 * c) / a;
double t_2 = Math.abs(b) * Math.abs(b);
double t_3 = ((c * 3.0) * a) - t_2;
double t_4 = (c * a) * 3.0;
double t_5 = t_2 - t_4;
double tmp;
if (Math.abs(b) <= 2.6e-131) {
tmp = (t_1 * t_1) * t_1;
} else if (Math.abs(b) <= 1.25e-81) {
tmp = (((c * a) * 0.3333333333333333) - (0.1111111111111111 * t_2)) * (((0.012345679012345678 * t_3) / ((t_0 * a) * (a * a))) * t_3);
} else {
tmp = (t_5 * t_5) * (((t_4 - t_2) / t_0) * (0.0013717421124828531 / t_0));
}
return tmp;
}
def code(a, b, c): t_0 = (a * a) * a t_1 = (0.3333333333333333 * c) / a t_2 = math.fabs(b) * math.fabs(b) t_3 = ((c * 3.0) * a) - t_2 t_4 = (c * a) * 3.0 t_5 = t_2 - t_4 tmp = 0 if math.fabs(b) <= 2.6e-131: tmp = (t_1 * t_1) * t_1 elif math.fabs(b) <= 1.25e-81: tmp = (((c * a) * 0.3333333333333333) - (0.1111111111111111 * t_2)) * (((0.012345679012345678 * t_3) / ((t_0 * a) * (a * a))) * t_3) else: tmp = (t_5 * t_5) * (((t_4 - t_2) / t_0) * (0.0013717421124828531 / t_0)) return tmp
function code(a, b, c) t_0 = Float64(Float64(a * a) * a) t_1 = Float64(Float64(0.3333333333333333 * c) / a) t_2 = Float64(abs(b) * abs(b)) t_3 = Float64(Float64(Float64(c * 3.0) * a) - t_2) t_4 = Float64(Float64(c * a) * 3.0) t_5 = Float64(t_2 - t_4) tmp = 0.0 if (abs(b) <= 2.6e-131) tmp = Float64(Float64(t_1 * t_1) * t_1); elseif (abs(b) <= 1.25e-81) tmp = Float64(Float64(Float64(Float64(c * a) * 0.3333333333333333) - Float64(0.1111111111111111 * t_2)) * Float64(Float64(Float64(0.012345679012345678 * t_3) / Float64(Float64(t_0 * a) * Float64(a * a))) * t_3)); else tmp = Float64(Float64(t_5 * t_5) * Float64(Float64(Float64(t_4 - t_2) / t_0) * Float64(0.0013717421124828531 / t_0))); end return tmp end
function tmp_2 = code(a, b, c) t_0 = (a * a) * a; t_1 = (0.3333333333333333 * c) / a; t_2 = abs(b) * abs(b); t_3 = ((c * 3.0) * a) - t_2; t_4 = (c * a) * 3.0; t_5 = t_2 - t_4; tmp = 0.0; if (abs(b) <= 2.6e-131) tmp = (t_1 * t_1) * t_1; elseif (abs(b) <= 1.25e-81) tmp = (((c * a) * 0.3333333333333333) - (0.1111111111111111 * t_2)) * (((0.012345679012345678 * t_3) / ((t_0 * a) * (a * a))) * t_3); else tmp = (t_5 * t_5) * (((t_4 - t_2) / t_0) * (0.0013717421124828531 / t_0)); end tmp_2 = tmp; end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(a * a), $MachinePrecision] * a), $MachinePrecision]}, Block[{t$95$1 = N[(N[(0.3333333333333333 * c), $MachinePrecision] / a), $MachinePrecision]}, Block[{t$95$2 = N[(N[Abs[b], $MachinePrecision] * N[Abs[b], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(c * 3.0), $MachinePrecision] * a), $MachinePrecision] - t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[(N[(c * a), $MachinePrecision] * 3.0), $MachinePrecision]}, Block[{t$95$5 = N[(t$95$2 - t$95$4), $MachinePrecision]}, If[LessEqual[N[Abs[b], $MachinePrecision], 2.6e-131], N[(N[(t$95$1 * t$95$1), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[N[Abs[b], $MachinePrecision], 1.25e-81], N[(N[(N[(N[(c * a), $MachinePrecision] * 0.3333333333333333), $MachinePrecision] - N[(0.1111111111111111 * t$95$2), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(0.012345679012345678 * t$95$3), $MachinePrecision] / N[(N[(t$95$0 * a), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$3), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$5 * t$95$5), $MachinePrecision] * N[(N[(N[(t$95$4 - t$95$2), $MachinePrecision] / t$95$0), $MachinePrecision] * N[(0.0013717421124828531 / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
t_0 := \left(a \cdot a\right) \cdot a\\
t_1 := \frac{0.3333333333333333 \cdot c}{a}\\
t_2 := \left|b\right| \cdot \left|b\right|\\
t_3 := \left(c \cdot 3\right) \cdot a - t\_2\\
t_4 := \left(c \cdot a\right) \cdot 3\\
t_5 := t\_2 - t\_4\\
\mathbf{if}\;\left|b\right| \leq 2.6 \cdot 10^{-131}:\\
\;\;\;\;\left(t\_1 \cdot t\_1\right) \cdot t\_1\\
\mathbf{elif}\;\left|b\right| \leq 1.25 \cdot 10^{-81}:\\
\;\;\;\;\left(\left(c \cdot a\right) \cdot 0.3333333333333333 - 0.1111111111111111 \cdot t\_2\right) \cdot \left(\frac{0.012345679012345678 \cdot t\_3}{\left(t\_0 \cdot a\right) \cdot \left(a \cdot a\right)} \cdot t\_3\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_5 \cdot t\_5\right) \cdot \left(\frac{t\_4 - t\_2}{t\_0} \cdot \frac{0.0013717421124828531}{t\_0}\right)\\
\end{array}
if b < 2.6e-131Initial program 81.1%
Taylor expanded in a around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-*.f6494.0%
Applied rewrites94.0%
Taylor expanded in a around inf
lower-*.f6458.9%
Applied rewrites58.9%
lift-pow.f64N/A
unpow3N/A
lower-*.f64N/A
Applied rewrites58.9%
if 2.6e-131 < b < 1.25e-81Initial program 81.1%
Applied rewrites66.2%
Applied rewrites59.3%
if 1.25e-81 < b Initial program 81.1%
lift-pow.f64N/A
lift-/.f64N/A
mult-flipN/A
cube-prodN/A
unpow3N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites40.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
unswap-sqrN/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
metadata-evalN/A
lift-*.f64N/A
lift-*.f64N/A
cube-unmultN/A
cube-divN/A
lift-/.f64N/A
Applied rewrites46.5%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (* (fabs b) (fabs b)))
(t_1 (/ (* 0.3333333333333333 c) a))
(t_2 (- (* (* c 3.0) a) t_0)))
(if (<= (fabs b) 2.6e-131)
(* (* t_1 t_1) t_1)
(*
(- (* (* c a) 0.3333333333333333) (* 0.1111111111111111 t_0))
(*
(/ (* 0.012345679012345678 t_2) (* (* (* (* a a) a) a) (* a a)))
t_2)))))double code(double a, double b, double c) {
double t_0 = fabs(b) * fabs(b);
double t_1 = (0.3333333333333333 * c) / a;
double t_2 = ((c * 3.0) * a) - t_0;
double tmp;
if (fabs(b) <= 2.6e-131) {
tmp = (t_1 * t_1) * t_1;
} else {
tmp = (((c * a) * 0.3333333333333333) - (0.1111111111111111 * t_0)) * (((0.012345679012345678 * t_2) / ((((a * a) * a) * a) * (a * a))) * t_2);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = abs(b) * abs(b)
t_1 = (0.3333333333333333d0 * c) / a
t_2 = ((c * 3.0d0) * a) - t_0
if (abs(b) <= 2.6d-131) then
tmp = (t_1 * t_1) * t_1
else
tmp = (((c * a) * 0.3333333333333333d0) - (0.1111111111111111d0 * t_0)) * (((0.012345679012345678d0 * t_2) / ((((a * a) * a) * a) * (a * a))) * t_2)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double t_0 = Math.abs(b) * Math.abs(b);
double t_1 = (0.3333333333333333 * c) / a;
double t_2 = ((c * 3.0) * a) - t_0;
double tmp;
if (Math.abs(b) <= 2.6e-131) {
tmp = (t_1 * t_1) * t_1;
} else {
tmp = (((c * a) * 0.3333333333333333) - (0.1111111111111111 * t_0)) * (((0.012345679012345678 * t_2) / ((((a * a) * a) * a) * (a * a))) * t_2);
}
return tmp;
}
def code(a, b, c): t_0 = math.fabs(b) * math.fabs(b) t_1 = (0.3333333333333333 * c) / a t_2 = ((c * 3.0) * a) - t_0 tmp = 0 if math.fabs(b) <= 2.6e-131: tmp = (t_1 * t_1) * t_1 else: tmp = (((c * a) * 0.3333333333333333) - (0.1111111111111111 * t_0)) * (((0.012345679012345678 * t_2) / ((((a * a) * a) * a) * (a * a))) * t_2) return tmp
function code(a, b, c) t_0 = Float64(abs(b) * abs(b)) t_1 = Float64(Float64(0.3333333333333333 * c) / a) t_2 = Float64(Float64(Float64(c * 3.0) * a) - t_0) tmp = 0.0 if (abs(b) <= 2.6e-131) tmp = Float64(Float64(t_1 * t_1) * t_1); else tmp = Float64(Float64(Float64(Float64(c * a) * 0.3333333333333333) - Float64(0.1111111111111111 * t_0)) * Float64(Float64(Float64(0.012345679012345678 * t_2) / Float64(Float64(Float64(Float64(a * a) * a) * a) * Float64(a * a))) * t_2)); end return tmp end
function tmp_2 = code(a, b, c) t_0 = abs(b) * abs(b); t_1 = (0.3333333333333333 * c) / a; t_2 = ((c * 3.0) * a) - t_0; tmp = 0.0; if (abs(b) <= 2.6e-131) tmp = (t_1 * t_1) * t_1; else tmp = (((c * a) * 0.3333333333333333) - (0.1111111111111111 * t_0)) * (((0.012345679012345678 * t_2) / ((((a * a) * a) * a) * (a * a))) * t_2); end tmp_2 = tmp; end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[Abs[b], $MachinePrecision] * N[Abs[b], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(0.3333333333333333 * c), $MachinePrecision] / a), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(c * 3.0), $MachinePrecision] * a), $MachinePrecision] - t$95$0), $MachinePrecision]}, If[LessEqual[N[Abs[b], $MachinePrecision], 2.6e-131], N[(N[(t$95$1 * t$95$1), $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[(N[(N[(c * a), $MachinePrecision] * 0.3333333333333333), $MachinePrecision] - N[(0.1111111111111111 * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(0.012345679012345678 * t$95$2), $MachinePrecision] / N[(N[(N[(N[(a * a), $MachinePrecision] * a), $MachinePrecision] * a), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \left|b\right| \cdot \left|b\right|\\
t_1 := \frac{0.3333333333333333 \cdot c}{a}\\
t_2 := \left(c \cdot 3\right) \cdot a - t\_0\\
\mathbf{if}\;\left|b\right| \leq 2.6 \cdot 10^{-131}:\\
\;\;\;\;\left(t\_1 \cdot t\_1\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(\left(c \cdot a\right) \cdot 0.3333333333333333 - 0.1111111111111111 \cdot t\_0\right) \cdot \left(\frac{0.012345679012345678 \cdot t\_2}{\left(\left(\left(a \cdot a\right) \cdot a\right) \cdot a\right) \cdot \left(a \cdot a\right)} \cdot t\_2\right)\\
\end{array}
if b < 2.6e-131Initial program 81.1%
Taylor expanded in a around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-*.f6494.0%
Applied rewrites94.0%
Taylor expanded in a around inf
lower-*.f6458.9%
Applied rewrites58.9%
lift-pow.f64N/A
unpow3N/A
lower-*.f64N/A
Applied rewrites58.9%
if 2.6e-131 < b Initial program 81.1%
Applied rewrites66.2%
Applied rewrites59.3%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (- (* (* c a) 3.0) (* (fabs b) (fabs b))))
(t_1 (/ (* 0.3333333333333333 c) a))
(t_2 (* (* a a) a)))
(if (<= (fabs b) 2.6e-131)
(* (* t_1 t_1) t_1)
(* t_0 (* t_0 (* (/ 0.0013717421124828531 (* t_2 t_2)) t_0))))))double code(double a, double b, double c) {
double t_0 = ((c * a) * 3.0) - (fabs(b) * fabs(b));
double t_1 = (0.3333333333333333 * c) / a;
double t_2 = (a * a) * a;
double tmp;
if (fabs(b) <= 2.6e-131) {
tmp = (t_1 * t_1) * t_1;
} else {
tmp = t_0 * (t_0 * ((0.0013717421124828531 / (t_2 * t_2)) * t_0));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = ((c * a) * 3.0d0) - (abs(b) * abs(b))
t_1 = (0.3333333333333333d0 * c) / a
t_2 = (a * a) * a
if (abs(b) <= 2.6d-131) then
tmp = (t_1 * t_1) * t_1
else
tmp = t_0 * (t_0 * ((0.0013717421124828531d0 / (t_2 * t_2)) * t_0))
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double t_0 = ((c * a) * 3.0) - (Math.abs(b) * Math.abs(b));
double t_1 = (0.3333333333333333 * c) / a;
double t_2 = (a * a) * a;
double tmp;
if (Math.abs(b) <= 2.6e-131) {
tmp = (t_1 * t_1) * t_1;
} else {
tmp = t_0 * (t_0 * ((0.0013717421124828531 / (t_2 * t_2)) * t_0));
}
return tmp;
}
def code(a, b, c): t_0 = ((c * a) * 3.0) - (math.fabs(b) * math.fabs(b)) t_1 = (0.3333333333333333 * c) / a t_2 = (a * a) * a tmp = 0 if math.fabs(b) <= 2.6e-131: tmp = (t_1 * t_1) * t_1 else: tmp = t_0 * (t_0 * ((0.0013717421124828531 / (t_2 * t_2)) * t_0)) return tmp
function code(a, b, c) t_0 = Float64(Float64(Float64(c * a) * 3.0) - Float64(abs(b) * abs(b))) t_1 = Float64(Float64(0.3333333333333333 * c) / a) t_2 = Float64(Float64(a * a) * a) tmp = 0.0 if (abs(b) <= 2.6e-131) tmp = Float64(Float64(t_1 * t_1) * t_1); else tmp = Float64(t_0 * Float64(t_0 * Float64(Float64(0.0013717421124828531 / Float64(t_2 * t_2)) * t_0))); end return tmp end
function tmp_2 = code(a, b, c) t_0 = ((c * a) * 3.0) - (abs(b) * abs(b)); t_1 = (0.3333333333333333 * c) / a; t_2 = (a * a) * a; tmp = 0.0; if (abs(b) <= 2.6e-131) tmp = (t_1 * t_1) * t_1; else tmp = t_0 * (t_0 * ((0.0013717421124828531 / (t_2 * t_2)) * t_0)); end tmp_2 = tmp; end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(N[(c * a), $MachinePrecision] * 3.0), $MachinePrecision] - N[(N[Abs[b], $MachinePrecision] * N[Abs[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(0.3333333333333333 * c), $MachinePrecision] / a), $MachinePrecision]}, Block[{t$95$2 = N[(N[(a * a), $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[N[Abs[b], $MachinePrecision], 2.6e-131], N[(N[(t$95$1 * t$95$1), $MachinePrecision] * t$95$1), $MachinePrecision], N[(t$95$0 * N[(t$95$0 * N[(N[(0.0013717421124828531 / N[(t$95$2 * t$95$2), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \left(c \cdot a\right) \cdot 3 - \left|b\right| \cdot \left|b\right|\\
t_1 := \frac{0.3333333333333333 \cdot c}{a}\\
t_2 := \left(a \cdot a\right) \cdot a\\
\mathbf{if}\;\left|b\right| \leq 2.6 \cdot 10^{-131}:\\
\;\;\;\;\left(t\_1 \cdot t\_1\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(t\_0 \cdot \left(\frac{0.0013717421124828531}{t\_2 \cdot t\_2} \cdot t\_0\right)\right)\\
\end{array}
if b < 2.6e-131Initial program 81.1%
Taylor expanded in a around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-*.f6494.0%
Applied rewrites94.0%
Taylor expanded in a around inf
lower-*.f6458.9%
Applied rewrites58.9%
lift-pow.f64N/A
unpow3N/A
lower-*.f64N/A
Applied rewrites58.9%
if 2.6e-131 < b Initial program 81.1%
lift-pow.f64N/A
lift-/.f64N/A
mult-flipN/A
cube-prodN/A
unpow3N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites40.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
unswap-sqrN/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites46.8%
lift-*.f64N/A
lift-*.f64N/A
sqr-neg-revN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
associate-*l*N/A
Applied rewrites59.0%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (* (* c a) 3.0))
(t_1 (* (fabs b) (fabs b)))
(t_2 (- t_0 t_1))
(t_3 (/ (* 0.3333333333333333 c) a))
(t_4 (- t_1 t_0)))
(if (<= (fabs b) 2.25e-138)
(* (* t_3 t_3) t_3)
(if (<= (fabs b) 2.45e-80)
(*
t_2
(*
(* -0.037037037037037035 (/ c a))
(/ (* t_4 (/ 0.1111111111111111 (* a a))) (* a a))))
(*
(* t_4 t_4)
(/ t_2 (* 729.0 (* (* (* a a) (* a a)) (* a a)))))))))double code(double a, double b, double c) {
double t_0 = (c * a) * 3.0;
double t_1 = fabs(b) * fabs(b);
double t_2 = t_0 - t_1;
double t_3 = (0.3333333333333333 * c) / a;
double t_4 = t_1 - t_0;
double tmp;
if (fabs(b) <= 2.25e-138) {
tmp = (t_3 * t_3) * t_3;
} else if (fabs(b) <= 2.45e-80) {
tmp = t_2 * ((-0.037037037037037035 * (c / a)) * ((t_4 * (0.1111111111111111 / (a * a))) / (a * a)));
} else {
tmp = (t_4 * t_4) * (t_2 / (729.0 * (((a * a) * (a * a)) * (a * a))));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_0 = (c * a) * 3.0d0
t_1 = abs(b) * abs(b)
t_2 = t_0 - t_1
t_3 = (0.3333333333333333d0 * c) / a
t_4 = t_1 - t_0
if (abs(b) <= 2.25d-138) then
tmp = (t_3 * t_3) * t_3
else if (abs(b) <= 2.45d-80) then
tmp = t_2 * (((-0.037037037037037035d0) * (c / a)) * ((t_4 * (0.1111111111111111d0 / (a * a))) / (a * a)))
else
tmp = (t_4 * t_4) * (t_2 / (729.0d0 * (((a * a) * (a * a)) * (a * a))))
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double t_0 = (c * a) * 3.0;
double t_1 = Math.abs(b) * Math.abs(b);
double t_2 = t_0 - t_1;
double t_3 = (0.3333333333333333 * c) / a;
double t_4 = t_1 - t_0;
double tmp;
if (Math.abs(b) <= 2.25e-138) {
tmp = (t_3 * t_3) * t_3;
} else if (Math.abs(b) <= 2.45e-80) {
tmp = t_2 * ((-0.037037037037037035 * (c / a)) * ((t_4 * (0.1111111111111111 / (a * a))) / (a * a)));
} else {
tmp = (t_4 * t_4) * (t_2 / (729.0 * (((a * a) * (a * a)) * (a * a))));
}
return tmp;
}
def code(a, b, c): t_0 = (c * a) * 3.0 t_1 = math.fabs(b) * math.fabs(b) t_2 = t_0 - t_1 t_3 = (0.3333333333333333 * c) / a t_4 = t_1 - t_0 tmp = 0 if math.fabs(b) <= 2.25e-138: tmp = (t_3 * t_3) * t_3 elif math.fabs(b) <= 2.45e-80: tmp = t_2 * ((-0.037037037037037035 * (c / a)) * ((t_4 * (0.1111111111111111 / (a * a))) / (a * a))) else: tmp = (t_4 * t_4) * (t_2 / (729.0 * (((a * a) * (a * a)) * (a * a)))) return tmp
function code(a, b, c) t_0 = Float64(Float64(c * a) * 3.0) t_1 = Float64(abs(b) * abs(b)) t_2 = Float64(t_0 - t_1) t_3 = Float64(Float64(0.3333333333333333 * c) / a) t_4 = Float64(t_1 - t_0) tmp = 0.0 if (abs(b) <= 2.25e-138) tmp = Float64(Float64(t_3 * t_3) * t_3); elseif (abs(b) <= 2.45e-80) tmp = Float64(t_2 * Float64(Float64(-0.037037037037037035 * Float64(c / a)) * Float64(Float64(t_4 * Float64(0.1111111111111111 / Float64(a * a))) / Float64(a * a)))); else tmp = Float64(Float64(t_4 * t_4) * Float64(t_2 / Float64(729.0 * Float64(Float64(Float64(a * a) * Float64(a * a)) * Float64(a * a))))); end return tmp end
function tmp_2 = code(a, b, c) t_0 = (c * a) * 3.0; t_1 = abs(b) * abs(b); t_2 = t_0 - t_1; t_3 = (0.3333333333333333 * c) / a; t_4 = t_1 - t_0; tmp = 0.0; if (abs(b) <= 2.25e-138) tmp = (t_3 * t_3) * t_3; elseif (abs(b) <= 2.45e-80) tmp = t_2 * ((-0.037037037037037035 * (c / a)) * ((t_4 * (0.1111111111111111 / (a * a))) / (a * a))); else tmp = (t_4 * t_4) * (t_2 / (729.0 * (((a * a) * (a * a)) * (a * a)))); end tmp_2 = tmp; end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(c * a), $MachinePrecision] * 3.0), $MachinePrecision]}, Block[{t$95$1 = N[(N[Abs[b], $MachinePrecision] * N[Abs[b], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 - t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(0.3333333333333333 * c), $MachinePrecision] / a), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$1 - t$95$0), $MachinePrecision]}, If[LessEqual[N[Abs[b], $MachinePrecision], 2.25e-138], N[(N[(t$95$3 * t$95$3), $MachinePrecision] * t$95$3), $MachinePrecision], If[LessEqual[N[Abs[b], $MachinePrecision], 2.45e-80], N[(t$95$2 * N[(N[(-0.037037037037037035 * N[(c / a), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$4 * N[(0.1111111111111111 / N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$4 * t$95$4), $MachinePrecision] * N[(t$95$2 / N[(729.0 * N[(N[(N[(a * a), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
t_0 := \left(c \cdot a\right) \cdot 3\\
t_1 := \left|b\right| \cdot \left|b\right|\\
t_2 := t\_0 - t\_1\\
t_3 := \frac{0.3333333333333333 \cdot c}{a}\\
t_4 := t\_1 - t\_0\\
\mathbf{if}\;\left|b\right| \leq 2.25 \cdot 10^{-138}:\\
\;\;\;\;\left(t\_3 \cdot t\_3\right) \cdot t\_3\\
\mathbf{elif}\;\left|b\right| \leq 2.45 \cdot 10^{-80}:\\
\;\;\;\;t\_2 \cdot \left(\left(-0.037037037037037035 \cdot \frac{c}{a}\right) \cdot \frac{t\_4 \cdot \frac{0.1111111111111111}{a \cdot a}}{a \cdot a}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_4 \cdot t\_4\right) \cdot \frac{t\_2}{729 \cdot \left(\left(\left(a \cdot a\right) \cdot \left(a \cdot a\right)\right) \cdot \left(a \cdot a\right)\right)}\\
\end{array}
if b < 2.25e-138Initial program 81.1%
Taylor expanded in a around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-*.f6494.0%
Applied rewrites94.0%
Taylor expanded in a around inf
lower-*.f6458.9%
Applied rewrites58.9%
lift-pow.f64N/A
unpow3N/A
lower-*.f64N/A
Applied rewrites58.9%
if 2.25e-138 < b < 2.45e-80Initial program 81.1%
Applied rewrites66.6%
Applied rewrites76.0%
Taylor expanded in a around inf
lower-*.f64N/A
lower-/.f6452.6%
Applied rewrites52.6%
if 2.45e-80 < b Initial program 81.1%
lift-pow.f64N/A
lift-/.f64N/A
cube-divN/A
unpow3N/A
associate-/l*N/A
lower-*.f64N/A
Applied rewrites40.7%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (* (* 3.0 c) a))
(t_1 (* (fabs b) (fabs b)))
(t_2 (/ (* 0.3333333333333333 c) a))
(t_3 (* (* c a) 3.0))
(t_4 (- t_1 t_0)))
(if (<= (fabs b) 2.25e-138)
(* (* t_2 t_2) t_2)
(if (<= (fabs b) 2.45e-80)
(*
(- t_3 t_1)
(*
(* -0.037037037037037035 (/ c a))
(/ (* (- t_1 t_3) (/ 0.1111111111111111 (* a a))) (* a a))))
(*
(* t_4 t_4)
(*
(- t_0 t_1)
(/ 0.0013717421124828531 (* (* (* a a) (* a a)) (* a a)))))))))double code(double a, double b, double c) {
double t_0 = (3.0 * c) * a;
double t_1 = fabs(b) * fabs(b);
double t_2 = (0.3333333333333333 * c) / a;
double t_3 = (c * a) * 3.0;
double t_4 = t_1 - t_0;
double tmp;
if (fabs(b) <= 2.25e-138) {
tmp = (t_2 * t_2) * t_2;
} else if (fabs(b) <= 2.45e-80) {
tmp = (t_3 - t_1) * ((-0.037037037037037035 * (c / a)) * (((t_1 - t_3) * (0.1111111111111111 / (a * a))) / (a * a)));
} else {
tmp = (t_4 * t_4) * ((t_0 - t_1) * (0.0013717421124828531 / (((a * a) * (a * a)) * (a * a))));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_0 = (3.0d0 * c) * a
t_1 = abs(b) * abs(b)
t_2 = (0.3333333333333333d0 * c) / a
t_3 = (c * a) * 3.0d0
t_4 = t_1 - t_0
if (abs(b) <= 2.25d-138) then
tmp = (t_2 * t_2) * t_2
else if (abs(b) <= 2.45d-80) then
tmp = (t_3 - t_1) * (((-0.037037037037037035d0) * (c / a)) * (((t_1 - t_3) * (0.1111111111111111d0 / (a * a))) / (a * a)))
else
tmp = (t_4 * t_4) * ((t_0 - t_1) * (0.0013717421124828531d0 / (((a * a) * (a * a)) * (a * a))))
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double t_0 = (3.0 * c) * a;
double t_1 = Math.abs(b) * Math.abs(b);
double t_2 = (0.3333333333333333 * c) / a;
double t_3 = (c * a) * 3.0;
double t_4 = t_1 - t_0;
double tmp;
if (Math.abs(b) <= 2.25e-138) {
tmp = (t_2 * t_2) * t_2;
} else if (Math.abs(b) <= 2.45e-80) {
tmp = (t_3 - t_1) * ((-0.037037037037037035 * (c / a)) * (((t_1 - t_3) * (0.1111111111111111 / (a * a))) / (a * a)));
} else {
tmp = (t_4 * t_4) * ((t_0 - t_1) * (0.0013717421124828531 / (((a * a) * (a * a)) * (a * a))));
}
return tmp;
}
def code(a, b, c): t_0 = (3.0 * c) * a t_1 = math.fabs(b) * math.fabs(b) t_2 = (0.3333333333333333 * c) / a t_3 = (c * a) * 3.0 t_4 = t_1 - t_0 tmp = 0 if math.fabs(b) <= 2.25e-138: tmp = (t_2 * t_2) * t_2 elif math.fabs(b) <= 2.45e-80: tmp = (t_3 - t_1) * ((-0.037037037037037035 * (c / a)) * (((t_1 - t_3) * (0.1111111111111111 / (a * a))) / (a * a))) else: tmp = (t_4 * t_4) * ((t_0 - t_1) * (0.0013717421124828531 / (((a * a) * (a * a)) * (a * a)))) return tmp
function code(a, b, c) t_0 = Float64(Float64(3.0 * c) * a) t_1 = Float64(abs(b) * abs(b)) t_2 = Float64(Float64(0.3333333333333333 * c) / a) t_3 = Float64(Float64(c * a) * 3.0) t_4 = Float64(t_1 - t_0) tmp = 0.0 if (abs(b) <= 2.25e-138) tmp = Float64(Float64(t_2 * t_2) * t_2); elseif (abs(b) <= 2.45e-80) tmp = Float64(Float64(t_3 - t_1) * Float64(Float64(-0.037037037037037035 * Float64(c / a)) * Float64(Float64(Float64(t_1 - t_3) * Float64(0.1111111111111111 / Float64(a * a))) / Float64(a * a)))); else tmp = Float64(Float64(t_4 * t_4) * Float64(Float64(t_0 - t_1) * Float64(0.0013717421124828531 / Float64(Float64(Float64(a * a) * Float64(a * a)) * Float64(a * a))))); end return tmp end
function tmp_2 = code(a, b, c) t_0 = (3.0 * c) * a; t_1 = abs(b) * abs(b); t_2 = (0.3333333333333333 * c) / a; t_3 = (c * a) * 3.0; t_4 = t_1 - t_0; tmp = 0.0; if (abs(b) <= 2.25e-138) tmp = (t_2 * t_2) * t_2; elseif (abs(b) <= 2.45e-80) tmp = (t_3 - t_1) * ((-0.037037037037037035 * (c / a)) * (((t_1 - t_3) * (0.1111111111111111 / (a * a))) / (a * a))); else tmp = (t_4 * t_4) * ((t_0 - t_1) * (0.0013717421124828531 / (((a * a) * (a * a)) * (a * a)))); end tmp_2 = tmp; end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(3.0 * c), $MachinePrecision] * a), $MachinePrecision]}, Block[{t$95$1 = N[(N[Abs[b], $MachinePrecision] * N[Abs[b], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(0.3333333333333333 * c), $MachinePrecision] / a), $MachinePrecision]}, Block[{t$95$3 = N[(N[(c * a), $MachinePrecision] * 3.0), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$1 - t$95$0), $MachinePrecision]}, If[LessEqual[N[Abs[b], $MachinePrecision], 2.25e-138], N[(N[(t$95$2 * t$95$2), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[N[Abs[b], $MachinePrecision], 2.45e-80], N[(N[(t$95$3 - t$95$1), $MachinePrecision] * N[(N[(-0.037037037037037035 * N[(c / a), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(t$95$1 - t$95$3), $MachinePrecision] * N[(0.1111111111111111 / N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$4 * t$95$4), $MachinePrecision] * N[(N[(t$95$0 - t$95$1), $MachinePrecision] * N[(0.0013717421124828531 / N[(N[(N[(a * a), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
t_0 := \left(3 \cdot c\right) \cdot a\\
t_1 := \left|b\right| \cdot \left|b\right|\\
t_2 := \frac{0.3333333333333333 \cdot c}{a}\\
t_3 := \left(c \cdot a\right) \cdot 3\\
t_4 := t\_1 - t\_0\\
\mathbf{if}\;\left|b\right| \leq 2.25 \cdot 10^{-138}:\\
\;\;\;\;\left(t\_2 \cdot t\_2\right) \cdot t\_2\\
\mathbf{elif}\;\left|b\right| \leq 2.45 \cdot 10^{-80}:\\
\;\;\;\;\left(t\_3 - t\_1\right) \cdot \left(\left(-0.037037037037037035 \cdot \frac{c}{a}\right) \cdot \frac{\left(t\_1 - t\_3\right) \cdot \frac{0.1111111111111111}{a \cdot a}}{a \cdot a}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_4 \cdot t\_4\right) \cdot \left(\left(t\_0 - t\_1\right) \cdot \frac{0.0013717421124828531}{\left(\left(a \cdot a\right) \cdot \left(a \cdot a\right)\right) \cdot \left(a \cdot a\right)}\right)\\
\end{array}
if b < 2.25e-138Initial program 81.1%
Taylor expanded in a around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-*.f6494.0%
Applied rewrites94.0%
Taylor expanded in a around inf
lower-*.f6458.9%
Applied rewrites58.9%
lift-pow.f64N/A
unpow3N/A
lower-*.f64N/A
Applied rewrites58.9%
if 2.25e-138 < b < 2.45e-80Initial program 81.1%
Applied rewrites66.6%
Applied rewrites76.0%
Taylor expanded in a around inf
lower-*.f64N/A
lower-/.f6452.6%
Applied rewrites52.6%
if 2.45e-80 < b Initial program 81.1%
lift-pow.f64N/A
lift-/.f64N/A
mult-flipN/A
cube-prodN/A
unpow3N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites40.3%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6440.3%
Applied rewrites40.3%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6440.3%
Applied rewrites40.3%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6440.3%
Applied rewrites40.3%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (* (* c a) 3.0))
(t_1 (* (* c a) -3.0))
(t_2 (* (fabs b) (fabs b)))
(t_3 (- t_0 t_2))
(t_4 (/ (* 0.3333333333333333 c) a))
(t_5 (* (* a a) a)))
(if (<= (fabs b) 2.25e-138)
(* (* t_4 t_4) t_4)
(if (<= (fabs b) 1.55e-77)
(*
t_3
(*
(* -0.037037037037037035 (/ c a))
(/ (* (- t_2 t_0) (/ 0.1111111111111111 (* a a))) (* a a))))
(* (* (* t_1 (/ 0.0013717421124828531 (* t_5 t_5))) t_3) t_1)))))double code(double a, double b, double c) {
double t_0 = (c * a) * 3.0;
double t_1 = (c * a) * -3.0;
double t_2 = fabs(b) * fabs(b);
double t_3 = t_0 - t_2;
double t_4 = (0.3333333333333333 * c) / a;
double t_5 = (a * a) * a;
double tmp;
if (fabs(b) <= 2.25e-138) {
tmp = (t_4 * t_4) * t_4;
} else if (fabs(b) <= 1.55e-77) {
tmp = t_3 * ((-0.037037037037037035 * (c / a)) * (((t_2 - t_0) * (0.1111111111111111 / (a * a))) / (a * a)));
} else {
tmp = ((t_1 * (0.0013717421124828531 / (t_5 * t_5))) * t_3) * t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: tmp
t_0 = (c * a) * 3.0d0
t_1 = (c * a) * (-3.0d0)
t_2 = abs(b) * abs(b)
t_3 = t_0 - t_2
t_4 = (0.3333333333333333d0 * c) / a
t_5 = (a * a) * a
if (abs(b) <= 2.25d-138) then
tmp = (t_4 * t_4) * t_4
else if (abs(b) <= 1.55d-77) then
tmp = t_3 * (((-0.037037037037037035d0) * (c / a)) * (((t_2 - t_0) * (0.1111111111111111d0 / (a * a))) / (a * a)))
else
tmp = ((t_1 * (0.0013717421124828531d0 / (t_5 * t_5))) * t_3) * t_1
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double t_0 = (c * a) * 3.0;
double t_1 = (c * a) * -3.0;
double t_2 = Math.abs(b) * Math.abs(b);
double t_3 = t_0 - t_2;
double t_4 = (0.3333333333333333 * c) / a;
double t_5 = (a * a) * a;
double tmp;
if (Math.abs(b) <= 2.25e-138) {
tmp = (t_4 * t_4) * t_4;
} else if (Math.abs(b) <= 1.55e-77) {
tmp = t_3 * ((-0.037037037037037035 * (c / a)) * (((t_2 - t_0) * (0.1111111111111111 / (a * a))) / (a * a)));
} else {
tmp = ((t_1 * (0.0013717421124828531 / (t_5 * t_5))) * t_3) * t_1;
}
return tmp;
}
def code(a, b, c): t_0 = (c * a) * 3.0 t_1 = (c * a) * -3.0 t_2 = math.fabs(b) * math.fabs(b) t_3 = t_0 - t_2 t_4 = (0.3333333333333333 * c) / a t_5 = (a * a) * a tmp = 0 if math.fabs(b) <= 2.25e-138: tmp = (t_4 * t_4) * t_4 elif math.fabs(b) <= 1.55e-77: tmp = t_3 * ((-0.037037037037037035 * (c / a)) * (((t_2 - t_0) * (0.1111111111111111 / (a * a))) / (a * a))) else: tmp = ((t_1 * (0.0013717421124828531 / (t_5 * t_5))) * t_3) * t_1 return tmp
function code(a, b, c) t_0 = Float64(Float64(c * a) * 3.0) t_1 = Float64(Float64(c * a) * -3.0) t_2 = Float64(abs(b) * abs(b)) t_3 = Float64(t_0 - t_2) t_4 = Float64(Float64(0.3333333333333333 * c) / a) t_5 = Float64(Float64(a * a) * a) tmp = 0.0 if (abs(b) <= 2.25e-138) tmp = Float64(Float64(t_4 * t_4) * t_4); elseif (abs(b) <= 1.55e-77) tmp = Float64(t_3 * Float64(Float64(-0.037037037037037035 * Float64(c / a)) * Float64(Float64(Float64(t_2 - t_0) * Float64(0.1111111111111111 / Float64(a * a))) / Float64(a * a)))); else tmp = Float64(Float64(Float64(t_1 * Float64(0.0013717421124828531 / Float64(t_5 * t_5))) * t_3) * t_1); end return tmp end
function tmp_2 = code(a, b, c) t_0 = (c * a) * 3.0; t_1 = (c * a) * -3.0; t_2 = abs(b) * abs(b); t_3 = t_0 - t_2; t_4 = (0.3333333333333333 * c) / a; t_5 = (a * a) * a; tmp = 0.0; if (abs(b) <= 2.25e-138) tmp = (t_4 * t_4) * t_4; elseif (abs(b) <= 1.55e-77) tmp = t_3 * ((-0.037037037037037035 * (c / a)) * (((t_2 - t_0) * (0.1111111111111111 / (a * a))) / (a * a))); else tmp = ((t_1 * (0.0013717421124828531 / (t_5 * t_5))) * t_3) * t_1; end tmp_2 = tmp; end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(c * a), $MachinePrecision] * 3.0), $MachinePrecision]}, Block[{t$95$1 = N[(N[(c * a), $MachinePrecision] * -3.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[Abs[b], $MachinePrecision] * N[Abs[b], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$0 - t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[(N[(0.3333333333333333 * c), $MachinePrecision] / a), $MachinePrecision]}, Block[{t$95$5 = N[(N[(a * a), $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[N[Abs[b], $MachinePrecision], 2.25e-138], N[(N[(t$95$4 * t$95$4), $MachinePrecision] * t$95$4), $MachinePrecision], If[LessEqual[N[Abs[b], $MachinePrecision], 1.55e-77], N[(t$95$3 * N[(N[(-0.037037037037037035 * N[(c / a), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(t$95$2 - t$95$0), $MachinePrecision] * N[(0.1111111111111111 / N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t$95$1 * N[(0.0013717421124828531 / N[(t$95$5 * t$95$5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$3), $MachinePrecision] * t$95$1), $MachinePrecision]]]]]]]]]
\begin{array}{l}
t_0 := \left(c \cdot a\right) \cdot 3\\
t_1 := \left(c \cdot a\right) \cdot -3\\
t_2 := \left|b\right| \cdot \left|b\right|\\
t_3 := t\_0 - t\_2\\
t_4 := \frac{0.3333333333333333 \cdot c}{a}\\
t_5 := \left(a \cdot a\right) \cdot a\\
\mathbf{if}\;\left|b\right| \leq 2.25 \cdot 10^{-138}:\\
\;\;\;\;\left(t\_4 \cdot t\_4\right) \cdot t\_4\\
\mathbf{elif}\;\left|b\right| \leq 1.55 \cdot 10^{-77}:\\
\;\;\;\;t\_3 \cdot \left(\left(-0.037037037037037035 \cdot \frac{c}{a}\right) \cdot \frac{\left(t\_2 - t\_0\right) \cdot \frac{0.1111111111111111}{a \cdot a}}{a \cdot a}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(t\_1 \cdot \frac{0.0013717421124828531}{t\_5 \cdot t\_5}\right) \cdot t\_3\right) \cdot t\_1\\
\end{array}
if b < 2.25e-138Initial program 81.1%
Taylor expanded in a around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-*.f6494.0%
Applied rewrites94.0%
Taylor expanded in a around inf
lower-*.f6458.9%
Applied rewrites58.9%
lift-pow.f64N/A
unpow3N/A
lower-*.f64N/A
Applied rewrites58.9%
if 2.25e-138 < b < 1.55e-77Initial program 81.1%
Applied rewrites66.6%
Applied rewrites76.0%
Taylor expanded in a around inf
lower-*.f64N/A
lower-/.f6452.6%
Applied rewrites52.6%
if 1.55e-77 < b Initial program 81.1%
lift-pow.f64N/A
lift-/.f64N/A
mult-flipN/A
cube-prodN/A
unpow3N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites40.3%
Taylor expanded in a around inf
lower-*.f64N/A
lower-*.f6418.9%
Applied rewrites18.9%
Taylor expanded in a around inf
lower-*.f64N/A
lower-*.f6417.4%
Applied rewrites17.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites35.8%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (* (* 3.0 c) a))
(t_1 (* (* c a) -3.0))
(t_2 (* (fabs b) (fabs b)))
(t_3 (/ (* 0.3333333333333333 c) a))
(t_4 (* (* a a) a)))
(if (<= (fabs b) 2.25e-138)
(* (* t_3 t_3) t_3)
(if (<= (fabs b) 1.55e-77)
(*
(- t_0 t_2)
(*
(* -0.037037037037037035 (/ c a))
(/ (* (- t_2 t_0) (/ 0.1111111111111111 (* a a))) (* a a))))
(*
(*
(* t_1 (/ 0.0013717421124828531 (* t_4 t_4)))
(- (* (* c a) 3.0) t_2))
t_1)))))double code(double a, double b, double c) {
double t_0 = (3.0 * c) * a;
double t_1 = (c * a) * -3.0;
double t_2 = fabs(b) * fabs(b);
double t_3 = (0.3333333333333333 * c) / a;
double t_4 = (a * a) * a;
double tmp;
if (fabs(b) <= 2.25e-138) {
tmp = (t_3 * t_3) * t_3;
} else if (fabs(b) <= 1.55e-77) {
tmp = (t_0 - t_2) * ((-0.037037037037037035 * (c / a)) * (((t_2 - t_0) * (0.1111111111111111 / (a * a))) / (a * a)));
} else {
tmp = ((t_1 * (0.0013717421124828531 / (t_4 * t_4))) * (((c * a) * 3.0) - t_2)) * t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_0 = (3.0d0 * c) * a
t_1 = (c * a) * (-3.0d0)
t_2 = abs(b) * abs(b)
t_3 = (0.3333333333333333d0 * c) / a
t_4 = (a * a) * a
if (abs(b) <= 2.25d-138) then
tmp = (t_3 * t_3) * t_3
else if (abs(b) <= 1.55d-77) then
tmp = (t_0 - t_2) * (((-0.037037037037037035d0) * (c / a)) * (((t_2 - t_0) * (0.1111111111111111d0 / (a * a))) / (a * a)))
else
tmp = ((t_1 * (0.0013717421124828531d0 / (t_4 * t_4))) * (((c * a) * 3.0d0) - t_2)) * t_1
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double t_0 = (3.0 * c) * a;
double t_1 = (c * a) * -3.0;
double t_2 = Math.abs(b) * Math.abs(b);
double t_3 = (0.3333333333333333 * c) / a;
double t_4 = (a * a) * a;
double tmp;
if (Math.abs(b) <= 2.25e-138) {
tmp = (t_3 * t_3) * t_3;
} else if (Math.abs(b) <= 1.55e-77) {
tmp = (t_0 - t_2) * ((-0.037037037037037035 * (c / a)) * (((t_2 - t_0) * (0.1111111111111111 / (a * a))) / (a * a)));
} else {
tmp = ((t_1 * (0.0013717421124828531 / (t_4 * t_4))) * (((c * a) * 3.0) - t_2)) * t_1;
}
return tmp;
}
def code(a, b, c): t_0 = (3.0 * c) * a t_1 = (c * a) * -3.0 t_2 = math.fabs(b) * math.fabs(b) t_3 = (0.3333333333333333 * c) / a t_4 = (a * a) * a tmp = 0 if math.fabs(b) <= 2.25e-138: tmp = (t_3 * t_3) * t_3 elif math.fabs(b) <= 1.55e-77: tmp = (t_0 - t_2) * ((-0.037037037037037035 * (c / a)) * (((t_2 - t_0) * (0.1111111111111111 / (a * a))) / (a * a))) else: tmp = ((t_1 * (0.0013717421124828531 / (t_4 * t_4))) * (((c * a) * 3.0) - t_2)) * t_1 return tmp
function code(a, b, c) t_0 = Float64(Float64(3.0 * c) * a) t_1 = Float64(Float64(c * a) * -3.0) t_2 = Float64(abs(b) * abs(b)) t_3 = Float64(Float64(0.3333333333333333 * c) / a) t_4 = Float64(Float64(a * a) * a) tmp = 0.0 if (abs(b) <= 2.25e-138) tmp = Float64(Float64(t_3 * t_3) * t_3); elseif (abs(b) <= 1.55e-77) tmp = Float64(Float64(t_0 - t_2) * Float64(Float64(-0.037037037037037035 * Float64(c / a)) * Float64(Float64(Float64(t_2 - t_0) * Float64(0.1111111111111111 / Float64(a * a))) / Float64(a * a)))); else tmp = Float64(Float64(Float64(t_1 * Float64(0.0013717421124828531 / Float64(t_4 * t_4))) * Float64(Float64(Float64(c * a) * 3.0) - t_2)) * t_1); end return tmp end
function tmp_2 = code(a, b, c) t_0 = (3.0 * c) * a; t_1 = (c * a) * -3.0; t_2 = abs(b) * abs(b); t_3 = (0.3333333333333333 * c) / a; t_4 = (a * a) * a; tmp = 0.0; if (abs(b) <= 2.25e-138) tmp = (t_3 * t_3) * t_3; elseif (abs(b) <= 1.55e-77) tmp = (t_0 - t_2) * ((-0.037037037037037035 * (c / a)) * (((t_2 - t_0) * (0.1111111111111111 / (a * a))) / (a * a))); else tmp = ((t_1 * (0.0013717421124828531 / (t_4 * t_4))) * (((c * a) * 3.0) - t_2)) * t_1; end tmp_2 = tmp; end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(3.0 * c), $MachinePrecision] * a), $MachinePrecision]}, Block[{t$95$1 = N[(N[(c * a), $MachinePrecision] * -3.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[Abs[b], $MachinePrecision] * N[Abs[b], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(0.3333333333333333 * c), $MachinePrecision] / a), $MachinePrecision]}, Block[{t$95$4 = N[(N[(a * a), $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[N[Abs[b], $MachinePrecision], 2.25e-138], N[(N[(t$95$3 * t$95$3), $MachinePrecision] * t$95$3), $MachinePrecision], If[LessEqual[N[Abs[b], $MachinePrecision], 1.55e-77], N[(N[(t$95$0 - t$95$2), $MachinePrecision] * N[(N[(-0.037037037037037035 * N[(c / a), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(t$95$2 - t$95$0), $MachinePrecision] * N[(0.1111111111111111 / N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t$95$1 * N[(0.0013717421124828531 / N[(t$95$4 * t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(c * a), $MachinePrecision] * 3.0), $MachinePrecision] - t$95$2), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]]]]]]]]
\begin{array}{l}
t_0 := \left(3 \cdot c\right) \cdot a\\
t_1 := \left(c \cdot a\right) \cdot -3\\
t_2 := \left|b\right| \cdot \left|b\right|\\
t_3 := \frac{0.3333333333333333 \cdot c}{a}\\
t_4 := \left(a \cdot a\right) \cdot a\\
\mathbf{if}\;\left|b\right| \leq 2.25 \cdot 10^{-138}:\\
\;\;\;\;\left(t\_3 \cdot t\_3\right) \cdot t\_3\\
\mathbf{elif}\;\left|b\right| \leq 1.55 \cdot 10^{-77}:\\
\;\;\;\;\left(t\_0 - t\_2\right) \cdot \left(\left(-0.037037037037037035 \cdot \frac{c}{a}\right) \cdot \frac{\left(t\_2 - t\_0\right) \cdot \frac{0.1111111111111111}{a \cdot a}}{a \cdot a}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(t\_1 \cdot \frac{0.0013717421124828531}{t\_4 \cdot t\_4}\right) \cdot \left(\left(c \cdot a\right) \cdot 3 - t\_2\right)\right) \cdot t\_1\\
\end{array}
if b < 2.25e-138Initial program 81.1%
Taylor expanded in a around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-*.f6494.0%
Applied rewrites94.0%
Taylor expanded in a around inf
lower-*.f6458.9%
Applied rewrites58.9%
lift-pow.f64N/A
unpow3N/A
lower-*.f64N/A
Applied rewrites58.9%
if 2.25e-138 < b < 1.55e-77Initial program 81.1%
Applied rewrites66.6%
Applied rewrites76.0%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6476.1%
Applied rewrites76.1%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6476.1%
Applied rewrites76.1%
Taylor expanded in a around inf
lower-*.f64N/A
lower-/.f6452.6%
Applied rewrites52.6%
if 1.55e-77 < b Initial program 81.1%
lift-pow.f64N/A
lift-/.f64N/A
mult-flipN/A
cube-prodN/A
unpow3N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites40.3%
Taylor expanded in a around inf
lower-*.f64N/A
lower-*.f6418.9%
Applied rewrites18.9%
Taylor expanded in a around inf
lower-*.f64N/A
lower-*.f6417.4%
Applied rewrites17.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites35.8%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (* (* c a) -3.0))
(t_1 (* (* a a) a))
(t_2 (* 0.3333333333333333 (/ c a))))
(if (<= (fabs b) 1.25e-76)
(* (* t_2 t_2) t_2)
(*
(*
(* t_0 (/ 0.0013717421124828531 (* t_1 t_1)))
(- (* (* c a) 3.0) (* (fabs b) (fabs b))))
t_0))))double code(double a, double b, double c) {
double t_0 = (c * a) * -3.0;
double t_1 = (a * a) * a;
double t_2 = 0.3333333333333333 * (c / a);
double tmp;
if (fabs(b) <= 1.25e-76) {
tmp = (t_2 * t_2) * t_2;
} else {
tmp = ((t_0 * (0.0013717421124828531 / (t_1 * t_1))) * (((c * a) * 3.0) - (fabs(b) * fabs(b)))) * t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (c * a) * (-3.0d0)
t_1 = (a * a) * a
t_2 = 0.3333333333333333d0 * (c / a)
if (abs(b) <= 1.25d-76) then
tmp = (t_2 * t_2) * t_2
else
tmp = ((t_0 * (0.0013717421124828531d0 / (t_1 * t_1))) * (((c * a) * 3.0d0) - (abs(b) * abs(b)))) * t_0
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double t_0 = (c * a) * -3.0;
double t_1 = (a * a) * a;
double t_2 = 0.3333333333333333 * (c / a);
double tmp;
if (Math.abs(b) <= 1.25e-76) {
tmp = (t_2 * t_2) * t_2;
} else {
tmp = ((t_0 * (0.0013717421124828531 / (t_1 * t_1))) * (((c * a) * 3.0) - (Math.abs(b) * Math.abs(b)))) * t_0;
}
return tmp;
}
def code(a, b, c): t_0 = (c * a) * -3.0 t_1 = (a * a) * a t_2 = 0.3333333333333333 * (c / a) tmp = 0 if math.fabs(b) <= 1.25e-76: tmp = (t_2 * t_2) * t_2 else: tmp = ((t_0 * (0.0013717421124828531 / (t_1 * t_1))) * (((c * a) * 3.0) - (math.fabs(b) * math.fabs(b)))) * t_0 return tmp
function code(a, b, c) t_0 = Float64(Float64(c * a) * -3.0) t_1 = Float64(Float64(a * a) * a) t_2 = Float64(0.3333333333333333 * Float64(c / a)) tmp = 0.0 if (abs(b) <= 1.25e-76) tmp = Float64(Float64(t_2 * t_2) * t_2); else tmp = Float64(Float64(Float64(t_0 * Float64(0.0013717421124828531 / Float64(t_1 * t_1))) * Float64(Float64(Float64(c * a) * 3.0) - Float64(abs(b) * abs(b)))) * t_0); end return tmp end
function tmp_2 = code(a, b, c) t_0 = (c * a) * -3.0; t_1 = (a * a) * a; t_2 = 0.3333333333333333 * (c / a); tmp = 0.0; if (abs(b) <= 1.25e-76) tmp = (t_2 * t_2) * t_2; else tmp = ((t_0 * (0.0013717421124828531 / (t_1 * t_1))) * (((c * a) * 3.0) - (abs(b) * abs(b)))) * t_0; end tmp_2 = tmp; end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(c * a), $MachinePrecision] * -3.0), $MachinePrecision]}, Block[{t$95$1 = N[(N[(a * a), $MachinePrecision] * a), $MachinePrecision]}, Block[{t$95$2 = N[(0.3333333333333333 * N[(c / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[b], $MachinePrecision], 1.25e-76], N[(N[(t$95$2 * t$95$2), $MachinePrecision] * t$95$2), $MachinePrecision], N[(N[(N[(t$95$0 * N[(0.0013717421124828531 / N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(c * a), $MachinePrecision] * 3.0), $MachinePrecision] - N[(N[Abs[b], $MachinePrecision] * N[Abs[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \left(c \cdot a\right) \cdot -3\\
t_1 := \left(a \cdot a\right) \cdot a\\
t_2 := 0.3333333333333333 \cdot \frac{c}{a}\\
\mathbf{if}\;\left|b\right| \leq 1.25 \cdot 10^{-76}:\\
\;\;\;\;\left(t\_2 \cdot t\_2\right) \cdot t\_2\\
\mathbf{else}:\\
\;\;\;\;\left(\left(t\_0 \cdot \frac{0.0013717421124828531}{t\_1 \cdot t\_1}\right) \cdot \left(\left(c \cdot a\right) \cdot 3 - \left|b\right| \cdot \left|b\right|\right)\right) \cdot t\_0\\
\end{array}
if b < 1.2499999999999999e-76Initial program 81.1%
Taylor expanded in a around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-*.f6494.0%
Applied rewrites94.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
metadata-evalN/A
lower-*.f6494.0%
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6499.3%
Applied rewrites99.3%
lift-pow.f64N/A
unpow3N/A
lower-*.f64N/A
Applied rewrites99.3%
Taylor expanded in a around inf
lower-*.f64N/A
lower-/.f6466.9%
Applied rewrites66.9%
Taylor expanded in a around inf
lower-*.f64N/A
lower-/.f6475.1%
Applied rewrites75.1%
Taylor expanded in a around inf
lower-*.f64N/A
lower-/.f6458.9%
Applied rewrites58.9%
if 1.2499999999999999e-76 < b Initial program 81.1%
lift-pow.f64N/A
lift-/.f64N/A
mult-flipN/A
cube-prodN/A
unpow3N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites40.3%
Taylor expanded in a around inf
lower-*.f64N/A
lower-*.f6418.9%
Applied rewrites18.9%
Taylor expanded in a around inf
lower-*.f64N/A
lower-*.f6417.4%
Applied rewrites17.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites35.8%
(FPCore (a b c) :precision binary64 (let* ((t_0 (* 0.3333333333333333 (/ c a)))) (* (* t_0 t_0) t_0)))
double code(double a, double b, double c) {
double t_0 = 0.3333333333333333 * (c / a);
return (t_0 * t_0) * t_0;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_0
t_0 = 0.3333333333333333d0 * (c / a)
code = (t_0 * t_0) * t_0
end function
public static double code(double a, double b, double c) {
double t_0 = 0.3333333333333333 * (c / a);
return (t_0 * t_0) * t_0;
}
def code(a, b, c): t_0 = 0.3333333333333333 * (c / a) return (t_0 * t_0) * t_0
function code(a, b, c) t_0 = Float64(0.3333333333333333 * Float64(c / a)) return Float64(Float64(t_0 * t_0) * t_0) end
function tmp = code(a, b, c) t_0 = 0.3333333333333333 * (c / a); tmp = (t_0 * t_0) * t_0; end
code[a_, b_, c_] := Block[{t$95$0 = N[(0.3333333333333333 * N[(c / a), $MachinePrecision]), $MachinePrecision]}, N[(N[(t$95$0 * t$95$0), $MachinePrecision] * t$95$0), $MachinePrecision]]
\begin{array}{l}
t_0 := 0.3333333333333333 \cdot \frac{c}{a}\\
\left(t\_0 \cdot t\_0\right) \cdot t\_0
\end{array}
Initial program 81.1%
Taylor expanded in a around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-*.f6494.0%
Applied rewrites94.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
metadata-evalN/A
lower-*.f6494.0%
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6499.3%
Applied rewrites99.3%
lift-pow.f64N/A
unpow3N/A
lower-*.f64N/A
Applied rewrites99.3%
Taylor expanded in a around inf
lower-*.f64N/A
lower-/.f6466.9%
Applied rewrites66.9%
Taylor expanded in a around inf
lower-*.f64N/A
lower-/.f6475.1%
Applied rewrites75.1%
Taylor expanded in a around inf
lower-*.f64N/A
lower-/.f6458.9%
Applied rewrites58.9%
herbie shell --seed 2025258
(FPCore (a b c)
:name "Q^3 (Cubic Equation Discriminant Part)"
:precision binary64
:pre (and (and (and (<= -1000000000.0 a) (<= a 1000000000.0)) (and (<= -1000000000.0 b) (<= b 1000000000.0))) (and (<= -1000000000.0 c) (<= c 1000000000.0)))
(pow (/ (- (* 3.0 (* a c)) (pow b 2.0)) (* 9.0 (pow a 2.0))) 3.0))