You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Idea 8140617: Extend custom numeric types to support floating point literals
Status : planned Submitted by Phillip Trelford on 5/27/2015 12:00:00 AM 13 votes
Currently you can define custom numeric types for integer values.
It would be nice to be able to handle floating point values too, e.g.
type complex = Complex of double * double
type imaginery = Imaginery of double
with
static member (+) (lhs:double,Imaginery(rhs)) = Complex(lhs,rhs)
module NumericLiteralI =
let FromZero () = Imaginery 0.0
let FromOne () = Imaginery 1.0
let FromInt32 (x) = Imaginery (double x)
let FromInt64 (x:int64) = Imaginery (double x)
let FromDouble (x:float) = Imaginery x // extension
let polar = 1.5 + 2.5I
Idea 8140617: Extend custom numeric types to support floating point literals
Status : planned
Submitted by Phillip Trelford on 5/27/2015 12:00:00 AM
13 votes
Currently you can define custom numeric types for integer values.
It would be nice to be able to handle floating point values too, e.g.
type complex = Complex of double * double
type imaginery = Imaginery of double
with
static member (+) (lhs:double,Imaginery(rhs)) = Complex(lhs,rhs)
module NumericLiteralI =
let FromZero () = Imaginery 0.0
let FromOne () = Imaginery 1.0
let FromInt32 (x) = Imaginery (double x)
let FromInt64 (x:int64) = Imaginery (double x)
let FromDouble (x:float) = Imaginery x // extension
let polar = 1.5 + 2.5I
Response
** by fslang-admin on 3/4/2016 12:00:00 AM **
Now marking as planned, which means we can move to an RFC https://github.com/fsharp/FSharpLangDesign/tree/master/RFCs
The details remain to be worked out however
Don Syme
F# Language Evolution
Archived Uservoice Comments
The text was updated successfully, but these errors were encountered: