Author Topic: Calcalca  (Read 24067 times)

0 Members and 1 Guest are viewing this topic.

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Calcalca
« Reply #60 on: June 06, 2010, 09:55:15 pm »
Why don't you just simply NOT make a distinction between mass and weight.  Just make all conversions that do happen to go between a mass and a weight use earth gravity 9.81 m/s^2 for the acceleration automatically implied in the conversion.
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Calcalca
« Reply #61 on: June 06, 2010, 09:57:10 pm »
Actually technically a pound is a measure of mass and a pound-force is the measurement of force. Both are just abbreviated lb (or can be; mass is technically lb, lbm, lbm and force is lb, lbf, or lbf).

What?! That makes my job even harder. :(
Didn't know that. Thanks for telling me.

To convert from lbm to kg all you do is multiply by 0.45359237 kg. Then to turn lbf into N you just multiply by both 0.45359237 kg and 9.80665 m/s2. So one lbf equals about 4.44822 N.

Whoops, I mixed the two. More changes now needed. :(
EVERYONE: UNTIL FURTHER NOTICE, DO NOT TEST OUT CONVERSIONS DEALING WITH POUNDS OF ANY SORT.

Edit: What you could do is differentiate between the two by making the user type in either lbm or lbf and then have the two separate conversions.

Don't want to put the extra work on the user, though. I want to keep this as easy to use as possible, and most people probably wouldn't use lbm for pounds mass. At the same time, I want compatibility with pounds force being lb, as in "ft-lb".
« Last Edit: June 06, 2010, 10:00:42 pm by Deep Thought »




Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Calcalca
« Reply #62 on: June 06, 2010, 09:59:02 pm »
@Quigibo
Because they technically aren't the same thing. Force already has gravity in it while mass doesn't. Unless you are talking about like when it displays you have the mass displayed and then it also shows the acceleration of gravity? I'm not entirely sure what you are asking but ya...I don't know :P
« Last Edit: June 06, 2010, 10:24:14 pm by meishe91 »
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Calcalca
« Reply #63 on: June 06, 2010, 09:59:57 pm »
Why don't you just simply NOT make a distinction between mass and weight.  Just make all conversions that do happen to go between a mass and a weight use earth gravity 9.81 m/s^2 for the acceleration automatically implied in the conversion.

Hmm, that's a good idea. At the end, when Calcalca tests whether or not the units on either side are identical, I could make it detect whether the difference is m*s-2, and add a 9.81 as a conversion factor...
Thanks!

EDIT: What if it's not on Earth, though? :)

Seriously, though, I might actually add that.

Because they technically aren't the same thing. Force already has gravity in it while mass doesn't. Unless you are talking about like when it displays you have the mass displayed and then it also shows the acceleration of gravity? I'm not entirely sure what you are asking but ya...I don't know :P

I think this is what Quigibo means.
« Last Edit: June 07, 2010, 09:55:30 am by Deep Thought »




Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Calcalca
« Reply #64 on: June 06, 2010, 10:09:38 pm »
Well another thing you could do is when it comes to pounds (force or mass) you can test what the output is being put into (either N or kg or whatever) and have it calculate accordingly. I don't know how practical that is though.

Side Question: Does this support slugs? Not that slugs are used much anymore but ya.
« Last Edit: June 06, 2010, 10:11:32 pm by meishe91 »
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Calcalca
« Reply #65 on: June 06, 2010, 10:12:50 pm »
Well another thing you could do is when it comes to pounds (force or mass) you can test what the output is being put into (either N or kg or whatever) and have it calculate accordingly. I don't know how practical that is though.

I like Quigibo's idea better because it's simpler and tests only if there's a difference between the sides, meaning that most conversions wouldn't be affected by the extra evaluation time.

EDIT: Except where the unit of mass/weight is raised to some power other than one. But who would use lb2 anyway?

EDIT2: Found a good way to check for discrepancies regarding lb. Adding comparison now. Hopefully I'll finish before finals week. :P

EDIT3: Yeah, I was thinking of adding slugs, but I need a 3-letter abbreviation for it. Would slg work?

EDIT4: Fixed lb problem! Here it is:

EDIT5: Another record (for me). 5 edits in a single post.

Anyway, I've also gotten it to work as a group. Thanks for the tip, and here it is (again):
« Last Edit: June 07, 2010, 06:16:29 pm by Deep Thought »




Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55941
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Calcalca
« Reply #66 on: June 08, 2010, 02:15:02 am »
cool I just sent the new group on my calc and it works. Glad you could get 8xg files to work.

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Calcalca
« Reply #67 on: June 08, 2010, 02:21:59 am »
Well I don't think there is a real abbreviation for slugs but ya I'm sure "slg" would work. Glad to hear you got the pound issue fixed. What did you end up doing?
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Calcalca
« Reply #68 on: June 08, 2010, 09:47:50 am »
Well I don't think there is a real abbreviation for slugs but ya I'm sure "slg" would work. Glad to hear you got the pound issue fixed. What did you end up doing?

Basically, I compared the base unit lists for either side of the expression. If there is no difference in mass or amperage, and if the difference in time is the opposite of twice the difference in distance, the program assumes that it should now add in the 9.81 m/s2, raised to the power of the difference in distance, to account, so lb should now work no matter what power it is raised to (sorry if this explanation is confusing). The only problem is that if you entered, say, 8 kg into N, it would also change kg into a unit of force, since the program doesn't actually detect the specific unit lb.

Okay, now I really need to optimize it. The program is slow. :(
« Last Edit: June 08, 2010, 09:51:38 am by Deep Thought »




Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: Calcalca
« Reply #69 on: June 08, 2010, 05:05:48 pm »
looks nice
you're right, though, the speed is painful
also, i would suggest not clearing the homescreen after a unit conversion, and not having parentheses for prefixes (though i don't know how possible that is)
I like how you also included Google's little "answer to life/universe/everything) ;)

edit: do you think you need parentheses at all? i can't really see why they need to be there for clarity ( i mean, (7 (in))=17.78((c)m))) is kind of silly
and i can't think of why they'd be needed for coding purposes...although i may be wrong about that

edit2 didnt read your whole first post. so, parentheses ARE needed...damn

edit3 lol i'm a little "submit button" happy today...what if you ran another routine that's kind of like a "find and delete" to kill parentheses? although it might make the program even slower...and also tightening the user's syntax to allow for spaces to be cushions over parentheses might be viable...

Also, it's a pain that variables can't be stored in-program... although the only way for that to be allowed would be with ASM..sigh..guess you can't have everything
« Last Edit: June 08, 2010, 05:21:08 pm by squidgetx »

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Calcalca
« Reply #70 on: June 08, 2010, 07:01:29 pm »
looks nice
you're right, though, the speed is painful
also, i would suggest not clearing the homescreen after a unit conversion, and not having parentheses for prefixes (though i don't know how possible that is)

I have to clear the homescreen because I use Output( to display the answer, and there's no way to tell what line I'm on except with *sigh* ASM.

Guess I could use Disp, but then textwrapping would be a nightmare. :(

I like how you also included Google's little "answer to life/universe/everything) ;)

Had to add that. I found that answer, anyway. ;)

edit: do you think you need parentheses at all? i can't really see why they need to be there for clarity ( i mean, (7 (in))=17.78((c)m))) is kind of silly
and i can't think of why they'd be needed for coding purposes...although i may be wrong about that

edit2 didnt read your whole first post. so, parentheses ARE needed...damn

Parentheses actually makes life easier for the program. It's kind of hard to explain now, but basically, if there were no parentheses, I would have to add a lot more duplicate coding, making the size approximately double. Though it would make the program a little faster, I guess...

edit3 lol i'm a little "submit button" happy today...

I do that all the time. :D

what if you ran another routine that's kind of like a "find and delete" to kill parentheses? although it might make the program even slower...and also tightening the user's syntax to allow for spaces to be cushions over parentheses might be viable...

What do you mean by "cushions"?

The way spaces are implemented now, they're pretty much ignored. I'm actually taking advantage of the fact that the program adds so many unnecessary parentheses here; because of this, the user can add as many spaces as he wants and they would all be counted as implicit multiplication.

Also, it's a pain that variables can't be stored in-program... although the only way for that to be allowed would be with ASM..sigh..guess you can't have everything

Yeah...but what kind of "variables" would you want to store? If you think it's a good idea to store the answer or the original expression, it'd be pretty easy to add that in at the end.

EDIT: Whoa... I just realized I had a habit of making REALLY LONG POSTS.
« Last Edit: June 08, 2010, 07:37:01 pm by Deep Thought »




Offline jsj795

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1105
  • Rating: +84/-3
    • View Profile
Re: Calcalca
« Reply #71 on: June 09, 2010, 12:08:20 am »
I was looking through the program, and I thought, hmm... wouldn't it be easier if you knew all the variables calculator can accept? Like, you can implement scrollable menu that shows what unit you want to put in, and what output unit you want, something like itouch menu.
I think that will lessen the user making syntax error that the calculator doesn't recognize and lessen the frustration, them going like, 15 In into m instead of 15 in into m.


Spoiler For funny life mathematics:
1. ROMANCE MATHEMATICS
Smart man + smart woman = romance
Smart man + dumb woman = affair
Dumb man + smart woman = marriage
Dumb man + dumb woman = pregnancy
2. OFFICE ARITHMETIC
Smart boss + smart employee = profit
Smart boss + dumb employee = production
Dumb boss + smart employee = promotion
Dumb boss + dumb employee = overtime
3. SHOPPING MATH
A man will pay $2 for a $1 item he needs.
A woman will pay $1 for a $2 item that she doesn't need.
4. GENERAL EQUATIONS & STATISTICS
A woman worries about the future until she gets a husband.
A man never worries about the future until he gets a wife.
A successful man is one who makes more money than his wife can spend.
A successful woman is one who can find such a man.
5. HAPPINESS
To be happy with a man, you must understand him a lot and love him a little.
To be happy with a woman, you must love her a lot and not try to understand her at all.
6. LONGEVITY
Married men live longer than single men do, but married men are a lot more willing to die.
7. PROPENSITY TO CHANGE
A woman marries a man expecting he will change, but he doesn't.
A man marries a woman expecting that she won't change, and she does.
8. DISCUSSION TECHNIQUE
A woman has the last word in any argument.
Anything a man says after that is the beginning of a new argument.

Girls = Time * Money (Girls are a combination of time and money)
Time = Money (Time is money)
Girls = Money squared (So, girls are money squared)
Money = sqrt(Evil) (Money is also the root of all evil)
Girls = sqrt(Evil) squared (So, girls are the root of all evil squared)
Girls = Evil (Thus, girls are evil)
*Girls=Evil credit goes to Compynerd255*

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Calcalca
« Reply #72 on: June 09, 2010, 05:44:53 am »
looks nice
you're right, though, the speed is painful
also, i would suggest not clearing the homescreen after a unit conversion, and not having parentheses for prefixes (though i don't know how possible that is)

I have to clear the homescreen because I use Output( to display the answer, and there's no way to tell what line I'm on except with *sigh* ASM.

Guess I could use Disp, but then textwrapping would be a nightmare. :(

I like how you also included Google's little "answer to life/universe/everything) ;)

Had to add that. I found that answer, anyway. ;)

edit: do you think you need parentheses at all? i can't really see why they need to be there for clarity ( i mean, (7 (in))=17.78((c)m))) is kind of silly
and i can't think of why they'd be needed for coding purposes...although i may be wrong about that

edit2 didnt read your whole first post. so, parentheses ARE needed...damn

Parentheses actually makes life easier for the program. It's kind of hard to explain now, but basically, if there were no parentheses, I would have to add a lot more duplicate coding, making the size approximately double. Though it would make the program a little faster, I guess...

edit3 lol i'm a little "submit button" happy today...

I do that all the time. :D

what if you ran another routine that's kind of like a "find and delete" to kill parentheses? although it might make the program even slower...and also tightening the user's syntax to allow for spaces to be cushions over parentheses might be viable...

What do you mean by "cushions"?

The way spaces are implemented now, they're pretty much ignored. I'm actually taking advantage of the fact that the program adds so many unnecessary parentheses here; because of this, the user can add as many spaces as he wants and they would all be counted as implicit multiplication.

Also, it's a pain that variables can't be stored in-program... although the only way for that to be allowed would be with ASM..sigh..guess you can't have everything

Yeah...but what kind of "variables" would you want to store? If you think it's a good idea to store the answer or the original expression, it'd be pretty easy to add that in at the end.

EDIT: Whoa... I just realized I had a habit of making REALLY LONG POSTS.

If you did do something that would make it faster but you'd have repeditive code you could always make either a sub-program that is recalled or put a Lbl at the top of the program with the code.

I was looking through the program, and I thought, hmm... wouldn't it be easier if you knew all the variables calculator can accept? Like, you can implement scrollable menu that shows what unit you want to put in, and what output unit you want, something like itouch menu.
I think that will lessen the user making syntax error that the calculator doesn't recognize and lessen the frustration, them going like, 15 In into m instead of 15 in into m.

His whole goal is to try to make it like the Google thing, I believe. Which has you type everything in.
« Last Edit: June 09, 2010, 05:45:13 am by meishe91 »
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Calcalca
« Reply #73 on: June 09, 2010, 10:12:01 am »
If you did do something that would make it faster but you'd have repeditive code you could always make either a sub-program that is recalled or put a Lbl at the top of the program with the code.

Oh, yeah, I heard about that trick with the For( loop and the end inside the label. Does it only work with For( loops, not While or Repeat ?




SirCmpwn

  • Guest
Re: Calcalca
« Reply #74 on: June 09, 2010, 10:48:46 am »
I'm not entirely sure about how you are saying this, but if you want to Goto from a While, For(, Repeat, or If statement, you can have that many End statements on the end of it.  For example:
Code: [Select]
If 1
Then
If 1
Then
While 1
If getKey=105
Goto A
If getKey=21
Goto B
End
End
End
Lbl A
End
End
End
Disp "No memory leak!
Return
Lbl B
Disp "Memory leak!