Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!wuarchive!csus.edu!ucdavis!csusac!csuchico.edu!RGOLDSTONE@OAVAX.CSUCHICO.EDU From: rgoldstone@OAVAX.CSUCHICO.EDU (Robin Goldstone) Newsgroups: comp.sys.mac.hypercard Subject: Re: more 2.0 probs - number precision, file operations Message-ID: <009407AF.3239D820@OAVAX.CSUCHICO.EDU> Date: 30 Nov 90 17:35:59 GMT References: <009406E0.A248D460@OAVAX.CSUCHICO.EDU>,<2786@ux.acs.umn.edu> Sender: news@ecst.csuchico.edu (USENET) Reply-To: rgoldstone@OAVAX.CSUCHICO.EDU (Robin Goldstone) Organization: California State University, Chico Lines: 40 In article <2786@ux.acs.umn.edu>, clarson@ux.acs.umn.edu (Chaz Larson) writes: >In article <009406E0.A248D460@OAVAX.CSUCHICO.EDU> I write: >|1) I have a card that represents an "invoice". The user fills in some >|stuff and my script calculates the total invoice amount (i.e. adds up item >|prices * quantities and calculates sales tax and total invoice amount). >|All of a sudden the user noticed that sales tax was not being computed >|correctly. Our sales tax is 6.025%. In my stack, I have: >| put .0625 into taxRate >|When I debug the script, the variable watcher shows that taxRate >|contains .06. Has something changed regarding default number precision? >|Where are my other two significant digits?! Do I have to somehow tell HC >|what precision I want? > >Do you have a "set numberformat to 0.00" statement in there somewhere? > Yes, as a matter of fact I do. I need that so that the amounts displayed on the invoice have two significant digits. I anaylzed this some more last night. When I first wrote the stack, I was under the assumption that numberFormat just affected the precision at which numbers were *displayed* not the precision at which they were *calculated*. And my assumption was validated by the fact that this worked as I had thought. With HC 1.2.5 I had numberFormat set to 0.00, I put .0625 in taxRate and everything was calculated correctly. I swear it is true!! I went back and double-checked some invoices that were done under HC 1.2.5. Sales tax was properly calculated at 6.25%. Now it is only being calculated at 6%. Nothing in my script has changed. All I did was install HC 2.0 and do a "convert stack". Looking at the HyperTalk 2.0 Reference Stack, it does seem to imply that numberFormat affects computation of variables, not just how they are displayed. So I feel that I misinterpreted it before. Yet it worked... So maybe it was HC 1.2.5 that was doing it wrong and HC 2.0 has actually fixed this. Any comments from Apple/Claris?! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | | Robin Goldstone, Systems Software Specialist | | California State University, Chico Computing Services | | rgoldstone@oavax.csuchico.edu | | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+