I'm not mathematically gifted, but shouldn't 957%60 be 15 remainder 57?

Google and my desktop calculator certainly think so.

So where am I going wrong here? The following code

 exten => 7,1,Verbose(Context: ${CONTEXT} Exten:${EXTEN})
    same => n,Set(myNum=957)
    same => n,Set(sec=$[REMAINDER(${myNum},60)])
    same => n,Set(sec=$[ABS(${sec})])
    same => n,Set(sec=$[${MATH(${sec}+0,i)}])
    same => n,Verbose(1,${myNum},${sec})
gives me

    -- Executing [7@fromvoipfone201:1] Verbose("PJSIP/6001-00000007",
"Context: fromvoipfone201 Exten:7") in new stack
Context: fromvoipfone201 Exten:7
    -- Executing [7@fromvoipfone201:2] Set("PJSIP/6001-00000007",
"myNum=957") in new stack
    -- Executing [7@fromvoipfone201:3] Set("PJSIP/6001-00000007",
"sec=-3") in new stack
    -- Executing [7@fromvoipfone201:4] Set("PJSIP/6001-00000007",
"sec=3") in new stack
    -- Executing [7@fromvoipfone201:5] Set("PJSIP/6001-00000007",
"sec=3") in new stack
    -- Executing [7@fromvoipfone201:6] Verbose("PJSIP/6001-00000007",
"1,957,3") in new stack

Where is -3 coming from?!?

I can flip it around by using ABS to stop people freaking out when
they hear a track is "15 minutes minus 3 seconds long", but it's still
incorrect, isn't it?

(I add the second MATH function to everything I do now to make it an
integer as it seems you never can tell with Asterisk, just ignore it!)

Any ideas? Thanks.

-- 
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Join the Asterisk Community at the 13th AstriCon, September 27-29, 2016
      http://www.asterisk.org/community/astricon-user-conference

New to Asterisk? Start here:
      https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to