<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.harlamenkov.ru/index.php?action=history&amp;feed=atom&amp;title=EN%2Fdocumentation%2Fbasic_guide%2Fnumbers</id>
	<title>EN/documentation/basic guide/numbers - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.harlamenkov.ru/index.php?action=history&amp;feed=atom&amp;title=EN%2Fdocumentation%2Fbasic_guide%2Fnumbers"/>
	<link rel="alternate" type="text/html" href="https://wiki.harlamenkov.ru/index.php?title=EN/documentation/basic_guide/numbers&amp;action=history"/>
	<updated>2026-11-11T14:18:41Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.33.0</generator>
	<entry>
		<id>https://wiki.harlamenkov.ru/index.php?title=EN/documentation/basic_guide/numbers&amp;diff=16854&amp;oldid=prev</id>
		<title>Sancho at 10:47, 6 September 2011</title>
		<link rel="alternate" type="text/html" href="https://wiki.harlamenkov.ru/index.php?title=EN/documentation/basic_guide/numbers&amp;diff=16854&amp;oldid=prev"/>
		<updated>2011-09-06T10:47:52Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 10:47, 6 September 2011&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l78&quot; &gt;Line 78:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 78:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Documentation/&lt;/del&gt;Caution|The handling of Basic Currency type is not reliable. {{bug|31001}} {{bug|54049}} {{bug|91121}} {{bug|107277}} are still not corrected on {{OOo}} version 3.1.1. }}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{Caution|The handling of Basic Currency type is not reliable. {{bug|31001}} {{bug|54049}} {{bug|91121}} {{bug|107277}} are still not corrected on {{OOo}} version 3.1.1. }}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Floats ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Floats ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Sancho</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.harlamenkov.ru/index.php?title=EN/documentation/basic_guide/numbers&amp;diff=15880&amp;oldid=prev</id>
		<title>Sancho: Created page with &quot;&lt;section begin=title /&gt;&lt;noinclude&gt;{{DISPLAYTITLE:&lt;/noinclude&gt;Number Variables&lt;noinclude&gt;}}&lt;/noinclude&gt;&lt;section end=title /&gt;{{BreadCrumbL10n}}  {{Documentation/BASICGuideTOC |Show...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.harlamenkov.ru/index.php?title=EN/documentation/basic_guide/numbers&amp;diff=15880&amp;oldid=prev"/>
		<updated>2011-09-01T13:46:06Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;section begin=title /&amp;gt;&amp;lt;noinclude&amp;gt;{{DISPLAYTITLE:&amp;lt;/noinclude&amp;gt;Number Variables&amp;lt;noinclude&amp;gt;}}&amp;lt;/noinclude&amp;gt;&amp;lt;section end=title /&amp;gt;{{BreadCrumbL10n}}  {{Documentation/BASICGuideTOC |Show...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;section begin=title /&amp;gt;&amp;lt;noinclude&amp;gt;{{DISPLAYTITLE:&amp;lt;/noinclude&amp;gt;Number Variables&amp;lt;noinclude&amp;gt;}}&amp;lt;/noinclude&amp;gt;&amp;lt;section end=title /&amp;gt;{{BreadCrumbL10n}}&lt;br /&gt;
&lt;br /&gt;
{{Documentation/BASICGuideTOC&lt;br /&gt;
|ShowPrevNext=block&lt;br /&gt;
|ShowPrevPage=block&lt;br /&gt;
|PrevPage=EN/documentation/basic_guide/strings&lt;br /&gt;
|NextPage=EN/documentation/basic_guide/boolean&lt;br /&gt;
|lang=block&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
__NOTOC__ &lt;br /&gt;
&lt;br /&gt;
{{OOo}} Basic supports five basic types for processing numbers:&lt;br /&gt;
&lt;br /&gt;
* Integer&lt;br /&gt;
* Long Integer&lt;br /&gt;
* Single&lt;br /&gt;
* Double&lt;br /&gt;
* Currency&lt;br /&gt;
&lt;br /&gt;
== Integer Variables ==&lt;br /&gt;
&lt;br /&gt;
Integer variables can store any whole number between '''-32768''' and '''32767'''. An integer variable can take up to two bytes of memory. The type declaration symbol for an integer variable is &amp;lt;tt&amp;gt;%&amp;lt;/tt&amp;gt;. Calculations that use integer variables are very fast and are particularly useful for loop counters. If you assign a floating point number to an integer variable, the number is rounded up or down to the next whole number.&lt;br /&gt;
&lt;br /&gt;
Example declarations for integer variables:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Variable As Integer&lt;br /&gt;
Dim Variable%&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Long Integer Variables ==&lt;br /&gt;
&lt;br /&gt;
Long integer variables can store any whole number between '''–2147483648''' and '''2147483647'''. A long integer variable can takes up to four bytes of memory. The type declaration symbol for a long integer is &amp;lt;tt&amp;gt;&amp;amp;&amp;lt;/tt&amp;gt;. Calculations with long integer variables are very fast and are particularly useful for loop counters. If you assign a floating point number to a long integer variable, the number is rounded up or down to the next whole number.&lt;br /&gt;
&lt;br /&gt;
Example declarations for long integer variables:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Variable as Long&lt;br /&gt;
Dim Variable&amp;amp;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Single Variables ==&lt;br /&gt;
&lt;br /&gt;
Single variables can store any positive or negative floating point number between '''3.402823 x 10&amp;lt;sup&amp;gt;38&amp;lt;/sup&amp;gt;''' and '''1.401298 x 10&amp;lt;sup&amp;gt;-45&amp;lt;/sup&amp;gt;'''. A single variable can take up to four bytes of memory. The type declaration symbol for a single variable is &amp;lt;tt&amp;gt;!&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Originally, single variables were used to reduce the computing time required for the more precise double variables. However, these speed considerations no longer apply, reducing the need for single variables.&lt;br /&gt;
&lt;br /&gt;
Example declarations for single variables:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Variable as Single&lt;br /&gt;
Dim Variable!&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Double Variables ==&lt;br /&gt;
&lt;br /&gt;
Double variables can store any positive or negative floating point numbers between '''1.79769313486232 x 10&amp;lt;sup&amp;gt;308&amp;lt;/sup&amp;gt;''' and '''4.94065645841247 x 10&amp;lt;sup&amp;gt;-324&amp;lt;/sup&amp;gt;'''. A double variable can take up to eight bytes of memory. Double variables are suitable for precise calculations. The type declaration symbol is &amp;lt;tt&amp;gt;#&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Example declarations of double variables:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Variable As Double&lt;br /&gt;
Dim Variable#&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Currency Variables ==&lt;br /&gt;
&lt;br /&gt;
Currency variables differ from the other variable types by the way they handle values. The decimal point is fixed and is followed by four decimal places. The variable can contain up to 15 numbers before the decimal point. A currency variable can store any value between '''-922337203685477.5808''' and '''+922337203685477.5807''' and takes up to eight bytes of memory. The type declaration symbol for a currency variable is &amp;lt;tt&amp;gt;@&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Currency variables are mostly intended for business calculations that yield unforeseeable rounding errors due to the use of floating point numbers.&lt;br /&gt;
&lt;br /&gt;
Example declarations of currency variables:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Variable As Currency&lt;br /&gt;
Dim Variable@&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Caution|The handling of Basic Currency type is not reliable. {{bug|31001}} {{bug|54049}} {{bug|91121}} {{bug|107277}} are still not corrected on {{OOo}} version 3.1.1. }}&lt;br /&gt;
&lt;br /&gt;
== Floats ==&lt;br /&gt;
&lt;br /&gt;
The types single, double and currency are often collectively referred to as floats, or floating-point number types. They can contain numerical values with decimal fractions of various length, hence the name: The decimal point seems to be able to 'float' through the number.&lt;br /&gt;
&lt;br /&gt;
You can declare variables of the type float. The actual variable type (single, double, currency) is determined the moment a value is assigned to the variable:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim A As Float&lt;br /&gt;
A = 1210.126&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Specification of Explicit Numbers ==&lt;br /&gt;
&lt;br /&gt;
Numbers can be presented in several ways, for example, in decimal format or in scientific notation, or even with a different base than the decimal system. The following rules apply to numerical characters in {{OOo}} Basic:&lt;br /&gt;
&lt;br /&gt;
=== Whole Numbers ===&lt;br /&gt;
&lt;br /&gt;
The simplest method is to work with whole numbers. They are listed in the source text without a comma separating the thousand figure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim A As Integer&lt;br /&gt;
Dim B As Float&lt;br /&gt;
&lt;br /&gt;
A = 1210&lt;br /&gt;
B = 2438&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The numbers can be preceded by both a plus (+) or minus (-) sign (with or without a space in between):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim A As Integer&lt;br /&gt;
Dim B As Float&lt;br /&gt;
&lt;br /&gt;
A = + 121&lt;br /&gt;
B = - 243&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Decimal Numbers ===&lt;br /&gt;
&lt;br /&gt;
When you type a decimal number, use a period (.) as the decimal point. This rule ensures that source texts can be transferred from one country to another without conversion.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim A As Integer&lt;br /&gt;
Dim B As Integer&lt;br /&gt;
Dim C As Float&lt;br /&gt;
&lt;br /&gt;
A = 1223.53      ' is rounded&lt;br /&gt;
B = - 23446.46   ' is rounded&lt;br /&gt;
C = + 3532.76323&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also use plus (+) or minus (-) signs as prefixes for decimal numbers (again with or without spaces).&lt;br /&gt;
&lt;br /&gt;
If a decimal number is assigned to an integer variable, {{OOo}} Basic rounds the figure up or down.&lt;br /&gt;
&lt;br /&gt;
=== Exponential Writing Style ===&lt;br /&gt;
&lt;br /&gt;
{{OOo}} Basic allows numbers to be specified in the exponential writing style, for example, you can write &amp;lt;tt&amp;gt;1.5e-10&amp;lt;/tt&amp;gt; for the number 1.5 x 10&amp;lt;sup&amp;gt;-10&amp;lt;/sup&amp;gt; (0.00000000015). The letter &amp;quot;e&amp;quot; can be lowercase or uppercase with or without a plus sign (+) as a prefix.&lt;br /&gt;
&lt;br /&gt;
Here are a few correct and incorrect examples of numbers in exponential format:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim A As Double&lt;br /&gt;
&lt;br /&gt;
A = 1.43E2    ' Correct&lt;br /&gt;
A = + 1.43E2  ' Correct (space between plus and basic number)&lt;br /&gt;
A = - 1.43E2  ' Correct (space between minus and basic number)&lt;br /&gt;
A = 1.43E-2   ' Correct (negative exponent)&lt;br /&gt;
A = 1.43E -2  ' Incorrect (spaces not permitted within the number)&lt;br /&gt;
A = 1,43E-2   ' Incorrect (commas not permitted as decimal points)&lt;br /&gt;
A = 1.43E2.2  ' Incorrect (exponent must be a whole number)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note, that in the first and third incorrect examples that no error message is generated even though the variables return incorrect values. The expression&lt;br /&gt;
&lt;br /&gt;
 A = 1.43E -2&lt;br /&gt;
&lt;br /&gt;
is interpreted as 1.43 minus 2, which corresponds to the value -0.57. However, the value 1.43 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt; (corresponding to 0.0143) was the intended value. With the value&lt;br /&gt;
&lt;br /&gt;
 A = 1.43E2.2&lt;br /&gt;
&lt;br /&gt;
{{OOo}} Basic ignores the part of the exponent after the decimal point and interprets the expression as&lt;br /&gt;
&lt;br /&gt;
 A = 1.43E2&lt;br /&gt;
&lt;br /&gt;
=== Hexadecimal Values ===&lt;br /&gt;
&lt;br /&gt;
In the hexadecimal system (base 16 system), a 2-digit number corresponds to precisely one byte. This allows numbers to be handled in a manner which more closely reflects machine architecture. In the hexadecimal system, the numbers 0 to 9 and the letters A to F are used as numbers. An A stands for the decimal number 10, while the letter F represents the decimal number 15. {{OOo}} Basic lets you use whole numbered hexadecimal values, so long as they are preceded by &amp;lt;tt&amp;gt;&amp;amp;H&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim A As Long&lt;br /&gt;
A = &amp;amp;HFF ' Hexadecimal value FF, corresponds to the decimal value 255&lt;br /&gt;
A = &amp;amp;H10 ' Hexadecimal value 10, corresponds to the decimal value 16&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Octal Values ===&lt;br /&gt;
&lt;br /&gt;
{{OOo}} Basic also understands the octal system (base 8 system), which uses the numbers 0 to 7. You must use whole numbers that are preceded by &amp;lt;tt&amp;gt;&amp;amp;O&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim A As Long&lt;br /&gt;
A = &amp;amp;O77 ' Octal value 77, corresponds to the decimal value 63&lt;br /&gt;
A = &amp;amp;O10 ' Octal value 10, corresponds to the decimal value 8&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
{{PDL1}}&lt;/div&gt;</summary>
		<author><name>Sancho</name></author>
		
	</entry>
</feed>