-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Open
Labels
designDesign of APIs or of the language itselfDesign of APIs or of the language itselfdocsThis change adds or pertains to documentationThis change adds or pertains to documentationmathsMathematical functionsMathematical functions
Description
I think it would be good to document what methods needs to be defined for a type to behave as a Number.
Last time I had to do this it took me quite some try and error to get the methods.
I ended up with the following
+,-,*,/3 each ( (T,T), (T,Any), (Any,T) )==,hash,<promote_rule,convertrem,signed,typemaxshow, Constructor
That works in my usecase, but I am still unsure if this is "correct" or it its lacking something.
If I got it right, a Number is something that can be used in basic arithmetic, can be compared, and needs some basic rules to be usable in julia.
Maybe Number is too broad and it would need to be further devided.
Metadata
Metadata
Assignees
Labels
designDesign of APIs or of the language itselfDesign of APIs or of the language itselfdocsThis change adds or pertains to documentationThis change adds or pertains to documentationmathsMathematical functionsMathematical functions