6.3.14 Transforming a string into a number: expr
The expr command transforms a string representing a valid
Xcas statement into the actual statement.
-
expr takes one argument:
str, a string corresponding to an Xcas statement.
- expr(str) evaluates the statement.
Examples.
-
Input:
expr("a:=1")
Output:
Then:
Input:
a
Output:
In particular, expr can transform a string representing a
number into the number (see Section 5.1).
- Input:
expr("123")
Output:
- Input:
expr("0123")
Output:
since 0123 represents a base 8 integer (see
Section 6.4.1) and 1· 82+2· 8+3=83.
- Input:
expr("0x12f")
Output:
since 0x12f represents a base 16 number and 1*162+2*16+15=303.
- Input:
expr("123.4567")
Output:
- Input:
expr("123e-5")
Output: