[Scilab-users] Confusion about types (typeof vs. Variabe Browser)

Federico Miyara fmiyara at fceia.unr.edu.ar
Wed Dec 11 19:20:50 CET 2019


Stéphane,

>> I think, from the user's perspective, that the type names appearing 
>> in the variable browser (in the Type column) should be strictly the 
>> same as reported by the function typeof. Otherwise it can and will 
>> cause confusion and the sensation of lack of consistency.
> So do I. But other users do not agree with that, that's why I am 
> trying to find a sensible compromise...

Users who don't think that each thing should bear a single name should 
provide a good rationale.

The rationale for my proposal is that most users are not computer 
science experts and can be easily confused by the reach of the word 
"type". If the variable browser gives a contradictory message, such as 
calling "double" what typeof calls "constant", they will probably be at 
a loss.

>> Finally, I don't consider it recommendable that the same word be used 
>> both for a /format /and a /type name/, such as if "constant" were 
>> replaced by "double".
> What do you mean by "format" ?

I mean the way basic data are stored, such as the IEEE Std 754 
specification, so double (double precision) is a format with 1 sign bit, 
11 binary exponent bits and 52 fraction bits.

Type involves other information appart from the data themselves, 
contained in a heaader. According to

https://wiki.scilab.org/Memory%20representation%20of%20variables

"constant" requires a numeric type integer, two integers representing 
rows and columns, an integer representing whether it is real or complex, 
and finally the data in double precision format.

>> I tend to think the answer is no, since they have very different 
>> storage representations, cover different sets of numbers and even 
>> operations behave differently. If so, the type should be called 
>> integer8, integer16 and so on (so the type would be integer8 and the 
>> basic format would be int16 --no ambiguity). If, on the contrary, 
>> they are the same, then the only type name should be "integer" and 
>> the basic format should be informed in a different column.
>>
> That was my attempt, by using parenthesis.
>

This could be prevented if it were acknowledged that int16 and 1nt32, 
for instance, are actually different types as they have different memory 
representations, they represent different number sets, and operators on 
them have different reults:

--> int16(32000)*2
  ans  =

  -1536
--> int32(32000)*2
  ans  =

   64000

typeof acknowledges it, but type doesn't, yielding 8 for both types.

Regards,

Federico Miyara


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20191211/ab0307bb/attachment.htm>


More information about the users mailing list