Get Started →
Common Warnings

NaNs produced

Matches: NaNs produced

WHAT THIS ERROR MEANS

A mathematical operation produced Not-a-Number results. This happens with operations like sqrt() on negative numbers or log() of zero/negative values.

HOW TO FIX IT

1. Check your input data for negative or zero values.

2. Filter or transform data before applying the function.

3. Use pmax() to clamp values: sqrt(pmax(x, 0)).

CODE EXAMPLES

BAD — THIS CAUSES THE ERROR
sqrt(-1)
log(-5)
GOOD — CORRECT APPROACH
sqrt(pmax(x, 0))  # clamp negatives to 0
log(pmax(x, 1e-10))  # avoid log of zero

Still stuck?

Paste your code in RChat and the AI will fix this error in context.

Try RChat Free →

RELATED COMMON WARNINGS