Overview

isinf

isinf is useful for detecting overflow conditions or division-by-zero results in computed columns. Unlike isfinite, which also catches NaN values, isinf specifically targets infinite results, allowing you to distinguish overflow from undefined computations.

Usage#

Syntax#

isinf(x)

Parameters#

Name Type Required Description
x real Yes The numeric value to check.

Returns#

true if x is positive or negative infinity. false for finite values and NaN.

  • isfinite: Returns true for values that are neither infinite nor NaN. Use it for a broader check covering all invalid float states.
  • isnan: Returns true only for NaN values. Use it alongside isinf to detect the other class of invalid float.
  • isint: Returns true for integer values. Use it when you need to validate that a value is a whole number.
  • not: Reverses a boolean value. Use not(isinf(x)) as a shorthand for isfinite(x) when NaN values aren't a concern.
  • log: Returns the natural logarithm. Compute log on potentially zero or negative values and use isinf to detect the resulting -inf.

Other query languages#

Splunk SPL users

Splunk SPL doesn't have a direct isinf() function. You typically check whether a value equals a specific infinity representation, which isn't directly available in most SPL expressions.

Splunk example

| eval is_inf = if(value = 'Infinity' OR value = '-Infinity', 1, 0)

APL equivalent

['sample-http-logs']
| extend is_inf = isinf(value)
ANSI SQL users

Standard SQL does not define an ISINF() function. Most SQL databases raise an error on division by zero rather than producing infinity, so there is no direct equivalent.

SQL example

-- Division by zero raises an error in most SQL dialects; no direct ISINF() equivalent
SELECT CASE WHEN value > 1e308 OR value < -1e308 THEN 1 ELSE 0 END AS is_inf FROM logs

APL equivalent

['sample-http-logs']
| extend is_inf = isinf(value)

Updated

Was this page helpful?