suivant: Write an integer in
monter: Strings
précédent: Transform an integer into
Table des matières
Index
Transform a string into a number : expr
Use expr, the parser with a string representing a number.
- For integers, enter the string representing the integer without
leading 0 for basis 10, with prefix 0x for basis 16,
0 for basis 8 or 0b for basis 2.
Input :
expr("123")
Output :
123
Input :
expr("0123")
Output :
83
Because :
1*82 + 2*8 + 3 = 83
Input :
expr("0x12f")
Output :
303
Because :
1*162 + 2*16 + 15 = 303
- For decimal numbers, use a string with a . or e inside.
Input :
expr("123.4567")
Output :
123.4567
Input :
expr("123e-5")
Output :
0.00123
- Note that expr more generally transforms a string
into a command if the command exists.
Input :
expr("a:=1")
Output :
1
Then, input :
a
Output :
1
suivant: Write an integer in
monter: Strings
précédent: Transform an integer into
Table des matières
Index
giac documentation written by Renée De Graeve and Bernard Parisse