-
Notifications
You must be signed in to change notification settings - Fork 55
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
Type conversion before evaluation #125
Labels
enhancement
New feature or request
Comments
If you write 1.0/4 or 1/4.0 or 1.0/4.0, then the result will be float. It's
inspired by Rust's syntax.
…On Sun, Apr 23, 2023 at 9:37 PM ch-47 ***@***.***> wrote:
Is there a way to convert numbers before evaluation?
For example, fractions like 1/4 and 1/3 are evaluated to 0 and 0. Which
makes sense, but it would be nice to get 0.25 and 0.33 instead.
—
Reply to this email directly, view it on GitHub
<#125>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AASATXV3GLTIBG5EOPP7UOTXCVZHVANCNFSM6AAAAAAXIWIGPQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Yes, I understand that. I should have specified that I'm using |
eval_number just means that the result of the expression will be converted
to a float. It does not affect evaluation itself. Supporting fractions
could be done by making the integer and float types generic. There is #111,
and some branch where I have experimented with that. I am happy to accept
pull requests into that direction.
…On Mon, 24 Apr 2023, 18.10 ch-47, ***@***.***> wrote:
Yes, I understand that. I should have specified that I'm using eval_number
function, so I was thinking maybe there is a way to do that implicitly. And
I was talking about fractions in general, not the division operation.
Sorry, if it doesn't make sense.
—
Reply to this email directly, view it on GitHub
<#125 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AASATXTEYTARKMUAHN3HA5LXC2JWTANCNFSM6AAAAAAXIWIGPQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is there a way to convert numbers before evaluation?
For example, fractions like
1/4
and1/3
are evaluated to0
and0
. Which makes sense, but it would be nice to get0.25
and0.33
instead.The text was updated successfully, but these errors were encountered: