Documentation topicsNumbers
Lexical Structure
Control Flow
Functions & Scope
Lists & Built-ins
Reference
MarathiCode v0.2.0
Numbers
संख्या
Numbers are whole numbers (10) or decimals (3.14). They can be written with ASCII or Devanagari digits, and both kinds can be mixed in one expression.
numbers.mr
चल a = 10
चल b = ४
चल c = ३.५
छापा(a + b)
छापा(b * c)
छापा(-a)Output (आउटपुट)
14 14 -10
- Negative numbers use unary minus:
-5,-x. - A decimal needs digits on both sides of the point:
0.5, not.5. - There is no exponent notation (
1e3) and no digit separators.
Division and display
/ is always true division. Results with no fractional part are shown without a decimal point. Decimal arithmetic uses 64-bit floating point, so some results show rounding:
division.mr
छापा(10 / 4)
छापा(10 / 2)
छापा(7 % 3)
छापा(0.1 + 0.2)Output (आउटपुट)
2.5 5 1 0.30000000000000004
Dividing by zero (with / or %) is a runtime error.
Very large numbers
Every number is a 64-bit floating-point value. Whole numbers are exact up to 9,007,199,254,740,992; beyond that results are rounded, and from 1021 they are shown in exponent form. A result too large to store (above about 1.8 × 10308) is a runtime error.
large.mr
चल x = 1
साठी (i = 1; i <= 25; i = i + 1) {
x = x * i
}
छापा(x)
छापा(9007199254740993)Output (आउटपुट)
1.5511210043330986e+25 9007199254740992