Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
soloeeeoff
Contributor III
Contributor III

QlikView : mod( -4,3 ) returns 2

Hi,

Please could any one explain me why ?

mod( -4,3 ) returns 2

Thanks.

2 Replies
Frank_Hartmann
Master II
Master II

It's in detail explained here:

Euclidean division - Wikipedia, the free encyclopedia

In your example, the quotient would be -2 and the remainder 2:

-2*3 +2 = -4

Clever_Anjos
Employee
Employee

Mod() aka "remainder" is always positive by definition

Given two integers a and b, with b ≠ 0, there exist unique integers q and r such that

a = bq + r

and

0 ≤ r < |b|