source: tests/math1.cfa @ ac1ae2c

aaron-thesisarm-ehcleanup-dtorsdeferred_resnjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprno_listpersistent-indexer
Last change on this file since ac1ae2c was ac1ae2c, checked in by Peter A. Buhr <pabuhr@…>, 3 years ago

speed up longest test cases by subdividing long sout chains

  • 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.cfa --
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 : Wed Dec 12 16:28:49 2018
13// Update Count     : 89
14//
15
16#include <fstream.hfa>
17#include <math.hfa>
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 | nonl;
25        sout | fmod( 5.0D, -2.0D ) | 5.0L % -2.0L | fmod( 5.0L, -2.0L );
26        sout | "remainder:" | remainder( 2.0F, 3.0F ) | remainder( 2.0D, 3.0D ) | remainder( 2.0L, 3.0L );
27        int quot;
28        f = remquo( 3.6F, 0.5F, &quot );
29        sout | "remquo:" | quot | f | nonl;
30        d = remquo( 3.6D, 0.5F, &quot );
31        sout | quot | d | nonl;
32        l = remquo( 3.6L, 0.5L, &quot );
33        sout | quot | l;
34        sout | "div:" | div( 3.6F, 0.5F ) | div( 3.6D, 0.5D ) | div( 3.6L, 0.5L );
35        sout | "fma:" | fma( 3.0F, -1.0F, 1.0F ) | fma( 3.0D, -1.0D, 1.0D ) | fma( 3.0L, -1.0L, , 1.0L );
36        sout | "fdim:" | fdim( 1.0F, -1.0F ) | fdim( 1.0D, -1.0D ) | fdim( 1.0L, -1.0L );
37        sout | "nan:" | (float)nan( "" ) | (double)nan( "" ) | (long double)nan( "" );
38
39        //---------------------- Exponential ----------------------
40
41        sout | "exp:" | exp( 1.0F ) | exp( 1.0D ) | exp( 1.0L ) | nonl;
42        sout | exp( 1.0F+1.0FI ) | exp( 1.0D+1.0DI ) | exp( 1.0DL+1.0LI );
43        sout | "exp2:" | exp2( 1.0F ) | exp2( 1.0D ) | exp2( 1.0L );
44        sout | "expm1:" | expm1( 1.0F ) | expm1( 1.0D ) | expm1( 1.0L );
45        sout | "pow:" | pow( 1.0F, 1.0F ) | pow( 1.0D, 1.0D ) | pow( 1.0L, 1.0L ) | nonl;
46        sout | pow( 1.0F+1.0FI, 1.0F+1.0FI ) | pow( 1.0D+1.0DI, 1.0D+1.0DI ) | pow( 1.5DL+1.5LI, 1.5DL+1.5LI );
47
48        int b = 4;
49        unsigned int e = 2;
50    b \= e;
51    sout | "\\" | b | b \ e;
52    sout | "\\" | 'a' \ 3u | 2 \ 8u | 4 \ 3u | -4 \ 3u | nonl;
53        sout | 4 \ -3 | -4 \ -3 | 4.0 \ 2.1 | (1.0f+2.0fi) \ (3.0f+2.0fi);
54} // main
55
56// Local Variables: //
57// tab-width: 4 //
58// compile-command: "cfa math1.cfa" //
59// End: //
Note: See TracBrowser for help on using the repository browser.