expr
expr copied to clipboard
Is it possible to use a wider data type than float with expr_eval()?
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?
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?