Esempio n. 1
0
char	*m_apm_to_fixpt_stringexp_mt(int dplaces, M_APM atmp, char ch_radx, 
				char ch_sep, int ct_sep)
{
char 	*s;

	m_apm_enter();
	s=m_apm_to_fixpt_stringexp(dplaces,atmp,ch_radx,ch_sep,ct_sep);
	m_apm_leave();
	return(s);
}
Esempio n. 2
0
static int Btostring(lua_State *L)		/** tostring(x,[n,exp]) */
{
 char *s;
 M_APM a=Bget(L,1);
 int n=luaL_optint(L,2,DIGITS);
 if (lua_toboolean(L,3))
 {
  int m=(n<0) ? m_apm_significant_digits(a) : n;
  s=malloc(m+16);
  if (s!=NULL) m_apm_to_string(s,n,a);
 }
 else
  s=m_apm_to_fixpt_stringexp(n,a,'.',0,0);
 lua_pushstring(L,s);
 if (s!=NULL) free(s);
 return 1;
}