math.functions: make it clear that 0 = is the more correct zero?.
							parent
							
								
									94ad1c236f
								
							
						
					
					
						commit
						ea25cde2af
					
				| 
						 | 
				
			
			@ -16,6 +16,8 @@ IN: math.complex.tests
 | 
			
		|||
[ f ] [ C{ 1.0 2.3 } C{ 1 2 } number= ] unit-test
 | 
			
		||||
 | 
			
		||||
[ C{ 2 5 } ] [ 2 5  rect> ] unit-test
 | 
			
		||||
{ 2 } [ 2 0  rect> ] unit-test
 | 
			
		||||
{ C{ 2 0.0 } } [ 2 0.0  rect> ] unit-test
 | 
			
		||||
[ 2 5 ] [ C{ 2 5 }  >rect ] unit-test
 | 
			
		||||
[ C{ 1/2 1 } ] [ 1/2 C{ 0 1 }  + ] unit-test
 | 
			
		||||
[ C{ 1/2 1 } ] [ C{ 0 1 } 1/2  + ] unit-test
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,6 +8,7 @@ IN: math.functions
 | 
			
		|||
    [ numerator ] [ denominator ] bi ; inline
 | 
			
		||||
 | 
			
		||||
: rect> ( x y -- z )
 | 
			
		||||
    ! Note: an imaginary 0.0 should still create a complex
 | 
			
		||||
    dup 0 = [ drop ] [ complex boa ] if ; inline
 | 
			
		||||
 | 
			
		||||
GENERIC: sqrt ( x -- y ) foldable
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue