[GRASS-git] [OSGeo/grass] 71d952: i.smap: fix possible pole error with log in extrac...

Mohan Yelugoti noreply at github.com
Sat Aug 9 16:25:25 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/OSGeo/grass
  Commit: 71d952fbddcf06ad27cb9e927bdd1260e88d1304
      https://github.com/OSGeo/grass/commit/71d952fbddcf06ad27cb9e927bdd1260e88d1304
  Author: Mohan Yelugoti <ymdatta.work at gmail.com>
  Date:   2025-08-09 (Sat, 09 Aug 2025)

  Changed paths:
    M imagery/i.smap/model.c

  Log Message:
  -----------
  i.smap: fix possible pole error with log in extract function (#4499)

Using logarithm function call with zero argument will lead to
a pole error, which occurs if the mathematical function has
an exact infinite result.

Refactor the conditional to only execute the code when number
of subclasses are more than 1, which would preemptively stop
us from getting into situation where log would have a zero
argument. In cases where number of subclasses are <= 0, set
the default value to 0. This is necessary as `ll` points to
malloc'd memory and can contain random value.

Signed-off-by: Mohan Yelugoti <ymdatta.work at gmail.com>



To unsubscribe from these emails, change your notification settings at https://github.com/OSGeo/grass/settings/notifications


More information about the grass-commit mailing list