Numbers
Learn Soplang integers (abn) and floating-point numbers (jajab), including arithmetic, comparisons, conversions, and rounding.
Numbers in Soplang
Soplang has two numeric types: abn (signed 64-bit integers) and jajab (64-bit binary floating-point numbers). This guide covers literals, arithmetic, comparisons, and conversions.
Integers — abn
abn represents whole numbers such as −2, −1, 0, 1, and 2. Use door for a
dynamic variable or abn for an explicitly typed declaration.
// Literals & declaration abn da = 21 door tirin = 100 // dynamic, but integer value // Arithmetic abn a = 10 abn b = 3 qor(a + b) // 13 qor(a - b) // 7 qor(a * b) // 30 qor(a / b) // 3.3333333333333335 (floating-point result) qor(a % b) // 1 (remainder) // Comparisons qor(a > b) // run qor(a == 10) // run qor(a != b) // run
Division (/) can produce a fractional result. Use abn() to truncate a
result toward zero when you need an integer.
abn natiijo_dhan = abn(10 / 3) // 3 (truncation)
Floating-Point Numbers — jajab
jajab represents binary floating-point values. It supports fractional
calculations but does not provide exact decimal arithmetic.
// Literals & declaration jajab pi = 3.14159 door qiime = 2.5 // dynamic, decimal value // Arithmetic jajab x = 10.0 jajab y = 4.0 qor(x + y) // 14 qor(x - y) // 6 qor(x * y) // 40 qor(x / y) // 2.5 // Comparisons qor(pi > 3) // run qor(2.0 == 2) // run (numeric values compare equally)
Printing floating-point values
When a jajab value is integral, such as 14.0, qor() displays 14 without .0. Its type is still jajab; use nooc() to inspect it.
Use nooc() when you need to check the type held by a dynamic variable.
door n = 2.75 qor(nooc(n)) // "jajab"
Mixing abn and jajab
Arithmetic that mixes abn and jajab generally produces a jajab result.
Use abn() or jajab() for an explicit conversion.
abn a = 5 jajab b = 2.0 // Floating-point result door c = a + b qor(c) // 7 qor(nooc(c)) // "jajab" // Convert to an integer (truncate) abn d = abn(a / b) qor(d) // 2 // Convert to floating point jajab e = jajab(a * 2) qor(e) // 10
Conversion Examples
// From input → number door gelin_da = gelin("Da'daada qor: ") abn da = abn(gelin_da) // "19" -> 19 qor("Nooc: " + nooc(da)) // "abn" // String → decimal jajab qiime = jajab("12.75") qor(qiime + 0.25) // 13 // Number → string qoraal s = qoraal(2025) qor("Sanad: " + s)
Rounding — daji() and kor()
daji() rounds down toward negative infinity (floor). kor() rounds up toward
positive infinity (ceiling). Both return abn.
qor(daji(4.8)) // 4 qor(kor(4.2)) // 5 qor(nooc(daji(4.8))) // abn qor(abn(kor(4.2))) // 5