Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
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|