11.07.2015 Views

Advanced Programming Guide

Advanced Programming Guide

Advanced Programming Guide

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

4.5 Input Commands • 171y The next non-whitespace characters in the input must consist of anIEEE hex-dump format floating-point value. This value must consistof sixteen hexadecimal characters. The value is converted to and returnedas a Maple float.e, f, or g The next non-whitespace characters in the input must consistof a signed or unsigned decimal number, possibly including a decimalpoint, and possibly followed by E or e, an optional sign, and a decimalinteger indicating a power of ten. The number is returned as a Maplefloating-point value.In addition to numeric values, the e, f, and g formats also recognizethe special values “inf” and “NaN”. If an i or N is encountered whenscanf is looking for the first digit of a number, it assumes that oneof these special values has been found, and proceeds to look for thesubsequent nf or aN. If the rest of the special value is not found, anexception is raised.he, hf, or hg These are special formats for reading one or two-dimensionalnumeric arrays. In general, such arrays should be read by using themore sophisticated functionality provided by the {} format, but thehe, hf, and hg formats are provided for backward compatibility withhfarrays, and provide some intelligence in automatically dealing witha variety of textual layouts of such arrays.The following input must consist of a one or two-dimensional arrayof floating-point (or integer) values. Characters encountered duringscanning are categorized into three classes: numeric, separator, andterminator. All the characters that can appear within a number (thedigits, decimal point, signs, E, e, D, and d) are numeric. Any whitespace, commas, or square brackets are separators. A square bracketnot immediately followed by a comma, and any other character, is aterminator. If a backslash is encountered, it and the following characterare ignored.The dimensions of the array are determined by the number of linesread, and the number of values in the first line. If either of these is 1,or if the number of rows multiplied by the number of columns doesnot equal the total number of values read, a one-dimensional array isproduced.The definition of “the first line” is “everything read up to the firstline break that does not immediately follow a comma or a backslash,or up to the first closing square bracket that is immediately followedby a comma”.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!