Page 1 sur 1

INTEGER() function command

Publié : jeu. nov. 29, 2018 2:11 pm
par compsystems
Hello BP, to give similarity to the Python syntax, please overload the INTEGER command

integer() as a function synonym of expr() and iPart() cmd

example
integer("42") [enter] 42
integer("1.25") [enter] 1

I note that the float command does operate in this way =)

float("3.14") [enter] 3.14
float(10) [enter] 10.0

Re: INTEGER() function command

Publié : jeu. nov. 29, 2018 2:45 pm
par parisse
integer does not exist in Python, it's int, and it's already in Xcas if you select Python syntax compatibility.

Re: INTEGER() function command

Publié : jeu. nov. 29, 2018 4:15 pm
par compsystems
Ok, but that the integer() command is available in xcas is also a good idea.

In addition, in some cases it is required to extract only the entire part of a number that is enclosed as a string.
integer("1.25") [enter] 1

About expr() cmd in the case of expr(5) return 5 and not expr(5)

Re: INTEGER() function command

Publié : jeu. nov. 29, 2018 5:30 pm
par parisse
int does that in Python mode. Please check before asking.