source: src/tests/ato.c@ 882ad37

ADT aaron-thesis arm-eh ast-experimental cleanup-dtors deferred_resn demangler enum forall-pointer-decay jacob/cs343-translation jenkins-sandbox new-ast new-ast-unique-expr new-env no_list persistent-indexer pthread-emulation qualifiedEnum resolv-new with_gc
Last change on this file since 882ad37 was 00b7cd3, checked in by Peter A. Buhr <pabuhr@…>, 9 years ago

update include files for test programs

  • Property mode set to 100644
File size: 1.7 KB
RevLine 
[658f6de0]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// ato.c --
8//
9// Author : Peter A. Buhr
10// Created On : Thu Feb 4 08:10:57 2016
11// Last Modified By : Peter A. Buhr
[00b7cd3]12// Last Modified On : Mon Jul 4 23:38:04 2016
13// Update Count : 48
[658f6de0]14//
15
16#include <fstream>
17#include <stdlib> // ato, strto
18
19int main( void ) {
20 int i = ato( "-123" );
[90c3b1c]21 sout | i | "-123" | endl;
[658f6de0]22 unsigned int ui = ato( "123" );
[90c3b1c]23 sout | ui | "123" | endl;
[658f6de0]24 long int li = ato( "-123" );
[90c3b1c]25 sout | li | "-123" | endl;
[658f6de0]26 unsigned long int uli = ato( "123" );
[90c3b1c]27 sout | uli | "123" | endl;
[658f6de0]28 long long int lli = ato( "-123" );
[90c3b1c]29 sout | lli | "-123" | endl;
[658f6de0]30 unsigned long long int ulli = ato( "123" );
[90c3b1c]31 sout | ulli | "123" | endl;
[658f6de0]32 float f = ato( "-123.456" );
[90c3b1c]33 sout | f | "-123.456" | endl;
[658f6de0]34 double d = ato( "-123.4567890123456" );
[90c3b1c]35 sout | d | "-123.4567890123456" | endl;
[658f6de0]36 long double ld = ato( "-123.45678901234567890123456789" );
[90c3b1c]37 sout | ld | "-123.45678901234567890123456789" | endl;
[658f6de0]38 float _Complex fc = ato( "-123.456-123.456i" );
[90c3b1c]39 sout | fc | "-123.456-123.456i" | endl;
[658f6de0]40 double _Complex dc = ato( "-123.4567890123456+123.4567890123456i" );
[90c3b1c]41 sout | dc | "-123.4567890123456+123.4567890123456i" | endl;
[658f6de0]42 long double _Complex ldc = ato( "123.45678901234567890123456789-123.45678901234567890123456789i" );
[90c3b1c]43 sout | ldc | "123.45678901234567890123456789-123.45678901234567890123456789i" | endl;
[658f6de0]44 long double _Complex ldc2 = ato( "123.45678901234-123.4567890i" );
[90c3b1c]45 sout | ldc2 | "123.45678901234-123.4567890i" | endl;
[658f6de0]46} // main
47
48// Local Variables: //
49// tab-width: 4 //
50// compile-command: "cfa ato.c" //
51// End: //
Note: See TracBrowser for help on using the repository browser.