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

Non-trivial float multiplication is broken #2361

Closed
LisannaAtHome opened this issue Aug 18, 2018 · 3 comments
Closed

Non-trivial float multiplication is broken #2361

LisannaAtHome opened this issue Aug 18, 2018 · 3 comments

Comments

@LisannaAtHome
Copy link

LisannaAtHome commented Aug 18, 2018

> let a = { b = 0.5; }; in a.b * 2
=> value is a float while an integer was expected, at (string):1:26
> 0.5 * 2
=> 1
> let a = 0.5; in a * 2
=> 1
> let a = { b = 0.5; }; c = a.b; in c * 2
=> value is a float while an integer was expected, at (string):1:35
> let a = { b = 0.5; }; c = a.b; in builtins.seq c (c * 2)
=> 1
@LisannaAtHome
Copy link
Author

More float weirdness:

> let a = { b = 0.5; }; in a.b * 2.0
=> 1
> let a = { b = 0.5; }; in a.b * (2.0 + 0.5)
=> value is a float while an integer was expected, at (string):1:26

@LisannaAtHome
Copy link
Author

Okay, it doesn't even have to be an attrset

> (0.5 + 0.5) * (2.0 + 0.5)
=> value is a float while an integer was expected, at (string):1:1

@LisannaAtHome LisannaAtHome changed the title Can't use a float in multiplication with an int if accessed from an attrset Non-trivial float multiplication is broken Aug 18, 2018
@LisannaAtHome
Copy link
Author

Workaround seems to be to make sure the float operands are fully evaluated to floats (are not thunks).

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

1 participant