Mercury Bugs - mercury
View Issue Details
0000312mercuryBugpublic2014-01-26 14:492014-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? fibonacciSa.m (3,195) 2014-01-26 14:49
https://bugs.mercurylang.org/file_download.php?file_id=192&type=bug
? fibonacci.m (4,760) 2014-01-27 09:30
https://bugs.mercurylang.org/file_download.php?file_id=193&type=bug

Notes
(0000610)
pbone   
2014-01-26 19:25   
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   
2014-01-26 19:29   
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   
2014-01-27 02:17   
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   
2014-01-27 09:31   
Thank you so much for the tip. Code works now. See working code, fibonacci.m.
(0000614)
pbone   
2014-01-27 11:58   
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.

Issue History
2014-01-26 14:49lpimmesNew Issue
2014-01-26 14:49lpimmesFile Added: fibonacciSa.m
2014-01-26 19:25pboneNote Added: 0000610
2014-01-26 19:29pboneNote Added: 0000611
2014-01-27 02:17zsNote Added: 0000612
2014-01-27 09:30lpimmesFile Added: fibonacci.m
2014-01-27 09:31lpimmesNote Added: 0000613
2014-01-27 11:58pboneNote Added: 0000614
2014-01-27 11:58pboneStatusnew => closed
2014-01-27 11:58pboneAssigned To => pbone
2014-01-27 11:58pboneResolutionopen => no change required