Is there a replacement for Pow in BigInteger in F #?

I used the Pow function from the BigInteger class in F # when my compiler told me:

This design is outdated. This member has been removed to type binary compatible with type .NET 4.0. System.Numerics.BigInteger

I am quite satisfied, but did not immediately find a replacement.

Is he there? Should we use only Pow's own functions? And (how) will it be replaced in NET4.0?

+6
f # biginteger pow
source share
2 answers

You can use the pown function

let result = pown 42I 42

works with any type that understands multiplication and one.

+13
source share

If you look at F # in terms of what is based on OCaml, then the OCaml Num module has power_num. Since the OCaml num type is arbitrary precision rational numbers, they can handle any number of numbers, for example. they are not limited to the processor register, since they can symbolically do math. Also, since num is defined as

type num =
| Int int int | Big_int from Big_int.big_int
| Ratio Ratio.ratio

they can handle very small numbers without losing accuracy due to the Ratio type.

Since F # is not of type num, Jack created FSharp.Compatibility.OCaml , which has num.fs and is accessible through NuGet.

Thus, you can get all the necessary accuracy using this function, and num functions can handle negative indicators.

+2
source share

All Articles