RazarDessun / shedskin

An experimental (restricted-Python)-to-C++ compiler
0 stars 0 forks source link

Simple program raises Floating point exception #197

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Running the translated C++ program

What is the expected output? What do you see instead?
I'm expecting the program to work. I see a floating point exception.

What version of the product are you using? On what operating system?
No clue for the version. I'm on Ubuntu 12 LTS.

Please provide any additional information below.
The screens are attached, as well as the program causing the fatal exception.

Original issue reported on code.google.com by Rym...@gmail.com on 18 Dec 2013 at 10:17

Attachments:

GoogleCodeExporter commented 9 years ago
thanks for reporting! 

since by default, integers become 32-bit signed after compilation with 
shedskin, 2**64 becomes 0.. leading the program to calculate '1 % 0' 
((a+b)%SZ), which leads to an exception with regular python as well. a 
different exception though, so we have to fix that.

unfortunately we can't use shedskin -l here either, since 2**64 doesn't fit as 
64-bit signed either. but perhaps with a minor change in your code things might 
fit up to reasonable values..?

Original comment by mark.duf...@gmail.com on 19 Dec 2013 at 7:45

GoogleCodeExporter commented 9 years ago
I was trying to see how long the program at 
http://jabsoft.io/2013/08/29/why-c-still-matters-in-2013-a-simple-example/ 
takes under ShedSkin.

What about using an unsigned long long if the value is constant and 
non-negative?

Original comment by Rym...@gmail.com on 19 Dec 2013 at 10:13