source: tests/io/manipulatorsOutput4.cfa @ 59627b3

Last change on this file since 59627b3 was 2bf46a5, checked in by Peter A. Buhr <pabuhr@…>, 13 months ago

add additional test for engineering and unit manipulator output

  • Property mode set to 100644
File size: 3.6 KB
Line 
1//
2// Cforall Version 1.0.0 Copyright (C) 2019 University of Waterloo
3//
4// manipulatorsOutput4.cfa --
5//
6// Author           : Peter A. Buhr
7// Created On       : Tue Apr 13 17:55:02 2021
8// Last Modified By : Peter A. Buhr
9// Last Modified On : Tue Oct 17 08:37:42 2023
10// Update Count     : 5
11//
12
13#include <fstream.hfa>
14
15int main() {
16        for ( double w = 1e-27; w < 1e30; w *= 10 ) {
17                sout | w | eng(w) | sign(eng(w)) | ws(12,5, eng(w) ) | sign(ws(12,5, eng(w) )) | wd(12,5, eng(w) ) | sign(wd(12,5, eng(w) )) | pad0(ws(12,5, eng(w) )) | pad0(sign(ws(12,5, eng(w) ))) | pad0(wd(12,5, eng(w) )) | pad0(sign(wd(12,5, eng(w) )))
18                         | left(ws(12,5, eng(w) )) | left(sign(ws(12,5, eng(w) ))) | left(wd(12,5, eng(w) )) | left(sign(wd(12,5, eng(w) ))) | left(pad0(ws(12,5, eng(w) ))) | left(pad0(sign(ws(12,5, eng(w) )))) | left(pad0(wd(12,5, eng(w) ))) | left(pad0(sign(wd(12,5, eng(w) ))));
19        } // for
20        sout | nl;
21
22        for ( double w = 1e-27; w < 1e30; w *= 42 ) {
23                sout | w | eng(w) | sign(eng(w)) | ws(12,5, eng(w) ) | sign(ws(12,5, eng(w) )) | wd(12,5, eng(w) ) | sign(wd(12,5, eng(w) )) | pad0(ws(12,5, eng(w) )) | pad0(sign(ws(12,5, eng(w) ))) | pad0(wd(12,5, eng(w) )) | pad0(sign(wd(12,5, eng(w) )))
24                         | left(ws(12,5, eng(w) )) | left(sign(ws(12,5, eng(w) ))) | left(wd(12,5, eng(w) )) | left(sign(wd(12,5, eng(w) ))) | left(pad0(ws(12,5, eng(w) ))) | left(pad0(sign(ws(12,5, eng(w) )))) | left(pad0(wd(12,5, eng(w) ))) | left(pad0(sign(wd(12,5, eng(w) ))));
25        } // for
26        sout | nl;
27
28        for ( double w = 1e-27; w < 1e30; w *= 10 ) {
29                sout | w | unit(eng(w)) | unit(sign(eng(w))) | unit(ws(12,5, eng(w) )) | unit(sign(ws(12,5, eng(w) ))) | unit(wd(12,5, eng(w) )) | unit(sign(wd(12,5, eng(w) ))) | unit(pad0(ws(12,5, eng(w) ))) | unit(pad0(sign(ws(12,5, eng(w) )))) | unit(pad0(wd(12,5, eng(w) ))) | unit(pad0(sign(wd(12,5, eng(w) ))))
30                        | unit(left(ws(12,5, eng(w) ))) | unit(left(sign(ws(12,5, eng(w) )))) | unit(left(wd(12,5, eng(w) ))) | unit(left(sign(wd(12,5, eng(w) )))) | unit(left(pad0(ws(12,5, eng(w) )))) | unit(left(pad0(sign(ws(12,5, eng(w) ))))) | unit(left(pad0(wd(12,5, eng(w) )))) | unit(left(pad0(sign(wd(12,5, eng(w) )))));
31        } // for
32        sout | nl;
33
34        for ( double w = 1e-27; w < 1e30; w *= 42 ) {
35                sout | w | unit(eng(w)) | unit(sign(eng(w))) | unit(ws(12,5, eng(w) )) | unit(sign(ws(12,5, eng(w) ))) | unit(wd(12,5, eng(w) )) | unit(sign(wd(12,5, eng(w) ))) | unit(pad0(ws(12,5, eng(w) ))) | unit(pad0(sign(ws(12,5, eng(w) )))) | unit(pad0(wd(12,5, eng(w) ))) | unit(pad0(sign(wd(12,5, eng(w) ))))
36                        | unit(left(ws(12,5, eng(w) ))) | unit(left(sign(ws(12,5, eng(w) )))) | unit(left(wd(12,5, eng(w) ))) | unit(left(sign(wd(12,5, eng(w) )))) | unit(left(pad0(ws(12,5, eng(w) )))) | unit(left(pad0(sign(ws(12,5, eng(w) ))))) | unit(left(pad0(wd(12,5, eng(w) )))) | unit(left(pad0(sign(wd(12,5, eng(w) )))));
37        } // for
38        sout | nl;
39
40        for ( double w = -1e-27; w > -1e30; w *= 42 ) {
41                sout | w | eng(w) | sign(eng(w)) | ws(12,5, eng(w) ) | sign(ws(12,5, eng(w) )) | wd(12,5, eng(w) ) | sign(wd(12,5, eng(w) )) | pad0(ws(12,5, eng(w) )) | pad0(sign(ws(12,5, eng(w) ))) | pad0(wd(12,5, eng(w) )) | pad0(sign(wd(12,5, eng(w) )))
42                         | left(ws(12,5, eng(w) )) | left(sign(ws(12,5, eng(w) ))) | left(wd(12,5, eng(w) )) | left(sign(wd(12,5, eng(w) ))) | left(pad0(ws(12,5, eng(w) ))) | left(pad0(sign(ws(12,5, eng(w) )))) | left(pad0(wd(12,5, eng(w) ))) | left(pad0(sign(wd(12,5, eng(w) ))));
43        } // for
44
45        for ( exp; sizeof(int) * 8 ) {
46                size_t pow2 = 1z << exp;
47                sout | exp | pow2 | unit(eng(pow2)) | wd(0,1, unit(eng( pow2 ))) | wd(0,0, unit(eng(pow2)));
48        } // for
49} // main
50
51// Local Variables: //
52// tab-width: 4 //
53// compile-command: "cfa -Wall -Wextra manipulatorsOutput4.cfa" //
54// End: //
Note: See TracBrowser for help on using the repository browser.