diff --git a/nshlib/nsh_proccmds.c b/nshlib/nsh_proccmds.c index 5a7dd93e5..ff168c692 100644 --- a/nshlib/nsh_proccmds.c +++ b/nshlib/nsh_proccmds.c @@ -455,17 +455,22 @@ static int ps_callback(FAR struct nsh_vtbl_s *vtbl, FAR const char *dirpath, nsh_output(vtbl, "%6.6d ", stack_size); nsh_output(vtbl, "%6.6d ", stack_used); - stack_filled = 0.0; + stack_filled = 0.0F; if (stack_size && stack_used) { - stack_filled = (100.0 / stack_size * stack_used); + stack_filled = 100.0F * stack_used / stack_size; } /* Additionally print a "!" if the stack is filled more than 80% */ +#ifndef LIBC_FLOATINGPOINT + nsh_output(vtbl, "%5d%%%s ", (int)stack_filled, (stack_filled >= 80 ? "!" : " ")); +#else nsh_output(vtbl, "%5.1f%%%s ", (double)stack_filled, (stack_filled >= 80 ? "!" : " ")); #endif +#endif + #ifdef NSH_HAVE_CPULOAD /* Get the CPU load */