HP Forums
HP PRIME: How to use [a b/c] key from a program - Printable Version

+- HP Forums (https://archived.hpcalc.org/museumforum)
+-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html)
+--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html)
+--- Thread: HP PRIME: How to use [a b/c] key from a program (/thread-254244.html)



HP PRIME: How to use [a b/c] key from a program - Joseph Ec - 10-29-2013

Hi Friends,


I need to use integers or fractions (not reals) so i need to convert 0.3333.. to get 1/3 I can do with [a b/c] key but how to use that from inside a programs ?

Thans and best regards!!

jose




Re: HP PRIME: How to use [a b/c] key from a program - Han - 10-29-2013

Quote:
Hi Friends,

I need to use integers or fractions (not reals) so i need to convert 0.3333.. to get 1/3 I can do with [a b/c] key but how to use that from inside a programs ?

Thans and best regards!!

jose


Perhaps the EXACT() function is what you're looking for?


Re: HP PRIME: How to use [a b/c] key from a program - CompSystems - 10-29-2013

[a <-> b/c ] dual function key => exact( ), approx()

example:

poly1[1,(-3*a-3*b-7)/3,(7*a+7*b+2)/3,(-2*a-2*b)/3];

[a <-> b/c ] =>

approx(poly1[1,(-3*a-3*b-7)/3,(7*a+7*b+2)/3,(-2*a-2*b)/3]); =>

poly1[1.,(-3.*a-3.*b-7.)*0.333333333333,(7.*a+7.*b+2.)*0.333333333333,(-2.*a-2.*b)*0.333333333333]

[a <-> b/c] =>

exact( Ans );

poly1[1,(-3*a-3*b-7)*1/3,(7*a+7*b+2)*1/3,(-2*a-2*b)*1/3]

Edited: 29 Oct 2013, 5:29 p.m.


Re: HP PRIME: How to use [a b/c] key from a program - Joseph Ec - 10-29-2013

Friend,

Thank so much,

exact() command is the function tha I need,

But, [a b/c] works direct in all MATRIX elements and exact() doesn´t work with matrix ... I wil try to do element by element...

Best regards!!
joseph




Re: HP PRIME: How to use [a b/c] key from a program - Joseph Ec - 10-29-2013

Friend,

That was the trick BUT,

ONCE running in the emulator program i GET "The application has crashed and will be restarted"....

Would be nice if the calculator indicates the command that cause the failure and mainly the REASON (allowed types or hint ).

Some idea ?

Best regards!!
joseph