MathException
Overview
Eliminates NaN and Inf from data
Discussion
This module detects NaN and Inf values in floating-point data and sets them to replacementValue. The module also keeps track of how many of each type of exception is detected. .infCount contains the number of Inf values seen (both positive and negative). .nanCount contains the number of NaN values see.
The module is useful for debugging mathematical errors such as divide by zero.
Module Pack
Advanced
ClassID
classID = 1295
Type Definition
typedef struct _ModuleMathException
{
ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure
INT32 nanCount; // Number of NaNs encountered
INT32 infCount; // Number of Infs encountered
FLOAT32 replacementValue; // NaN and Inf values are replaced with this number.
} ModuleMathExceptionClass;
Variables
Properties
| Name | Type | Usage | isHidden | Default Value | Range | Units |
|---|---|---|---|---|---|---|
| nanCount | int | state | 0 | 0 | Unrestricted | |
| infCount | int | state | 0 | 0 | Unrestricted | |
| replacementValue | float | parameter | 0 | 0 | Unrestricted |
Pins
Input Pins
| Name | in |
| Description | audio input |
| Data type | float |
| Channel range | Unrestricted |
| Block size range | Unrestricted |
| Sample rate range | Unrestricted |
| Complex support | Real and Complex |
Output Pins
| Name | out |
| Description | audio output |
| Data Type | float |
Matlab Usage
File Name: math_exception_module.m
M=math_exception_module(NAME)
This module eliminates NaN and Inf's from data and replaces them
with the parameter replacementValue. The module also counts how many NaN's and Inf's it
has replaced.
NAME - name of the module.
Copyright (c) 2026 DSP Concepts, Inc.