Path: utzoo!attcan!uunet!philmtl!altitude!pascal From: pascal@altitude.CAM.ORG (Pascal Gosselin) Newsgroups: comp.sys.mac.programmer Subject: Converting COMP to EXTENDED to STRING Summary: Converting with SANE Keywords: SANE CONVERSION FUNCTION PASCAL MPW Message-ID: <1990Jul22.180337.17771@altitude.CAM.ORG> Date: 22 Jul 90 18:03:37 GMT Distribution: comp Organization: None Lines: 46 Hi, I am presently trying to write a FUNCTION in MPW Pascal 3.1 that will input a 'real' of type COMP or INTEGER and output the equivalent value into a STRING. I've got it set up something like this at the moment: FUNCTION Number2Str(var ExtendedNumber:Extended):DecStr; Var TheNumber:DecStr; Begin DecimalFormat.Style:=FixedDecimal; DecimalFormat.Digits:=2; Num2Str(DecimalFormat,ExtendedNumber,TheNumber); Number2Str:=TheNumber; End; Now, everytime that I attempt to call this function with any REAL type (integer,comp,etc...), I get an error 125 'Invalid parameter passed to function' (I forget the exact wording) (this is during compilation). The chapter on SANE in the MPW Pascal manual states that "any function with a parameter declared as Extended may input any other real data type" (again, approximate wording, I don't have the manual next to me right now). I can get the function to work if I make it specific like: FUNCTION Number2Str(var CompNumber:COMP):Decstr; etc..... But that defeats the point, I want to make the routine generic. Why is it that SANE has built-on functions to convert almost anything EXCEPT from COMP to EXTENDED (or am I missing something???) ? I'm really stuck on this one, any info would be appreciated. -- +--------------------------------------------------------------------+ | Pascal Gosselin | Internet: pascal@altitude.CAM.ORG | | Gest-Mac Inc. Apple VAR | (514) 939-1127 CIS: 72757,1570 | +--------------------------------------------------------------------+