13.07.2015 Views

Turbo Basic

Turbo Basic

Turbo Basic

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

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

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

A p p E N o x ANumeric ConsiderationsDuring the execution of a program, <strong>Turbo</strong> <strong>Basic</strong> must sometimes convert numbersfrom one internal representation to another; for example, from single precision tointeger:a = 14.1b% = aIn such cases, <strong>Turbo</strong> <strong>Basic</strong> decides what to do with the excess (or missing)precision. The follOwing rules govern numeric type conversion:• In an assignment statement, the number is stored in the precision of the variablebeing assigned (that is, on the left side of the equal sign). For example:b = 1.1a% = bPRINT a%• Whenever a more precise representation is assigned to a less precise representation,rounding occurs. For example:a% = 1.5b = 123.456789PRINT a%, bNote, however, that <strong>Turbo</strong> <strong>Basic</strong> treats in a special manner any number containinga 5 in its fractional part: The number is always rounded toward theclosest even number. For example, 0.5 would be rounded down to 0; 9.005 wouldbe rounded down to 9.000.383

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

Saved successfully!

Ooh no, something went wrong!