Numeral system

Messages in english

Modérateur : xcasadmin

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

Numeral system

Message par compsystems » jeu. sept. 05, 2019 2:37 am

Hi BP,

can Xcas operate number bases ? And if so, what is the format?.
Bases most used
(2 Binary numeral system, 8 Octal system, 10 Decimal system, 16 Hexadecimal system)

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

Re: Numeral system

Message par parisse » jeu. sept. 05, 2019 7:54 am

You can input integers using the standard notations for base 2 (0b...), 16 (0x...), 8 (enter a leading 0 non significant digit). You can print integers in hexa or octal (select the right option in CAS configuration)

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

Re: Numeral system

Message par compsystems » jeu. sept. 05, 2019 8:51 pm

In the configuration of XCAS (PC installer), button [integer Basis], I do not see the option to display in binary, It is very important especially for professionals in computer science and electronics

What is the programming command (flag) to change the base display mode?

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

Re: Numeral system

Message par parisse » sam. sept. 07, 2019 6:50 am

There is no flag, display is purely UI. You can run convert(the_integer,base,2) to get the list of bits of an integer (reverse order).

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

Re: Numeral system

Message par compsystems » jeu. oct. 10, 2019 2:32 am

Hello BP, in the future you can include in the configuration: Integer base: 2. to be able to operate in the worksheet in binary base.

Répondre