Documentation

# `Dom`::`Float`

Real floating-point numbers

MuPAD® notebooks will be removed in a future release. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

## Syntax

```Dom::Float(`x`)
```

## Description

`Dom::Float` is the set of real floating-point numbers represented by elements of the domain `DOM_FLOAT`.

`Dom::Float` is the domain of real floating point numbers represented by expressions of type `DOM_FLOAT`.

`Dom::Float` has category `Cat::Field` out of pragmatism. This domain actually is not a field because `bool(1.0 = float(3) / float(3))` returns `FALSE` for example.

Elements of `Dom::Float` are usually not created explicitly. However, if one creates elements using the usual syntax, it is checked whether the input expression may be converted to a floating point number. This means `Dom::Float` is a facade domain which creates elements of domain type `DOM_FLOAT`.

Viewed as a differential ring `Dom::Float` is trivial, it contains constants only.

`Dom::Float` has the domain `Dom::Numerical` as its super domain, i.e., it inherits each method which is defined by `Dom::Numerical` and not implemented by `Dom::Float`. Methods described below are re-implemented by `Dom::Float`.

## Superdomain

`Dom::Numerical`

## Examples

### Example 1

Creating some floating-point numbers using `Dom::Float`. This example also shows that `Dom::Float` is a facade domain.

`Dom::Float(2.3); domtype(%)`
` `
` `
`Dom::Float(sin(2/3*PI) + 3)`
` `
`Dom::Float(sin(x))`
```Error: Invalid arguments. [Dom::Float::new] ```

### Example 2

By tracing the method `Dom::Float::testtypeDom` we can see the interaction between `testtype` and `Dom::Float::testtypeDom`.

```prog::trace(Dom::Float::testtypeDom): delete x: testtype(x, Dom::Float); testtype(3.4, Dom::Float); prog::untrace(Dom::Float::testtypeDom):```
```enter Dom::Float::testtypeDom(x, Dom::Float) computed FAIL ```
` `
``` enter Dom::Float::testtypeDom(3.4, Dom::Float) computed TRUE ```
` `

## Parameters

 `x` An expression which can be converted to a `DOM_FLOAT` by the function `float`.

## Entries

 "one" the unit element; it equals `1.0`. "zero" The zero element; it equals `0.0`.

## Methods

expand all

#### Mathematical Methods

`pivotSize(x)`

This method is called if this domain is used as the component ring of a matrix domain to perform Gaussian elimination.

`random()`

#### Conversion Methods

`convert(x)`

In general, if `float(x)` evaluates to a real floating-point number of type `DOM_FLOAT`, this number is the result of the conversion.

`convert_to(x, T)`

The following domains are allowed for `T`: `DOM_FLOAT`, `Dom::Float` and `Dom::Numerical`.

`testtype(x, T)`

In general this method is called from the function `testtype` and not directly by the user. Example 2 demonstrates this behavior.

#### Mathematical Modeling with Symbolic Math Toolbox

Get examples and videos