ADT
aaron-thesis
arm-eh
ast-experimental
cleanup-dtors
ctor
deferred_resn
demangler
enum
forall-pointer-decay
gc_noraii
jacob/cs343-translation
jenkins-sandbox
memory
new-ast
new-ast-unique-expr
new-env
no_list
persistent-indexer
pthread-emulation
qualifiedEnum
resolv-new
string
with_gc
Last change
on this file since ae8b942 was d3b7937, checked in by Peter A. Buhr <pabuhr@…>, 10 years ago |
building runtime library (first attempt)
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
Rev | Line | |
---|
[d3b7937] | 1 | //
|
---|
| 2 | // Cforall Version 1.0.0 Copyright (C) 2015 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 | // abs.c --
|
---|
| 8 | //
|
---|
| 9 | // Author : Peter A. Buhr
|
---|
| 10 | // Created On : Thu Jan 28 18:26:16 2016
|
---|
| 11 | // Last Modified By : Peter A. Buhr
|
---|
| 12 | // Last Modified On : Fri Jan 29 15:44:41 2016
|
---|
| 13 | // Update Count : 20
|
---|
| 14 | //
|
---|
| 15 |
|
---|
| 16 | extern "C" {
|
---|
| 17 | #include <complex.h>
|
---|
| 18 | } // extern
|
---|
| 19 | #include <fstream>
|
---|
| 20 | #include <algorithm>
|
---|
| 21 |
|
---|
| 22 | int main( void ) {
|
---|
| 23 | ofstream *sout = ofstream_stdout();
|
---|
| 24 |
|
---|
| 25 | char ch = -65;
|
---|
| 26 | sout | "char\t\t\t" | -65 | "\tabs " | abs( ch ) | endl;
|
---|
| 27 | sout | "signed int\t\t" | -65 | "\tabs " | abs( -65 ) | endl;
|
---|
| 28 | sout | "signed long int\t\t" | -65l | "\tabs " | abs( -65l ) | endl;
|
---|
| 29 | sout | "signed long long int\t" | -65ll | "\tabs " | abs( -65ll ) | endl;
|
---|
| 30 | sout | "float\t\t\t" | -65.0f | "\tabs " | abs( -65.0f ) | endl;
|
---|
| 31 | sout | "double\t\t\t" | -65.0 | "\tabs " | abs( -65.0 ) | endl;
|
---|
| 32 | sout | "long double\t\t" | -65.0l | "\tabs " | abs( -65.0l ) | endl;
|
---|
| 33 | double _Complex c = -65.0+2.0 * I;
|
---|
| 34 | sout | "double _Complex\t\t" | c | "\tabs " | abs( c ) | endl;
|
---|
| 35 | } // main
|
---|
| 36 |
|
---|
| 37 | // Local Variables: //
|
---|
| 38 | // tab-width: 4 //
|
---|
| 39 | // compile-command: "cfa abs.c" //
|
---|
| 40 | // End: //
|
---|
Note:
See
TracBrowser
for help on using the repository browser.