Post Reply 
Issue using EXACT() command.
04-26-2018, 09:43 AM
Post: #1
Issue using EXACT() command.
Hi,

An old program wich was running well on my real Prime, REV A version 12066,
present issue with version 13441 virtual Prime.

The EXACT() command give me result I don't can explain even the results are
good.

In attachement you'll see what happens.

In 13441 I've to remove all EXACT() commands to have the good presentation
I had in the old firmware 12066.

Here is the "old" program :

Code:

EXPORT DELTAold12066()
//EXPORT DELT()
BEGIN
//Syntaxe : DELTA()
//Auteur : Mic
//Version v1.02 (2013)
//Utilisation : entrer les 3 valeurs des coefficients A, B et C du trinôme AX²+BX+C.
INPUT(A,"dans AX²+BX+C","A=");
INPUT(B,"dans AX²+BX+C","B=");
INPUT(C,"dans AX²+BX+C","C=");
C▶X0;
RECT_P();
TEXTOUT_P("Tableau de variation",1,1,2,RGB(0,148,255));
LINE_P(1,12,108,12,RGB(0,148,255));
TEXTOUT_P("f(X)="+A+"X²+"+B+"X+"+C,1,18,2,1);
RECT_P(10,40,300,150,#FFD3A8);
TEXTOUT_P("−∞",13,41,0,3);
TEXTOUT_P("+∞",280,41,0,3);
LINE_P(10,60,300,60,3);
IF A≠0 THEN
−B/(2*A)▶X0;
A*X0^2+B*X0+C▶E;
ROUND(E,2)▶E;
IF 2*A*(X0−0.1)+B<0 THEN
LINE_P(15,65,143,144,RGB(255,0,0));
LINE_P(152,144,295,65,RGB(0,127,14));
TEXTOUT_P(E,143,120,0,3);
TEXTOUT_P("+∞",15,80);
TEXTOUT_P("+∞",280,80);
ELSE
LINE_P(15,144,143,65,RGB(0,127,14));
LINE_P(152,65,295,144,RGB(255,0,0));
TEXTOUT_P(exact(E),143,65,0,3);
TEXTOUT_P("−∞",15,120);
TEXTOUT_P("-∞",280,120);
END;
ELSE
IF B==0 THEN
TEXTOUT_P("Fonction constante",95,80,3);
FREEZE;
BREAK;
END;
IF B<0 THEN 
LINE_P(15,65,295,144,RGB(255,0,0));
FREEZE;
BREAK;
ELSE IF B>0 THEN
LINE_P(15,144,295,65,RGB(0,127,14));
FREEZE;
BREAK;
END;
END;
END;
TEXTOUT_P(exact(X0),142,41,0);
TEXTOUT_P("Dérivée :",1,160,1,RGB(255,0,110));
TEXTOUT_P("f'(X) = "+2*A+"X+"+B,60,160,1,RGB(127,0,55));
TEXTOUT_P("Discriminant :",1,175,1,RGB(255,0,110));
B*B−4*A*C▶D;
TEXTOUT_P("Δ = B² − 4AC = ("+B+")² − 4."+A+"."+C+" = "+D,70,175,1,RGB(127,0,55));

{"négatif","nul","positif"}▶L1;
{"2 solutions complexes","1 solution réelle","2 solutions réelles"}▶L2;
SIGN(D)+2▶N;
TEXTOUT_P("Le discriminant est "+L1(N)+".",70,185,1,RGB(127,0,55));
TEXTOUT_P("f(X)=0 admet donc "+L2(N)+" : ",70,195,1,RGB(127,0,55));
{"X = (−B−√(−Δ))/(2A) et X = (−B+√(−Δ))/(2A)","X = −B/(2A)","X = (−B−√Δ)/(2A) et X = (−B+√Δ)/(2A)"}▶L3;
TEXTOUT_P(L3(N),70,205,1,RGB(127,0,55));
"X = "+((−B−*√ABS(D))/(2*A))▶X1;
"X = "+((−B+*√ABS(D))/(2*A))▶X2;
"X = "+(−B/(2*A))▶X3;
"X = "+((−B−√ABS(D))/(2*A))▶X4;
"X = "+((−B+√ABS(D))/(2*A))▶X5;
{{exact(X1),exact(X2)},exact(X3),{exact(X4),exact(X5)}}▶L4;
//PRINT(L4);
TEXTOUT_P(L4(N),70,215,1,RGB(255,0,110)); 
TEXTOUT_P("par Mic",280,228,1,RGB(0,148,255));
//FREEZE();
WAIT;
END;

Maybe someone can explain me this strange behavior ?

Thanks.


Attached File(s) Thumbnail(s)
       

Gérard.
Find all posts by this user
Quote this message in a reply
04-26-2018, 12:41 PM
Post: #2
RE: Issue using EXACT() command.
If you add this line:

LOCAL X0,X1,X2,X3,X4,X5;

to the beginning of your program, it appears to work correctly. If probably has something to do with not declaring those variables as LOCAL and they are reserves for one of the other apps, I think the parametric app.

Code:
 EXPORT DELTAold12066()
 //EXPORT DELT()
 BEGIN
 LOCAL X0,X1,X2,X3,X4,X5;//ADDED BY ROAD
 //Syntaxe : DELTA()
 //Auteur : Mic
 //Version v1.02 (2013)
 //Utilisation : entrer les 3 valeurs des coefficients A, B et C du trinôme AX²+BX+C.
 INPUT(A,"dans AX²+BX+C","A=");
...

-road
Find all posts by this user
Quote this message in a reply
04-26-2018, 01:21 PM
Post: #3
RE: Issue using EXACT() command.
Hi Roadrunner,

Thanks you very much for your quick message (BIP BIP). But why my old program don't disturb parametric app and virtual Prime 13441 disturb ?!?!

I've update my program with your very good advice.

Gérard.
Find all posts by this user
Quote this message in a reply
04-26-2018, 04:52 PM
Post: #4
RE: Issue using EXACT() command.
I was just guessing at the cause. They may have put more stringent rules in place for what you can do with app variables in the newer versions. I bet Tim will have an authoritative answer for you.

I'm glad it worked for you.

-road
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)