Skip to content

Integer / Double

CrossBasic distinguishes between integer and floating‑point numeric types:

  • Integer

  • 32‑bit signed (–2,147,483,648 to 2,147,483,647)

  • Declared with As Integer

  • Double

  • 64‑bit IEEE‑754 double precision

  • Declared with As Double
Dim count As Integer = 10
Dim price As Double = 19.95
Dim ratio As Double = 3.0E2    // scientific notation

Arithmetic Operators

Operator Description
+ Addition
- Subtraction
* Multiplication
/ Division (floating)
\ Integer division
Mod Remainder
^ Exponentiation

Transformation Operators

Operator Description
+= Addition assignment: adds the right operand to the left operand and assigns the result back (e.g. x += 1 is the same as x = x + 1).
-= Subtraction assignment: subtracts the right operand from the left operand and assigns the result back (e.g. x -= 1 is the same as x = x - 1).
*= Multiplication assignment: multiplies the left operand by the right operand and assigns the result back (e.g. x *= 2 is the same as x = x * 2).
/= Division assignment: divides the left operand by the right operand and assigns the result back (e.g. x /= 2 is the same as x = x / 2).
Dim a As Integer = 7 \ 2    // 3
Dim b As Integer = 7 Mod 2  // 1
Dim c As Double = 7 / 2     // 3.5
Dim d As Double = 2 ^ 10    // 1024

Conversion Functions

Function Converts To
CInt(x) Integer
CDbl(x) Double
Int(x) Float truncated toward zero
Fix(x) Float truncated toward zero
Dim x As Double = 3.8
Dim i As Integer = CInt(x)   // 4
Dim t As Integer = Int(x)    // 3