Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!decwrl!netcomsv!mcmahan From: mcmahan@netcom.COM (Dave Mc Mahan) Newsgroups: comp.sys.amiga.programmer Subject: Re: Please convert some Basic->C for me. Message-ID: <1991Jun25.044236.4614@netcom.COM> Date: 25 Jun 91 04:42:36 GMT References: <1991Jun24.213840.24630@wehi.dn.mu.oz> Organization: Dave McMahan @ NetCom Services Lines: 35 In a previous article, baxter_a@wehi.dn.mu.oz writes: >Could someone please help me with a conversion from Basic -> C. I thought >I knew a bit of Basic, but all these appended ampersands are a bit beyond >me! The ampersands are used to explicitly define a variable as a 32 bit integer. This is talked about in detail in the AmigaBASIC manual I got with my A2000. The page reference is 8-10. This is usually an attempt at squeezing a bit of speed out of a section of code, since it is faster to work with integers than it is to work with floating point numbers, which are the default type if you don't explicitly force some other convention. >Below is the program. The bit I need most is the proceedure lsq, >and an explanation of the arguents. It looks like the code is trying to do a least-squares fitting of the data. Why does it want to do this? I don't know. I'm not really wild about doing a conversion of code that is as long as you posted, but I'd be happy to answer some specific questions about what is going on and how you can re-code it yourself. It looks like the code is trying to do some curve fitting. It wants to come up with the coefficients to for a polynomial that can be used to re-create the entire curve based upon data it is passed in a file. Good luck, and send me any questions you have on a particular implentation problem. I'd be happy to give you my input. Make sure to send code segments you are in doubt about, as I'm not going to keep this file around. -dave -- Dave McMahan mcmahan@netcom.com {apple,amdahl,claris}!netcom!mcmahan