![]() |
[QUOTE=science_man_88;239099]I used eval so people could use powers not the full written number., and yes it's incomplete.[/QUOTE]
You can certainly write [code]f(x,y)=x+y; f(2^10, 3^4)[/code] and have it work properly without eval. |
[QUOTE=science_man_88;239101]the site isn't updating I added the guessing script, and the rate counter lol.[/QUOTE]
Good stuff. I changed the name in the header to PARI/GP, because that's how it needs to be (with caps) to show up properly in the categories and all that. |
[QUOTE=CRGreathouse;239102]You can certainly write
[code]f(x,y)=x+y; f(2^10, 3^4)[/code] and have it work properly without eval.[/QUOTE] Yeah well long multiplication uses each digit last I heard. |
[QUOTE=CRGreathouse;239103]Good stuff. I changed the name in the header to PARI/GP, because that's how it needs to be (with caps) to show up properly in the categories and all that.[/QUOTE]
I should make a note lol. |
FWIW I'm working on the task Amb at the moment.
[QUOTE=science_man_88;239104]Yeah well long multiplication uses each digit last I heard.[/QUOTE] I don't know what that has to do with my point (that you don't need eval). |
[QUOTE=CRGreathouse;239107]FWIW I'm working on the task Amb at the moment.
I don't know what that has to do with my point (that you don't need eval).[/QUOTE] thought it wasn't self evaluating. |
[QUOTE=CRGreathouse;239098]I don't understand the program; it seems to never use c, carry, or answer. Is this just incomplete?
I certainly wouldn't use eval() unless I absolutely had to.[/QUOTE] The reason I never use the others is I can't get the d[x]==2 stuff to work. If I can't get this to work I can't work on digit by digit in string form. |
[QUOTE=science_man_88;239111]The reason I never use the others is I can't get the d[x]==2 stuff to work. If I can't get this to work I can't work on digit by digit in string form.[/QUOTE]
I don't understand what part you're stuck on, but eval() won't help you get there. |
[QUOTE=CRGreathouse;239114]I don't understand what part you're stuck on, but eval() won't help you get there.[/QUOTE]
What is stopping me is I made strings out of the digits and I want to check the digits but I haven't found a way that works to check them. If I could I'd complete->[url]http://rosettacode.org/wiki/Determine_if_a_string_is_numeric[/url] as well. |
[QUOTE=science_man_88;239115]What is stopping me is I made strings out of the digits and I want to check the digits but I haven't found a way that works to check them. If I could I'd complete->[url]http://rosettacode.org/wiki/Determine_if_a_string_is_numeric[/url] as well.[/QUOTE]
What does "check the digits" mean? Making a string out of a number is easy: Str(n). Making this into a vector is similarly easy: Vec(Str(n)). If you want numbers rather than characters, you need eval(Vec(Str(n))). Possibly a better way is Vecsmall(Str(n)) which gives numbers that are 48 to 57 rather than 0 to 9. (You can subtract, of course, as desired.) |
[QUOTE=CRGreathouse;239116]What does "check the digits" mean?
Making a string out of a number is easy: Str(n). Making this into a vector is similarly easy: Vec(Str(n)). If you want numbers rather than characters, you need eval(Vec(Str(n))). Possibly a better way is Vecsmall(Str(n)) which gives numbers that are 48 to 57 rather than 0 to 9. (You can subtract, of course, as desired.)[/QUOTE] okay thanks now we can use your brains to finish both long multiply and determine if numerical. doh! What am I doing checking if it's 2? Now I can just add them now and use carry to take care of everything thanks again. |
| All times are UTC. The time now is 23:11. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.