Changeset 5b51f5e for src/tests/ato.c
- Timestamp:
- Jan 5, 2018, 3:21:42 PM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 65deb18, cae28da
- Parents:
- 5c4f2c2 (diff), b834e98 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/tests/ato.c
r5c4f2c2 r5b51f5e 10 10 // Created On : Thu Feb 4 08:10:57 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Jul 4 23:38:04 201613 // Update Count : 4812 // Last Modified On : Thu Nov 16 18:31:56 2017 13 // Update Count : 89 14 14 // 15 15 … … 18 18 19 19 int main( void ) { 20 int i = ato( "-123" ); 21 sout | i | "-123" | endl; 22 unsigned int ui = ato( "123" ); 23 sout | ui | "123" | endl; 24 long int li = ato( "-123" ); 25 sout | li | "-123" | endl; 26 unsigned long int uli = ato( "123" ); 27 sout | uli | "123" | endl; 28 long long int lli = ato( "-123" ); 29 sout | lli | "-123" | endl; 30 unsigned long long int ulli = ato( "123" ); 31 sout | ulli | "123" | endl; 32 float f = ato( "-123.456" ); 33 sout | f | "-123.456" | endl; 34 double d = ato( "-123.4567890123456" ); 35 sout | d | "-123.4567890123456" | endl; 36 long double ld = ato( "-123.45678901234567890123456789" ); 37 sout | ld | "-123.45678901234567890123456789" | endl; 38 float _Complex fc = ato( "-123.456-123.456i" ); 39 sout | fc | "-123.456-123.456i" | endl; 40 double _Complex dc = ato( "-123.4567890123456+123.4567890123456i" ); 41 sout | dc | "-123.4567890123456+123.4567890123456i" | endl; 42 long double _Complex ldc = ato( "123.45678901234567890123456789-123.45678901234567890123456789i" ); 43 sout | ldc | "123.45678901234567890123456789-123.45678901234567890123456789i" | endl; 44 long double _Complex ldc2 = ato( "123.45678901234-123.4567890i" ); 45 sout | ldc2 | "123.45678901234-123.4567890i" | endl; 20 const char * sptr = "-123"; 21 int i = ato( sptr ); 22 sout | i | sptr | endl; 23 sptr = "123"; 24 unsigned int ui = ato( sptr ); 25 sout | ui | sptr | endl; 26 27 sptr = "-123"; 28 long int li = ato( sptr ); 29 sout | li | sptr | endl; 30 sptr = "123"; 31 unsigned long int uli = ato( sptr ); 32 sout | uli | sptr | endl; 33 34 sptr = "-123"; 35 long long int lli = ato( sptr ); 36 sout | lli | sptr | endl; 37 sptr = "123"; 38 unsigned long long int ulli = ato( sptr ); 39 sout | ulli | sptr | endl; 40 41 sptr = "-123.456"; 42 float f = ato( sptr ); 43 sout | f | sptr | endl; 44 sptr = "-123.4567890123456"; 45 double d = ato( sptr ); 46 sout | d | sptr | endl; 47 sptr = "-123.45678901234567890123456789"; 48 long double ld = ato( sptr ); 49 sout | ld | sptr | endl; 50 51 sptr = "-123.456-123.456i"; 52 float _Complex fc = ato( sptr ); 53 sout | fc | sptr | endl; 54 sptr = "-123.4567890123456+123.4567890123456i"; 55 double _Complex dc = ato( sptr ); 56 sout | dc | sptr | endl; 57 sptr = "123.45678901234567890123456789-123.45678901234567890123456789i"; 58 long double _Complex ldc = ato( sptr ); 59 sout | ldc | sptr | endl; 60 sptr = "123.45678901234-123.4567890i"; 61 long double _Complex ldc2 = ato( sptr ); 62 sout | ldc2 | sptr | endl; 63 64 65 sptr = "-123"; 66 i = strto( sptr, 0, 10 ); 67 sout | i | sptr | endl; 68 sptr = "123"; 69 ui = strto( sptr, 0, 10 ); 70 sout | ui | sptr | endl; 71 72 sptr = "-123"; 73 li = strto( sptr, 0, 10 ); 74 sout | li | sptr | endl; 75 sptr = "123"; 76 uli = strto( sptr, 0, 10 ); 77 sout | uli | sptr | endl; 78 79 sptr = "-123"; 80 lli = strto( sptr, 0, 10 ); 81 sout | lli | sptr | endl; 82 sptr = "123"; 83 ulli = strto( sptr, 0, 10 ); 84 sout | ulli | sptr | endl; 85 86 sptr = "-123.456"; 87 f = strto( sptr, 0 ); 88 sout | f | sptr | endl; 89 sptr = "-123.4567890123456"; 90 d = strto( sptr, 0 ); 91 sout | d | sptr | endl; 92 sptr = "-123.45678901234567890123456789"; 93 ld = strto( sptr, 0 ); 94 sout | ld | sptr | endl; 95 96 sptr = "-123.456-123.456i"; 97 fc = strto( sptr, 0 ); 98 sout | fc | sptr | endl; 99 100 char * eptr = 0; 101 // sptr = "2fred"; 102 // fc = strto( sptr, &eptr ); 103 // sout | fc | sptr | eptr | endl; 104 105 sptr = "2 3"; 106 fc = strto( sptr, &eptr ); 107 sout | fc | sptr | eptr | endl; 108 109 sptr = "-123.4567890123456+123.4567890123456i"; 110 dc = strto( sptr, 0 ); 111 sout | dc | sptr | endl; 112 sptr = "123.45678901234567890123456789-123.45678901234567890123456789i"; 113 ldc = strto( sptr, 0 ); 114 sout | ldc | sptr | endl; 115 sptr = "123.45678901234-123.4567890i"; 116 ldc2 = strto( sptr, 0 ); 117 sout | ldc2 | sptr | endl; 46 118 } // main 47 119
Note:
See TracChangeset
for help on using the changeset viewer.