expr icon indicating copy to clipboard operation
expr copied to clipboard

Is it possible to use a wider data type than float with expr_eval()?

Open dipanjan opened this issue 7 years ago • 1 comments

Looks like the return type of expr_eval() is float which is 32 bit wide on my 64 bit system. Is it possible to use double which is of 64 bits while evaluating an expression?

dipanjan avatar Dec 03 '17 17:12 dipanjan

Well, expr.h is a single-header library, so you can probably copy it and find/replace all float with double to make it work.

Alternatively, you may replace float with some expr_num_t where appropriate. It would allow you to redefine expr_num_t as double if needed, or any other implementation like fixed-point C++ class with overloaded operators. I haven't thought that far, but I think it might be convenient in some cases.

If you decide to go with expr_num_t way - may I ask you to do a pull request then?

zserge avatar Dec 03 '17 23:12 zserge