2010-04-28 18:48:47 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								USING: accessors alien.c-types alien.syntax math.floats.half kernel
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-18 18:26:20 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								math tools.test specialized-arrays alien.data classes.struct ;
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-09 23:33:34 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								SPECIALIZED-ARRAY: half
							 | 
						
					
						
							
								
									
										
										
										
											2010-04-28 18:48:47 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								IN: math.floats.half.tests
							 | 
						
					
						
							
								
									
										
										
										
											2009-06-10 14:06:06 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-23 21:49:33 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								[ 0x0000 ] [  0.0  half>bits ] unit-test
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ 0x8000 ] [ -0.0  half>bits ] unit-test
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ 0x3e00 ] [  1.5  half>bits ] unit-test
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ 0xbe00 ] [ -1.5  half>bits ] unit-test
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ 0x7c00 ] [  1/0. half>bits ] unit-test
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ 0xfc00 ] [ -1/0. half>bits ] unit-test
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ 0x7eaa ] [ NAN: aaaaaaaaaaaaa half>bits ] unit-test
							 | 
						
					
						
							
								
									
										
										
										
											2009-06-10 14:06:06 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								! too-big floats overflow to infinity
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-23 21:49:33 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								[ 0x7c00 ] [   65536.0 half>bits ] unit-test
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ 0xfc00 ] [  -65536.0 half>bits ] unit-test
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ 0x7c00 ] [  131072.0 half>bits ] unit-test
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ 0xfc00 ] [ -131072.0 half>bits ] unit-test
							 | 
						
					
						
							
								
									
										
										
										
											2009-06-10 14:06:06 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								! too-small floats flush to zero
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-23 21:49:33 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								[ 0x0000 ] [  1.0e-9 half>bits ] unit-test
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ 0x8000 ] [ -1.0e-9 half>bits ] unit-test
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[  0.0  ] [ 0x0000 bits>half ] unit-test
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ -0.0  ] [ 0x8000 bits>half ] unit-test
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[  1.5  ] [ 0x3e00 bits>half ] unit-test
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ -1.5  ] [ 0xbe00 bits>half ] unit-test
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[  1/0. ] [ 0x7c00 bits>half ] unit-test
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ -1/0. ] [ 0xfc00 bits>half ] unit-test
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[  3.0  ] [ 0x4200 bits>half ] unit-test
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[    t  ] [ 0x7e00 bits>half fp-nan? ] unit-test
							 | 
						
					
						
							
								
									
										
										
										
											2009-06-10 14:06:06 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-18 18:26:20 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								STRUCT: halves
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    { tom half }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    { dick half }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    { harry half }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    { harry-jr half } ;
							 | 
						
					
						
							
								
									
										
										
										
											2009-06-10 14:06:06 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-18 18:26:20 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ 8 ] [ halves heap-size ] unit-test
							 | 
						
					
						
							
								
									
										
										
										
											2009-06-10 14:06:06 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ 3.0 ] [
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-18 18:26:20 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    halves <struct>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        3.0 >>dick
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    dick>>
							 | 
						
					
						
							
								
									
										
										
										
											2009-06-10 14:06:06 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								] unit-test
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ half-array{ 1.0 2.0 3.0 1/0. -1/0. } ]
							 | 
						
					
						
							
								
									
										
										
										
											2011-09-25 14:49:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								[ { 1.0 2.0 3.0 1/0. -1/0. } half >c-array ] unit-test
							 | 
						
					
						
							
								
									
										
										
										
											2009-06-10 14:06:06 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 |