Not every number a computer produces is a real number. The floating-point standard that SCADA systems use to store measurements includes a handful of special values, and two of them, NaN and infinity, represent the results of calculations that have no meaningful numeric answer. When a calculated tag produces one of these, it is not just a large or small reading, it is a value with poisonous behavior that can corrupt everything it touches. This guide explains where NaN and infinity come from, why they must be trapped and flagged as bad quality rather than stored as numbers, and how to guard against them.
NaN / Infinity Handling in one line: NaN, meaning not a number, and infinity are special values defined by the IEEE-754 floating-point standard for calculations that have no valid numeric result, such as dividing zero by zero, taking the logarithm of a negative number, or overflowing the range of the format. In a SCADA calculated tag they behave like poison, propagating through sums, averages, and displays and corrupting them, so they must be detected and flagged as bad quality rather than archived as if they were ordinary readings.
The measurements and calculated points in a SCADA system are almost always stored as floating-point numbers following the IEEE-754 standard, and that standard deliberately reserves certain bit patterns for results that are not ordinary numbers. Infinity appears when a calculation overflows the representable range or divides a nonzero value by zero, giving a positive or negative infinity to signal that the true answer is unboundedly large. NaN, short for not a number, appears when an operation has no defined numeric answer at all, such as zero divided by zero, infinity minus infinity, or the square root or logarithm of a negative number. These are not error codes bolted on afterward; they are legitimate floating-point values that arithmetic can produce and store.
In practice these values surface in derived and calculated tags rather than in raw measurements, because raw signals come through fixed scaling that keeps them in range. A calculated tag, by contrast, runs an expression combining several inputs, and that expression can wander into forbidden territory when its inputs take unexpected values. An efficiency that divides output by an input that has momentarily gone to zero, a logarithmic or square-root term applied to a signal that dipped negative because of noise, or a running product that grows past the format's limit will each yield NaN or infinity. The math itself is doing exactly what the standard says; the problem is that the result is meaningless as a process value.
What makes these values distinct from an ordinary bad reading is their behavior under further arithmetic, which is defined and contagious. Any operation involving a NaN produces a NaN, so a single NaN input to a formula makes the whole result a NaN. Infinity spreads almost as aggressively and can also collapse into NaN, for instance when infinity is subtracted from infinity. This propagation rule is precisely why a single poisoned value does not stay contained: it flows outward through every calculation that consumes it.
The danger of an untrapped NaN or infinity is not the one bad point but the wreckage it causes downstream. Because any arithmetic touching a NaN returns a NaN, a single poisoned sample flowing into an average turns the whole average into NaN, a single NaN in a total makes the total NaN, and a NaN feeding a control calculation can produce a nonsensical output. One meaningless value at the source therefore does not stay a single bad point; it silently converts every aggregate, trend, and derived figure that depends on it into a meaningless value too, often far from where the fault originated.
Displays and trends fail in confusing ways when handed these values. Depending on the client, a NaN might render as a blank, a placeholder, a garbled string, or a wildly out-of-scale point that distorts the axis of a trend so the real data becomes unreadable. Infinity can push a gauge or a chart to an absurd extreme. Because the underlying value is not a normal number, comparisons behave strangely too, since NaN is defined to be unequal to everything including itself, so alarm limit checks and sorting logic that assume ordinary numeric behavior can quietly do the wrong thing.
This is exactly why these values must be treated as a quality problem rather than a numeric one. Storing a NaN or infinity in the historian as if it were a reading means the poison is now permanent in the archive, and every future query that averages or totals over the period that contains it inherits the corruption. The correct handling is to detect the special value at the point it is produced, substitute a safe placeholder in the stored numeric slot, and set the tag's quality to bad so that every downstream consumer knows to exclude it. Marking it bad lets aggregation logic skip it cleanly instead of being infected by it.
The reliable way to keep NaN and infinity out of a system is to guard the calculation at the point it happens. A calculated-tag engine should test the result of each expression for the special floating-point values before it is committed, using an is-finite check that rejects both NaN and infinity in one step, and it should also guard the risky operations themselves, checking a denominator before dividing and checking the argument of a logarithm or square root before applying it. Guarding at the source is far cheaper than trying to scrub poisoned values out of aggregates after they have spread.
When a guard fires, the right response pairs a safe numeric substitution with an explicit quality change. The numeric slot is filled with something harmless, often the last good value or a defined default, so no consumer ever receives a raw NaN, and at the same time the tag's quality is set to bad or questionable to record that the number is not a real measurement. This separation matters: the substituted number keeps arithmetic and displays from breaking, while the bad-quality flag tells any correct consumer to exclude the point from totals, averages, and decisions. A substitution without a quality flag would hide the fault; a flag without a substitution would leave the poison in place.
For a cloud SCADA platform such as Merobix, trapping these values before they enter the historian is essential precisely because the platform's value is in the long-lived, centrally queried history it keeps for every tag. A single unguarded NaN written to the archive would corrupt every future rollup, dashboard, and report that spans the affected interval, and because many users query the same central data, the damage would be shared across the whole operation. By guarding calculated tags at ingestion, substituting a safe value, and stamping the point bad quality, the platform keeps the archive clean, lets aggregation cleanly skip the bad interval, and makes the fault visible as a quality event rather than an invisible poisoning of the numbers.
They come from floating-point operations that have no valid numeric result. Infinity arises from dividing a nonzero value by zero or overflowing the format's range, while NaN arises from truly undefined operations like zero divided by zero, infinity minus infinity, or the logarithm or square root of a negative number. In SCADA these surface in calculated tags whose input values wander outside the range the expression assumed.
Because NaN is contagious under the floating-point rules: any arithmetic that touches it returns another NaN. A single NaN flowing into an average makes the whole average NaN, a NaN in a total makes the total NaN, and it spreads to every trend and derived figure that depends on it. One meaningless value at the source therefore silently corrupts every aggregate downstream rather than staying a single bad point.
It should trap the value at the point the calculation produces it, using an is-finite check, then do two things together. First, substitute a safe number, such as the last good value or a default, into the stored slot so displays and arithmetic do not break. Second, set the tag's quality to bad or questionable so every downstream consumer excludes the point from totals and decisions rather than inheriting the poison.
Merobix reads your field devices into a cloud SCADA - the real thing behind these terms, live in days from any browser.