INTEGER() function command

Messages in english

Modérateur : xcasadmin

compsystems
Messages : 561
Inscription : sam. févr. 04, 2017 11:34 pm
Localisation : Colombia
Contact :

INTEGER() function command

Message par compsystems » jeu. nov. 29, 2018 2:11 pm

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

parisse
Messages : 5739
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: INTEGER() function command

Message par parisse » jeu. nov. 29, 2018 2:45 pm

integer does not exist in Python, it's int, and it's already in Xcas if you select Python syntax compatibility.

compsystems
Messages : 561
Inscription : sam. févr. 04, 2017 11:34 pm
Localisation : Colombia
Contact :

Re: INTEGER() function command

Message par compsystems » jeu. nov. 29, 2018 4:15 pm

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)

parisse
Messages : 5739
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: INTEGER() function command

Message par parisse » jeu. nov. 29, 2018 5:30 pm

int does that in Python mode. Please check before asking.

Répondre