[Toybox] toysh math.

Rob Landley rob at landley.net
Mon Mar 30 18:40:47 PDT 2020


I kinda wanna make $((1.0+2.3)) work in toysh, which means using double, but I
have TOYBOX_FLOAT in Config.in allowing me to disable floating point support for
work on really tiny embedded systems. (Although would those have a shell prompt?)

I suppose I can cheat via:

#if TOYBOX_FLOAT
#include <math.h>
#else
#define double long long
#define NAN LLONG_MIN
#define isnan(x) (x == LLLONG_MIN)
#endif

But that's really ugly.

(Also, I want a way to have $SECONDS show fractional time, but changing the
existing format would break scripts, and defining a new $NANOSECONDS would break
scripts. I suppose I could "declare -m NANOSECONDS" to enable it... :)

Ok, not _now_. Tangent, throw on todo list, back to it later.

Rob


More information about the Toybox mailing list