# precision statement

The precision statement defines the
number of fractional decimal places that a numerical value can hold.

## Syntax

```
 precision num.constant
```

## Parameter(s)

| num.constant | Number of decimal places (from 0 to 9) that a numeric value can hold. |
| --- | --- |

## Description

The default precision is 4. The precision statement can be set in the range of
 0 to 9. Numbers with more decimal places than the precision are truncated on D3.

Only one precision statement is allowed in a program and it must precede the
 use of any numeric data. Programs calling subroutines or entering other programs must have the
 same precision.

 If the precisions do not match, the program aborts into the debugger. This restriction also
 applies to main programs that share data in named common space. However, violations in this case
 are not reported, and values of named common variables are incorrect.

- For certain arithmetic functions, higher precision limits the magnitude of the values returned.

- In D3, most functions have no limitation on their numeric range.

- Precision in the range of 1 to 9 handles numbers as 48-bit scaled binary numbers.

If the result of an arithmetic expression that
divides (/), multiplies (*), takes a remainder (\), or produces an
exponent (^) exceeds the maximum magnitude of the 48-bit representation,
the system creates an internal variable type that uses a precision
of 18 digits to the right of the decimal point, and unlimited to the
left. This feature assures maximum accuracy.

A precision of
0 forces 48-bit integer arithmetic for all operations. (99999/100000
results in a 0).

## Example(s)

This statement changes this program’s
arithmetic precision to 2. All subroutines called from this program
must have the same precision statement.

```
 precision 2
```
Example

```
 precision 6
 print 9999999/10000000
```
Output Result

```
 0.999999
```

## See also

- [* arithmetic operator](https://d3codex.com/pickbasic-flashbasic/asterisk-arithmetic-operator/)
- [*= assignment operator](https://d3codex.com/pickbasic-flashbasic/asterisk-equals-assignment-operator/)
- [+ arithmetic operator](https://d3codex.com/pickbasic-flashbasic/plus-arithmetic-operator/)
- [+= assignment operator](https://d3codex.com/pickbasic-flashbasic/plus-equals-assignment-operator/)
- [- arithmetic operator](https://d3codex.com/pickbasic-flashbasic/minus-arithmetic-operator/)
- [-= assignment operator](https://d3codex.com/pickbasic-flashbasic/minus-equals-assignment-operator/)
- [/= assignment operator](https://d3codex.com/pickbasic-flashbasic/slash-equals-assignment-operator/)
- [\= assignment operator](https://d3codex.com/pickbasic-flashbasic/backslash-equals-assignment-operator/)
- [:= assignment operator](https://d3codex.com/pickbasic-flashbasic/colon-equals-assignment-operator/)
- [Arithmetic operators](https://d3codex.com/pickbasic-flashbasic/arithmetic-operators/)
- [Boolean evaluation](https://d3codex.com/pickbasic-flashbasic/boolean-evaluation/)
- [call statement](https://d3codex.com/pickbasic-flashbasic/call-statement/)
- [chain statement](https://d3codex.com/pickbasic-flashbasic/chain-statement/)
- [common statement](https://d3codex.com/pickbasic-flashbasic/common-statement/)
- [enter statement](https://d3codex.com/pickbasic-flashbasic/enter-statement/)
- [int() function](https://d3codex.com/pickbasic-flashbasic/int-function/)
- [ln() function](https://d3codex.com/pickbasic-flashbasic/ln-function/)
- [Relational operators](https://d3codex.com/pickbasic-flashbasic/relational-operators/)
- [rnd() function](https://d3codex.com/pickbasic-flashbasic/rnd-function/)
- [Statements and functions](https://d3codex.com/pickbasic-flashbasic/statements-and-functions/)
- [subroutine statement](https://d3codex.com/pickbasic-flashbasic/subroutine-statement/)

---
Source: https://d3codex.com/pickbasic-flashbasic/precision-statement/ - part of the D3Codex reference.
