[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] asStringPrec



AFAIK it should be str[256];
i committed the fix ...

cheers.
Jan

nescivi <nescivi@xxxxxxxxx> schrieb:

> Hiho,
> 
> seems simple to fix: in the source code:
> 
> int prFloat_AsStringPrec(struct VMGlobals *g, int numArgsPushed);
> int prFloat_AsStringPrec(struct VMGlobals *g, int numArgsPushed)
> {
> 	PyrSlot *a = g->sp - 1;
> 	PyrSlot *b = g->sp;
> 	
> 	int precision;
> 	int err = slotIntVal(b, &precision);
> 	if (err) return err;
> 	
> 	char fmt[8], str[32];
> 	sprintf(fmt, "%%.%dg", precision);
> 	sprintf(str, fmt, a->uf);
> 	
> 	PyrString *string = newPyrString(g->gc, str, 0, true);
> 	SetObject(a, string);
> 	return errNone;
> 	
> }
> 
> the str[32] is the problem. It should be a larger string. To what
> should I set it?
> 
> sincerely,
> Marije
> 
> On 11/14/07, nescivi <nescivi@xxxxxxxxx> wrote:
> > crashes here too.
> > (on linux, and intel).
> >
> > m
> >
> > On 11/13/07, Scott Wilson <i@xxxxxxxxxxxxxx> wrote:
> > > I'm on intel.
> > >
> > > S.
> > >
> > > On 13 Nov 2007, at 21:32, Dan Stowell wrote:
> > >
> > > > You know, I don't get this happening. I'm on a PPC Powerbook, svn
> > > > rev 6611.
> > > >
> > > > pi.asStringPrec(41)
> > > > 3.1415926535897931159979634685441851615906
> > > > pi.asStringPrec(43)
> > > > 3.141592653589793115997963468544185161590576
> > > > pi.asStringPrec(47)
> > > > 3.1415926535897931159979634685441851615905761719
> > > > pi.asStringPrec(46)
> > > > 3.141592653589793115997963468544185161590576172
> > > > pi.asStringPrec(53)
> > > > 3.141592653589793115997963468544185161590576171875
> > > > pi.asStringPrec(150)
> > > > 3.141592653589793115997963468544185161590576171875
> > > >
> > > > Are you both trying it on intel Macs? May be a hitherto-undiscovered
> > > > intel thing.
> > > >
> > > > Dan
> > > >
> > > >
> > > > 2007/11/13, Scott Wilson <i@xxxxxxxxxxxxxx>:
> > > >> Hi Jesper,
> > > >>
> > > >> I get quite strange behaviour:
> > > >>
> > > >> pi.asStringPrec(41)
> > > >> 3.141592653589793115997963468544185161590615906
> > > >> pi.asStringPrec(43)
> > > >> 43
> > > >> pi.asStringPrec(47)
> > > >> 47
> > > >> pi.asStringPrec(46) // crashes!!
> > > >>
> > > >>
> > > >> Looks like a bug to me.
> > > >>
> > > >> S.
> > > >>
> > > >> On 11 Nov 2007, at 09:16, Jesper Elén wrote:
> > > >>
> > > >> Hi, seems that asStringPrec with numbers
> > > >> higher than 46 crashes SC. like ex. pi.asStringPrec(47)
> > > >> Same for anybody else?
> > > >>
> > > >> Regards Jesper
> > > >> _______________________________________________
> > > >> sc-users mailing list
> > > >> sc-users@xxxxxxxxxxxxxxx
> > > >> http://www.create.ucsb.edu/mailman/listinfo/sc-users
> > > >>
> > > >> _______________________________________________
> > > >> sc-users mailing list
> > > >> sc-users@xxxxxxxxxxxxxxx
> > > >> http://www.create.ucsb.edu/mailman/listinfo/sc-users
> > > >>
> > > >>
> > > >
> > > >
> > > > --
> > > > http://www.mcld.co.uk
> > > >
> > > > _______________________________________________
> > > > sc-users mailing list
> > > > sc-users@xxxxxxxxxxxxxxx
> > > > http://www.create.ucsb.edu/mailman/listinfo/sc-users
> > >
> > >
> > >
> > > _______________________________________________
> > > sc-users mailing list
> > > sc-users@xxxxxxxxxxxxxxx
> > > http://www.create.ucsb.edu/mailman/listinfo/sc-users
> > >
> >
> 
> _______________________________________________
> sc-users mailing list
> sc-users@xxxxxxxxxxxxxxx
> http://www.create.ucsb.edu/mailman/listinfo/sc-users
>