Blitz:Numerical Functions

From Amiga Coding
Revision as of 17:59, 8 October 2015 by Daedalus (talk | contribs) (Created page with "Blitz Basic / AmiBlitz provides many numerical functions to evaluate certain properties or carry out certain mathematical operations. Most of these will be very familiar to an...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Blitz Basic / AmiBlitz provides many numerical functions to evaluate certain properties or carry out certain mathematical operations. Most of these will be very familiar to anyone who has programmed before.

Basic Arithmetic

The simplest numerical operations are the basic mathematical functions such as add and subtract. These are used in an expression using + for add, - for subtract, * for multiply and / for divide: a = 2 + 5  ; a is 7 b = 3 - 5  ; b is -2 c = 2 * 8  ; c is 16 d = 10 / 2 ; d is 5 Blitz follows the standard conventional order used in the real world for carrying out the calculation:

  • Brackets
  • Powers
  • Multiplication & Division
  • Addition and Subtraction

Calculations are evaluated going from left to right with operators of equal priority as normal. Placing brackets around any expression allows you to change the normal priority: a = 3 + 2 * 5  ; a is 13 b = (3 + 2) * 5 ; b is 25