# Difference between revisions of "Error Messages/40506"

## Example warning text

Variable Va3 computes the product INF*0, resulting in NaN (an indeterminant number).

## Cause

You probably know that any number multiplied by zero is zero, and that any positive number multiplied by infinity is infinity. But when you consider multiplying 0 times infinity, both of these cannot be true. In mathematics, the product of zero times infinity is indeterminant, or not defined. In Analytica (as well as in most software programs), the special numeric value NaN denotes an indeterminant number.

By employing limits, it is possible to construct theoretical mathematical constructions that imply a finite result for INF*0. For example, consider the function

$f(x) = tan(x) * x$

(Note: x here is in radians, whereas the Tan(x) function in Analytica expects x to be in degrees). At $x=\pi/2$, INF*0 occurs, so that $f(\pi/2)$ is not defined; however,

$\lim_{x\rightarrow \pi/2} f(x) = -1$

implying that the correct value here for INF*0 should be -1. But if you apply the same logic to $g(x)=2*f(x)$, you would conclude that the correct value for INF*0 ought to be -2. You can see that with different mathematical constructions, you can create a valid argument that any value you desire is the natural result of INF*0. Because the multiplication operator can't possibly know which theoretical mathematical construction should apply, it cannot possibly know what the "correct" result should be, and hence, this is why an indeterminate number is returned.

The IEEE 754 standard is a widely accepted standard for how floating point numbers should represented in a computer's memory, and how arithmetic operations should be carried out. Analytica follows the IEEE 754 standard, which stipulates that the special value INF multiplied by zero should be the special value NaN.

In Analytica 3.x and earlier, Analytica returned 0 for NaN*0. This was changed in Analytica 4.0 to comply with the IEEE 754 standard.

## Remedies

In some cases, you might use multiplication to zero out certain values, as in this example

(direction = 'East' Or direction = 'West')*distance

This is a valid and concise way of doing this, but only provided that distance is guaranteed to be finite. If there is any chance that distance could validly be INF, then you would need to use

If direction = 'East' Or direction = 'West' Then distance Else 0

Zeroing by multiplication does have the advantage that it will trigger this warning if an INF is encountered. This is an advantage in that you might catch an error in your model logic when a non-finite value would never occur.

## See Also

Comments

You are not allowed to post comments.