source: src/tests/math1.c @ 41770ed1

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumwith_gc
Last change on this file since 41770ed1 was ef3403c6, checked in by Peter A. Buhr <pabuhr@…>, 6 years ago

reduce test time

  • Property mode set to 100644
File size: 2.1 KB
Line 
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// math1.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 : Thu May 24 21:01:15 2018
13// Update Count     : 85
14//
15
16#include <fstream>
17#include <math>
18
19int main( void ) {
20        float f;
21        double d;
22        long double l;
23
24        sout | "fmod:" | 5.0F % -2.0F | fmod( 5.0F, -2.0F ) | 5.0D % -2.0D | fmod( 5.0D, -2.0D ) | 5.0L % -2.0L | fmod( 5.0L, -2.0L ) | endl;
25        sout | "remainder:" | remainder( 2.0F, 3.0F ) | remainder( 2.0D, 3.0D ) | remainder( 2.0L, 3.0L ) | endl;
26        int quot;
27        f = remquo( 3.6F, 0.5F, &quot );
28        sout | "remquo:" | quot | f;
29        d = remquo( 3.6D, 0.5F, &quot );
30        sout | quot | d;
31        l = remquo( 3.6L, 0.5L, &quot );
32        sout | quot | l | endl;
33        sout | "div:" | div( 3.6F, 0.5F ) | div( 3.6D, 0.5D ) | div( 3.6L, 0.5L ) | endl;
34        sout | "fma:" | fma( 3.0F, -1.0F, 1.0F ) | fma( 3.0D, -1.0D, 1.0D ) | fma( 3.0L, -1.0L, , 1.0L ) | endl;
35        sout | "fdim:" | fdim( 1.0F, -1.0F ) | fdim( 1.0D, -1.0D ) | fdim( 1.0L, -1.0L ) | endl;
36        sout | "nan:" | (float)nan( "" ) | (double)nan( "" ) | (long double)nan( "" ) | endl;
37
38        //---------------------- Exponential ----------------------
39
40        sout | "exp:" | exp( 1.0F ) | exp( 1.0D ) | exp( 1.0L ) | exp( 1.0F+1.0FI ) | exp( 1.0D+1.0DI ) | exp( 1.0DL+1.0LI ) | endl;
41        sout | "exp2:" | exp2( 1.0F ) | exp2( 1.0D ) | exp2( 1.0L ) | endl;
42        sout | "expm1:" | expm1( 1.0F ) | expm1( 1.0D ) | expm1( 1.0L ) | endl;
43        sout | "pow:" | pow( 1.0F, 1.0F ) | pow( 1.0D, 1.0D ) | pow( 1.0L, 1.0L ) | pow( 1.0F+1.0FI, 1.0F+1.0FI ) | pow( 1.0D+1.0DI, 1.0D+1.0DI ) | pow( 1.0DL+1.0LI, 1.0DL+1.0LI ) | endl;
44
45        int b = 4;
46        unsigned int e = 2;
47    b \= e;
48    sout | "\\" | b | b \ e | endl;
49    sout | "\\" | 'a' \ 3u | 2 \ 8u | 4 \ 3u | -4 \ 3u | 4 \ -3 | -4 \ -3 | 4.0 \ 2.1 | (1.0f+2.0fi) \ (3.0f+2.0fi) | endl;
50} // main
51
52// Local Variables: //
53// tab-width: 4 //
54// compile-command: "cfa math1.c" //
55// End: //
Note: See TracBrowser for help on using the repository browser.