Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Turn negative into positive
Message
From
09/12/2013 14:00:51
 
 
To
09/12/2013 13:03:27
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01589528
Message ID:
01589588
Views:
50
>
>N = N-2*N  && this will do it but is there simply a function that will convert it.
>This assumes two's complement representation of integers and will fail on systems where you're dealing with one's complement representation. And if you think that sounds weird, in one's complement you can have positive and negative zero. Recall running into that once before on a Control Data mainframe when I had a Pascal program that called a routine written in FORTRAN and got weird results (code generated by the Pascal compiler assumed that zeroes were being normalized, whereas FORTRAN code tended to leave zero values non-normalized. Problem was easily fixed by calling an assembly-language routine that normalized values).
>
>And of course, changing a negative to a positive could be a simple matter of perspective. (^_-) ๐Ÿ˜‰ ๐Ÿ˜œ

I'm sorry - I don't see where the two's complement representation comes in. It's just arithmetic
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform