Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!decwrl!shelby!neon!kaufman From: kaufman@Neon.Stanford.EDU (Marc T. Kaufman) Newsgroups: comp.sys.mac.programmer Subject: Re: Converting COMP to EXTENDED to STRING Keywords: SANE CONVERSION FUNCTION PASCAL MPW Message-ID: <1990Jul24.041139.19261@Neon.Stanford.EDU> Date: 24 Jul 90 04:11:39 GMT References: <1990Jul22.180337.17771@altitude.CAM.ORG> <1861@krafla.rhi.hi.is> <1990Jul23.221417.24424@altitude.CAM.ORG> Distribution: comp Organization: Computer Science Department, Stanford University Lines: 24 In article <1990Jul23.221417.24424@altitude.CAM.ORG> pascal@altitude.CAM.ORG (Pascal Gosselin) writes: >aries@rhi.hi.is (Reynir Hugason) writes: -->FUNCTION Number2Str(var ExtendedNumber:Extended):DecStr; ->Your headache lies in the VAR part of your function declaration. The ->Pascal compiler can easily transform an INTEGER or a COMP to an ->Extended, but transforming an EXTENDED to an INTEGER is a bit harder ->than that. If that's what you want to do you'll have to use SANE's ->Num2Integer or Num2Comp. >No, I am trying to convert COMP to EXTENDED and INTEGER TO EXTENDED. The problem is that the "VAR" part means that the *ADDRESS* of the Extended is passed to the Function, so that it may be modified as a result. If this is not what you intend, and I don't think it is, try a prototype like: FUNCTION Number2Str(ExtendedNumber:Extended):DecStr; Not the lack of "var". In this case the parameter is passed by *VALUE*, and the compiler doesn't have to worry about how to store an Extended into an integer parameter passed by address. Marc Kaufman (kaufman@Neon.stanford.edu)