|
Posted: Mon Nov 12, 2007 4:46 am
|
|
My 500th post and UnSS's 2051st post reads as follows:
The lowercase u, v, and w, accessed by pressing [2ND] and then [7], [8], or [9] can store expressions. By expressions, I mean something that's not a value (e.g. 10, 1-5, 7^2).
Here's an example:
| Code: |
"10X→u
1→X
Disp u
3→X
Disp u
|
You should notice that while I don't actually change u, the number displayed is different! The expression that u holds, "10X," changes when I change the value of X. The first time, I display 10X when X is 1, or 10 * 1, but the second time, I display 10X when X is 3, or 10 * 3.
A practical use of this might be in a program where you use a specific equation several times. Here is an excerpt from a BASIC raycaster:
| Code: |
A+cos(C)(θ=25)-cos(C)(θ=34→A
B+sin(C)(θ=25)-sin(C)(θ=34→B
|
A more optimized (though not the best way) to do this could be:
| Code: |
"cos(C)(θ=25)-cos(C)(θ=34→u
A+u→A
B+u→B
| _________________ Tasty symbols: → ÷ ∟ ≥ ≠ ≤ ± π θ √ ∞ ∑ ► → ∟ ⌂ º ± Ω π
如果你能看得懂這個句子,送我一個PM。
|
|
Xphoenix
Forum Sage

Posts: 632
Joined: 25 Jul 2007
Location: Spain
|
Posted: Mon Nov 12, 2007 1:02 pm
|
|
Yeah I used this trick in Lightning It is nice but you have to keep in ming that the expression cannot use ans. In other words
| Code: | :10
:"10ans->u
:5
:Disp u | would output 100 and not 50 as you would hope if ans is needed you can use expr(Strn but that is about half the speed of u. u is also slower that the larger alternative so you should only use this trick in areas that don't require speed. _________________ >( (→ ÷ ∟ ≥ ≠ ≤ ± π θ √ ≅ ℕ ∞ ∑ ► → ∟ ⌂ º ± Ω π)') Blub ate Xphoenix's Tasty symbols
"If you've done something right no one will know that you've done anything at all" -Futurerama
|
|
TheStorm
Regular

Posts: 32
Joined: 31 Aug 2007
|
Posted: Sat Nov 17, 2007 9:55 pm
|
|
TheStorm, your post is rather confusing. Would you mind fixing the spelling/grammar to make your point clearer? _________________ "Mac's are the Perfect Computer", said the Perfect Idiot.
Testing for:
Vera
(\__/)
(='.'=)This is Bunny. Copy and paste bunny into your
(")_(")signature to help him gain world domination.
|
|
JoostinOnline
Senior

Posts: 428
Joined: 19 Aug 2007
Location: Behind You

|
Posted: Sat Nov 17, 2007 10:08 pm
|
|
I think what he means is that if you use "Ans" when storing to u, v, or w, it will interpret it as a constant equal to whatever Ans happens to be.
This means that instead of storing "10Ans" as you would expect in Storm's example, you store "10*10," or "100." Therefore, modifying Ans won't change the value of u, v, or w. _________________ Tasty symbols: → ÷ ∟ ≥ ≠ ≤ ± π θ √ ∞ ∑ ► → ∟ ⌂ º ± Ω π
如果你能看得懂這個句子,送我一個PM。
|
|
Xphoenix
Forum Sage

Posts: 632
Joined: 25 Jul 2007
Location: Spain
|
|