wishi
wishi

Reputation: 7387

How can I get a correct decimal results for a Python modulo operation (without extra libs)?

I am trying to get a correct decimal (not scientific) expression for the following equation. It seems, by default, Python prints the scientific notation. I am using Python on an embedded system, so I cannot easily install libs. I am looking for a default way to get the correct result.

>>> 4292739359**(-1) % 4292739360
2.329514830439068e-10

The correct expression is 4292739359. Python seems to show different results.

Upvotes: 1

Views: 79

Answers (1)

wim
wim

Reputation: 362458

The Python equivalent is using pow:

>>> pow(4292739359, -1, 4292739360)
4292739359

Upvotes: 1

Related Questions