# Make Pari-gp Return Integer Instead of Modulo

• a1call
In summary, there are a few reasons why you may want Pari-gp to return an integer instead of a modulo, such as convenience or the need for exact values. To make this change, you can use the 'floor' function, which returns the largest integer less than or equal to a given number. However, Pari-gp cannot return an integer for all calculations, and there may be a performance difference between using the modulo operator and the 'floor' function. Additionally, using the 'floor' function for all calculations may not always provide the desired result and could potentially be less efficient in certain cases.

#### a1call

Is there a way to make Pari-gp return an integer rather than another Modulo?

Can
Code:
(21:49) gp > Mod(1100,19)
%11 = Mod(17, 19)
return 17?
Sort of like Wolfram Alpha:
https://www.wolframalpha.com/input/?i=Mod[1100,19]

I got the answer on another board from a member nicknamed axn:
Code:
? 1100%19
%1 = 17
? lift( Mod(1100, 19) )
%2 = 17
? centerlift( Mod(1100, 19) )
%3 = -2

## 1. Why would I want Pari-gp to return an integer instead of a modulo?

There are a few reasons why you may want Pari-gp to return an integer instead of a modulo. One possible reason is that it may be more convenient for your specific application or calculation. Another reason could be that you need the exact integer value for further calculations or analyses.

## 2. How do I make Pari-gp return an integer instead of a modulo?

To make Pari-gp return an integer instead of a modulo, you can use the 'floor' function. This function takes a real number as an argument and returns the largest integer less than or equal to that number. For example, 'floor(5/2)' would return 2 instead of 1 (which would be the result if the modulo operator was used).

## 3. Can Pari-gp return an integer for all calculations?

No, Pari-gp cannot return an integer for all calculations. Some calculations inherently involve real numbers and will require the use of the modulo operator. However, for calculations involving integers, using the 'floor' function can ensure that an integer is returned.

## 4. Is there a performance difference between using the modulo operator and the 'floor' function?

Yes, there can be a performance difference between using the modulo operator and the 'floor' function. In general, the modulo operator is faster to compute than using the 'floor' function. However, the difference in performance may be negligible depending on the specific calculation and the size of the numbers involved.

## 5. Are there any potential drawbacks to using the 'floor' function to return integers instead of modulos?

One potential drawback of using the 'floor' function is that it may not always provide the desired result. For example, if the calculation involves negative numbers, the 'floor' function may not return the intended integer. Additionally, using the 'floor' function for all calculations may be less efficient and more cumbersome in certain cases.