Implicit type conversion: Difference between revisions
m
→{{header|Oforth}}
m (→{{header|REXX}}: reformatted the comment box.) |
|||
Line 516:
<lang Oforth>100 Number Class newPriority: Complex(re, im)
Complex method: re
Complex method: im
Complex method: initialize
Complex method: <<
Integer method: asComplex
Float method: asComplex
Complex new(0, 1) Constant new: I
Complex method: ==(c)
Complex method: norm
Complex method: conj
Complex method: +(c)
Complex method: -(c)
Complex method: *(c)
Complex method: inv
| n |
@re sq @im sq + asFloat ->n
Complex new(@re n /, @im neg n / ) ;
Complex method: /(c)
Usage :
|