The other solution is to use F# math library. Because F# is also .NET language you can use it from other .NET languages e.g. C#. So what you need to start? What is necessary to install? F# downloads are available on Microsoft research pages. After you download F# libraries you need to install it and simply create new project in Visual Studio and the FSharp.Core.dll library as reference.
Example calculation of factorial using F# classes:
using System;
using Microsoft.FSharp.Math;
namespace BigNumberCSharp
{
public class TestFactorial
{
public void CalculateFactorial(int x)
{
BigInt factorial = BigIntModule.factorial(BigInt.FromInt32(x));
Console.WriteLine(factorial);
}
}
}
Here is the result for factorial of 100.
1 comment:
I created a class in C# that handles numbers with a floating point of arbitrary size. You may find the code interesting. You can find it on my blog.
Post a Comment