Return to asin_basic.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / math |
1.1 misho 1: --TEST-- 2: Test return type and value for expected input asin() 3: --INI-- 4: precision = 14 5: --FILE-- 6: <?php 7: /* 8: * proto float asin(float number) 9: * Function is implemented in ext/standard/math.c 10: */ 11: 12: $file_path = dirname(__FILE__); 13: require($file_path."/allowed_rounding_error.inc"); 14: 15: 16: //output is in degrees 17: 18: echo "asin .5 = "; 19: $asinv1 = 360.0 * asin(0.5) / (2.0 * M_PI ); 20: var_dump($asinv1); 21: if (allowed_rounding_error($asinv1 ,30 )) { 22: echo "Pass\n"; 23: } 24: else { 25: echo "Fail\n"; 26: } 27: 28: echo "asin 0.86602540378444 = "; 29: $asinv2 = 360.0 * asin(0.86602540378444) / (2.0 * M_PI ); 30: var_dump($asinv2); 31: if (allowed_rounding_error($asinv2 ,60 )) { 32: echo "Pass\n"; 33: } 34: else { 35: echo "Fail\n"; 36: } 37: 38: echo "asin 1.0 = "; 39: $asinv3 = 360.0 * asin(1.0) / (2.0 * M_PI ); 40: var_dump($asinv3); 41: if (allowed_rounding_error($asinv3 ,90 )) { 42: echo "Pass\n"; 43: } 44: else { 45: echo "Fail\n"; 46: } 47: 48: 49: echo "asin 0.0 = "; 50: $asinv4 = 360.0 * asin(0.0) / (2.0 * M_PI ); 51: var_dump($asinv4); 52: if (allowed_rounding_error($asinv4 ,0 )) { 53: echo "Pass\n"; 54: } 55: else { 56: echo "Fail\n"; 57: } 58: 59: ?> 60: --EXPECTF-- 61: asin .5 = float(%f) 62: Pass 63: asin 0.86602540378444 = float(%f) 64: Pass 65: asin 1.0 = float(%f) 66: Pass 67: asin 0.0 = float(%f) 68: Pass