bugVmgen - Bugs: bug #48644, Bug in example

 
 

bug #48644: Bug in example

Submitter:  None
Submitted:  Wed 27 Jul 2016 06:19:05 AM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  anton
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 27 Jul 2016 05:24:38 PM UTC, comment #2: 

Fixed in git patch a391365..d40f7f2

Anton Ertl <anton>
Group administrator
Wed 27 Jul 2016 05:11:00 PM UTC, comment #1: 

Yes, fib.mini has an off-by-one error (the same as fib.fs).  This error is so traditional that I am not sure if I should fix it (probably not for fib.fs, because that is used as a benchmark; fib.mini is different, though).

Anton Ertl <anton>
Group administrator
Wed 27 Jul 2016 06:19:05 AM UTC, original submission:  


>./mini fib.mini

result = 9227465

fib.c:

#include <stdio.h>
long fib(long n) {
  if (n < 2) return n;
  return fib(n - 1) + fib(n - 2);
}

int main(int argc, char *argv[]) {
  printf("%ld\n",fib(34));
  return 0;
}

>gcc -o fib fib.c
>./fib

5702887

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by anton (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-07-27 anton StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2016-07-27 anton StatusNone Confirmed
        Assigned toNone anton

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code