[Er...] Posted July 2, 2018 Share Posted July 2, 2018 I was trying to do some complex calculations in pcm, instead of exporting data to an external program written in fortrun 200 years ago by some one who most likely are dead now. The only documentation available stated that calculation shall be done in binary due to precision issues in double with some of the math I cant access due to source code missing. (Well, that might not be true, but I don't really know what's going on in the external program. Only that it is used for strain and life length determination.) And I really don't like to change the whole concept since it's proven to work for the last 40 years or so. So what I needed was a way to convert binary to double, so once I sent the info to the program, calculations are done and all I get as a result is binary. So as a "fun" challenge, How would you convert lets say: "111010110111100110100010101" and "00000111010110111100110100010101" back to "123456789". You are only allowed to use PCM. Link to comment Share on other sites More sharing options...
[No...] Posted July 2, 2018 Share Posted July 2, 2018 I'd rather shoot myself in the foot before I'd even think about trying something like this with PCM 🤣 🤣 🤣 I trust you haven't used any fancy 'undocumented' stuff? 😉 Link to comment Share on other sites More sharing options...
[Er...] Posted July 3, 2018 Author Share Posted July 3, 2018 Yeah, I kind of figured. It really falls out side of CMM programing, but can actually be helpful in some very limited fields. And I hoped that some one else was forced to do very weird stuff. 😉 Any way. This finally got me to understand why you cant assign variable names starting with a integer. A question I've asked everyone at Zeiss I ever met. But never got an answer to. So let me be the messenger, like Jesus if you wish. It all ends up on how Arithmetic values are "read" in the software. Or numbers to be more specific. And since there actually exist a radix function, the "first" number in a line is to tell what base it belongs to. Where 2 is binary. Since binary only contains 0 and 1. Two different numbers. 8 is octal 0 to 7. 10 is everyone familiar with, right? No? 0-9, yes the decimal system. 16 the Hex, and loads of more that I've never heard of... Well so to convert the binary number of 111010110111100110100010101 we need to start to compare what number that's next to each other. So my very first rough approach was something like this: string="111010110111100110100010101" for i = 1 to string.capacity binContainer[i]=subStr(string,i,i).asInteger next i for i = 1 to string.capacity convert = 0 j=i+1 if i <> string.capacity if binContainer[j] < 0 or binContainer[j] == binContainer[i] convert = convert * binContainer[i] + binContainer[j] endif endif next i Some one might see where this is going.. But I stumbled upon something while storing temporary variables. Like: abc=111010110111100110100010101 As you can see the value is not the same when recollected. That caused some, lets say "confusion". While testing weird stuff I stumbled upon 666. That I know origins from 29a in the hex system. (Yeah, it was fun to play with calculators in school..) So, the conclusion. Why cant you assign variables starting with integers? Cause leading integers tells the software what place-value notation that should be used. As I said before, 16 is hex, 2 is binary. And the "hidden" radix function I "stumbled" upon while receiving 666. is simply "r". So: 16r29a = 666 2r111010110111100110100010101 = 123456789 So this task that I tough would take weeks turned out to be really simple in the end. So even if you don't care. You can now at least shine when someone ask why variables can't start with a integer. Or convert binary, Hex or what ever else you wish, stupidly simple. And when Christmas arrives, remember me! I like expensive stuff 😃 Link to comment Share on other sites More sharing options...
[Is...] Posted January 2, 2019 Share Posted January 2, 2019 ... Link to comment Share on other sites More sharing options...
[Ri...] Posted January 2, 2019 Share Posted January 2, 2019 Please sign in to view this quote. You had me at jesus...hahaha also what he said. Please sign in to view this quote. Link to comment Share on other sites More sharing options...
[Er...] Posted January 4, 2019 Author Share Posted January 4, 2019 What company do you work for? Link to comment Share on other sites More sharing options...
[Is...] Posted January 4, 2019 Share Posted January 4, 2019 ... Link to comment Share on other sites More sharing options...
[Er...] Posted January 4, 2019 Author Share Posted January 4, 2019 Well, in that case. Heres the complete (the useful stuff) api of pcm. https://mega.nz/#!rSIVBABZ!yZAy77y_5A1RNiB9qsSdKz2om9YqtPVgDDi9gDyTmKc Link to comment Share on other sites More sharing options...
[Is...] Posted January 7, 2019 Share Posted January 7, 2019 ... Link to comment Share on other sites More sharing options...
[Is...] Posted January 30, 2019 Share Posted January 30, 2019 ... Link to comment Share on other sites More sharing options...
[To...] Posted January 31, 2019 Share Posted January 31, 2019 Please sign in to view this quote. Eric. You were so kind to post an "un-zipped" format before. I hate to beg.... How about a windows zipped file instead of winzip? Or, am I asking too much? Link to comment Share on other sites More sharing options...
[Ma...] Posted January 31, 2019 Share Posted January 31, 2019 Tom, In windows just highlight the file and right click. Select 7-Zip and then choose open archive. Mark Link to comment Share on other sites More sharing options...
[Er...] Posted February 4, 2019 Author Share Posted February 4, 2019 Please sign in to view this quote. You're a quality guy, but you don't read documentation? Link to comment Share on other sites More sharing options...
[Da...] Posted February 4, 2019 Share Posted February 4, 2019 Please sign in to view this quote. Documentation is for software programmers only 😃 Link to comment Share on other sites More sharing options...
[Is...] Posted February 4, 2019 Share Posted February 4, 2019 ... Link to comment Share on other sites More sharing options...
[Er...] Posted February 4, 2019 Author Share Posted February 4, 2019 Oh, I forgot to update that. 🤣 The password is: friendofbenny Link to comment Share on other sites More sharing options...
[Is...] Posted February 4, 2019 Share Posted February 4, 2019 ... Link to comment Share on other sites More sharing options...
[Is...] Posted February 4, 2019 Share Posted February 4, 2019 ... Link to comment Share on other sites More sharing options...
[Is...] Posted July 17, 2019 Share Posted July 17, 2019 ... Link to comment Share on other sites More sharing options...
[Is...] Posted September 5, 2019 Share Posted September 5, 2019 ... Link to comment Share on other sites More sharing options...
[Kl...] Posted September 21, 2019 Share Posted September 21, 2019 Sorry this Editor do not Show square parentheses "" Code is inside text document Link to comment Share on other sites More sharing options...
[Er...] Posted September 23, 2019 Author Share Posted September 23, 2019 Similar to my first un-finished approach. But better 🙂 How ever, it doesn't beat the method I ended up using. display(compute("2r"+string.asInteger)) Link to comment Share on other sites More sharing options...
[Jo...] Posted November 14, 2019 Share Posted November 14, 2019 Please sign in to view this quote. Hi guys Looking for unsupported PCM syntax This file is not avaiable anymore. Can someone provide it ? Thanks a million. Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in