Skip to content

Conversation

@nvaytet
Copy link
Member

@nvaytet nvaytet commented Mar 4, 2024

Fixes #3402

Note that:

sc.scalar(4., unit='m') % sc.scalar(3., unit='m')  # works
sc.scalar(4., unit='m') % sc.scalar(3., unit='s')  # raises
sc.scalar(4., unit='m') % 3.  # raises
sc.scalar(4.) % 3.  # works

i.e. dimensionless can work with bare numbers.

Comment on lines 134 to 135
throw except::UnitError("Cannot perform modulo operation with " + a.name() +
" and " + b.name() + ".");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mention that units must match?

@nvaytet nvaytet merged commit 59ef5df into main Mar 5, 2024
@nvaytet nvaytet deleted the mod-require-same-units branch March 5, 2024 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

scipp.mod ignores the divisor's units

3 participants