Transforming a string into a number

### 5.2.15 Transforming a string into a number

The expr command transforms a string representing a valid Xcas statement into the actual statement.

- expr takes str, a string corresponding to an Xcas statement.
- expr(str) evaluates the statement.

#### Examples

expr("a:=1")

1 |  |  |  |  |  |  |  |  |  |

a

1 |  |  |  |  |  |  |  |  |  |

In particular, expr can transform a string representing a number into the number (see Section 3.1.1).

expr("123")

123 |  |  |  |  |  |  |  |  |  |

expr("0123")

83 |  |  |  |  |  |  |  |  |  |

since 0123 represents a base 8 integer (see Section 5.4.1) and 1· 82+2· 8+3=83.

expr("0x12f")

303 |  |  |  |  |  |  |  |  |  |

since 0x12f represents a base 16 number and 1· 162+2· 16+15=303.

expr("123.4567")

123.4567 |  |  |  |  |  |  |  |  |  |

expr("123e-5")

0.00123 |  |  |  |  |  |  |  |  |  |