---
url: /dyad/stable/stdlib/BlockComponents/components/Math.RealToBoolean.md
description: Dyad Math.RealToBoolean docs.  Convert Real to Boolean signal.
---

# `Math.RealToBoolean` {#Math.RealToBoolean}

Convert Real to Boolean signal.

This block computes the Boolean output `y` from the Real input `u` by the equation:

```
y = u ≥ threshold
```

where `threshold` is a parameter.

This component extends from [`BlockComponents.Interfaces.PartialBooleanSO`](../types/Interfaces.PartialBooleanSO.md)

## Usage {#Usage}

`BlockComponents.Math.RealToBoolean(threshold=0.5)`

## Parameters: {#Parameters:}

|        Name |                                         Description | Units | Default value |
| -----------:| ---------------------------------------------------:| -----:| -------------:|
| `threshold` | Output signal y is true, if input u >= threshold |     – |           0.5 |

## Connectors {#Connectors}

* `y` - This connector represents a boolean signal as an output from a component ([`BooleanOutput`](/stdlib/Dyad/connectors/BooleanOutput#BooleanOutput))

* `u` - This connector represents a real signal as an input to a component ([`RealInput`](/stdlib/Dyad/connectors/RealInput#RealInput))

## Behavior {#Behavior}

$$ \begin{align}
y\left( t \right) &= u\left( t \right) \geq \mathtt{threshold}
\end{align}
$$

## Source {#Source}

````dyad
"""
Convert Real to Boolean signal.

This block computes the Boolean output `y` from the Real input `u` by the equation:

```
y = u ≥ threshold
```

where `threshold` is a parameter.
"""
component RealToBoolean
  extends BlockComponents.Interfaces.PartialBooleanSO
  "Connector of Real input signal"
  u = RealInput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -110, "y1": 450, "x2": -10, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  "Output signal y is true, if input u >= threshold"
  parameter threshold::Real = 0.5
relations
  y = u >= threshold
metadata {
  "Dyad": {
    "labels": [{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0}],
    "icons": {"default": "dyad://BlockComponents/RealToBoolean.svg"}
  }
}
end
````

````dyad
"""
Convert Real to Boolean signal.

This block computes the Boolean output `y` from the Real input `u` by the equation:

```
y = u ≥ threshold
```

where `threshold` is a parameter.
"""
component RealToBoolean
  "Connector of Boolean output signal"
  y = BooleanOutput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 1000, "y1": 450, "x2": 1100, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  "Connector of Real input signal"
  u = RealInput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -110, "y1": 450, "x2": -10, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  "Output signal y is true, if input u >= threshold"
  parameter threshold::Real = 0.5
relations
  y = u >= threshold
metadata {
  "Dyad": {
    "labels": [{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0}],
    "icons": {"default": "dyad://BlockComponents/RealToBoolean.svg"}
  }
}
end
````

## Test Cases {#Test-Cases}

No test cases defined.

## Related {#Related}

* Examples

* Experiments

* Analyses

* Tests
  * [`BooleanToInteger`](Math.RealToBoolean.md)

  * [`BooleanToReal`](Math.RealToBoolean.md)

  * [`Constant`](Math.RealToBoolean.md)

  * [`RealToBoolean`](Math.RealToBoolean.md)

  * [`RealToBoolean`](Math.RealToBoolean.md)

  * [`Sine`](Math.RealToBoolean.md)
