Skip to content

mod misnormer in Matlab #2767

Closed
Closed

Description

@jgillis

The CasADi primitive mod corresponds to rem.

C fmod == Matlab rem
C remainder != Matlab mod

#2394

Activity

  1. added a commit that references this issue on Apr 20, 2021
  2. added a commit that references this issue on Nov 21, 2022
  3. added a commit that references this issue on Nov 29, 2022
  4. added this to the Version 3.6 milestone on Mar 28, 2023
  5. jgillis commented on Mar 30, 2023

    @jgillis
    MemberAuthor

    I'll be dumping some result tables here

    op 3 -3
    5 op(5,3) op(5,-3)
    -5 op(-5,3) op(-5,-3)

    matlab

    matlab.mod
    2|-1
    1|-2
    matlab.rem
    2|2
    -2|-2
    

    Python

    numpy.fmod
    2.0|2.0|
    -2.0|-2.0
    numpy.mod / numpy.remainder /  %
    2.0|-1.0|
    1.0|-2.0
    math.remainder
    -1.0|-1.0|
    1.0|1.0
    

    C

    c99 fmod
    2|2|
    -2|-2|
    c99 remainder
    -1|-1|
    1|1|
    
  6. added a commit that references this issue on Mar 30, 2023
  7. jgillis commented on Mar 30, 2023

    @jgillis
    MemberAuthor

    Added documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions