-
Notifications
You must be signed in to change notification settings - Fork 44
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
High precision numbers seem to be rounded #66
Comments
Hi Ramsay - thanks for this. In fact this reflects the fact that those two numbers are the same in Erlang |
This came up because it was causing a problem for someone's tests. I'll try and track down the original. None the less, a refactoring tool probably shouldn't be altering the text without being asked. Presumably this is because the Wrangler AST has them stored by value rather than by "image"? Will this then break things like literals in other bases? I.e. if I typed 16#F because I want to work in hex (for some good presentation reason), will wrangler then rewrite this to base ten? |
Interestingly, I have just tried a hex representation and it was unchanged, but now (OTP17) it doesn't seem to damage the high precision number either. And OTP version issue maybe? -module(hex). -export([f/1,test/0]). f(A) -> test() -> |
Hi Ramsay - thanks for this. The point I was making was that though syntactially the two numbers are different, their semantics are identical in Erlang. Nonetheless we’ll look at this. S.
Simon Thompson | Professor of Logic and Computation |
Processing source files via the API (in smother) seems to round very high precision numbers when they are written back to the file. E.g.:
tt() ->
test([101]),
test([-1]),
test([278]),
test([97]),
test(10.500000000000000000000000000001).
becomes:
tt() ->
smother_server:log(string_paramtest, {{9, 1}, {14, 43}}, []),
test([101]),
test([-1]),
test([278]),
test([97]),
test(10.5).
I'm using the unix pretty printer, so that could be related:
wrangler_prettypr:print_ast('unix',AST2),
The text was updated successfully, but these errors were encountered: