
(FPCore (x)
:precision binary64
(let* ((t_0 (* (* x x) (* x x)))
(t_1 (* t_0 (* x x)))
(t_2 (* t_1 (* x x)))
(t_3 (* t_2 (* x x))))
(*
(/
(+
(+
(+
(+ (+ 1.0 (* 0.1049934947 (* x x))) (* 0.0424060604 t_0))
(* 0.0072644182 t_1))
(* 0.0005064034 t_2))
(* 0.0001789971 t_3))
(+
(+
(+
(+
(+ (+ 1.0 (* 0.7715471019 (* x x))) (* 0.2909738639 t_0))
(* 0.0694555761 t_1))
(* 0.0140005442 t_2))
(* 0.0008327945 t_3))
(* (* 2.0 0.0001789971) (* t_3 (* x x)))))
x)))
double code(double x) {
double t_0 = (x * x) * (x * x);
double t_1 = t_0 * (x * x);
double t_2 = t_1 * (x * x);
double t_3 = t_2 * (x * x);
return ((((((1.0 + (0.1049934947 * (x * x))) + (0.0424060604 * t_0)) + (0.0072644182 * t_1)) + (0.0005064034 * t_2)) + (0.0001789971 * t_3)) / ((((((1.0 + (0.7715471019 * (x * x))) + (0.2909738639 * t_0)) + (0.0694555761 * t_1)) + (0.0140005442 * t_2)) + (0.0008327945 * t_3)) + ((2.0 * 0.0001789971) * (t_3 * (x * x))))) * x;
}
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(x)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
t_0 = (x * x) * (x * x)
t_1 = t_0 * (x * x)
t_2 = t_1 * (x * x)
t_3 = t_2 * (x * x)
code = ((((((1.0d0 + (0.1049934947d0 * (x * x))) + (0.0424060604d0 * t_0)) + (0.0072644182d0 * t_1)) + (0.0005064034d0 * t_2)) + (0.0001789971d0 * t_3)) / ((((((1.0d0 + (0.7715471019d0 * (x * x))) + (0.2909738639d0 * t_0)) + (0.0694555761d0 * t_1)) + (0.0140005442d0 * t_2)) + (0.0008327945d0 * t_3)) + ((2.0d0 * 0.0001789971d0) * (t_3 * (x * x))))) * x
end function
public static double code(double x) {
double t_0 = (x * x) * (x * x);
double t_1 = t_0 * (x * x);
double t_2 = t_1 * (x * x);
double t_3 = t_2 * (x * x);
return ((((((1.0 + (0.1049934947 * (x * x))) + (0.0424060604 * t_0)) + (0.0072644182 * t_1)) + (0.0005064034 * t_2)) + (0.0001789971 * t_3)) / ((((((1.0 + (0.7715471019 * (x * x))) + (0.2909738639 * t_0)) + (0.0694555761 * t_1)) + (0.0140005442 * t_2)) + (0.0008327945 * t_3)) + ((2.0 * 0.0001789971) * (t_3 * (x * x))))) * x;
}
def code(x): t_0 = (x * x) * (x * x) t_1 = t_0 * (x * x) t_2 = t_1 * (x * x) t_3 = t_2 * (x * x) return ((((((1.0 + (0.1049934947 * (x * x))) + (0.0424060604 * t_0)) + (0.0072644182 * t_1)) + (0.0005064034 * t_2)) + (0.0001789971 * t_3)) / ((((((1.0 + (0.7715471019 * (x * x))) + (0.2909738639 * t_0)) + (0.0694555761 * t_1)) + (0.0140005442 * t_2)) + (0.0008327945 * t_3)) + ((2.0 * 0.0001789971) * (t_3 * (x * x))))) * x
function code(x) t_0 = Float64(Float64(x * x) * Float64(x * x)) t_1 = Float64(t_0 * Float64(x * x)) t_2 = Float64(t_1 * Float64(x * x)) t_3 = Float64(t_2 * Float64(x * x)) return Float64(Float64(Float64(Float64(Float64(Float64(Float64(1.0 + Float64(0.1049934947 * Float64(x * x))) + Float64(0.0424060604 * t_0)) + Float64(0.0072644182 * t_1)) + Float64(0.0005064034 * t_2)) + Float64(0.0001789971 * t_3)) / Float64(Float64(Float64(Float64(Float64(Float64(1.0 + Float64(0.7715471019 * Float64(x * x))) + Float64(0.2909738639 * t_0)) + Float64(0.0694555761 * t_1)) + Float64(0.0140005442 * t_2)) + Float64(0.0008327945 * t_3)) + Float64(Float64(2.0 * 0.0001789971) * Float64(t_3 * Float64(x * x))))) * x) end
function tmp = code(x) t_0 = (x * x) * (x * x); t_1 = t_0 * (x * x); t_2 = t_1 * (x * x); t_3 = t_2 * (x * x); tmp = ((((((1.0 + (0.1049934947 * (x * x))) + (0.0424060604 * t_0)) + (0.0072644182 * t_1)) + (0.0005064034 * t_2)) + (0.0001789971 * t_3)) / ((((((1.0 + (0.7715471019 * (x * x))) + (0.2909738639 * t_0)) + (0.0694555761 * t_1)) + (0.0140005442 * t_2)) + (0.0008327945 * t_3)) + ((2.0 * 0.0001789971) * (t_3 * (x * x))))) * x; end
code[x_] := Block[{t$95$0 = N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[(x * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * N[(x * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 * N[(x * x), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(N[(N[(N[(N[(1.0 + N[(0.1049934947 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.0424060604 * t$95$0), $MachinePrecision]), $MachinePrecision] + N[(0.0072644182 * t$95$1), $MachinePrecision]), $MachinePrecision] + N[(0.0005064034 * t$95$2), $MachinePrecision]), $MachinePrecision] + N[(0.0001789971 * t$95$3), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(N[(N[(N[(1.0 + N[(0.7715471019 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.2909738639 * t$95$0), $MachinePrecision]), $MachinePrecision] + N[(0.0694555761 * t$95$1), $MachinePrecision]), $MachinePrecision] + N[(0.0140005442 * t$95$2), $MachinePrecision]), $MachinePrecision] + N[(0.0008327945 * t$95$3), $MachinePrecision]), $MachinePrecision] + N[(N[(2.0 * 0.0001789971), $MachinePrecision] * N[(t$95$3 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x \cdot x\right) \cdot \left(x \cdot x\right)\\
t_1 := t\_0 \cdot \left(x \cdot x\right)\\
t_2 := t\_1 \cdot \left(x \cdot x\right)\\
t_3 := t\_2 \cdot \left(x \cdot x\right)\\
\frac{\left(\left(\left(\left(1 + 0.1049934947 \cdot \left(x \cdot x\right)\right) + 0.0424060604 \cdot t\_0\right) + 0.0072644182 \cdot t\_1\right) + 0.0005064034 \cdot t\_2\right) + 0.0001789971 \cdot t\_3}{\left(\left(\left(\left(\left(1 + 0.7715471019 \cdot \left(x \cdot x\right)\right) + 0.2909738639 \cdot t\_0\right) + 0.0694555761 \cdot t\_1\right) + 0.0140005442 \cdot t\_2\right) + 0.0008327945 \cdot t\_3\right) + \left(2 \cdot 0.0001789971\right) \cdot \left(t\_3 \cdot \left(x \cdot x\right)\right)} \cdot x
\end{array}
\end{array}
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x)
:precision binary64
(let* ((t_0 (* (* x x) (* x x)))
(t_1 (* t_0 (* x x)))
(t_2 (* t_1 (* x x)))
(t_3 (* t_2 (* x x))))
(*
(/
(+
(+
(+
(+ (+ 1.0 (* 0.1049934947 (* x x))) (* 0.0424060604 t_0))
(* 0.0072644182 t_1))
(* 0.0005064034 t_2))
(* 0.0001789971 t_3))
(+
(+
(+
(+
(+ (+ 1.0 (* 0.7715471019 (* x x))) (* 0.2909738639 t_0))
(* 0.0694555761 t_1))
(* 0.0140005442 t_2))
(* 0.0008327945 t_3))
(* (* 2.0 0.0001789971) (* t_3 (* x x)))))
x)))
double code(double x) {
double t_0 = (x * x) * (x * x);
double t_1 = t_0 * (x * x);
double t_2 = t_1 * (x * x);
double t_3 = t_2 * (x * x);
return ((((((1.0 + (0.1049934947 * (x * x))) + (0.0424060604 * t_0)) + (0.0072644182 * t_1)) + (0.0005064034 * t_2)) + (0.0001789971 * t_3)) / ((((((1.0 + (0.7715471019 * (x * x))) + (0.2909738639 * t_0)) + (0.0694555761 * t_1)) + (0.0140005442 * t_2)) + (0.0008327945 * t_3)) + ((2.0 * 0.0001789971) * (t_3 * (x * x))))) * x;
}
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(x)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
t_0 = (x * x) * (x * x)
t_1 = t_0 * (x * x)
t_2 = t_1 * (x * x)
t_3 = t_2 * (x * x)
code = ((((((1.0d0 + (0.1049934947d0 * (x * x))) + (0.0424060604d0 * t_0)) + (0.0072644182d0 * t_1)) + (0.0005064034d0 * t_2)) + (0.0001789971d0 * t_3)) / ((((((1.0d0 + (0.7715471019d0 * (x * x))) + (0.2909738639d0 * t_0)) + (0.0694555761d0 * t_1)) + (0.0140005442d0 * t_2)) + (0.0008327945d0 * t_3)) + ((2.0d0 * 0.0001789971d0) * (t_3 * (x * x))))) * x
end function
public static double code(double x) {
double t_0 = (x * x) * (x * x);
double t_1 = t_0 * (x * x);
double t_2 = t_1 * (x * x);
double t_3 = t_2 * (x * x);
return ((((((1.0 + (0.1049934947 * (x * x))) + (0.0424060604 * t_0)) + (0.0072644182 * t_1)) + (0.0005064034 * t_2)) + (0.0001789971 * t_3)) / ((((((1.0 + (0.7715471019 * (x * x))) + (0.2909738639 * t_0)) + (0.0694555761 * t_1)) + (0.0140005442 * t_2)) + (0.0008327945 * t_3)) + ((2.0 * 0.0001789971) * (t_3 * (x * x))))) * x;
}
def code(x): t_0 = (x * x) * (x * x) t_1 = t_0 * (x * x) t_2 = t_1 * (x * x) t_3 = t_2 * (x * x) return ((((((1.0 + (0.1049934947 * (x * x))) + (0.0424060604 * t_0)) + (0.0072644182 * t_1)) + (0.0005064034 * t_2)) + (0.0001789971 * t_3)) / ((((((1.0 + (0.7715471019 * (x * x))) + (0.2909738639 * t_0)) + (0.0694555761 * t_1)) + (0.0140005442 * t_2)) + (0.0008327945 * t_3)) + ((2.0 * 0.0001789971) * (t_3 * (x * x))))) * x
function code(x) t_0 = Float64(Float64(x * x) * Float64(x * x)) t_1 = Float64(t_0 * Float64(x * x)) t_2 = Float64(t_1 * Float64(x * x)) t_3 = Float64(t_2 * Float64(x * x)) return Float64(Float64(Float64(Float64(Float64(Float64(Float64(1.0 + Float64(0.1049934947 * Float64(x * x))) + Float64(0.0424060604 * t_0)) + Float64(0.0072644182 * t_1)) + Float64(0.0005064034 * t_2)) + Float64(0.0001789971 * t_3)) / Float64(Float64(Float64(Float64(Float64(Float64(1.0 + Float64(0.7715471019 * Float64(x * x))) + Float64(0.2909738639 * t_0)) + Float64(0.0694555761 * t_1)) + Float64(0.0140005442 * t_2)) + Float64(0.0008327945 * t_3)) + Float64(Float64(2.0 * 0.0001789971) * Float64(t_3 * Float64(x * x))))) * x) end
function tmp = code(x) t_0 = (x * x) * (x * x); t_1 = t_0 * (x * x); t_2 = t_1 * (x * x); t_3 = t_2 * (x * x); tmp = ((((((1.0 + (0.1049934947 * (x * x))) + (0.0424060604 * t_0)) + (0.0072644182 * t_1)) + (0.0005064034 * t_2)) + (0.0001789971 * t_3)) / ((((((1.0 + (0.7715471019 * (x * x))) + (0.2909738639 * t_0)) + (0.0694555761 * t_1)) + (0.0140005442 * t_2)) + (0.0008327945 * t_3)) + ((2.0 * 0.0001789971) * (t_3 * (x * x))))) * x; end
code[x_] := Block[{t$95$0 = N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[(x * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * N[(x * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 * N[(x * x), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(N[(N[(N[(N[(1.0 + N[(0.1049934947 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.0424060604 * t$95$0), $MachinePrecision]), $MachinePrecision] + N[(0.0072644182 * t$95$1), $MachinePrecision]), $MachinePrecision] + N[(0.0005064034 * t$95$2), $MachinePrecision]), $MachinePrecision] + N[(0.0001789971 * t$95$3), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(N[(N[(N[(1.0 + N[(0.7715471019 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.2909738639 * t$95$0), $MachinePrecision]), $MachinePrecision] + N[(0.0694555761 * t$95$1), $MachinePrecision]), $MachinePrecision] + N[(0.0140005442 * t$95$2), $MachinePrecision]), $MachinePrecision] + N[(0.0008327945 * t$95$3), $MachinePrecision]), $MachinePrecision] + N[(N[(2.0 * 0.0001789971), $MachinePrecision] * N[(t$95$3 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x \cdot x\right) \cdot \left(x \cdot x\right)\\
t_1 := t\_0 \cdot \left(x \cdot x\right)\\
t_2 := t\_1 \cdot \left(x \cdot x\right)\\
t_3 := t\_2 \cdot \left(x \cdot x\right)\\
\frac{\left(\left(\left(\left(1 + 0.1049934947 \cdot \left(x \cdot x\right)\right) + 0.0424060604 \cdot t\_0\right) + 0.0072644182 \cdot t\_1\right) + 0.0005064034 \cdot t\_2\right) + 0.0001789971 \cdot t\_3}{\left(\left(\left(\left(\left(1 + 0.7715471019 \cdot \left(x \cdot x\right)\right) + 0.2909738639 \cdot t\_0\right) + 0.0694555761 \cdot t\_1\right) + 0.0140005442 \cdot t\_2\right) + 0.0008327945 \cdot t\_3\right) + \left(2 \cdot 0.0001789971\right) \cdot \left(t\_3 \cdot \left(x \cdot x\right)\right)} \cdot x
\end{array}
\end{array}
(FPCore (x)
:precision binary64
(let* ((t_0 (* 0.2514179000665374 (/ 1.0 (pow x 2.0)))))
(if (<= x -1.0)
(/ (+ 0.5 (+ (/ 0.15298196345929074 (pow x 4.0)) t_0)) x)
(if (<= x 0.95)
(* (+ 1.0 (* (* -0.6665536072 x) x)) x)
(/ (+ 0.5 t_0) x)))))
double code(double x) {
double t_0 = 0.2514179000665374 * (1.0 / pow(x, 2.0));
double tmp;
if (x <= -1.0) {
tmp = (0.5 + ((0.15298196345929074 / pow(x, 4.0)) + t_0)) / x;
} else if (x <= 0.95) {
tmp = (1.0 + ((-0.6665536072 * x) * x)) * x;
} else {
tmp = (0.5 + t_0) / x;
}
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(x)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = 0.2514179000665374d0 * (1.0d0 / (x ** 2.0d0))
if (x <= (-1.0d0)) then
tmp = (0.5d0 + ((0.15298196345929074d0 / (x ** 4.0d0)) + t_0)) / x
else if (x <= 0.95d0) then
tmp = (1.0d0 + (((-0.6665536072d0) * x) * x)) * x
else
tmp = (0.5d0 + t_0) / x
end if
code = tmp
end function
public static double code(double x) {
double t_0 = 0.2514179000665374 * (1.0 / Math.pow(x, 2.0));
double tmp;
if (x <= -1.0) {
tmp = (0.5 + ((0.15298196345929074 / Math.pow(x, 4.0)) + t_0)) / x;
} else if (x <= 0.95) {
tmp = (1.0 + ((-0.6665536072 * x) * x)) * x;
} else {
tmp = (0.5 + t_0) / x;
}
return tmp;
}
def code(x): t_0 = 0.2514179000665374 * (1.0 / math.pow(x, 2.0)) tmp = 0 if x <= -1.0: tmp = (0.5 + ((0.15298196345929074 / math.pow(x, 4.0)) + t_0)) / x elif x <= 0.95: tmp = (1.0 + ((-0.6665536072 * x) * x)) * x else: tmp = (0.5 + t_0) / x return tmp
function code(x) t_0 = Float64(0.2514179000665374 * Float64(1.0 / (x ^ 2.0))) tmp = 0.0 if (x <= -1.0) tmp = Float64(Float64(0.5 + Float64(Float64(0.15298196345929074 / (x ^ 4.0)) + t_0)) / x); elseif (x <= 0.95) tmp = Float64(Float64(1.0 + Float64(Float64(-0.6665536072 * x) * x)) * x); else tmp = Float64(Float64(0.5 + t_0) / x); end return tmp end
function tmp_2 = code(x) t_0 = 0.2514179000665374 * (1.0 / (x ^ 2.0)); tmp = 0.0; if (x <= -1.0) tmp = (0.5 + ((0.15298196345929074 / (x ^ 4.0)) + t_0)) / x; elseif (x <= 0.95) tmp = (1.0 + ((-0.6665536072 * x) * x)) * x; else tmp = (0.5 + t_0) / x; end tmp_2 = tmp; end
code[x_] := Block[{t$95$0 = N[(0.2514179000665374 * N[(1.0 / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.0], N[(N[(0.5 + N[(N[(0.15298196345929074 / N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 0.95], N[(N[(1.0 + N[(N[(-0.6665536072 * x), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], N[(N[(0.5 + t$95$0), $MachinePrecision] / x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.2514179000665374 \cdot \frac{1}{{x}^{2}}\\
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\frac{0.5 + \left(\frac{0.15298196345929074}{{x}^{4}} + t\_0\right)}{x}\\
\mathbf{elif}\;x \leq 0.95:\\
\;\;\;\;\left(1 + \left(-0.6665536072 \cdot x\right) \cdot x\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5 + t\_0}{x}\\
\end{array}
\end{array}
if x < -1Initial program 54.6%
Taylor expanded in x around inf
Applied rewrites50.6%
if -1 < x < 0.94999999999999996Initial program 54.6%
Taylor expanded in x around 0
Applied rewrites51.0%
Applied rewrites51.0%
if 0.94999999999999996 < x Initial program 54.6%
Taylor expanded in x around inf
Applied rewrites50.6%
(FPCore (x)
:precision binary64
(let* ((t_0 (/ (+ 0.5 (* 0.2514179000665374 (/ 1.0 (pow x 2.0)))) x)))
(if (<= x -0.95)
t_0
(if (<= x 0.95) (* (+ 1.0 (* (* -0.6665536072 x) x)) x) t_0))))
double code(double x) {
double t_0 = (0.5 + (0.2514179000665374 * (1.0 / pow(x, 2.0)))) / x;
double tmp;
if (x <= -0.95) {
tmp = t_0;
} else if (x <= 0.95) {
tmp = (1.0 + ((-0.6665536072 * x) * x)) * x;
} else {
tmp = 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(x)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = (0.5d0 + (0.2514179000665374d0 * (1.0d0 / (x ** 2.0d0)))) / x
if (x <= (-0.95d0)) then
tmp = t_0
else if (x <= 0.95d0) then
tmp = (1.0d0 + (((-0.6665536072d0) * x) * x)) * x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x) {
double t_0 = (0.5 + (0.2514179000665374 * (1.0 / Math.pow(x, 2.0)))) / x;
double tmp;
if (x <= -0.95) {
tmp = t_0;
} else if (x <= 0.95) {
tmp = (1.0 + ((-0.6665536072 * x) * x)) * x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x): t_0 = (0.5 + (0.2514179000665374 * (1.0 / math.pow(x, 2.0)))) / x tmp = 0 if x <= -0.95: tmp = t_0 elif x <= 0.95: tmp = (1.0 + ((-0.6665536072 * x) * x)) * x else: tmp = t_0 return tmp
function code(x) t_0 = Float64(Float64(0.5 + Float64(0.2514179000665374 * Float64(1.0 / (x ^ 2.0)))) / x) tmp = 0.0 if (x <= -0.95) tmp = t_0; elseif (x <= 0.95) tmp = Float64(Float64(1.0 + Float64(Float64(-0.6665536072 * x) * x)) * x); else tmp = t_0; end return tmp end
function tmp_2 = code(x) t_0 = (0.5 + (0.2514179000665374 * (1.0 / (x ^ 2.0)))) / x; tmp = 0.0; if (x <= -0.95) tmp = t_0; elseif (x <= 0.95) tmp = (1.0 + ((-0.6665536072 * x) * x)) * x; else tmp = t_0; end tmp_2 = tmp; end
code[x_] := Block[{t$95$0 = N[(N[(0.5 + N[(0.2514179000665374 * N[(1.0 / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[x, -0.95], t$95$0, If[LessEqual[x, 0.95], N[(N[(1.0 + N[(N[(-0.6665536072 * x), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{0.5 + 0.2514179000665374 \cdot \frac{1}{{x}^{2}}}{x}\\
\mathbf{if}\;x \leq -0.95:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 0.95:\\
\;\;\;\;\left(1 + \left(-0.6665536072 \cdot x\right) \cdot x\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -0.94999999999999996 or 0.94999999999999996 < x Initial program 54.6%
Taylor expanded in x around inf
Applied rewrites50.6%
if -0.94999999999999996 < x < 0.94999999999999996Initial program 54.6%
Taylor expanded in x around 0
Applied rewrites51.0%
Applied rewrites51.0%
(FPCore (x) :precision binary64 (if (<= x -0.8) (/ 0.5 x) (if (<= x 0.78) (* (+ 1.0 (* (* -0.6665536072 x) x)) x) (/ 0.5 x))))
double code(double x) {
double tmp;
if (x <= -0.8) {
tmp = 0.5 / x;
} else if (x <= 0.78) {
tmp = (1.0 + ((-0.6665536072 * x) * x)) * x;
} else {
tmp = 0.5 / x;
}
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(x)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8) :: tmp
if (x <= (-0.8d0)) then
tmp = 0.5d0 / x
else if (x <= 0.78d0) then
tmp = (1.0d0 + (((-0.6665536072d0) * x) * x)) * x
else
tmp = 0.5d0 / x
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= -0.8) {
tmp = 0.5 / x;
} else if (x <= 0.78) {
tmp = (1.0 + ((-0.6665536072 * x) * x)) * x;
} else {
tmp = 0.5 / x;
}
return tmp;
}
def code(x): tmp = 0 if x <= -0.8: tmp = 0.5 / x elif x <= 0.78: tmp = (1.0 + ((-0.6665536072 * x) * x)) * x else: tmp = 0.5 / x return tmp
function code(x) tmp = 0.0 if (x <= -0.8) tmp = Float64(0.5 / x); elseif (x <= 0.78) tmp = Float64(Float64(1.0 + Float64(Float64(-0.6665536072 * x) * x)) * x); else tmp = Float64(0.5 / x); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= -0.8) tmp = 0.5 / x; elseif (x <= 0.78) tmp = (1.0 + ((-0.6665536072 * x) * x)) * x; else tmp = 0.5 / x; end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, -0.8], N[(0.5 / x), $MachinePrecision], If[LessEqual[x, 0.78], N[(N[(1.0 + N[(N[(-0.6665536072 * x), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], N[(0.5 / x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.8:\\
\;\;\;\;\frac{0.5}{x}\\
\mathbf{elif}\;x \leq 0.78:\\
\;\;\;\;\left(1 + \left(-0.6665536072 \cdot x\right) \cdot x\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{x}\\
\end{array}
\end{array}
if x < -0.80000000000000004 or 0.78000000000000003 < x Initial program 54.6%
Taylor expanded in x around inf
Applied rewrites50.9%
if -0.80000000000000004 < x < 0.78000000000000003Initial program 54.6%
Taylor expanded in x around 0
Applied rewrites51.0%
Applied rewrites51.0%
(FPCore (x) :precision binary64 (if (<= x -0.7) (/ 0.5 x) (if (<= x 0.72) x (/ 0.5 x))))
double code(double x) {
double tmp;
if (x <= -0.7) {
tmp = 0.5 / x;
} else if (x <= 0.72) {
tmp = x;
} else {
tmp = 0.5 / x;
}
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(x)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8) :: tmp
if (x <= (-0.7d0)) then
tmp = 0.5d0 / x
else if (x <= 0.72d0) then
tmp = x
else
tmp = 0.5d0 / x
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= -0.7) {
tmp = 0.5 / x;
} else if (x <= 0.72) {
tmp = x;
} else {
tmp = 0.5 / x;
}
return tmp;
}
def code(x): tmp = 0 if x <= -0.7: tmp = 0.5 / x elif x <= 0.72: tmp = x else: tmp = 0.5 / x return tmp
function code(x) tmp = 0.0 if (x <= -0.7) tmp = Float64(0.5 / x); elseif (x <= 0.72) tmp = x; else tmp = Float64(0.5 / x); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= -0.7) tmp = 0.5 / x; elseif (x <= 0.72) tmp = x; else tmp = 0.5 / x; end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, -0.7], N[(0.5 / x), $MachinePrecision], If[LessEqual[x, 0.72], x, N[(0.5 / x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.7:\\
\;\;\;\;\frac{0.5}{x}\\
\mathbf{elif}\;x \leq 0.72:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{x}\\
\end{array}
\end{array}
if x < -0.69999999999999996 or 0.71999999999999997 < x Initial program 54.6%
Taylor expanded in x around inf
Applied rewrites50.9%
if -0.69999999999999996 < x < 0.71999999999999997Initial program 54.6%
Taylor expanded in x around 0
Applied rewrites52.0%
(FPCore (x)
:precision binary64
(let* ((t_0 (* (* x x) (* x x)))
(t_1 (* t_0 (* x x)))
(t_2 (* t_1 (* x x)))
(t_3 (* t_2 (* x x)))
(t_4
(*
(/
(+
(+
(+
(+ (+ 1.0 (* 0.1049934947 (* x x))) (* 0.0424060604 t_0))
(* 0.0072644182 t_1))
(* 0.0005064034 t_2))
(* 0.0001789971 t_3))
(+
(+
(+
(+
(+ (+ 1.0 (* 0.7715471019 (* x x))) (* 0.2909738639 t_0))
(* 0.0694555761 t_1))
(* 0.0140005442 t_2))
(* 0.0008327945 t_3))
(* (* 2.0 0.0001789971) (* t_3 (* x x)))))
x)))
(if (<= t_4 1e-5) t_4 (/ 0.5 x))))
double code(double x) {
double t_0 = (x * x) * (x * x);
double t_1 = t_0 * (x * x);
double t_2 = t_1 * (x * x);
double t_3 = t_2 * (x * x);
double t_4 = ((((((1.0 + (0.1049934947 * (x * x))) + (0.0424060604 * t_0)) + (0.0072644182 * t_1)) + (0.0005064034 * t_2)) + (0.0001789971 * t_3)) / ((((((1.0 + (0.7715471019 * (x * x))) + (0.2909738639 * t_0)) + (0.0694555761 * t_1)) + (0.0140005442 * t_2)) + (0.0008327945 * t_3)) + ((2.0 * 0.0001789971) * (t_3 * (x * x))))) * x;
double tmp;
if (t_4 <= 1e-5) {
tmp = t_4;
} else {
tmp = 0.5 / x;
}
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(x)
use fmin_fmax_functions
real(8), intent (in) :: x
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 = (x * x) * (x * x)
t_1 = t_0 * (x * x)
t_2 = t_1 * (x * x)
t_3 = t_2 * (x * x)
t_4 = ((((((1.0d0 + (0.1049934947d0 * (x * x))) + (0.0424060604d0 * t_0)) + (0.0072644182d0 * t_1)) + (0.0005064034d0 * t_2)) + (0.0001789971d0 * t_3)) / ((((((1.0d0 + (0.7715471019d0 * (x * x))) + (0.2909738639d0 * t_0)) + (0.0694555761d0 * t_1)) + (0.0140005442d0 * t_2)) + (0.0008327945d0 * t_3)) + ((2.0d0 * 0.0001789971d0) * (t_3 * (x * x))))) * x
if (t_4 <= 1d-5) then
tmp = t_4
else
tmp = 0.5d0 / x
end if
code = tmp
end function
public static double code(double x) {
double t_0 = (x * x) * (x * x);
double t_1 = t_0 * (x * x);
double t_2 = t_1 * (x * x);
double t_3 = t_2 * (x * x);
double t_4 = ((((((1.0 + (0.1049934947 * (x * x))) + (0.0424060604 * t_0)) + (0.0072644182 * t_1)) + (0.0005064034 * t_2)) + (0.0001789971 * t_3)) / ((((((1.0 + (0.7715471019 * (x * x))) + (0.2909738639 * t_0)) + (0.0694555761 * t_1)) + (0.0140005442 * t_2)) + (0.0008327945 * t_3)) + ((2.0 * 0.0001789971) * (t_3 * (x * x))))) * x;
double tmp;
if (t_4 <= 1e-5) {
tmp = t_4;
} else {
tmp = 0.5 / x;
}
return tmp;
}
def code(x): t_0 = (x * x) * (x * x) t_1 = t_0 * (x * x) t_2 = t_1 * (x * x) t_3 = t_2 * (x * x) t_4 = ((((((1.0 + (0.1049934947 * (x * x))) + (0.0424060604 * t_0)) + (0.0072644182 * t_1)) + (0.0005064034 * t_2)) + (0.0001789971 * t_3)) / ((((((1.0 + (0.7715471019 * (x * x))) + (0.2909738639 * t_0)) + (0.0694555761 * t_1)) + (0.0140005442 * t_2)) + (0.0008327945 * t_3)) + ((2.0 * 0.0001789971) * (t_3 * (x * x))))) * x tmp = 0 if t_4 <= 1e-5: tmp = t_4 else: tmp = 0.5 / x return tmp
function code(x) t_0 = Float64(Float64(x * x) * Float64(x * x)) t_1 = Float64(t_0 * Float64(x * x)) t_2 = Float64(t_1 * Float64(x * x)) t_3 = Float64(t_2 * Float64(x * x)) t_4 = Float64(Float64(Float64(Float64(Float64(Float64(Float64(1.0 + Float64(0.1049934947 * Float64(x * x))) + Float64(0.0424060604 * t_0)) + Float64(0.0072644182 * t_1)) + Float64(0.0005064034 * t_2)) + Float64(0.0001789971 * t_3)) / Float64(Float64(Float64(Float64(Float64(Float64(1.0 + Float64(0.7715471019 * Float64(x * x))) + Float64(0.2909738639 * t_0)) + Float64(0.0694555761 * t_1)) + Float64(0.0140005442 * t_2)) + Float64(0.0008327945 * t_3)) + Float64(Float64(2.0 * 0.0001789971) * Float64(t_3 * Float64(x * x))))) * x) tmp = 0.0 if (t_4 <= 1e-5) tmp = t_4; else tmp = Float64(0.5 / x); end return tmp end
function tmp_2 = code(x) t_0 = (x * x) * (x * x); t_1 = t_0 * (x * x); t_2 = t_1 * (x * x); t_3 = t_2 * (x * x); t_4 = ((((((1.0 + (0.1049934947 * (x * x))) + (0.0424060604 * t_0)) + (0.0072644182 * t_1)) + (0.0005064034 * t_2)) + (0.0001789971 * t_3)) / ((((((1.0 + (0.7715471019 * (x * x))) + (0.2909738639 * t_0)) + (0.0694555761 * t_1)) + (0.0140005442 * t_2)) + (0.0008327945 * t_3)) + ((2.0 * 0.0001789971) * (t_3 * (x * x))))) * x; tmp = 0.0; if (t_4 <= 1e-5) tmp = t_4; else tmp = 0.5 / x; end tmp_2 = tmp; end
code[x_] := Block[{t$95$0 = N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[(x * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * N[(x * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 * N[(x * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(N[(N[(N[(N[(N[(1.0 + N[(0.1049934947 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.0424060604 * t$95$0), $MachinePrecision]), $MachinePrecision] + N[(0.0072644182 * t$95$1), $MachinePrecision]), $MachinePrecision] + N[(0.0005064034 * t$95$2), $MachinePrecision]), $MachinePrecision] + N[(0.0001789971 * t$95$3), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(N[(N[(N[(1.0 + N[(0.7715471019 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.2909738639 * t$95$0), $MachinePrecision]), $MachinePrecision] + N[(0.0694555761 * t$95$1), $MachinePrecision]), $MachinePrecision] + N[(0.0140005442 * t$95$2), $MachinePrecision]), $MachinePrecision] + N[(0.0008327945 * t$95$3), $MachinePrecision]), $MachinePrecision] + N[(N[(2.0 * 0.0001789971), $MachinePrecision] * N[(t$95$3 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[t$95$4, 1e-5], t$95$4, N[(0.5 / x), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x \cdot x\right) \cdot \left(x \cdot x\right)\\
t_1 := t\_0 \cdot \left(x \cdot x\right)\\
t_2 := t\_1 \cdot \left(x \cdot x\right)\\
t_3 := t\_2 \cdot \left(x \cdot x\right)\\
t_4 := \frac{\left(\left(\left(\left(1 + 0.1049934947 \cdot \left(x \cdot x\right)\right) + 0.0424060604 \cdot t\_0\right) + 0.0072644182 \cdot t\_1\right) + 0.0005064034 \cdot t\_2\right) + 0.0001789971 \cdot t\_3}{\left(\left(\left(\left(\left(1 + 0.7715471019 \cdot \left(x \cdot x\right)\right) + 0.2909738639 \cdot t\_0\right) + 0.0694555761 \cdot t\_1\right) + 0.0140005442 \cdot t\_2\right) + 0.0008327945 \cdot t\_3\right) + \left(2 \cdot 0.0001789971\right) \cdot \left(t\_3 \cdot \left(x \cdot x\right)\right)} \cdot x\\
\mathbf{if}\;t\_4 \leq 10^{-5}:\\
\;\;\;\;t\_4\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{x}\\
\end{array}
\end{array}
if (*.f64 (/.f64 (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 1049934947/10000000000 binary64) (*.f64 x x))) (*.f64 #s(literal 106015151/2500000000 binary64) (*.f64 (*.f64 x x) (*.f64 x x)))) (*.f64 #s(literal 36322091/5000000000 binary64) (*.f64 (*.f64 (*.f64 x x) (*.f64 x x)) (*.f64 x x)))) (*.f64 #s(literal 2532017/5000000000 binary64) (*.f64 (*.f64 (*.f64 (*.f64 x x) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)))) (*.f64 #s(literal 1789971/10000000000 binary64) (*.f64 (*.f64 (*.f64 (*.f64 (*.f64 x x) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)))) (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 7715471019/10000000000 binary64) (*.f64 x x))) (*.f64 #s(literal 2909738639/10000000000 binary64) (*.f64 (*.f64 x x) (*.f64 x x)))) (*.f64 #s(literal 694555761/10000000000 binary64) (*.f64 (*.f64 (*.f64 x x) (*.f64 x x)) (*.f64 x x)))) (*.f64 #s(literal 70002721/5000000000 binary64) (*.f64 (*.f64 (*.f64 (*.f64 x x) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)))) (*.f64 #s(literal 1665589/2000000000 binary64) (*.f64 (*.f64 (*.f64 (*.f64 (*.f64 x x) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)))) (*.f64 (*.f64 #s(literal 2 binary64) #s(literal 1789971/10000000000 binary64)) (*.f64 (*.f64 (*.f64 (*.f64 (*.f64 (*.f64 x x) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)) (*.f64 x x))))) x) < 1.00000000000000008e-5Initial program 54.6%
if 1.00000000000000008e-5 < (*.f64 (/.f64 (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 1049934947/10000000000 binary64) (*.f64 x x))) (*.f64 #s(literal 106015151/2500000000 binary64) (*.f64 (*.f64 x x) (*.f64 x x)))) (*.f64 #s(literal 36322091/5000000000 binary64) (*.f64 (*.f64 (*.f64 x x) (*.f64 x x)) (*.f64 x x)))) (*.f64 #s(literal 2532017/5000000000 binary64) (*.f64 (*.f64 (*.f64 (*.f64 x x) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)))) (*.f64 #s(literal 1789971/10000000000 binary64) (*.f64 (*.f64 (*.f64 (*.f64 (*.f64 x x) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)))) (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 7715471019/10000000000 binary64) (*.f64 x x))) (*.f64 #s(literal 2909738639/10000000000 binary64) (*.f64 (*.f64 x x) (*.f64 x x)))) (*.f64 #s(literal 694555761/10000000000 binary64) (*.f64 (*.f64 (*.f64 x x) (*.f64 x x)) (*.f64 x x)))) (*.f64 #s(literal 70002721/5000000000 binary64) (*.f64 (*.f64 (*.f64 (*.f64 x x) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)))) (*.f64 #s(literal 1665589/2000000000 binary64) (*.f64 (*.f64 (*.f64 (*.f64 (*.f64 x x) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)))) (*.f64 (*.f64 #s(literal 2 binary64) #s(literal 1789971/10000000000 binary64)) (*.f64 (*.f64 (*.f64 (*.f64 (*.f64 (*.f64 x x) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)) (*.f64 x x))))) x) Initial program 54.6%
Taylor expanded in x around inf
Applied rewrites50.9%
(FPCore (x)
:precision binary64
(let* ((t_0 (* (* x x) (* x x)))
(t_1 (* t_0 (* x x)))
(t_2
(+
(+ (+ 1.0 (* 0.7715471019 (* x x))) (* 0.2909738639 t_0))
(* 0.0694555761 t_1)))
(t_3
(+
(+ (+ 1.0 (* 0.1049934947 (* x x))) (* 0.0424060604 t_0))
(* 0.0072644182 t_1)))
(t_4 (* t_1 (* x x)))
(t_5 (* t_4 (* x x))))
(if (<=
(*
(/
(+ (+ t_3 (* 0.0005064034 t_4)) (* 0.0001789971 t_5))
(+
(+ (+ t_2 (* 0.0140005442 t_4)) (* 0.0008327945 t_5))
(* (* 2.0 0.0001789971) (* t_5 (* x x)))))
x)
1e-5)
(*
(/
(+ (+ t_3 (* 0.0005064034 (pow x 8.0))) (* 0.0001789971 (pow x 10.0)))
(+
(+ (+ t_2 (* 0.0140005442 (pow x 8.0))) (* 0.0008327945 (pow x 10.0)))
(* (* 2.0 0.0001789971) (* (pow x 10.0) (* x x)))))
x)
(/ 0.5 x))))
double code(double x) {
double t_0 = (x * x) * (x * x);
double t_1 = t_0 * (x * x);
double t_2 = ((1.0 + (0.7715471019 * (x * x))) + (0.2909738639 * t_0)) + (0.0694555761 * t_1);
double t_3 = ((1.0 + (0.1049934947 * (x * x))) + (0.0424060604 * t_0)) + (0.0072644182 * t_1);
double t_4 = t_1 * (x * x);
double t_5 = t_4 * (x * x);
double tmp;
if (((((t_3 + (0.0005064034 * t_4)) + (0.0001789971 * t_5)) / (((t_2 + (0.0140005442 * t_4)) + (0.0008327945 * t_5)) + ((2.0 * 0.0001789971) * (t_5 * (x * x))))) * x) <= 1e-5) {
tmp = (((t_3 + (0.0005064034 * pow(x, 8.0))) + (0.0001789971 * pow(x, 10.0))) / (((t_2 + (0.0140005442 * pow(x, 8.0))) + (0.0008327945 * pow(x, 10.0))) + ((2.0 * 0.0001789971) * (pow(x, 10.0) * (x * x))))) * x;
} else {
tmp = 0.5 / x;
}
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(x)
use fmin_fmax_functions
real(8), intent (in) :: x
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 = (x * x) * (x * x)
t_1 = t_0 * (x * x)
t_2 = ((1.0d0 + (0.7715471019d0 * (x * x))) + (0.2909738639d0 * t_0)) + (0.0694555761d0 * t_1)
t_3 = ((1.0d0 + (0.1049934947d0 * (x * x))) + (0.0424060604d0 * t_0)) + (0.0072644182d0 * t_1)
t_4 = t_1 * (x * x)
t_5 = t_4 * (x * x)
if (((((t_3 + (0.0005064034d0 * t_4)) + (0.0001789971d0 * t_5)) / (((t_2 + (0.0140005442d0 * t_4)) + (0.0008327945d0 * t_5)) + ((2.0d0 * 0.0001789971d0) * (t_5 * (x * x))))) * x) <= 1d-5) then
tmp = (((t_3 + (0.0005064034d0 * (x ** 8.0d0))) + (0.0001789971d0 * (x ** 10.0d0))) / (((t_2 + (0.0140005442d0 * (x ** 8.0d0))) + (0.0008327945d0 * (x ** 10.0d0))) + ((2.0d0 * 0.0001789971d0) * ((x ** 10.0d0) * (x * x))))) * x
else
tmp = 0.5d0 / x
end if
code = tmp
end function
public static double code(double x) {
double t_0 = (x * x) * (x * x);
double t_1 = t_0 * (x * x);
double t_2 = ((1.0 + (0.7715471019 * (x * x))) + (0.2909738639 * t_0)) + (0.0694555761 * t_1);
double t_3 = ((1.0 + (0.1049934947 * (x * x))) + (0.0424060604 * t_0)) + (0.0072644182 * t_1);
double t_4 = t_1 * (x * x);
double t_5 = t_4 * (x * x);
double tmp;
if (((((t_3 + (0.0005064034 * t_4)) + (0.0001789971 * t_5)) / (((t_2 + (0.0140005442 * t_4)) + (0.0008327945 * t_5)) + ((2.0 * 0.0001789971) * (t_5 * (x * x))))) * x) <= 1e-5) {
tmp = (((t_3 + (0.0005064034 * Math.pow(x, 8.0))) + (0.0001789971 * Math.pow(x, 10.0))) / (((t_2 + (0.0140005442 * Math.pow(x, 8.0))) + (0.0008327945 * Math.pow(x, 10.0))) + ((2.0 * 0.0001789971) * (Math.pow(x, 10.0) * (x * x))))) * x;
} else {
tmp = 0.5 / x;
}
return tmp;
}
def code(x): t_0 = (x * x) * (x * x) t_1 = t_0 * (x * x) t_2 = ((1.0 + (0.7715471019 * (x * x))) + (0.2909738639 * t_0)) + (0.0694555761 * t_1) t_3 = ((1.0 + (0.1049934947 * (x * x))) + (0.0424060604 * t_0)) + (0.0072644182 * t_1) t_4 = t_1 * (x * x) t_5 = t_4 * (x * x) tmp = 0 if ((((t_3 + (0.0005064034 * t_4)) + (0.0001789971 * t_5)) / (((t_2 + (0.0140005442 * t_4)) + (0.0008327945 * t_5)) + ((2.0 * 0.0001789971) * (t_5 * (x * x))))) * x) <= 1e-5: tmp = (((t_3 + (0.0005064034 * math.pow(x, 8.0))) + (0.0001789971 * math.pow(x, 10.0))) / (((t_2 + (0.0140005442 * math.pow(x, 8.0))) + (0.0008327945 * math.pow(x, 10.0))) + ((2.0 * 0.0001789971) * (math.pow(x, 10.0) * (x * x))))) * x else: tmp = 0.5 / x return tmp
function code(x) t_0 = Float64(Float64(x * x) * Float64(x * x)) t_1 = Float64(t_0 * Float64(x * x)) t_2 = Float64(Float64(Float64(1.0 + Float64(0.7715471019 * Float64(x * x))) + Float64(0.2909738639 * t_0)) + Float64(0.0694555761 * t_1)) t_3 = Float64(Float64(Float64(1.0 + Float64(0.1049934947 * Float64(x * x))) + Float64(0.0424060604 * t_0)) + Float64(0.0072644182 * t_1)) t_4 = Float64(t_1 * Float64(x * x)) t_5 = Float64(t_4 * Float64(x * x)) tmp = 0.0 if (Float64(Float64(Float64(Float64(t_3 + Float64(0.0005064034 * t_4)) + Float64(0.0001789971 * t_5)) / Float64(Float64(Float64(t_2 + Float64(0.0140005442 * t_4)) + Float64(0.0008327945 * t_5)) + Float64(Float64(2.0 * 0.0001789971) * Float64(t_5 * Float64(x * x))))) * x) <= 1e-5) tmp = Float64(Float64(Float64(Float64(t_3 + Float64(0.0005064034 * (x ^ 8.0))) + Float64(0.0001789971 * (x ^ 10.0))) / Float64(Float64(Float64(t_2 + Float64(0.0140005442 * (x ^ 8.0))) + Float64(0.0008327945 * (x ^ 10.0))) + Float64(Float64(2.0 * 0.0001789971) * Float64((x ^ 10.0) * Float64(x * x))))) * x); else tmp = Float64(0.5 / x); end return tmp end
function tmp_2 = code(x) t_0 = (x * x) * (x * x); t_1 = t_0 * (x * x); t_2 = ((1.0 + (0.7715471019 * (x * x))) + (0.2909738639 * t_0)) + (0.0694555761 * t_1); t_3 = ((1.0 + (0.1049934947 * (x * x))) + (0.0424060604 * t_0)) + (0.0072644182 * t_1); t_4 = t_1 * (x * x); t_5 = t_4 * (x * x); tmp = 0.0; if (((((t_3 + (0.0005064034 * t_4)) + (0.0001789971 * t_5)) / (((t_2 + (0.0140005442 * t_4)) + (0.0008327945 * t_5)) + ((2.0 * 0.0001789971) * (t_5 * (x * x))))) * x) <= 1e-5) tmp = (((t_3 + (0.0005064034 * (x ^ 8.0))) + (0.0001789971 * (x ^ 10.0))) / (((t_2 + (0.0140005442 * (x ^ 8.0))) + (0.0008327945 * (x ^ 10.0))) + ((2.0 * 0.0001789971) * ((x ^ 10.0) * (x * x))))) * x; else tmp = 0.5 / x; end tmp_2 = tmp; end
code[x_] := Block[{t$95$0 = N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[(x * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(1.0 + N[(0.7715471019 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.2909738639 * t$95$0), $MachinePrecision]), $MachinePrecision] + N[(0.0694555761 * t$95$1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(1.0 + N[(0.1049934947 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.0424060604 * t$95$0), $MachinePrecision]), $MachinePrecision] + N[(0.0072644182 * t$95$1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$1 * N[(x * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(t$95$4 * N[(x * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[(N[(t$95$3 + N[(0.0005064034 * t$95$4), $MachinePrecision]), $MachinePrecision] + N[(0.0001789971 * t$95$5), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(t$95$2 + N[(0.0140005442 * t$95$4), $MachinePrecision]), $MachinePrecision] + N[(0.0008327945 * t$95$5), $MachinePrecision]), $MachinePrecision] + N[(N[(2.0 * 0.0001789971), $MachinePrecision] * N[(t$95$5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], 1e-5], N[(N[(N[(N[(t$95$3 + N[(0.0005064034 * N[Power[x, 8.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.0001789971 * N[Power[x, 10.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(t$95$2 + N[(0.0140005442 * N[Power[x, 8.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.0008327945 * N[Power[x, 10.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(2.0 * 0.0001789971), $MachinePrecision] * N[(N[Power[x, 10.0], $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], N[(0.5 / x), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x \cdot x\right) \cdot \left(x \cdot x\right)\\
t_1 := t\_0 \cdot \left(x \cdot x\right)\\
t_2 := \left(\left(1 + 0.7715471019 \cdot \left(x \cdot x\right)\right) + 0.2909738639 \cdot t\_0\right) + 0.0694555761 \cdot t\_1\\
t_3 := \left(\left(1 + 0.1049934947 \cdot \left(x \cdot x\right)\right) + 0.0424060604 \cdot t\_0\right) + 0.0072644182 \cdot t\_1\\
t_4 := t\_1 \cdot \left(x \cdot x\right)\\
t_5 := t\_4 \cdot \left(x \cdot x\right)\\
\mathbf{if}\;\frac{\left(t\_3 + 0.0005064034 \cdot t\_4\right) + 0.0001789971 \cdot t\_5}{\left(\left(t\_2 + 0.0140005442 \cdot t\_4\right) + 0.0008327945 \cdot t\_5\right) + \left(2 \cdot 0.0001789971\right) \cdot \left(t\_5 \cdot \left(x \cdot x\right)\right)} \cdot x \leq 10^{-5}:\\
\;\;\;\;\frac{\left(t\_3 + 0.0005064034 \cdot {x}^{8}\right) + 0.0001789971 \cdot {x}^{10}}{\left(\left(t\_2 + 0.0140005442 \cdot {x}^{8}\right) + 0.0008327945 \cdot {x}^{10}\right) + \left(2 \cdot 0.0001789971\right) \cdot \left({x}^{10} \cdot \left(x \cdot x\right)\right)} \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{x}\\
\end{array}
\end{array}
if (*.f64 (/.f64 (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 1049934947/10000000000 binary64) (*.f64 x x))) (*.f64 #s(literal 106015151/2500000000 binary64) (*.f64 (*.f64 x x) (*.f64 x x)))) (*.f64 #s(literal 36322091/5000000000 binary64) (*.f64 (*.f64 (*.f64 x x) (*.f64 x x)) (*.f64 x x)))) (*.f64 #s(literal 2532017/5000000000 binary64) (*.f64 (*.f64 (*.f64 (*.f64 x x) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)))) (*.f64 #s(literal 1789971/10000000000 binary64) (*.f64 (*.f64 (*.f64 (*.f64 (*.f64 x x) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)))) (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 7715471019/10000000000 binary64) (*.f64 x x))) (*.f64 #s(literal 2909738639/10000000000 binary64) (*.f64 (*.f64 x x) (*.f64 x x)))) (*.f64 #s(literal 694555761/10000000000 binary64) (*.f64 (*.f64 (*.f64 x x) (*.f64 x x)) (*.f64 x x)))) (*.f64 #s(literal 70002721/5000000000 binary64) (*.f64 (*.f64 (*.f64 (*.f64 x x) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)))) (*.f64 #s(literal 1665589/2000000000 binary64) (*.f64 (*.f64 (*.f64 (*.f64 (*.f64 x x) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)))) (*.f64 (*.f64 #s(literal 2 binary64) #s(literal 1789971/10000000000 binary64)) (*.f64 (*.f64 (*.f64 (*.f64 (*.f64 (*.f64 x x) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)) (*.f64 x x))))) x) < 1.00000000000000008e-5Initial program 54.6%
Taylor expanded in x around 0
Applied rewrites54.5%
Taylor expanded in x around 0
Applied rewrites54.5%
Taylor expanded in x around 0
Applied rewrites54.6%
Taylor expanded in x around 0
Applied rewrites54.6%
Taylor expanded in x around 0
Applied rewrites54.6%
if 1.00000000000000008e-5 < (*.f64 (/.f64 (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 1049934947/10000000000 binary64) (*.f64 x x))) (*.f64 #s(literal 106015151/2500000000 binary64) (*.f64 (*.f64 x x) (*.f64 x x)))) (*.f64 #s(literal 36322091/5000000000 binary64) (*.f64 (*.f64 (*.f64 x x) (*.f64 x x)) (*.f64 x x)))) (*.f64 #s(literal 2532017/5000000000 binary64) (*.f64 (*.f64 (*.f64 (*.f64 x x) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)))) (*.f64 #s(literal 1789971/10000000000 binary64) (*.f64 (*.f64 (*.f64 (*.f64 (*.f64 x x) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)))) (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 7715471019/10000000000 binary64) (*.f64 x x))) (*.f64 #s(literal 2909738639/10000000000 binary64) (*.f64 (*.f64 x x) (*.f64 x x)))) (*.f64 #s(literal 694555761/10000000000 binary64) (*.f64 (*.f64 (*.f64 x x) (*.f64 x x)) (*.f64 x x)))) (*.f64 #s(literal 70002721/5000000000 binary64) (*.f64 (*.f64 (*.f64 (*.f64 x x) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)))) (*.f64 #s(literal 1665589/2000000000 binary64) (*.f64 (*.f64 (*.f64 (*.f64 (*.f64 x x) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)))) (*.f64 (*.f64 #s(literal 2 binary64) #s(literal 1789971/10000000000 binary64)) (*.f64 (*.f64 (*.f64 (*.f64 (*.f64 (*.f64 x x) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)) (*.f64 x x))))) x) Initial program 54.6%
Taylor expanded in x around inf
Applied rewrites50.9%
(FPCore (x)
:precision binary64
(let* ((t_0 (* (* x x) (* x x)))
(t_1 (* t_0 (* x x)))
(t_2
(+
(+ (+ 1.0 (* 0.7715471019 (* x x))) (* 0.2909738639 t_0))
(* 0.0694555761 t_1)))
(t_3
(+
(+ (+ 1.0 (* 0.1049934947 (* x x))) (* 0.0424060604 t_0))
(* 0.0072644182 t_1)))
(t_4 (* t_1 (* x x)))
(t_5 (* t_4 (* x x))))
(if (<=
(*
(/
(+ (+ t_3 (* 0.0005064034 t_4)) (* 0.0001789971 t_5))
(+
(+ (+ t_2 (* 0.0140005442 t_4)) (* 0.0008327945 t_5))
(* (* 2.0 0.0001789971) (* t_5 (* x x)))))
x)
1e-5)
(*
(/
(+ (+ t_3 (* 0.0005064034 (pow x 8.0))) (* 0.0001789971 (pow x 10.0)))
(+
(+ (+ t_2 (* 0.0140005442 (pow x 8.0))) (* 0.0008327945 (pow x 10.0)))
(* (pow x 12.0) 0.0003579942)))
x)
(/ 0.5 x))))
double code(double x) {
double t_0 = (x * x) * (x * x);
double t_1 = t_0 * (x * x);
double t_2 = ((1.0 + (0.7715471019 * (x * x))) + (0.2909738639 * t_0)) + (0.0694555761 * t_1);
double t_3 = ((1.0 + (0.1049934947 * (x * x))) + (0.0424060604 * t_0)) + (0.0072644182 * t_1);
double t_4 = t_1 * (x * x);
double t_5 = t_4 * (x * x);
double tmp;
if (((((t_3 + (0.0005064034 * t_4)) + (0.0001789971 * t_5)) / (((t_2 + (0.0140005442 * t_4)) + (0.0008327945 * t_5)) + ((2.0 * 0.0001789971) * (t_5 * (x * x))))) * x) <= 1e-5) {
tmp = (((t_3 + (0.0005064034 * pow(x, 8.0))) + (0.0001789971 * pow(x, 10.0))) / (((t_2 + (0.0140005442 * pow(x, 8.0))) + (0.0008327945 * pow(x, 10.0))) + (pow(x, 12.0) * 0.0003579942))) * x;
} else {
tmp = 0.5 / x;
}
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(x)
use fmin_fmax_functions
real(8), intent (in) :: x
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 = (x * x) * (x * x)
t_1 = t_0 * (x * x)
t_2 = ((1.0d0 + (0.7715471019d0 * (x * x))) + (0.2909738639d0 * t_0)) + (0.0694555761d0 * t_1)
t_3 = ((1.0d0 + (0.1049934947d0 * (x * x))) + (0.0424060604d0 * t_0)) + (0.0072644182d0 * t_1)
t_4 = t_1 * (x * x)
t_5 = t_4 * (x * x)
if (((((t_3 + (0.0005064034d0 * t_4)) + (0.0001789971d0 * t_5)) / (((t_2 + (0.0140005442d0 * t_4)) + (0.0008327945d0 * t_5)) + ((2.0d0 * 0.0001789971d0) * (t_5 * (x * x))))) * x) <= 1d-5) then
tmp = (((t_3 + (0.0005064034d0 * (x ** 8.0d0))) + (0.0001789971d0 * (x ** 10.0d0))) / (((t_2 + (0.0140005442d0 * (x ** 8.0d0))) + (0.0008327945d0 * (x ** 10.0d0))) + ((x ** 12.0d0) * 0.0003579942d0))) * x
else
tmp = 0.5d0 / x
end if
code = tmp
end function
public static double code(double x) {
double t_0 = (x * x) * (x * x);
double t_1 = t_0 * (x * x);
double t_2 = ((1.0 + (0.7715471019 * (x * x))) + (0.2909738639 * t_0)) + (0.0694555761 * t_1);
double t_3 = ((1.0 + (0.1049934947 * (x * x))) + (0.0424060604 * t_0)) + (0.0072644182 * t_1);
double t_4 = t_1 * (x * x);
double t_5 = t_4 * (x * x);
double tmp;
if (((((t_3 + (0.0005064034 * t_4)) + (0.0001789971 * t_5)) / (((t_2 + (0.0140005442 * t_4)) + (0.0008327945 * t_5)) + ((2.0 * 0.0001789971) * (t_5 * (x * x))))) * x) <= 1e-5) {
tmp = (((t_3 + (0.0005064034 * Math.pow(x, 8.0))) + (0.0001789971 * Math.pow(x, 10.0))) / (((t_2 + (0.0140005442 * Math.pow(x, 8.0))) + (0.0008327945 * Math.pow(x, 10.0))) + (Math.pow(x, 12.0) * 0.0003579942))) * x;
} else {
tmp = 0.5 / x;
}
return tmp;
}
def code(x): t_0 = (x * x) * (x * x) t_1 = t_0 * (x * x) t_2 = ((1.0 + (0.7715471019 * (x * x))) + (0.2909738639 * t_0)) + (0.0694555761 * t_1) t_3 = ((1.0 + (0.1049934947 * (x * x))) + (0.0424060604 * t_0)) + (0.0072644182 * t_1) t_4 = t_1 * (x * x) t_5 = t_4 * (x * x) tmp = 0 if ((((t_3 + (0.0005064034 * t_4)) + (0.0001789971 * t_5)) / (((t_2 + (0.0140005442 * t_4)) + (0.0008327945 * t_5)) + ((2.0 * 0.0001789971) * (t_5 * (x * x))))) * x) <= 1e-5: tmp = (((t_3 + (0.0005064034 * math.pow(x, 8.0))) + (0.0001789971 * math.pow(x, 10.0))) / (((t_2 + (0.0140005442 * math.pow(x, 8.0))) + (0.0008327945 * math.pow(x, 10.0))) + (math.pow(x, 12.0) * 0.0003579942))) * x else: tmp = 0.5 / x return tmp
function code(x) t_0 = Float64(Float64(x * x) * Float64(x * x)) t_1 = Float64(t_0 * Float64(x * x)) t_2 = Float64(Float64(Float64(1.0 + Float64(0.7715471019 * Float64(x * x))) + Float64(0.2909738639 * t_0)) + Float64(0.0694555761 * t_1)) t_3 = Float64(Float64(Float64(1.0 + Float64(0.1049934947 * Float64(x * x))) + Float64(0.0424060604 * t_0)) + Float64(0.0072644182 * t_1)) t_4 = Float64(t_1 * Float64(x * x)) t_5 = Float64(t_4 * Float64(x * x)) tmp = 0.0 if (Float64(Float64(Float64(Float64(t_3 + Float64(0.0005064034 * t_4)) + Float64(0.0001789971 * t_5)) / Float64(Float64(Float64(t_2 + Float64(0.0140005442 * t_4)) + Float64(0.0008327945 * t_5)) + Float64(Float64(2.0 * 0.0001789971) * Float64(t_5 * Float64(x * x))))) * x) <= 1e-5) tmp = Float64(Float64(Float64(Float64(t_3 + Float64(0.0005064034 * (x ^ 8.0))) + Float64(0.0001789971 * (x ^ 10.0))) / Float64(Float64(Float64(t_2 + Float64(0.0140005442 * (x ^ 8.0))) + Float64(0.0008327945 * (x ^ 10.0))) + Float64((x ^ 12.0) * 0.0003579942))) * x); else tmp = Float64(0.5 / x); end return tmp end
function tmp_2 = code(x) t_0 = (x * x) * (x * x); t_1 = t_0 * (x * x); t_2 = ((1.0 + (0.7715471019 * (x * x))) + (0.2909738639 * t_0)) + (0.0694555761 * t_1); t_3 = ((1.0 + (0.1049934947 * (x * x))) + (0.0424060604 * t_0)) + (0.0072644182 * t_1); t_4 = t_1 * (x * x); t_5 = t_4 * (x * x); tmp = 0.0; if (((((t_3 + (0.0005064034 * t_4)) + (0.0001789971 * t_5)) / (((t_2 + (0.0140005442 * t_4)) + (0.0008327945 * t_5)) + ((2.0 * 0.0001789971) * (t_5 * (x * x))))) * x) <= 1e-5) tmp = (((t_3 + (0.0005064034 * (x ^ 8.0))) + (0.0001789971 * (x ^ 10.0))) / (((t_2 + (0.0140005442 * (x ^ 8.0))) + (0.0008327945 * (x ^ 10.0))) + ((x ^ 12.0) * 0.0003579942))) * x; else tmp = 0.5 / x; end tmp_2 = tmp; end
code[x_] := Block[{t$95$0 = N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[(x * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(1.0 + N[(0.7715471019 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.2909738639 * t$95$0), $MachinePrecision]), $MachinePrecision] + N[(0.0694555761 * t$95$1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(1.0 + N[(0.1049934947 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.0424060604 * t$95$0), $MachinePrecision]), $MachinePrecision] + N[(0.0072644182 * t$95$1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$1 * N[(x * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(t$95$4 * N[(x * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[(N[(t$95$3 + N[(0.0005064034 * t$95$4), $MachinePrecision]), $MachinePrecision] + N[(0.0001789971 * t$95$5), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(t$95$2 + N[(0.0140005442 * t$95$4), $MachinePrecision]), $MachinePrecision] + N[(0.0008327945 * t$95$5), $MachinePrecision]), $MachinePrecision] + N[(N[(2.0 * 0.0001789971), $MachinePrecision] * N[(t$95$5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], 1e-5], N[(N[(N[(N[(t$95$3 + N[(0.0005064034 * N[Power[x, 8.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.0001789971 * N[Power[x, 10.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(t$95$2 + N[(0.0140005442 * N[Power[x, 8.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.0008327945 * N[Power[x, 10.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Power[x, 12.0], $MachinePrecision] * 0.0003579942), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], N[(0.5 / x), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x \cdot x\right) \cdot \left(x \cdot x\right)\\
t_1 := t\_0 \cdot \left(x \cdot x\right)\\
t_2 := \left(\left(1 + 0.7715471019 \cdot \left(x \cdot x\right)\right) + 0.2909738639 \cdot t\_0\right) + 0.0694555761 \cdot t\_1\\
t_3 := \left(\left(1 + 0.1049934947 \cdot \left(x \cdot x\right)\right) + 0.0424060604 \cdot t\_0\right) + 0.0072644182 \cdot t\_1\\
t_4 := t\_1 \cdot \left(x \cdot x\right)\\
t_5 := t\_4 \cdot \left(x \cdot x\right)\\
\mathbf{if}\;\frac{\left(t\_3 + 0.0005064034 \cdot t\_4\right) + 0.0001789971 \cdot t\_5}{\left(\left(t\_2 + 0.0140005442 \cdot t\_4\right) + 0.0008327945 \cdot t\_5\right) + \left(2 \cdot 0.0001789971\right) \cdot \left(t\_5 \cdot \left(x \cdot x\right)\right)} \cdot x \leq 10^{-5}:\\
\;\;\;\;\frac{\left(t\_3 + 0.0005064034 \cdot {x}^{8}\right) + 0.0001789971 \cdot {x}^{10}}{\left(\left(t\_2 + 0.0140005442 \cdot {x}^{8}\right) + 0.0008327945 \cdot {x}^{10}\right) + {x}^{12} \cdot 0.0003579942} \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{x}\\
\end{array}
\end{array}
if (*.f64 (/.f64 (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 1049934947/10000000000 binary64) (*.f64 x x))) (*.f64 #s(literal 106015151/2500000000 binary64) (*.f64 (*.f64 x x) (*.f64 x x)))) (*.f64 #s(literal 36322091/5000000000 binary64) (*.f64 (*.f64 (*.f64 x x) (*.f64 x x)) (*.f64 x x)))) (*.f64 #s(literal 2532017/5000000000 binary64) (*.f64 (*.f64 (*.f64 (*.f64 x x) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)))) (*.f64 #s(literal 1789971/10000000000 binary64) (*.f64 (*.f64 (*.f64 (*.f64 (*.f64 x x) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)))) (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 7715471019/10000000000 binary64) (*.f64 x x))) (*.f64 #s(literal 2909738639/10000000000 binary64) (*.f64 (*.f64 x x) (*.f64 x x)))) (*.f64 #s(literal 694555761/10000000000 binary64) (*.f64 (*.f64 (*.f64 x x) (*.f64 x x)) (*.f64 x x)))) (*.f64 #s(literal 70002721/5000000000 binary64) (*.f64 (*.f64 (*.f64 (*.f64 x x) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)))) (*.f64 #s(literal 1665589/2000000000 binary64) (*.f64 (*.f64 (*.f64 (*.f64 (*.f64 x x) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)))) (*.f64 (*.f64 #s(literal 2 binary64) #s(literal 1789971/10000000000 binary64)) (*.f64 (*.f64 (*.f64 (*.f64 (*.f64 (*.f64 x x) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)) (*.f64 x x))))) x) < 1.00000000000000008e-5Initial program 54.6%
Taylor expanded in x around 0
Applied rewrites54.5%
Taylor expanded in x around 0
Applied rewrites54.5%
Taylor expanded in x around 0
Applied rewrites54.6%
Taylor expanded in x around 0
Applied rewrites54.6%
Taylor expanded in x around 0
Applied rewrites54.6%
Taylor expanded in x around 0
Applied rewrites54.6%
Applied rewrites54.6%
if 1.00000000000000008e-5 < (*.f64 (/.f64 (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 1049934947/10000000000 binary64) (*.f64 x x))) (*.f64 #s(literal 106015151/2500000000 binary64) (*.f64 (*.f64 x x) (*.f64 x x)))) (*.f64 #s(literal 36322091/5000000000 binary64) (*.f64 (*.f64 (*.f64 x x) (*.f64 x x)) (*.f64 x x)))) (*.f64 #s(literal 2532017/5000000000 binary64) (*.f64 (*.f64 (*.f64 (*.f64 x x) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)))) (*.f64 #s(literal 1789971/10000000000 binary64) (*.f64 (*.f64 (*.f64 (*.f64 (*.f64 x x) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)))) (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 7715471019/10000000000 binary64) (*.f64 x x))) (*.f64 #s(literal 2909738639/10000000000 binary64) (*.f64 (*.f64 x x) (*.f64 x x)))) (*.f64 #s(literal 694555761/10000000000 binary64) (*.f64 (*.f64 (*.f64 x x) (*.f64 x x)) (*.f64 x x)))) (*.f64 #s(literal 70002721/5000000000 binary64) (*.f64 (*.f64 (*.f64 (*.f64 x x) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)))) (*.f64 #s(literal 1665589/2000000000 binary64) (*.f64 (*.f64 (*.f64 (*.f64 (*.f64 x x) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)))) (*.f64 (*.f64 #s(literal 2 binary64) #s(literal 1789971/10000000000 binary64)) (*.f64 (*.f64 (*.f64 (*.f64 (*.f64 (*.f64 x x) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)) (*.f64 x x)) (*.f64 x x))))) x) Initial program 54.6%
Taylor expanded in x around inf
Applied rewrites50.9%
(FPCore (x) :precision binary64 x)
double code(double x) {
return x;
}
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(x)
use fmin_fmax_functions
real(8), intent (in) :: x
code = x
end function
public static double code(double x) {
return x;
}
def code(x): return x
function code(x) return x end
function tmp = code(x) tmp = x; end
code[x_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 54.6%
Taylor expanded in x around 0
Applied rewrites52.0%
herbie shell --seed 2025159
(FPCore (x)
:name "Jmat.Real.dawson"
:precision binary64
(* (/ (+ (+ (+ (+ (+ 1.0 (* 0.1049934947 (* x x))) (* 0.0424060604 (* (* x x) (* x x)))) (* 0.0072644182 (* (* (* x x) (* x x)) (* x x)))) (* 0.0005064034 (* (* (* (* x x) (* x x)) (* x x)) (* x x)))) (* 0.0001789971 (* (* (* (* (* x x) (* x x)) (* x x)) (* x x)) (* x x)))) (+ (+ (+ (+ (+ (+ 1.0 (* 0.7715471019 (* x x))) (* 0.2909738639 (* (* x x) (* x x)))) (* 0.0694555761 (* (* (* x x) (* x x)) (* x x)))) (* 0.0140005442 (* (* (* (* x x) (* x x)) (* x x)) (* x x)))) (* 0.0008327945 (* (* (* (* (* x x) (* x x)) (* x x)) (* x x)) (* x x)))) (* (* 2.0 0.0001789971) (* (* (* (* (* (* x x) (* x x)) (* x x)) (* x x)) (* x x)) (* x x))))) x))