This may not be a critical issue but I am trying to understand the basics well 
to be able to build on them. This is what I think I know:

When we declare a variable, we declare it with a type: 
    
    
    var
      i: int = 0
      i3: int8 = 1
      f: float = 0.0
      f32: float32 = 3.14
    
    
    Run

Manual says, any integer literal without a type suffix will have the generic 
unsigned `int` type (as I understand, with a platform dependent size: 32 or 
64-bit).

Similarly, `float` is the generic type for floating point literals (specific to 
this implementation, not platform dependent, always 64-bit).

This is probably where I am misinterpreting this but from this info, I expect 
the following: 
    
    
    var
      i = 0    # type int
      f = 0.0  # type float
    
    doAssert $type(i) == "int"
    echo sizeof(i)  # platform dependent, 4 (32-bit) or 8 (64-bit)
    
    doAssert $type(f) == "float"  # contrary to my expectation, this FAILS
    echo sizeof(f)  # always 8 (64-bit)
    
    echo type(f)  # apparently the type of "f" is "float64"
    
    
    Run

Am I getting this all wrong or, although most probably not that important at 
all, would it be better (or maybe less confusing at least for me) if `type(f)` 
was "float"?

Thanks in advance

Reply via email to