
I have some RPython that does this: return a % b while in another function I'm calling the same, but the two functions differ in the types of a and b (mix of ints and floats). However, during translation I'm getting a blocked block exception. translation:ERROR] AnnotatorError: [translation:ERROR] [translation:ERROR] Blocked block -- operation cannot succeed [translation:ERROR] [translation:ERROR] v12 = mod(v10, v11) [translation:ERROR] [translation:ERROR] In <FunctionGraph of (pixie.vm.numbers:1)_rem_Float_Integer at 0x105b80490>: [translation:ERROR] no source! [translation:ERROR] Known variable annotations: [translation:ERROR] v10 = SomeFloat() [translation:ERROR] v11 = SomeInteger(knowntype=int, nonneg=False, unsigned=False) [translation:ERROR] [translation:ERROR] Blocked block -- operation cannot succeed [translation:ERROR] [translation:ERROR] v15 = mod(v13, v14) [translation:ERROR] [translation:ERROR] In <FunctionGraph of (pixie.vm.numbers:1)_rem_Integer_Float at 0x1059ac550>: [translation:ERROR] no source! [translation:ERROR] Known variable annotations: [translation:ERROR] v13 = SomeInteger(knowntype=int, nonneg=False, unsigned=False) [translation:ERROR] v14 = SomeFloat() [translation:ERROR] [translation:ERROR] Blocked block -- operation cannot succeed [translation:ERROR] [translation:ERROR] v18 = mod(v16, v17) [translation:ERROR] [translation:ERROR] In <FunctionGraph of (pixie.vm.numbers:1)_rem_Float_Float at 0x10544a650>: [translation:ERROR] no source! [translation:ERROR] Known variable annotations: [translation:ERROR] v16 = SomeFloat() [translation:ERROR] v17 = SomeFloat() [translation:ERROR] Do we need another entry in rtyper? Looking at rtyper/rfloat.py I see entries on how to type add, sub, etc, but nothing for mod. Thanks, Timothy

I don't know much about RPython internals, but PyPy calls rpython.rtyper.lltypesystem.module.ll_math.math_fmod for modulus operations on floats. On Fri, Mar 27, 2015 at 5:46 PM, Timothy Baldridge <tbaldridge@gmail.com> wrote:
-- Ryan [ERROR]: Your autotools build scripts are 200 lines longer than your program. Something’s wrong. http://kirbyfan64.github.io/

Hi Timothy, hi Ryan, On 28 March 2015 at 00:00, Ryan Gonzalez <rymg19@gmail.com> wrote:
Yes, "%" on floats is not supported. You should use math.fmod() in RPython. See also how PyPy implements "%" on floats in pypy.objspace.std.floatobject: descr_mod(). Of course it would be possible to add RPython support, but we figured out that the particular rules that make "%" on floats different from math.fmod() are specific to the Python language anyway, whereas math.fmod() is directly the C fmod() function. A bientôt, Armin.

I don't know much about RPython internals, but PyPy calls rpython.rtyper.lltypesystem.module.ll_math.math_fmod for modulus operations on floats. On Fri, Mar 27, 2015 at 5:46 PM, Timothy Baldridge <tbaldridge@gmail.com> wrote:
-- Ryan [ERROR]: Your autotools build scripts are 200 lines longer than your program. Something’s wrong. http://kirbyfan64.github.io/

Hi Timothy, hi Ryan, On 28 March 2015 at 00:00, Ryan Gonzalez <rymg19@gmail.com> wrote:
Yes, "%" on floats is not supported. You should use math.fmod() in RPython. See also how PyPy implements "%" on floats in pypy.objspace.std.floatobject: descr_mod(). Of course it would be possible to add RPython support, but we figured out that the particular rules that make "%" on floats different from math.fmod() are specific to the Python language anyway, whereas math.fmod() is directly the C fmod() function. A bientôt, Armin.
participants (3)
-
Armin Rigo
-
Ryan Gonzalez
-
Timothy Baldridge