Arithmetic - back to content

		+   	plus			-   	minus
		*   	multiplication		^   	power
		/   	division		// 	integer division	
		sqrt    square root		mod     N mod M is the remainder N/M

?- X is 5+4, Y is 5-4. X = 9 Y = 1 ?- X is 5*4, Y is 2^3. X = 20 Y = 8 ?- X is 234556^100. Error 0:Arithmetic Overflow ?- X is 5/3, Y=5//3. X = 1.66666667 Y = 1 ?- X is sqrt(3),Y is 3^0.5. X = 1.73205080756888 Y = 1.73205080756888 ?- X is 8 mod 3. X = 2 ?- Y is 10^3 * (1+1) + 3. Y = 2003 ?- halt. Exit from Prolog