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

Implement div_euc for vector types #11

Closed
zesterer opened this issue Sep 11, 2018 · 8 comments
Closed

Implement div_euc for vector types #11

zesterer opened this issue Sep 11, 2018 · 8 comments

Comments

@zesterer
Copy link
Contributor

No description provided.

@yoanlcq
Copy link
Owner

yoanlcq commented Sep 12, 2018

The issues I see :

  • div_euc and mod_euc in the std are nightly only. Do we use the std with a feature gate, or do we roll our own?
  • We need a trait that provides div_euc and mod_euc. To me, the best way to go would be to add it to the Num trait of num_traits (or add a new trait there or whatever; in any case that may be controversial). An alternative is just to roll our own trait and implement it for primitive types.

As an aside, this kind of thing immediately made me think about the map method. We might actually want some kind of map2 method which would allow anyone to write e.g let res = a.map2(b, |(x, y)| x.div_euc(y)); (which is admittedly a bit verbose...)

@yoanlcq
Copy link
Owner

yoanlcq commented Sep 12, 2018

I wouldn't mind some kind of EucOps trait in vek::ops; however, this "feels" very much like an std feature. Clamp, Lerp and friends were OK because they're not in std, and other "very-close-to-standard" traits are provided by num-traits.

My point is, I prefer avoiding to add such traits to vek; If anything, it would rather belong in num-traits; and then we could implement it for vectors where T: EucOps.

@zesterer
Copy link
Contributor Author

zesterer commented Apr 9, 2020

div_euclid and rem_euclid are now stable.

@yoanlcq
Copy link
Owner

yoanlcq commented Apr 9, 2020

Yup, I would wait to see how this will be handled in num-traits.

@SparrowLii
Copy link

I have submitted the pr in num-trait. Could I ask what this operation does in vek ?( just curious.)

@zesterer
Copy link
Contributor Author

zesterer commented Dec 5, 2020

@SparrowLii It doesn't exist in vek yet. I assumed it would just apply div/rem_euclid element-wise for vectors in much the same way as other arithmetic operations.

@Patiga
Copy link
Contributor

Patiga commented Nov 29, 2022

Fixed by 2e10920 via #86

@yoanlcq
Copy link
Owner

yoanlcq commented Nov 29, 2022

Thanks @Patiga !

@yoanlcq yoanlcq closed this as completed Nov 29, 2022
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

No branches or pull requests

4 participants