Pip
Pip

Reputation: 95

What does %% mean?

From the question you can probably tell that I don't know much about code! My question is this:

What does this code mean?

mnlong <- 280.460 + .9856474 * time
mnlong <- mnlong %% 360
mnlong[mnlong < 0] <- mnlong[mnlong < 0] + 360

I understand that the mnlong and time are variables but the %% confuses me.

Could someone give me a basic description?

Upvotes: 3

Views: 6265

Answers (2)

dhn
dhn

Reputation: 206

Taking an educated guess that the language here is either R or S/Splus. As others have said: %% is the mod operator.

Upvotes: 5

sharptooth
sharptooth

Reputation: 170489

It's most likely that %% means integer division by modulo - the result is within 0..360 range. It's used for cases when some value can't get out of some reasonable range like longitute fo example that can be only within 0..360 degrees.

Upvotes: 6

Related Questions