Hello, I am testing the syntax of python on xcas
According to https://docs.python.org/3.7/library/std ... pesnumeric
Says
Also referred to as integer division. The resultant value is a whole integer, though the result’s type is not necessarily int. The result is always rounded towards minus infinity: 1//2 is 0, (-1)//2 is -1, 1//(-2) is -1, and (-1)//(-2) is 0.
xcas have to emulate floored quotient =)
https://en.wikipedia.org/wiki/Modulo_operation
Syntax Python: x // y floored quotient of x and y
Modérateur : xcasadmin
-
- Messages : 563
- Inscription : sam. févr. 04, 2017 11:34 pm
- Localisation : Colombia
- Contact :
Re: Syntax Python: x // y floored quotient of x and y
It does in Python compat mode, at least for positive values of b (I don't really care of negative values of b).
-
- Messages : 563
- Inscription : sam. févr. 04, 2017 11:34 pm
- Localisation : Colombia
- Contact :
Re: Syntax Python: x // y floored quotient of x and y
// is interpreted as iquo cmd,
I think it is important to define a new function flooredMod() on xCAS, which include negative values of b and decimal numbers
pyhton
-5.5//3 returns -2
PD: to emulate output, on the xor operator
Python:
True^True returns False
Xcas Syntax Python
python_compat(2) and (^==Xor)
True^True returns 0 => false =)
I think it is important to define a new function flooredMod() on xCAS, which include negative values of b and decimal numbers
pyhton
-5.5//3 returns -2
PD: to emulate output, on the xor operator
Python:
True^True returns False
Xcas Syntax Python
python_compat(2) and (^==Xor)
True^True returns 0 => false =)
Re: Syntax Python: x // y floored quotient of x and y
fmod(a,b) returns a mod b for floats.