Skip to content
Snippets Groups Projects
Commit 42418dec authored by Pranay Gupta's avatar Pranay Gupta
Browse files

support for converting double values to nbx display string added

parent c7a99e64
No related branches found
No related tags found
No related merge requests found
......@@ -13,6 +13,12 @@
#include <math.h>
#define IEM_GUI_COLOR_EDITED 0xff0000
#if PD_FLOATSIZE == 32
#define MY_NUMBOX_FLOAT_SPECIFIER "%.6g"
#elif PD_FLOATSIZE == 64
#define MY_NUMBOX_FLOAT_SPECIFIER "%.14lg"
#endif
extern int gfxstub_haveproperties(void *key);
static void my_numbox_draw_select(t_my_numbox *x, t_glist *glist);
static void my_numbox_key(void *z, t_floatarg fkey);
......@@ -64,7 +70,7 @@ void my_numbox_ftoa(t_my_numbox *x)
double f=x->x_val;
int bufsize, is_exp=0, i, idecimal;
sprintf(x->x_buf, "%g", f);
sprintf(x->x_buf, MY_NUMBOX_FLOAT_SPECIFIER, f);
bufsize = strlen(x->x_buf);
if(bufsize >= 5)/* if it is in exponential mode */
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment