-
Notifications
You must be signed in to change notification settings - Fork 851
Closed
Labels
Description
(~~~) doesn't work on bigints for some reason, but System.Numerics.BigInteger has op_OnesComplement, which does what we want.
> ~~~(1I);;
~~~(1I);;
----^^
stdin(57,5): error FS0001: The type 'BigInteger' does not support the operator '~~~'
> BigInteger.op_OnesComplement 1I;;
val it : BigInteger = -2 {IsEven = true;
IsOne = false;
IsPowerOfTwo = false;
IsZero = false;
Sign = -1;}
> BigInteger.op_OnesComplement -2I;;
val it : BigInteger = 1 {IsEven = false;
IsOne = true;
IsPowerOfTwo = true;
IsZero = false;
Sign = 1;}
> BigInteger.op_OnesComplement 0I;;
val it : BigInteger = -1 {IsEven = false;
IsOne = false;
IsPowerOfTwo = false;
IsZero = false;
Sign = -1;}
> BigInteger.op_OnesComplement -1I;;
val it : BigInteger = 0 {IsEven = true;
IsOne = false;
IsPowerOfTwo = false;
IsZero = true;
Sign = 0;}
In fact, op_OnesComplement is the correct name for this operator--it seems F# mixed up op_OnesComplement and op_LogicalNot. See also I.10.3.1, "Unary operators", in the CLI standard.
Reactions are currently unavailable