# Simulate Casio S-VPAM calulator [closed]

It is 20th anniversary of Casio's S-VPAM calculators and it is worth celebrating.

Task: Process input string as Casio S-VPAM calculator does. The infix notation and precedence of mathematical operations must be followed. Angle values are expected in radians. Since there were multiple updates, sin 15, sin15 and sin(15 are equally parsed as sin(15) and spaces are thus ignored.

Input: String or Char array

Output: Array of 8-bit numbers representing the segments states on the 7-segment display

      A B C D E F G DP | representation | visualization
blank 0 0 0 0 0 0 0 0  |   0 / 00       | " " or "_"
minus 0 0 0 0 0 0 1 0  |   2 / 02       | "-"
0  1 1 1 1 1 1 0 0  | 252 / FC       | "0"
0. 1 1 1 1 1 1 0 1  | 253 / FD       | "0." or "0,"
1  0 1 1 0 0 0 0 0  |  96 / 60       | "1"
1. 0 1 1 0 0 0 0 1  |  97 / 61       | "1."
2  1 1 0 1 1 0 1 0  | 218 / DA       | "2"
2. 1 1 0 1 1 0 1 1  | 219 / DB       | "2."
3  1 1 1 1 0 0 1 0  | 242 / F2       | "3"
3. 1 1 1 1 0 0 1 1  | 243 / F3       | "3."
4  0 1 1 0 0 1 1 0  | 102 / 66       | "4"
4. 0 1 1 0 0 1 1 1  | 103 / 67       | "4."
5  1 0 1 1 0 1 1 0  | 182 / B6       | "5"
5. 1 0 1 1 0 1 1 1  | 183 / B7       | "5."
6  1 0 1 1 1 1 1 0  | 190 / BE       | "6"
6. 1 0 1 1 1 1 1 1  | 191 / BF       | "6."
7  1 1 1 0 0 0 0 0  | 224 / E0       | "7"
7. 1 1 1 0 0 0 0 1  | 225 / E1       | "7."
8  1 1 1 1 1 1 1 0  | 254 / FE       | "8"
8. 1 1 1 1 1 1 1 1  | 255 / FF       | "8."
9  1 1 1 1 0 1 1 0  | 246 / F6       | "9"
9. 1 1 1 1 0 1 1 1  | 247 / F7       | "9."
deg 1 1 0 0 0 1 1 0  | 198 / C6       | "o"
frac 0 0 1 1 0 0 0 0  |  48 / 30       | "/"
A B C D E F G DC | representation | visualization


Input string is split in substrings as follows:

X : number
decimal separator is either dot or comma, whatever comes first. Using both results in Syntax Error n : one-digit number or result in braces
command : string operator

Special commands:

• Power X^n: X to power n
• Root nsqrtX: nth root of X
• Exponent: XEY X times 10^Y
• Angles: XD return X degrees in radians; XG return X grads in degrees
• Degrees: XdYdZd return string in MoNoXo format. M is number of whole degrees(hours), N<60 number of whole minutes and X seconds (may be decimal) If part of command return as decimal value. Xd may be omitted returning 0oNoXo string instead
• Goniometric functions funX: 'function of X. -h suffix triggers hyperbolic function a- prefix triggers inverse function.
• Logarithms: lnX natural logarithm of X; logX decadic logarithm of X
• Fractions: X\Y,X\Y\Z: If XandYandZ are integers return "A/B" where A and B are lowest integers possible, otherwise return default format
• Combinatorics: X! Factorial of X; XCY Y-combinations of X; XPY Y-permutations of X. X and Y must be integer, otherwise return "Syntax error"
• Constants: pi, e
• Random number: Ran# return uniformally distributed value U(0,1)
• Absolute value: AbsX

Non-necessary zeros, multiplications and trailing brackets may be omitted

Test:

Input                   | Result HEX array                          | Result Visualized
1+6                     | 00 00 00 00 00 00 00 00 00 00 E0 00 00 00 | "          7   "
sin-.5pi                | 00 00 00 00 00 00 00 00 00 02 60 00 00 00 | "         -1   "
cosh180D                | 00 60 61 B6 F6 60 F6 B6 F2 DA FE 00 00 00 | " 11.59195328   "
piD                     | 00 00 F2 C6 FE C6 DA F7 E0 F2 C6 00 00 00 | "  3o8o29.73o   "
-25e-4sin 1-cos 59^(5-7 | 02 61 FC F2 60 B6 E0 E0 E0 66 F2 02 60 FC | "-1.031577743-10"


Rules:

Standard rules apply: Loopholes forbidden, the shortest answer in bytes win.

## closed as unclear what you're asking by user202729, JayCe, Laikoni, Jonathan Frech, FantaCSep 7 '18 at 18:22

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• Hello and welcome to PPCG! I see potential in this challenge, but as it stands it appears a bit rough around the edges. You could use the sandbox to fine tune your challenge and get community input on best practices and standard rules. – Jonathan Frech Sep 7 '18 at 6:59
• I'd suggest adding a diagram to clarify which stroke a register corresponds to, e.g. the top stroke is denoted A. – Shieru Asakoto Sep 7 '18 at 8:46
• @user202729 Thank you very much for your comments. I've removed the bonus part and updated the angles part. My old Casio has malfunctioning display and the new one has natural-VPAM. I'll process it soon – Crowley Sep 7 '18 at 11:17
• Hi, and Welcome to PPCG! It's your challenge so you're the boss... you can decide that the only limitations are the ones you outlined in the challenge, or make it more like a simulator by enforcing actual limitations/bugs. It's your decision, just clarify what your intent is and make sure to edit the question accordingly (ie "no need to enforce stach error for >23 nested parentheses" or "must throw a Stack Error when >23 nested parentheses". – JayCe Sep 7 '18 at 13:27
• I'm temporarily vote to close the challenge as "unclear what you're asking", when it's clear enough I will retract the close vote or vote to reopen. – user202729 Sep 7 '18 at 15:36