Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend custom numeric types to support floating point literals #445

Open
cloudRoutine opened this issue Oct 12, 2016 · 0 comments
Open

Extend custom numeric types to support floating point literals #445

cloudRoutine opened this issue Oct 12, 2016 · 0 comments
Labels

Comments

@cloudRoutine
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant