Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: Derf321 on November 20, 2012, 03:17:31 pm

Title: Negative/Opposite Numbers (SOLVED)
Post by: Derf321 on November 20, 2012, 03:17:31 pm
Is there a way I can make it so "If EXP1 = true, 1→Z, else, -1→Z"? Or some variation of this? I need a negative number to use in a formula (as in the output eventually will not be negative)
Title: Re: Negative/Opposite Numbers
Post by: leafy on November 20, 2012, 03:19:03 pm
Code: [Select]
EXP1=true*2-1→Z

That's not optimized at all, but it's easy enough to see why it works.
Title: Re: Negative/Opposite Numbers
Post by: calc84maniac on November 20, 2012, 03:19:42 pm
...that's actually pretty optimized actually :P
Title: Re: Negative/Opposite Numbers
Post by: Juju on November 20, 2012, 03:20:14 pm
(2*(EXP1=1)-1)→Z should do the job, if (EXP1=1) returns either 0 or 1 as in TI-BASIC.

EDIT: Ninja'd. But you should understand the point.
Title: Re: Negative/Opposite Numbers
Post by: bored_student on November 22, 2012, 03:17:32 am
couldn't you leave the parentheses
Code: [Select]
1=EXP1*2-1→Z
or if the "true" isn't always 1
Code: [Select]
0<EXP1*2-1→Z
Title: Re: Negative/Opposite Numbers
Post by: Derf321 on November 27, 2012, 11:29:26 pm
couldn't you leave the parentheses
Code: [Select]
1=EXP1*2-1→Z
or if the "true" isn't always 1
Code: [Select]
0<EXP1*2-1→Z
Hmm, this didn't seem to work for me in my program. I guess Axe really doesn't support negative numbers in equasions. I figured out a different way to do it, and it works fine. Thanks for the help all!
Title: Re: Negative/Opposite Numbers (SOLVED)
Post by: Runer112 on November 28, 2012, 08:46:11 am
couldn't you leave the parentheses
Code: [Select]
1=EXP1*2-1→Z
or if the "true" isn't always 1
Code: [Select]
0<EXP1*2-1→Z
Hmm, this didn't seem to work for me in my program. I guess Axe really doesn't support negative numbers in equasions. I figured out a different way to do it, and it works fine. Thanks for the help all!

What doesn't Axe support for negative numbers? Keep in mind that the normal, unsigned comparison operators mostly don't work for signed numbers, but there are the signed comparison operators: ==, ≠≠, <<, ≤≤, >>, and ≥≥.
Title: Re: Negative/Opposite Numbers (SOLVED)
Post by: Derf321 on November 30, 2012, 12:49:34 pm
Nevermind, I was using an older version of axe that probably didn't support it.