Basic HTML version of Foils prepared Sept 20 97

Foil 6 Scalar Data I -- Numbers

From Tutorial on PERL Computational Science for Information Age Course CPS616 -- Sept 20 97. by Geoffrey C. Fox,Nancy McCracken,Tom Scavo


Scalars are either numbers or a string of characters as in C although in both cases there are significant differences
  • numbers and strings are not explicitly typed
  • Note Perl is "safer" than JavaScript in this regard and it is very rare that numbers and strings are confused
Numbers are stored internally as integers if this represents them adequately -- otherwise as double-precision numbers
  • Perl and the runtime system make certain that this is transparent to user
  • Wolfram's SMP (the forerunner of Mathematica) at Caltech (which I worked on) also made the more extreme choice of everything being double precision
  • For example 1, 5.0, 4.5E23, and 7.45 E-15, are all numbers
Octal and Hexadecimal numbers are allowed with
  • 0377 (initial zero) assumed to be octal and so is equal to 255 decimal
  • 0X or 0x represents hexadecimal with letters A to F corresponding to numbers 10 to 15 as normal. 0XFF is hex FF or 255 decimal



© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sun Sep 21 1997