You are right that there is some inconsistency in whether it is possible to convert BigInteger using the decimal function or not. It seems to depend on the version of .NET you are compiling for. If you use the F # (or F # interactive) compiler from Visual Studio 2010, then .NET 4.0 is used by default. For this purpose compilation works fine:
C:\Temp>"C:\Program Files (x86)\Microsoft F#\v4.0\Fsc.exe" test.fs Microsoft (R) F# 3.0 Compiler build 2.0.0.0 Copyright (c) Microsoft Corporation. All Rights Reserved.
You can change the target structure by explicitly specifying .NET 2.0 version of mscorlib.dll and FSharp.Core.dll . The compiler then reports the error you described:
C:\Temp>"C:\Program Files (x86)\Microsoft F#\v4.0\Fsc.exe" test.fs --noframework -r:C:\Program Files (x86)\FSharp-2.0.0.0\bin\FSharp.Core.dll -r:C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll Microsoft (R) F
If you get an error compiling the project, your project is probably configured to compile for .NET 2.0.
Tomas petricek
source share