12.07.2015 Views

spec - Local Sector 7 web page

spec - Local Sector 7 web page

spec - Local Sector 7 web page

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

format <strong>spec</strong>ifications are the same as for the C-language routine and can be found inthe printf() write-up in any C reference manual.2.FOURC> printf("The square root of two is %.12g.\n", sqrt(2))The square root of two is 1.41421356237.3.FOURC>Using Var ia bles<strong>spec</strong>’s variables can be used as both strings and as double-precision floating-pointnumbers. Variables are not declared, but come into existence through usage. Somevariables are built-in, though, and of these, some have preassigned values. The variablePI is an example.3.FOURC> {4.more> k = 2 * PI / 1.545.more> print k6.more> }4.079997.FOURC>Curly brackets ({ and } )are used to delimit a block to be interpreted together, sincevariables are local to interpreted blocks. Notice that the prompt indicates the programis expecting further input before interpreting and taking action.7.FOURC> print k08.FOURC>The value of k disappeared because k was local to the previous statement block. Newvariables start off with a value of zero.Avariable may be declared global to hold its value outside an interpreted block:8.FOURC> global Lambda CuKa9.FOURC> Lambda = 1.5410.FOURC> CuKa = "Copper K-alpha"11.FOURC> print CuKa, "=", LambdaCopper K-alpha = 1.5412.FOURC>18 USER MANUAL AND TUTORIALS INTERIM WORK-IN-PROGRESS (8/16/01) NOT FOR GENERAL DISTRIBUTION

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

Saved successfully!

Ooh no, something went wrong!