Stateflow | ![]() ![]() |
Fixed-Point Context-Sensitive Constants
You can conveniently use fixed-point constants without using the data properties dialog or Stateflow Explorer, by using context-sensitive constants. Context-sensitive constants are constants that infer their types from the context in which they occur. They are written like ordinary constants, but have the suffix C
or c
. For example, the numbers 4.3C and 123.4c are valid fixed-point context-sensitive constants you can use in action language operations.
While fixed-point context-sensitive constants can be used in context with any types (for example, int32
or double
), the primary motivation for using them is with fixed-point numbers. The algorithm that computes the type to assign to a fixed-point context-sensitive constant depends on the operator, the types in the context, and the value of the constant. It provides a "natural" type, providing maximum accuracy without overflow.
![]() | Offline and Online Conversions of Fixed-Point Data | Supported Operations with Fixed-Point Operands | ![]() |