Number Type Speed ● SmileBASIC Source

Register

# Number Type Speed

I wondered how fast the seven different number representations were so I pieced this together: ``` VAR M%,CONSTANT%,INT%,REAL%,LITERAL%,BIN%,HEX%,SCI%,TESTINT% = 1,TESTREAL# = 1 M% = MILLISEC DEF VOID X END'used to access variables but don't do anything with them WHILE MILLISEC-M%<1001 VOID #TRUE INC CONSTANT WEND M% = MILLISEC WHILE MILLISEC - M% <1001 VOID TESTINT% INC INT% WEND M% = MILLISEC WHILE MILLISEC - M%< 1001 VOID TESTREAL# INC REAL% WEND M% = MILLISEC WHILE MILLISEC-M%<1001 VOID 1 INC LITERAL% WEND M% = MILLISEC WHILE MILLISEC-M%<1001 VOID &B1 INC BIN% WEND M% = MILLISEC WHILE MILLISEC-M%<1001 VOID &H1 INC HEX% WEND M% = MILLISEC WHILE MILLISEC - M%<1001 VOID 10E-1 INC SCI% WEND PRINT HEX%'like &H1 PRINT BIN%'like &B1 PRINT LITERAL%'like 1 PRINT REAL%'like X# PRINT INT%'like X% PRINT CONSTANT%'like #TRUE PRINT SCI%'like 10E-1 ``` my result was binary having the highest score.
Updated
Rating
Categories
Keywords
• integer
• real
• constant
• scientific
• notation
Y_ack ```VAR TESTINT% = 1,TESTREAL# = 1 DEF VOID X END VAR B=&HDEADBEEF 'for separating assignment and calls VOID #TRUE VOID TESTINT% VOID TESTREAL# VOID 1 VOID &B1 VOID &H1 VOID 10E-1``` ```0x2fffa6: 0x30010000 0xff940001 0xb001004f 0xff840001 0x2fffb6: 0x941c004f 0x002fffc0 0xb401802c 0xdeadbeef 0x2fffc6: 0x004fee48 0x00017001 0xee589425 0x0001004f 0x2fffd6: 0xff946000 0x9425004f 0x004fee58 0x60000001 0x2fffe6: 0x004fff84 0xee589425 0x0001004f 0x00017001 0x2ffff6: 0xee589425 0x0001004f 0x00017001 0xee589425 0x300006: 0x0001004f 0x00017001 0xee589425 0x0001004f 0x300016: 0x00007801 0x00000000 0x94253ff0 0x004fee58 0x300026: 0x00300001```What you're saying doesn't make any sense. 3.3.2: ```3001 0001 ff94 ; assign 1 to TESTINT% 004f b001 0001 ff84 ;assign 1.0 to TESTREAL# 004f 941c ffc0 002f 802c b401 beef dead ;assign 0xDEADBEEF to B ee48 004f 0001 7001 9425 'call VOID(1) with ?? ee58 004f 0001 6000 ff94 004f 9425 'call VOID(1) with TESTINT% ee58 004f 0001 6000 ff84 004f 9425 'call VOID(1) with TESTREAL# ee58 004f 0001 7001 0001 9425 'push int<1> to the stack and call VOID(1) ee58 004f 0001 7001 0001 9425 'push int<1> to the stack and call VOID(1) ee58 004f 0001 7001 0001 9425 'push int<1> to the stack and call VOID(1) ee58 004f 0001 7801 0000 0000 0000 3ff0 9425 'push real<1.0> to the stack and call VOID(1) ee58 004f 0001 'questionable 0030 'end of program``` Literal 1, &B1, and &H1 all compile to the same constant. DFrost Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength EXPLAIN THIS: Y_ack idk what you're showing me edit: here's what I get running the code in the post (with the print order and type suffixes fixed) +/- 3 milliseconds not counting the first one (#TRUE) which is +/- 30 milliseconds DFrost Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength well, that graph shows their values compared to the max I don't know why these results are on my DS. I'm not doubting you. IAmRalsei Forum Leader Hidden Achievements First Year My account is over 1 year old Website Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength *clap clap* DFrost Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength -_- what does that mean? ProKuku Avatar Taboo I didn't change my avatar for 180 days Website Final(?) Contest Runner Up I placed 2nd in the (possibly) final SmileBASIC Source Contest! October 2018 Programming Contest First Year My account is over 1 year old Website MEME REVIEW 👏👏 skratta du förlorar du IAmRalsei Forum Leader Hidden Achievements First Year My account is over 1 year old Website Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength I was clapping, obviously. It means good job.