Revert removal of round and round64 #352

Merged
sb10q merged 3 commits from issue-149 into master 2023-11-04 13:35:53 +08:00
Collaborator

Change round/floor/ceil/trunc to return int and add *64 family which returns int64.

Change `round`/`floor`/`ceil`/`trunc` to return int and add `*64` family which returns `int64`.
derppening self-assigned this 2023-11-02 14:57:15 +08:00
derppening added 2 commits 2023-11-02 14:57:15 +08:00
derppening force-pushed issue-149 from 2b3bf4d5ac to d13cfd46ab 2023-11-02 15:26:40 +08:00 Compare
Poster
Collaborator

v2: Add implementation for trunc64.

v2: Add implementation for `trunc64`.

Add implementation for trunc64.

As discussed I don't think we want trunc functions, just typecast instead. In Python and Numpy, the casts already truncate:

>>> int(3.6)
3
>>> import numpy as np
>>> np.int32(3.6)
3
>>> np.int64(3.6)
3

I think numpy has this trunc function solely to be able to deal with arrays (i.e. element-wise trunc of an array). Maybe add it later when we implement numpy arrays, if it is the best solution.

> Add implementation for trunc64. As discussed I don't think we want trunc functions, just typecast instead. In Python and Numpy, the casts already truncate: ``` >>> int(3.6) 3 >>> import numpy as np >>> np.int32(3.6) 3 >>> np.int64(3.6) 3 ``` I think numpy has this trunc function solely to be able to deal with arrays (i.e. element-wise trunc of an array). Maybe add it later when we implement numpy arrays, if it is the best solution.
derppening force-pushed issue-149 from d13cfd46ab to 742b264911 2023-11-03 15:58:05 +08:00 Compare
Poster
Collaborator

v3: Removed trunc, fixed multiple bugs related to numeric casting

v3: Removed `trunc`, fixed multiple bugs related to numeric casting
Poster
Collaborator

Actually don't merge this yet, let me break the casting changes out of this PR.

Actually don't merge this yet, let me break the casting changes out of this PR.
derppening force-pushed issue-149 from 742b264911 to 23f0805f20 2023-11-03 16:25:22 +08:00 Compare
Poster
Collaborator

v4: Separated casting-related fixes to a separate branch (#353).

v4: Separated casting-related fixes to a separate branch (#353).
sb10q merged commit fd787ca3f5 into master 2023-11-04 13:35:53 +08:00
sb10q deleted branch issue-149 2023-11-04 13:35:54 +08:00
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: M-Labs/nac3#352
There is no content yet.