Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Flatly)
  • No Skin
Collapse
Brand Logo

NetXMS Forum

  1. Home
  2. Support
  3. NXLS Script returns bad sum values

NXLS Script returns bad sum values

Scheduled Pinned Locked Moved Support
3 Posts 1 Posters 35.8k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M
    M
    Mystery
    wrote on last edited by
    #1

    Hello guys,

    I have one question about scripting in NetXMS. I wrote script, which simply sum three values and return this result.

    val1 = GetDCIValueByDescription ...
    val2 = GetDCIValueByDescription ...
    val3 = GetDCIValueByDescription ...

    return val1 + val2 + val3;

    When I return val1 or val2 or val3 it returns right number, but when I sum these values, it returns negative incorrect value.
    For example val1 = 200.50 val2 = 700.56 and val3 = 1500. When I sum it, it returns -1400 ... That's very strange ...
    I thought it could be due to overflow of float value, but somehow it works correctly on different servers with higher values.

    Any idea how to solve this or debug this?? Thank you in advance


    val.GIF

    1 Reply Last reply
    0
    • M
      M
      Mystery
      wrote on last edited by
      #2

      Well,

      return val1 / 1000 + val2 /1000 + val3 /1000;

      returns correct numbers (/1000 lower ofc), so it has to be something with overflow ...

      1 Reply Last reply
      0
      • M
        M
        Mystery
        wrote on last edited by
        #3

        Ok, I solved it by:

        return real(GetDCIValueByDescription.....

        and also by val1 = real(GetDCI ...

        1 Reply Last reply
        0

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        Powered by NodeBB Contributors
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups