// -*- Mode: C -*- // // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo // // The contents of this file are covered under the licence agreement in the // file "LICENCE" distributed with Cforall. // // ato.c -- // // Author : Peter A. Buhr // Created On : Thu Feb 4 08:10:57 2016 // Last Modified By : Peter A. Buhr // Last Modified On : Mon Feb 29 17:57:35 2016 // Update Count : 44 // #include #include // ato, strto extern "C" { #include #include } int main( void ) { int i = ato( "-123" ); sout | i | "-123" | endl; unsigned int ui = ato( "123" ); sout | ui | "123" | endl; long int li = ato( "-123" ); sout | li | "-123" | endl; unsigned long int uli = ato( "123" ); sout | uli | "123" | endl; long long int lli = ato( "-123" ); sout | lli | "-123" | endl; unsigned long long int ulli = ato( "123" ); sout | ulli | "123" | endl; float f = ato( "-123.456" ); sout | f | "-123.456" | endl; double d = ato( "-123.4567890123456" ); sout | d | "-123.4567890123456" | endl; long double ld = ato( "-123.45678901234567890123456789" ); sout | ld | "-123.45678901234567890123456789" | endl; float _Complex fc = ato( "-123.456-123.456i" ); sout | fc | "-123.456-123.456i" | endl; double _Complex dc = ato( "-123.4567890123456+123.4567890123456i" ); sout | dc | "-123.4567890123456+123.4567890123456i" | endl; long double _Complex ldc = ato( "123.45678901234567890123456789-123.45678901234567890123456789i" ); sout | ldc | "123.45678901234567890123456789-123.45678901234567890123456789i" | endl; long double _Complex ldc2 = ato( "123.45678901234-123.4567890i" ); sout | ldc2 | "123.45678901234-123.4567890i" | endl; } // main // Local Variables: // // tab-width: 4 // // compile-command: "cfa ato.c" // // End: //