SalNumberMod with negative numbers

Discussion forum about all things Gupta, OpenText and the community.
brunocheles
Brazil
Posts: 2
Joined: 22 Jun 2022, 18:17
Location: Ribeirão Preto - Brazil

SalNumberMod with negative numbers

Post by brunocheles » 27 Jun 2022, 15:06

Hello Everyone!

I'm have a problem with TD7.4.3. I'm trying to execute the function SalNumberMod with negative numbers[Example: SalNumberMod(-10, 1)], but always return the same number(in this example, always return -10).
Anyone knows whats happening?

Sorry about my english grammar errors, my english isn't good.

Michael Ehehalt
Germany
Posts: 72
Joined: 13 Mar 2017, 09:17
Location: Frankfurt, Germany

Re: SalNumberMod with negative numbers

Post by Michael Ehehalt » 28 Jun 2022, 06:02

Hi brunocheles,

checked this with TD 7.4.1. The results are ok:

Code: Select all

SalNumberMod(-10, 1) => 0
SalNumberMod(-10, 4) => -2
SalNumberMod( 10, 4) => 2
It seems this is a TD 7.4.3 problem?!
Best regards,
Michael Ehehalt

thomas.uttendorfer
Site Admin
Site Admin
Germany
Posts: 286
Joined: 05 Mar 2017, 17:19
Location: Munich Germany

Re: SalNumberMod with negative numbers

Post by thomas.uttendorfer » 28 Jun 2022, 07:44

Hi brunocheles,

I do not see this error with TD7.4.3. Build 67790:
SalNumberMod_Td743.png
Regards Thomas
You do not have the required permissions to view the files attached to this post.
Thomas Uttendorfer
[ frevel & fey ] Software-System GmbH
https://thomasuttendorfer.wordpress.com/

Igor Ivanovic
Site Admin
Site Admin
Croatia
Posts: 1462
Joined: 05 Mar 2017, 12:37
Location: Zagreb, Croatia

Re: SalNumberMod with negative numbers

Post by Igor Ivanovic » 28 Jun 2022, 07:55

There is no problem in TD 7.4.3, the results are correct.
The function SalNumberMod uses the so called truncated division to calculate the modulo, in which the sign of the result depends on the sign of the dividend (the first parameter of the function).
If for some reason you need the absolute value, use

Code: Select all

Set nResult = SalNumberMod( SalNumberAbs( -10 ), 4 )
Igor Ivanovic
Image

brunocheles
Brazil
Posts: 2
Joined: 22 Jun 2022, 18:17
Location: Ribeirão Preto - Brazil

Re: SalNumberMod with negative numbers

Post by brunocheles » 28 Jun 2022, 13:31

Hello guys,

I've written the wrong version.
I'm using TD7.4.2 Build 67386 and I've finally found the problem.
For some reason the dll 'cdlli74.dll' in that version caused this error to me.
I've tried the same thing in TD7.4.1 and worked normally.

Return to “General Discussion”

Who is online

Users browsing this forum: [Ccbot] and 0 guests