fix a normalization bug in decimals
							parent
							
								
									32adb5df27
								
							
						
					
					
						commit
						c681039c77
					
				| 
						 | 
				
			
			@ -49,3 +49,4 @@ ERROR: decimal-test-failure D1 D2 quot ;
 | 
			
		|||
[ f ] [ D: -1 D: -2 before? ] unit-test
 | 
			
		||||
[ f ] [ D: -2 D: -2 before? ] unit-test
 | 
			
		||||
[ t ] [ D: -3 D: -2 before? ] unit-test
 | 
			
		||||
[ t ] [ D: .5 D: 0 D: 1.0 between? ] unit-test
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -37,8 +37,7 @@ SYNTAX: D: parse-decimal parsed ;
 | 
			
		|||
    ] 2bi ;
 | 
			
		||||
 | 
			
		||||
: scale-decimals ( D1 D2 -- D1' D2' )
 | 
			
		||||
    [ drop ]
 | 
			
		||||
    [ scale-mantissas <decimal> nip ] 2bi ;
 | 
			
		||||
    scale-mantissas tuck [ <decimal> ] 2dip <decimal> ;
 | 
			
		||||
 | 
			
		||||
ERROR: decimal-types-expected d1 d2 ;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -83,3 +82,6 @@ M: decimal before?
 | 
			
		|||
    
 | 
			
		||||
    e1
 | 
			
		||||
    e2 a + - <decimal> ;
 | 
			
		||||
 | 
			
		||||
M: decimal <=>
 | 
			
		||||
    2dup before? [ 2drop +lt+ ] [ equal? +eq+ +gt+ ? ] if ; inline
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue