2025-05-09 19:11 AEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000312mercuryBugpublic2014-01-27 11:58
Reporterlpimmes 
Assigned Topbone 
PriorityhighSeveritymajorReproducibilityalways
StatusclosedResolutionno change required 
PlatformOSMACOS Version10.9.1
Product Version 
Target VersionFixed in Version 
Summary0000312: Fibonacci using pragma, fails at 93, and other larger integers.
DescriptionIn order to speed up fibonacci algorithm pragma was employed.
If not employ, code is very slow at 40.
Steps To ReproduceCompile, and run file. See comments in attached file.
TagsNo tags attached.
Attached Files

-Relationships
+Relationships

-Notes

~0000610

pbone (administrator)

Please explain what you mean by "fails at 93". What are the symptoms of your problem.

Please also include the Mercury version, the OS version, TCC's version and the options you used to build the Fibonacci program.

~0000611

pbone (administrator)

My apologies some of this information is provided in the attached file. However we still need to know what "fails at 93" means.

~0000612

zs (developer)

I am guessing that "fails at 93" means that fib(93) returns a negative number, since a comment in the source code says so. However, since this version of fib uses int, not integer, OF COURSE you get overflow when the fibonacci numbers exceed what can be represented as a 64 bit two's complement integer. In other words, this is NOT a bug; this is a misunderstanding.

~0000613

lpimmes (reporter)

Thank you so much for the tip. Code works now. See working code, fibonacci.m.

~0000614

pbone (administrator)

Closed as this is not a bug and the reporter is happy with the result.

Thanks for contacting us in any case and thanks Zoltan for investigating further.
+Notes

-Issue History
Date Modified Username Field Change
2014-01-26 14:49 lpimmes New Issue
2014-01-26 14:49 lpimmes File Added: fibonacciSa.m
2014-01-26 19:25 pbone Note Added: 0000610
2014-01-26 19:29 pbone Note Added: 0000611
2014-01-27 02:17 zs Note Added: 0000612
2014-01-27 09:30 lpimmes File Added: fibonacci.m
2014-01-27 09:31 lpimmes Note Added: 0000613
2014-01-27 11:58 pbone Note Added: 0000614
2014-01-27 11:58 pbone Status new => closed
2014-01-27 11:58 pbone Assigned To => pbone
2014-01-27 11:58 pbone Resolution open => no change required
+Issue History