mirror of
				https://github.com/eledio-devices/thirdparty-tinyexpr.git
				synced 2025-10-31 16:14:16 +01:00 
			
		
		
		
	add ncr and npr
This commit is contained in:
		
							
								
								
									
										41
									
								
								test.c
									
									
									
									
									
								
							
							
						
						
									
										41
									
								
								test.c
									
									
									
									
									
								
							| @@ -214,6 +214,12 @@ void test_nans() { | ||||
|         "1%(1%0)", | ||||
|         "(1%0)%1", | ||||
|         "fac(-1)", | ||||
|         "ncr(2, 4)", | ||||
|         "ncr(-2, 4)", | ||||
|         "ncr(2, -4)", | ||||
|         "npr(2, 4)", | ||||
|         "npr(-2, 4)", | ||||
|         "npr(2, -4)", | ||||
|     }; | ||||
|  | ||||
|     int i; | ||||
| @@ -242,6 +248,12 @@ void test_infs() { | ||||
|             "log(0)", | ||||
|             "pow(2,10000000)", | ||||
|             "fac(300)", | ||||
|             "ncr(300,100)", | ||||
|             "ncr(300000,100)", | ||||
|             "ncr(300000,100)*8", | ||||
|             "npr(3,2)*ncr(300000,100)", | ||||
|             "npr(100,90)", | ||||
|             "npr(30,25)", | ||||
|     }; | ||||
|  | ||||
|     int i; | ||||
| @@ -618,13 +630,28 @@ void test_pow() { | ||||
|  | ||||
| void test_combinatorics() { | ||||
|     test_case cases[] = { | ||||
|             {"fac(0) ", 1}, | ||||
|             {"fac(0.2) ", 1}, | ||||
|             {"fac(1) ", 1}, | ||||
|             {"fac(2) ", 2}, | ||||
|             {"fac(3) ", 6}, | ||||
|             {"fac(4.8) ", 24}, | ||||
|             {"fac(10) ", 3628800}, | ||||
|             {"fac(0)", 1}, | ||||
|             {"fac(0.2)", 1}, | ||||
|             {"fac(1)", 1}, | ||||
|             {"fac(2)", 2}, | ||||
|             {"fac(3)", 6}, | ||||
|             {"fac(4.8)", 24}, | ||||
|             {"fac(10)", 3628800}, | ||||
|  | ||||
|             {"ncr(0,0)", 1}, | ||||
|             {"ncr(10,1)", 10}, | ||||
|             {"ncr(10,0)", 1}, | ||||
|             {"ncr(10,10)", 1}, | ||||
|             {"ncr(16,7)", 11440}, | ||||
|             {"ncr(16,9)", 11440}, | ||||
|             {"ncr(100,95)", 75287520}, | ||||
|  | ||||
|             {"npr(0,0)", 1}, | ||||
|             {"npr(10,1)", 10}, | ||||
|             {"npr(10,0)", 1}, | ||||
|             {"npr(10,10)", 3628800}, | ||||
|             {"npr(20,5)", 1860480}, | ||||
|             {"npr(100,4)", 94109400}, | ||||
|     }; | ||||
|  | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user