[0a5b683] | 1 | //
|
---|
| 2 | // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
|
---|
| 3 | //
|
---|
| 4 | // The contents of this file are covered under the licence agreement in the
|
---|
| 5 | // file "LICENCE" distributed with Cforall.
|
---|
| 6 | //
|
---|
| 7 | // math2.c --
|
---|
| 8 | //
|
---|
| 9 | // Author : Peter A. Buhr
|
---|
| 10 | // Created On : Fri Apr 22 14:59:21 2016
|
---|
| 11 | // Last Modified By : Peter A. Buhr
|
---|
| 12 | // Last Modified On : Fri Aug 11 15:40:04 2017
|
---|
| 13 | // Update Count : 81
|
---|
| 14 | //
|
---|
| 15 |
|
---|
| 16 | #include <fstream>
|
---|
| 17 | #include <math>
|
---|
| 18 |
|
---|
| 19 | int main( void ) {
|
---|
| 20 | float f;
|
---|
| 21 | double d;
|
---|
| 22 | long double l;
|
---|
| 23 |
|
---|
| 24 | //---------------------- Trigonometric ----------------------
|
---|
| 25 |
|
---|
| 26 | sout | "sin:" | sin( 1.0F ) | sin( 1.0D ) | sin( 1.0L ) | sin( 1.0F+1.0FI ) | sin( 1.0D+1.0DI ) | sin( 1.0DL+1.0LI ) | endl;
|
---|
| 27 | sout | "cos:" | cos( 1.0F ) | cos( 1.0D ) | cos( 1.0L ) | cos( 1.0F+1.0FI ) | cos( 1.0D+1.0DI ) | cos( 1.0DL+1.0LI ) | endl;
|
---|
| 28 | sout | "tan:" | tan( 1.0F ) | tan( 1.0D ) | tan( 1.0L ) | tan( 1.0F+1.0FI ) | tan( 1.0D+1.0DI ) | tan( 1.0DL+1.0LI ) | endl;
|
---|
| 29 | sout | "asin:" | asin( 1.0F ) | asin( 1.0D ) | asin( 1.0L ) | asin( 1.0F+1.0FI ) | asin( 1.0D+1.0DI ) | asin( 1.0DL+1.0LI ) | endl;
|
---|
| 30 | sout | "acos:" | acos( 1.0F ) | acos( 1.0D ) | acos( 1.0L ) | acos( 1.0F+1.0FI ) | acos( 1.0D+1.0DI ) | acos( 1.0DL+1.0LI ) | endl;
|
---|
| 31 | sout | "atan:" | atan( 1.0F ) | atan( 1.0D ) | atan( 1.0L ) | atan( 1.0F+1.0FI ) | atan( 1.0D+1.0DI ) | atan( 1.0DL+1.0LI ) | endl;
|
---|
| 32 | sout | "atan2:" | atan2( 1.0F, 1.0F ) | atan2( 1.0D, 1.0D ) | atan2( 1.0L, 1.0L );
|
---|
| 33 | sout | "atan:" | atan( 1.0F, 1.0F ) | atan( 1.0D, 1.0D ) | atan( 1.0L, 1.0L ) | endl;
|
---|
| 34 |
|
---|
| 35 | //---------------------- Hyperbolic ----------------------
|
---|
| 36 |
|
---|
| 37 | sout | "sinh:" | sinh( 1.0F ) | sinh( 1.0D ) | sinh( 1.0L ) | sinh( 1.0F+1.0FI ) | sinh( 1.0D+1.0DI ) | sinh( 1.0DL+1.0LI ) | endl;
|
---|
| 38 | sout | "cosh:" | cosh( 1.0F ) | cosh( 1.0D ) | cosh( 1.0L ) | cosh( 1.0F+1.0FI ) | cosh( 1.0D+1.0DI ) | cosh( 1.0DL+1.0LI ) | endl;
|
---|
| 39 | sout | "tanh:" | tanh( 1.0F ) | tanh( 1.0D ) | tanh( 1.0L ) | tanh( 1.0F+1.0FI ) | tanh( 1.0D+1.0DI ) | tanh( 1.0DL+1.0LI ) | endl;
|
---|
| 40 | sout | "acosh:" | acosh( 1.0F ) | acosh( 1.0D ) | acosh( 1.0L ) | acosh( 1.0F+1.0FI ) | acosh( 1.0D+1.0DI ) | acosh( 1.0DL+1.0LI ) | endl;
|
---|
| 41 | sout | "asinh:" | asinh( 1.0F ) | asinh( 1.0D ) | asinh( 1.0L ) | asinh( 1.0F+1.0FI ) | asinh( 1.0D+1.0DI ) | asinh( 1.0DL+1.0LI ) | endl;
|
---|
| 42 | sout | "atanh:" | atanh( 1.0F ) | atanh( 1.0D ) | atanh( 1.0L ) | atanh( 1.0F+1.0FI ) | atanh( 1.0D+1.0DI ) | atanh( 1.0DL+1.0LI ) | endl;
|
---|
| 43 |
|
---|
| 44 | //---------------------- Error / Gamma ----------------------
|
---|
| 45 |
|
---|
| 46 | sout | "erf:" | erf( 1.0F ) | erf( 1.0D ) | erf( 1.0L ) | endl;
|
---|
| 47 | sout | "erfc:" | erfc( 1.0F ) | erfc( 1.0D ) | erfc( 1.0L ) | endl;
|
---|
| 48 | sout | "lgamma:" | lgamma( 4.0F ) | lgamma( 4.0D ) | lgamma( 4.0L ) | endl;
|
---|
| 49 | int sign;
|
---|
| 50 | f = lgamma( 4.0F, &sign );
|
---|
| 51 | sout | "lgamma:" | f | sign;
|
---|
| 52 | d = lgamma( 4.0D, &sign );
|
---|
| 53 | sout | d | sign;
|
---|
| 54 | l = lgamma( 4.0L, &sign );
|
---|
| 55 | sout | l | sign | endl;
|
---|
| 56 | sout | "tgamma:" | tgamma( 4.0F ) | tgamma( 4.0D ) | tgamma( 4.0L ) | endl;
|
---|
| 57 | } // main
|
---|
| 58 |
|
---|
| 59 | // Local Variables: //
|
---|
| 60 | // tab-width: 4 //
|
---|
| 61 | // compile-command: "cfa math2.c" //
|
---|
| 62 | // End: //
|
---|