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

update conversions to use type.method #184

Merged
merged 2 commits into from
Jun 17, 2015
Merged

update conversions to use type.method #184

merged 2 commits into from
Jun 17, 2015

Conversation

MikeHolman
Copy link
Member

No description provided.

* `sint64.from_float64`: truncate a 64-bit float to a signed integer
* `sint64.from_float32`: truncate a 32-bit float to a signed integer
* `uint64.from_float64`: truncate a 64-bit float to an unsigned integer
* `uint64.from_float32`: truncate a 32-bit float to an unsigned integer
Copy link
Member

Choose a reason for hiding this comment

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

This is slightly inconsistent because sint32 et al aren't local types. Would int32.from_float64_sx etc. be better?

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought about that too, but that isn't pretty either. _sx when converting between int and float seems completely bizarre.

Copy link
Member

Choose a reason for hiding this comment

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

Good point. How about int32.strunc_float64 and int32.utrunc_float64? Or is strunc too silly sounding?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, I think that sounds pretty good. I was actually rewording now to be along those lines. Will have a new iteration in a few mins, let's see if it sounds better

* `float64.cvt_signed[int64]`: convert a signed 64-bit integer to a 64-bit float
* `float64.cvt_unsigned[int32]`: convert an unsigned 32-bit integer to a 64-bit float
* `float64.cvt_unsigned[int64]`: convert an unsigned 64-bit integer to a 64-bit float
* `float64.reinterpret[int64]`: reinterpret the bits of a 64-bit integer as a 64-bit float
Copy link
Member Author

Choose a reason for hiding this comment

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

I think this sounds somewhat better, but maybe having all these different ones is too verbose, especially if you consider the case of someone writing text format?

Copy link
Member

Choose a reason for hiding this comment

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

This works for me, especially for now.

@sunfishcode
Copy link
Member

lgtm

@jfbastien
Copy link
Member

lgtm as well. This is cleaner than before.

sunfishcode added a commit that referenced this pull request Jun 17, 2015
update conversions to use type.method
@sunfishcode sunfishcode merged commit 9974cde into master Jun 17, 2015
@jfbastien jfbastien deleted the conversions branch June 17, 2015 15:05
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.

4 participants