x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

% is not modulo, wrong description

When you search modul (blueprint), you obtain the funciton "modulo: %", but this function is not modulo, it is the remainder of a division. Rest and modulo are equals ONLY IN POSITIVE NUMBERS

For example -84 mod 360 = 276 -84 % 360 = -84

So no, this is not modulo.

Product Version: UE 4.15
Tags:
more ▼

asked Apr 26 '17 at 12:08 PM in Bug Reports

avatar image

Cucharón
26 3 7 12

avatar image Memnarch Apr 26 '17 at 02:49 PM

% in C++ is called Modulus and returns the remainder of the division.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

This is working as intended, as the Engine's modulo node returns the same value as the modulo math function in c++. Different programming languages handle modulo differently. Here is another post that discusses this issue, which you may find helpful:

https://answers.unrealengine.com/questions/212021/blueprint-modulo-node-doesnt-handle-negatives.html

Cheers!

more ▼

answered Apr 26 '17 at 02:41 PM

avatar image

Thomas G ♦♦ STAFF
7k 64 4 54

avatar image Cucharón Apr 28 '17 at 11:03 AM

No, C++ % is not modulo, is, again, remainder of a division. If I go to C++ and I write %, I am writing remainder of a division, not modulo.

And even if the name in C++ were modulo, because you use fmodulo, it is still wrong, because your shortnames says "%" not "fmod".

So at least you could add to the description: Reminder of the division, not mod.

avatar image Benergy Apr 28 '17 at 01:16 PM

Do you have any resource on why modulo is not the remainder of a division? I googled it and couldn't find anything reliable, only things like "depends on the implementation for negative numbers".

avatar image ThompsonN13 Apr 27 '18 at 09:56 PM

i agree with the other replies here in that it works as intended if you have a problem with it not being positive numbers then just use a absolute node.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Hi, I found this thread while trying to confirm the correct operation for remainders. As far as I know:

1) "Mod" IS the operation for getting the remainder. Has been for at least the last 2+ decades, at least in C++

2) My understanding is that "Modulo" actually refers to the remainder. Wikipedia seems to confirm that as well: https://en.wikipedia.org/wiki/Modulo_operation

more ▼

answered Apr 27 '18 at 08:28 PM

avatar image

Orakga
35 5 11 14

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question