LanguagePrimitives.DivideByInt<^T> Function (F#)
Divides a value by an integer.
Namespace/Module Path: Microsoft.FSharp.Core.LanguagePrimitives
Assembly: FSharp.Core (in FSharp.Core.dll)
// Signature: DivideByInt : ^T -> int -> ^T (requires ^T with static member DivideByInt) // Usage: DivideByInt x y
If a type supports DivideByInt, the type supports exact division (floating-point division), rather than integer division, which rounds down to the nearest integer result.
Functions like Seq.average work only if the element type supports exact division. If you try to use Seq.average with an integer sequence, you get an error that indicates that the element type must implement DivideByInt. Typically, you can resolve this error by using Seq.averageBy and adding a cast to a floating-point value. The following code shows how to use Seq.averageBy with an integer sequence.