You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just started looking at V, reading the documentation and found what I think are problems.
In the section 'Primitive types', in the discussion of types that can be automatically promoted or coerced to other types, there is a diagram. In that diagram, there is an arrow from int to f32, indicating that an int can be promoted to an f32. But the immediately following discussion rightly disallows this because of loss of precision. I think the diagram should not have an arrow from int to f32.
That section also says "A small primitive type on one side can be automatically promoted if it fits completely into the data range of the type on the other side.". That is necessary but not sufficient, which the wording seems to imply. The promotion must also not cause loss of precision.
The text was updated successfully, but these errors were encountered:
ntrel
changed the title
Documentation problems
Documentation: type promotion
Aug 29, 2020
I was confused by this section of documentation as well. This piece of code is complied with no errors (despite precision loss):
a:=2147483647b:=f32(1)
println(a + b)
Looks like the diagram reflects real state of things but the documentation is misleading. On the other side if type promotion should preserve precision then we have a bug in the behavior and the diagram deceives us.
I just started looking at V, reading the documentation and found what I think are problems.
In the section 'Primitive types', in the discussion of types that can be automatically promoted or coerced to other types, there is a diagram. In that diagram, there is an arrow from int to f32, indicating that an int can be promoted to an f32. But the immediately following discussion rightly disallows this because of loss of precision. I think the diagram should not have an arrow from int to f32.
That section also says "A small primitive type on one side can be automatically promoted if it fits completely into the data range of the type on the other side.". That is necessary but not sufficient, which the wording seems to imply. The promotion must also not cause loss of precision.
The text was updated successfully, but these errors were encountered: