Changeset 447bf833 for src/tests/gmp.c


Ignore:
Timestamp:
May 24, 2017, 4:16:20 PM (4 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
a8e64c4, cf0b892
Parents:
7f623d6f (diff), 8bcaf21 (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.
Message:

Merge branch 'master' of plg.uwaterloo.ca:/u/cforall/software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tests/gmp.c

    r7f623d6f r447bf833  
    1010// Created On       : Tue Apr 19 08:55:51 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun May 14 14:46:50 2017
    13 // Update Count     : 530
     12// Last Modified On : Mon May 22 09:05:09 2017
     13// Update Count     : 538
    1414//
    1515
    1616#include <gmp>
    1717
    18 int main() {
     18int main( void ) {
    1919        sout | "constructors" | endl;
    2020        short int si = 3;
     
    2525        sout | "conversions" | endl;
    2626        y = 'a';
     27        sout | "y:" | y | endl;
     28        y = "12345678901234567890123456789";
    2729        sout | "y:" | y | endl;
    2830        y = si;
     
    6264        z = x / 3;
    6365        sout | "z:" | z | endl;
     66        sout | div( x, 3 ) | x / 3 | "," | x % 3 | endl;
    6467        [ x, y ] = div( x, 3 );
    6568        sout | "x:" | x | "y:" | y | endl;
    66 //      sout | div( x, 3 ) | x / 3 | "," | x % 3 | endl;
    6769
    6870        sout | endl;
     
    7274        fn = (Int){0}; fn1 = fn;                                                        // 1st case
    7375        sout | (int)0 | fn | endl;
    74         fn = (Int){1}; fn2 = fn1; fn1 = fn;                                     // 2nd case
     76        fn = 1; fn2 = fn1; fn1 = fn;                                            // 2nd case
    7577        sout | 1 | fn | endl;
    76         for ( int i = 2; i <= 200; i += 1 ) {
     78        for ( unsigned int i = 2; i <= 200; i += 1 ) {
    7779                fn = fn1 + fn2; fn2 = fn1; fn1 = fn;                    // general case
    7880                sout | i | fn | endl;
     
    8385        sout | "Factorial Numbers" | endl;
    8486        Int fact;
    85         fact = (Int){1};                                                                        // 1st case
     87        fact = 1;                                                                                       // 1st case
    8688        sout | (int)0 | fact | endl;
    87         for ( int i = 1; i <= 40; i += 1 ) {
     89        for ( unsigned int i = 1; i <= 40; i += 1 ) {
    8890                fact = fact * i;                                                                // general case
    8991                sout | i | fact | endl;
Note: See TracChangeset for help on using the changeset viewer.