Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

Chapter Contents
Chapter Introduction
NAG Toolbox

# NAG Toolbox: nag_machine_precision (x02aj)

## Purpose

nag_machine_precision (x02aj) returns $\epsilon$, the value machine precision.

## Syntax

[result] = x02aj
[result] = nag_machine_precision

## Description

nag_machine_precision (x02aj) returns machine precision, computed as $\epsilon =\frac{1}{2}×{b}^{1-p}$, where $b$ is the arithmetic base (see nag_machine_model_base (x02bh)) and $p$ is the number of significant base-$b$ digits (see nag_machine_model_digits (x02bj)).
It is important to note that the definition of $\epsilon$ here differs from that in ISO (1997).

## References

ISO (1997) ISO Fortran 95 programming language (ISO/IEC 1539–1:1997)

## Parameters

None.

None.

### Output Parameters

1:     $\mathrm{result}$ – double scalar
The result of the function.

None.

None.

None.

## Example

This example prints the values of all the functions in Chapter X02. The results will vary from one implementation of the Library to another.
```function x02aj_example

fprintf('x02aj example results\n\n');

fprintf('(results are machine-dependent)\n');

fprintf('\nThe basic parameters of the model\n\n');
fprintf('the model parameter B    (x02bh) = %8d\n', ...
x02bh);
fprintf('the model parameter P    (x02bj) = %8d\n', ...
x02bj);
fprintf('the model parameter Emin (x02bk) = %8d\n', ...
x02bk);
fprintf('the model parameter Emax (x02bl) = %8d\n', ...
x02bl);

fprintf('\nDerived parameters of floating-point arithmetic\n\n')
fprintf('the machine precision               (x02aj) = %21.15e\n', ...
x02aj);
fprintf('the smallest positive model number  (x02ak) = %22.15e\n', ...
x02ak);
fprintf('the largest positive model number   (x02al) = %22.15e\n', ...
x02al);
fprintf('the real safe range parameter       (x02am) = %22.15e\n', ...
x02am);
fprintf('the complex safe range parameter    (x02an) = %22.15e\n', ...
x02an);

fprintf('\nParameters of other aspects of the computing environment\n\n');
fprintf('largest argument of sin and cos (x02ah) = %20.8e\n', ...
x02ah);
fprintf('the largest positive integer    (x02bb) = %20d\n', ...
x02bb);
fprintf('precision in decimal digits     (x02be) = %20d\n', ...
x02be);

```
```x02aj example results

(results are machine-dependent)

The basic parameters of the model

the model parameter B    (x02bh) =        2
the model parameter P    (x02bj) =       53
the model parameter Emin (x02bk) =    -1021
the model parameter Emax (x02bl) =     1024

Derived parameters of floating-point arithmetic

the machine precision               (x02aj) = 1.110223024625157e-16
the smallest positive model number  (x02ak) = 2.225073858507201e-308
the largest positive model number   (x02al) = 1.797693134862316e+308
the real safe range parameter       (x02am) = 2.225073858507202e-308
the complex safe range parameter    (x02an) = 2.225073858507202e-308

Parameters of other aspects of the computing environment

largest argument of sin and cos (x02ah) =       1.42724769e+45
the largest positive integer    (x02bb) =  9223372036854775807
precision in decimal digits     (x02be) =                   15
```