Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] math.ceildiv gives incorrect results for unsigned simd types #3733

Open
soraros opened this issue Nov 3, 2024 · 1 comment
Open

[BUG] math.ceildiv gives incorrect results for unsigned simd types #3733

soraros opened this issue Nov 3, 2024 · 1 comment
Assignees
Labels
bug Something isn't working mojo-repo Tag all issues with this label

Comments

@soraros
Copy link
Contributor

soraros commented Nov 3, 2024

Bug description

As title.

fn ceildiv[T: CeilDivable, //](num: T, denom: T) -> T:
  return -(nun // -denom)  # shouldn't use __neg__ on unsigned types

Steps to reproduce

import math

fn main():
  res = math.ceildiv(UInt8(8), 2)
  print(res)  # prints 0

System information

Mojo 2024.11.305 (a9c84705) on Docker, Intel Mac
@soraros soraros added bug Something isn't working mojo-repo Tag all issues with this label labels Nov 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working mojo-repo Tag all issues with this label
Projects
None yet
Development

No branches or pull requests

3 participants
@lsh @soraros and others