☟☟ Upcoming C++ Best Practices – Tools online seminar, March 8th! ☟☟

Notes and code:
Previous Episode:

T-SHIRTS AVAILABLE!

► The best C++ T-Shirts anywhere!

WANT MORE JASON?

► My Training Classes:
► Follow me on twitter:

SUPPORT THE CHANNEL

► Patreon:
► Github Sponsors:
► Paypal Donation:

GET INVOLVED

► Video Idea List:

JASON’S BOOKS

► C++ Best Practices
Amazon Paperback:
Leanpub Ebook:

JASON’S PUZZLE BOOKS

► Object Lifetime Puzzlers Book 1
Amazon Paperback:
Leanpub Ebook:

► Object Lifetime Puzzlers Book 2
Amazon Paperback:
Leanpub Ebook:

► Object Lifetime Puzzlers Book 3
Leanpub Ebook:

► Copy and Reference Puzzlers Book 1
Amazon Paperback:
Leanpub Ebook:

► Copy and Reference Puzzlers Book 2
Amazon Paperback:
Leanpub Ebook:

► Copy and Reference Puzzlers Book 3
Leanpub Ebook:

► OpCode Puzzlers Book 1
Amazon Paperback:
Leanpub Ebook:

RECOMMENDED BOOKS

► Bjarne Stroustrup’s A Tour of C++ (now with C++20/23!):

AWESOME PROJECTS

► The C++ Starter Project – Gets you started with Best Practices Quickly –
► C++ Best Practices Forkable Coding Standards –

O’Reilly VIDEOS

► Inheritance and Polymorphism in C++ –
► Learning C++ Best Practices –

✅ Camiseta De Futbol Baratas Player vs Fan | camisetasfutboleses

🛒 Cómprala aquí: https://www.pidecamisetas.com/

📸 Siguenos en Instagram: https://www.instagram.com/msy_es/

📲 WhatsApp: +86 166 5930 6369

👏 ¡Muchas gracias por ver el vídeo! 👏

🔴 LIKE & SUBSCRIBE 🔴

🔴 Keywords:Camisetas ESPANYOL

__

🏷️ TAGS:
CAMISETA Real Madrid 22/23
camisetasfutboleses
camisetasfutboleses.com
CAMISETAS FUTBOL SPAIN
CAMISETAS DE FUTBOL
CAMISETAS FUTBOL Baratas
CAMISETAS DE FUTBOL 2020
CAMISETAS DE FUTBOL 2021
CAMISETAS DE FUTBOL 2022
CAMISETAS FUTBOL EQUIPOS
CAMISETAS FUTBOL SELECCIONES
CAMISETAS DE FUTBOL BARATAS
MEJORES CAMISETAS DE FUTBOL
EQUIPACIONES FUTBOL
EQUIPACIONES DE FUTBOL

Otros sitios web de nuestra empresa para que los visite:

20 comentarios en «C++ Weekly – Ep 365 – Modulo (%): More Complicated Than You Think»
  1. The (ambiguous) definition of Modulo (on math side) makes it complicated and its different (default-)implementation in different languages and libraries. And most language implementation docs do not have a clear statement/"warning" about it.

  2. That's the reason why you need to understand and know what the f*ck you are actually writing. The % Operator is just an operator, just like the + operator. And just like that "int a = b + c" will give you different results in C and Python with "a = b + c".

    The modulo operator is just a factor space. And is commonly defined as Z/nZ. Some use N/nZ, others N/nZ. Each programming language is free to do what it wants.

  3. Great topic. – If you refer to the behavior in C and C++ of the remainder relating to negative operands, the older standards specified an implementation-defined behavior. Only since C99 and C++11 the behavior is well-defined.
    So, if there was an implementation which calculates -5 / 3 to be -2, then -5 % 3 needs to be 1. This would be a valid implementation-defined C++03 behavior because (a / b) * b + (a % b) = a is fulfilled.
    But since the newer standards enforce – 5 / 3 to be -1 (truncation toward zero), -5 % 3 must be -2. Here, also -1 * 3 + -2 = -5 is true.

  4. That's exactly why I added the `modulo_arithmetic` lint to Rust Clippy. It was a real pita to find that % behaves like this while chasing a bug in Python2Cpp migration I've been doing some time ago.

  5. As an amateur I ran into this and in frustration I just wrote a wrap function:

    int wrap(int ndx, int ndxsize)
    {
    while(ndx >= ndxsize)
    ndx -= ndxsize;
    while(ndx < 0)
    ndx += ndxsize;
    return ndx;
    }

    Seems kinda inefficient to put this in what is usually a loop but it has the advantage that it is clear and works. And since nobody is paying me for my work…

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *