DataTypeConversion_to_Double DataTypeConversion_to_Double Icon

WIP.DataTypeConversion_to_Double

DataTypeConversion_to_Double(; saturate_on_overflow=false)

Converts a real-valued input signal into a double-precision floating-point value.

Parameters

  • saturate_on_overflow: When enabled, inputs outside the double representable range are clamped to +/- 1.797e+308 (default: false)

Variables

  • u(t): Real-valued input signal
  • y(t): Double-precision floating-point output

Description

Converts input to double-precision with floor rounding (fractional values rounded toward negative infinity). This block mimics Simulink's Data Type Conversion behavior when configured for double precision with Floor rounding.

Examples

to_double_floor(42.7, false)     → 42.0
to_double_floor(-3.2, false)     → -4.0
to_double_floor(1e12, false)     → 1.0e+12

Usage

PrimitiveComponents.WIP.DataTypeConversion_to_Double(saturate_on_overflow=false)

Parameters:

NameDescriptionUnitsDefault value
saturate_on_overflowfalse

Connectors

  • u - This connector represents a real signal as an input to a component (RealInput)
  • y - This connector represents a real signal as an output from a component (RealOutput)

Behavior

\[ \begin{align} y\left( t \right) &= to\_double\_floor\left( u\left( t \right), \mathtt{saturate\_on\_overflow} \right) \end{align} \]

Source

"""
    DataTypeConversion_to_Double(; saturate_on_overflow=false)

Converts a real-valued input signal into a double-precision floating-point value.

# Parameters
- `saturate_on_overflow`: When enabled, inputs outside the double representable range are clamped to +/- 1.797e+308 (default: false)

# Variables
- `u(t)`: Real-valued input signal
- `y(t)`: Double-precision floating-point output

# Description
Converts input to double-precision with floor rounding (fractional values rounded toward negative infinity).
This block mimics Simulink's Data Type Conversion behavior when configured for double precision with Floor rounding.

# Examples

todoublefloor(42.7, false) → 42.0 todoublefloor(-3.2, false) → -4.0 todoublefloor(1e12, false) → 1.0e+12

"""</span>
<span class="hljs-keyword">component</span> DataTypeConversion_to_Double
&nbsp;&nbsp;<span class="hljs-symbol">u</span> = <span class="hljs-link"><a href="https://help.juliahub.com/dyad/dev/stdlib/Dyad/connectors/RealInput.html">RealInput</a></span>() {
&nbsp;&nbsp;&nbsp;&nbsp;"Dyad": {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"placement": {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"diagram": {"x1": -40, "x2": 0, "y1": 480, "y2": 520, "sh": 1, "sw": 1, "rot": 0},
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"icon": {"x1": -40, "x2": 0, "y1": 480, "y2": 520, "sh": 1, "sw": 1, "rot": 0}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;}
&nbsp;&nbsp;<span class="hljs-symbol">y</span> = <span>Dyad.RealOutput</span>() {
&nbsp;&nbsp;&nbsp;&nbsp;"Dyad": {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"placement": {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"diagram": {"x1": 1000, "x2": 1040, "y1": 480, "y2": 520, "sh": 1, "sw": 1, "rot": 0},
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"icon": {"x1": 1000, "x2": 1040, "y1": 480, "y2": 520, "sh": 1, "sw": 1, "rot": 0}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;}
&nbsp;&nbsp;# Clamp to +/- 1.797e+308 if overflow occurs
&nbsp;&nbsp;<span class="hljs-keyword">parameter</span> <span class="hljs-symbol">saturate_on_overflow</span>::<span>Boolean</span> = false
<span class="hljs-keyword">relations</span>
&nbsp;&nbsp;y = to_double_floor(u, saturate_on_overflow)
<span class="hljs-keyword">metadata</span> {"Dyad": {"icons": {"default": "dyad://PrimitiveComponents/Convert.svg"}}}
<span class="hljs-keyword">end</span></code></pre>
Flattened Source
"""
    DataTypeConversion_to_Double(; saturate_on_overflow=false)

Converts a real-valued input signal into a double-precision floating-point value.

# Parameters
- `saturate_on_overflow`: When enabled, inputs outside the double representable range are clamped to +/- 1.797e+308 (default: false)

# Variables
- `u(t)`: Real-valued input signal
- `y(t)`: Double-precision floating-point output

# Description
Converts input to double-precision with floor rounding (fractional values rounded toward negative infinity).
This block mimics Simulink's Data Type Conversion behavior when configured for double precision with Floor rounding.

# Examples

todoublefloor(42.7, false) → 42.0 todoublefloor(-3.2, false) → -4.0 todoublefloor(1e12, false) → 1.0e+12

"""</span>
<span class="hljs-keyword">component</span> DataTypeConversion_to_Double
&nbsp;&nbsp;<span class="hljs-symbol">u</span> = <span class="hljs-link"><a href="https://help.juliahub.com/dyad/dev/stdlib/Dyad/connectors/RealInput.html">RealInput</a></span>() {
&nbsp;&nbsp;&nbsp;&nbsp;"Dyad": {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"placement": {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"diagram": {"x1": -40, "x2": 0, "y1": 480, "y2": 520, "sh": 1, "sw": 1, "rot": 0},
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"icon": {"x1": -40, "x2": 0, "y1": 480, "y2": 520, "sh": 1, "sw": 1, "rot": 0}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;}
&nbsp;&nbsp;<span class="hljs-symbol">y</span> = <span>Dyad.RealOutput</span>() {
&nbsp;&nbsp;&nbsp;&nbsp;"Dyad": {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"placement": {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"diagram": {"x1": 1000, "x2": 1040, "y1": 480, "y2": 520, "sh": 1, "sw": 1, "rot": 0},
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"icon": {"x1": 1000, "x2": 1040, "y1": 480, "y2": 520, "sh": 1, "sw": 1, "rot": 0}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;}
&nbsp;&nbsp;# Clamp to +/- 1.797e+308 if overflow occurs
&nbsp;&nbsp;<span class="hljs-keyword">parameter</span> <span class="hljs-symbol">saturate_on_overflow</span>::<span>Boolean</span> = false
<span class="hljs-keyword">relations</span>
&nbsp;&nbsp;y = to_double_floor(u, saturate_on_overflow)
<span class="hljs-keyword">metadata</span> {"Dyad": {"icons": {"default": "dyad://PrimitiveComponents/Convert.svg"}}}
<span class="hljs-keyword">end</span></code></pre>


Test Cases

No test cases defined.

  • Examples
  • Experiments
  • Analyses