Complex.st
branchjv
changeset 21242 19fabe339f8b
parent 21024 8734987eb5c7
parent 21110 fe4d99579623
equal deleted inserted replaced
21092:6dc23c67620f 21242:19fabe339f8b
   446     i = 0 ifTrue:[ ^ r ].
   446     i = 0 ifTrue:[ ^ r ].
   447     ^ self class real:r imaginary:i.
   447     ^ self class real:r imaginary:i.
   448 !
   448 !
   449 
   449 
   450 differenceFromFixedPoint: aFixedPoint
   450 differenceFromFixedPoint: aFixedPoint
       
   451     "Return the difference of the argument, aFixedPoint and the receiver."
       
   452 
   451     ^ aFixedPoint asComplex - self
   453     ^ aFixedPoint asComplex - self
   452 !
   454 !
   453 
   455 
   454 differenceFromFloat:aFloat
   456 differenceFromFloat:aFloat
   455     "Return the difference of the argument, aFloat and the receiver."
   457     "Return the difference of the argument, aFloat and the receiver."
   467      1.0 - (1 % 1)
   469      1.0 - (1 % 1)
   468     "
   470     "
   469 !
   471 !
   470 
   472 
   471 differenceFromFraction: aFraction
   473 differenceFromFraction: aFraction
       
   474     "Return the difference of the argument, aFraction and the receiver."
       
   475 
   472     ^ aFraction asComplex - self
   476     ^ aFraction asComplex - self
   473 !
   477 !
   474 
   478 
   475 differenceFromInteger: anInteger
   479 differenceFromInteger: anInteger
       
   480     "Return the difference of the argument, anInteger and the receiver."
       
   481 
   476     ^ anInteger asComplex - self
   482     ^ anInteger asComplex - self
   477 !
   483 !
   478 
   484 
   479 equalFromComplex:aComplex
   485 equalFromComplex:aComplex
   480     ^ (aComplex real = real) and:[aComplex imaginary = imaginary]
   486     ^ (aComplex real = real) and:[aComplex imaginary = imaginary]
   497     i = 0 ifTrue:[ ^ r ].
   503     i = 0 ifTrue:[ ^ r ].
   498     ^ self class real:r imaginary:i
   504     ^ self class real:r imaginary:i
   499 !
   505 !
   500 
   506 
   501 productFromFixedPoint: aFixedPoint
   507 productFromFixedPoint: aFixedPoint
       
   508     "Return the product of the receiver and the argument, aFixedPoint."
       
   509 
   502     ^ aFixedPoint asComplex * self
   510     ^ aFixedPoint asComplex * self
   503 !
   511 !
   504 
   512 
   505 productFromFloat: aFloat
   513 productFromFloat: aFloat
   506     "Return the product of the receiver and the argument, aFloat."
   514     "Return the product of the receiver and the argument, aFloat."
   521      2.0 * (1 % 1)
   529      2.0 * (1 % 1)
   522     "
   530     "
   523 !
   531 !
   524 
   532 
   525 productFromFraction: aFraction
   533 productFromFraction: aFraction
       
   534     "Return the product of the receiver and the argument, aFraction."
       
   535 
   526     ^ aFraction asComplex * self
   536     ^ aFraction asComplex * self
   527 !
   537 !
   528 
   538 
   529 productFromInteger: anInteger
   539 productFromInteger: anInteger
       
   540     "Return the product of the receiver and the argument, anInteger."
       
   541 
   530     ^ anInteger asComplex * self
   542     ^ anInteger asComplex * self
   531 !
   543 !
   532 
   544 
   533 quotientFromComplex:aComplex
   545 quotientFromComplex:aComplex
   534     "Return the quotient of the argument, aComplex and the receiver."
   546     "Return the quotient of the argument, aComplex and the receiver."
   599     i = 0 ifTrue:[ ^ r ].
   611     i = 0 ifTrue:[ ^ r ].
   600     ^ self class real:r imaginary:i
   612     ^ self class real:r imaginary:i
   601 !
   613 !
   602 
   614 
   603 sumFromFixedPoint: aFixedPoint
   615 sumFromFixedPoint: aFixedPoint
       
   616     "Return the sum of the receiver and the argument, aFixedPoint."
       
   617 
   604     ^ aFixedPoint asComplex + self
   618     ^ aFixedPoint asComplex + self
   605 !
   619 !
   606 
   620 
   607 sumFromFloat: aFloat
   621 sumFromFloat: aFloat
   608     "Return the sum of the receiver and the argument, aFloat."
   622     "Return the sum of the receiver and the argument, aFloat."
   620      1.0 + (1 % 1)
   634      1.0 + (1 % 1)
   621     "
   635     "
   622 !
   636 !
   623 
   637 
   624 sumFromFraction: aFraction
   638 sumFromFraction: aFraction
       
   639     "Return the sum of the receiver and the argument, aFraction."
       
   640 
   625     ^ aFraction asComplex + self
   641     ^ aFraction asComplex + self
   626 !
   642 !
   627 
   643 
   628 sumFromInteger: anInteger
   644 sumFromInteger: anInteger
       
   645     "Return the sum of the receiver and the argument, anInteger."
       
   646 
   629     ^ anInteger asComplex + self
   647     ^ anInteger asComplex + self
   630 ! !
   648 ! !
   631 
   649 
   632 !Complex methodsFor:'mathematical functions'!
   650 !Complex methodsFor:'mathematical functions'!
   633 
   651