|
|
1.1 ! root 1: ! 2: ! 3: acos() Mathematics Function acos() ! 4: ! 5: ! 6: ! 7: ! 8: Calculate inverse cosine ! 9: ! 10: #include <math.h> ! 11: ddoouubbllee aaccooss(_a_r_g) ddoouubbllee _a_r_g; ! 12: ! 13: acos calculates the inverse cosine. arg should be in the range ! 14: of -1.0, 1.0. It returns the result, which is in the range of ! 15: from zero to P radians. ! 16: ! 17: ***** Example ***** ! 18: ! 19: This example demonstrates the mathematics functions acos, asin, ! 20: atan, atan2, cabs, cos, hypot, sin, and tan. ! 21: ! 22: ! 23: #include <math.h> ! 24: #define display(x) dodisplay((double)(x), #x) ! 25: ! 26: ! 27: ! 28: dodisplay(value, name) ! 29: double value; char *name; ! 30: ! 31: ! 32: ! 33: { ! 34: if (errno) ! 35: perror(name); ! 36: else ! 37: printf("%10g %s\n", value, name); ! 38: errno = 0; ! 39: } ! 40: ! 41: ! 42: ! 43: main() ! 44: { ! 45: extern char *gets(); ! 46: double x; ! 47: char string[64]; ! 48: ! 49: ! 50: ! 51: for(;;) { ! 52: printf("Enter number: "); ! 53: if(gets(string) == NULL) ! 54: break; ! 55: ! 56: ! 57: ! 58: ! 59: ! 60: ! 61: ! 62: ! 63: ! 64: COHERENT Lexicon Page 1 ! 65: ! 66: ! 67: ! 68: ! 69: acos() Mathematics Function acos() ! 70: ! 71: ! 72: ! 73: x = atof(string); ! 74: display(x); ! 75: display(cos(x)); ! 76: display(sin(x)); ! 77: display(tan(x)); ! 78: display(acos(cos(x))); ! 79: ! 80: ! 81: ! 82: display(asin(sin(x))); ! 83: display(atan(tan(x))); ! 84: display(atan2(sin(x),cos(x))); ! 85: display(hypot(sin(x),cos(x))); ! 86: display(cabs(sin(x),cos(x))); ! 87: } ! 88: } ! 89: ! 90: ! 91: ***** See Also ***** ! 92: ! 93: errno, errno.h, mathematics library, perror() ! 94: ! 95: ! 96: ! 97: ! 98: ! 99: ! 100: ! 101: ! 102: ! 103: ! 104: ! 105: ! 106: ! 107: ! 108: ! 109: ! 110: ! 111: ! 112: ! 113: ! 114: ! 115: ! 116: ! 117: ! 118: ! 119: ! 120: ! 121: ! 122: ! 123: ! 124: ! 125: ! 126: ! 127: ! 128: ! 129: ! 130: COHERENT Lexicon Page 2 ! 131: ! 132:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.