Post Reply 
input issues
01-25-2021, 07:36 PM (This post was last modified: 01-25-2021 08:02 PM by C.Ret.)
Post: #12
RE: input issues
(01-25-2021 06:25 PM)Amer7 Wrote:  Can someone tell me why the program is returning a=0, b=0; when if we input
Input σ₁²: 2.45377
Input σ₂²: 0.000838
Input σ₁₂: −0.027712
Input F(α,2,f): 2.865

All the lines you entered in your code after LOCAL K,L; are erroneous.
The equal sign you use is reserved for equation, to affect value to variables, the correct syntax is to use the affectation sign ':=' or the store sign '▶ '

For example: a:=2; 3▶b;

An expression like
a=3;
is evaluated as an equation and the returned value of this evaluation is lost since there no affectation nor print or return order.

That why you a and b variable stay at 0, they are never the subject to any affectation or storing.


Here, as an example, is the way I would have compose your application:
Code:
EXPORT Elipsa1()
// This is a program for calculating Elliptical mistakes  
BEGIN
LOCAL a1,b1,b2,f;
INPUT({a1,b2,b1,f},"Input test", {"Input σ₁²","Input σ₂²","Input σ₁₂","Input F(α,2,f)"});
LOCAL  r:=SQRT((a1-b2)^2+4*b1^2);
       L:=((a1+b2+r)/2);         // Lambda 1 in GLOBAL real variable L
       K:=ABS((a1+b2-r)/2);      // Lambda 2 in GLOBAL real varialbe K
LOCAL  a:=SQRT(L);
LOCAL  b:=SQRT(K);
LOCAL a3:=SQRT(5.991*L);
LOCAL b3:=SQRT(5.991*K);
LOCAL s1:=SQRT(a1);
LOCAL s2:=SQRT(b2);
       P:=(b1/(SQRT(a1)*SQRT(b2)));     // GLOBAL real variable P
       O:=ATAN((L-a1)/b1);              // GLOBAL real variable O
 IF O<0 THEN U:=O+180 ELSE U=O END;     // GLOBAL real variable U
PRINT();                                // CLEAR TEXT EDITOR PAGE
 PRINT({a1,b2,b1,f});
 PRINT(" R="+r);
 PRINT("L1="+L);
 PRINT("L2="+K);
 PRINT(" a="+a);
 PRINT(" b="+b);
 PRINT("Sx="+s1);
 PRINT("Sy="+s2);
 PRINT(" P="+P);
 PRINT(" O="+ →HMS(U) );
 PRINT("95% elipsa kad imamo prekobrojnost");
 PRINT({" F="+f});
// PRINT(" a="+a4);               // <-- definition of a4 and b4 missing ??
// PRINT(" b="+b4);
// PRINT(" O="+ →HMS(U) );
END;

Since no LOCAL instruction were used for K l P O U, values are store in the corresponding user real variable you can acces with [Vars]/HOME/Real/...
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
input issues - Amer7 - 01-25-2021, 02:07 PM
RE: input issues - Didier Lachieze - 01-25-2021, 02:38 PM
RE: input issues - Amer7 - 01-25-2021, 03:13 PM
RE: input issues - rprosperi - 01-25-2021, 03:47 PM
RE: input issues - Amer7 - 01-25-2021, 03:53 PM
RE: input issues - Didier Lachieze - 01-25-2021, 04:03 PM
RE: input issues - Amer7 - 01-25-2021, 04:38 PM
RE: input issues - Didier Lachieze - 01-25-2021, 05:00 PM
RE: input issues - Amer7 - 01-25-2021, 06:25 PM
RE: input issues - C.Ret - 01-25-2021, 07:13 PM
RE: input issues - Didier Lachieze - 01-25-2021, 07:32 PM
RE: input issues - Amer7 - 01-25-2021, 07:42 PM
RE: input issues - toml_12953 - 01-26-2021, 04:34 PM
RE: input issues - C.Ret - 01-25-2021 07:36 PM
RE: input issues - Amer7 - 01-25-2021, 08:00 PM
RE: input issues - Amer7 - 01-26-2021, 03:01 PM
RE: input issues - Amer7 - 01-27-2021, 11:45 AM
RE: input issues - Didier Lachieze - 01-27-2021, 01:59 PM



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