Basic HTML version of Foils prepared March 30 97

Foil 4 Scalar Data I -- Numbers (Chapter 2 of Llama Book)

From PERL4 Tutorial for CPS616 Computational Science for Information Age Course CPS616 -- February 1995. by Geoffrey C. Fox


Scalars are either numbers or a string of characters as in C although in both cases there are significant if "second-order" differences
  • numbers and strings are not typed separately
  • 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
  • O377 (initial zero) assumed to be Octal and so equal to 255 decimal
  • OX or Ox reprepresents hexadecimal with letters A to F corresponding to numbers 10 to 15 as normal. OXFF is hex FF or also 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 Sat Sep 6 1997