crepl

An intuitive calculator REPL.
git clone git://git.knutsen.co/crepl
Log | Files | Refs | README | LICENSE

commit bb97219da3d33b54472340e176df4f2ea8465e66
parent 90ddf985e0d10c284c0fd946af4985cd2f9d4801
Author: Demonstrandum <moi@knutsen.co>
Date:   Fri, 26 Jun 2020 11:38:03 +0100

Update todo.

Diffstat:
MREADME.md | 3+++
Msrc/parse.c | 8++++----
2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/README.md b/README.md @@ -27,8 +27,11 @@ sudo make install # Installs the program system wide. ``` ## TODO + - [ ] Imaginary numbers (using `complex.h`). - [ ] User defined functions. + - [ ] Extend factorial to positive reals and complex values using Gamma function. - [ ] Garbage collection. + - [ ] Numerical equation solver (polynomial, simultaneous, &c.). - [ ] Add more functionality, notably for calculus. - [ ] Symbol manipulation (?). - [ ] Extend numbers to include “Big Numbers” (“Big Integers” and “Big Decimals”/Rationals), numbers a currently limited to ~80bit floats and pointer-sized (likely 64bit) integeres. diff --git a/src/parse.c b/src/parse.c @@ -197,6 +197,9 @@ NumberNode *make_number(NumberType type, void *val) return num; } +// Parse number literals: +// e.g. 3, 8.2, 2E32, 3E+4, 1.6E-19, 0b010110, 0xff32a1, 0o0774, etc. +// TODO: Parse binary, hexadecimal and octal literals (0b, 0x, 0o). NumberNode *parse_number(const char *str) { NumberNode *number = malloc(sizeof(NumberNode)); @@ -250,10 +253,7 @@ NumberNode *parse_number(const char *str) } number->type = FLOAT; - fsize power_term = 1; - - fsize significand = strtold(str, NULL); - number->value.f = significand * power_term; + number->value.f = strtold(str, NULL); return number; }