6 people like it.

DivRem Operator

Defines the operator /% as DivRem for int, int64 and bigint.

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
namespace System.Numerics

[<AutoOpen>]
module DivRem =
    type DivRem = DivRem with
        static member (/%) (x : int32,  DivRem) = fun y -> System.Math.DivRem(x, y)
        static member (/%) (x : int64,  DivRem) = fun y -> System.Math.DivRem(x, y)
        static member (/%) (x : bigint, DivRem) = fun y -> BigInteger.DivRem(x, y)

    let inline (/%) x y = (x /% DivRem) y
namespace System
namespace System.Numerics
Multiple items
type AutoOpenAttribute =
  inherit Attribute
  new : unit -> AutoOpenAttribute
  new : path:string -> AutoOpenAttribute
  member Path : string

Full name: Microsoft.FSharp.Core.AutoOpenAttribute

--------------------
new : unit -> AutoOpenAttribute
new : path:string -> AutoOpenAttribute
Multiple items
union case DivRem.DivRem: DivRem

--------------------
module DivRem

from System.Numerics

--------------------
type DivRem =
  | DivRem
  static member ( /% ) : x:int32 * DivRem:DivRem -> (int -> int * int)
  static member ( /% ) : x:int64 * DivRem:DivRem -> (int64 -> int64 * int64)
  static member ( /% ) : x:bigint * DivRem:DivRem -> (BigInteger -> BigInteger * BigInteger)

Full name: System.Numerics.DivRem.DivRem
Multiple items
union case DivRem.DivRem: DivRem

--------------------
type DivRem =
  | DivRem
  static member ( /% ) : x:int32 * DivRem:DivRem -> (int -> int * int)
  static member ( /% ) : x:int64 * DivRem:DivRem -> (int64 -> int64 * int64)
  static member ( /% ) : x:bigint * DivRem:DivRem -> (BigInteger -> BigInteger * BigInteger)

Full name: System.Numerics.DivRem.DivRem
val x : int32
Multiple items
val int32 : value:'T -> int32 (requires member op_Explicit)

Full name: Microsoft.FSharp.Core.Operators.int32

--------------------
type int32 = Int32

Full name: Microsoft.FSharp.Core.int32
val y : int
type Math =
  static val PI : float
  static val E : float
  static member Abs : value:sbyte -> sbyte + 6 overloads
  static member Acos : d:float -> float
  static member Asin : d:float -> float
  static member Atan : d:float -> float
  static member Atan2 : y:float * x:float -> float
  static member BigMul : a:int * b:int -> int64
  static member Ceiling : d:decimal -> decimal + 1 overload
  static member Cos : d:float -> float
  ...

Full name: System.Math
Math.DivRem(a: int64, b: int64, result: byref<int64>) : int64
Math.DivRem(a: int, b: int, result: byref<int>) : int
val x : int64
Multiple items
val int64 : value:'T -> int64 (requires member op_Explicit)

Full name: Microsoft.FSharp.Core.Operators.int64

--------------------
type int64 = Int64

Full name: Microsoft.FSharp.Core.int64

--------------------
type int64<'Measure> = int64

Full name: Microsoft.FSharp.Core.int64<_>
val y : int64
val x : bigint
type bigint = BigInteger

Full name: Microsoft.FSharp.Core.bigint
val y : BigInteger
Multiple items
type BigInteger =
  struct
    new : value:int -> BigInteger + 7 overloads
    member CompareTo : other:int64 -> int + 3 overloads
    member Equals : obj:obj -> bool + 3 overloads
    member GetHashCode : unit -> int
    member IsEven : bool
    member IsOne : bool
    member IsPowerOfTwo : bool
    member IsZero : bool
    member Sign : int
    member ToByteArray : unit -> byte[]
    ...
  end

Full name: System.Numerics.BigInteger

--------------------
BigInteger()
BigInteger(value: int) : unit
BigInteger(value: uint32) : unit
BigInteger(value: int64) : unit
BigInteger(value: uint64) : unit
BigInteger(value: float32) : unit
BigInteger(value: float) : unit
BigInteger(value: decimal) : unit
BigInteger(value: byte []) : unit
BigInteger.DivRem(dividend: BigInteger, divisor: BigInteger, remainder: byref<BigInteger>) : BigInteger
val x : 'a (requires member ( /% ))
val y : 'b
Raw view Test code New version

More information

Link:http://fssnip.net/gH
Posted:11 years ago
Author:Diego Frata
Tags: operator , numeric , math , division , modulus , remainder