HP Forums
[CAS] inconsistent evaluation - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: [CAS] inconsistent evaluation (/thread-7202.html)



[CAS] inconsistent evaluation - compsystems - 11-07-2016 03:00 AM

Hello Hp-Prime user and developers

Flags: Simplify none, exact mode off, and cas mode on

run line by line the following script

Quote:c:=1+(-a-b); [enter] returns 1.-a-b
but
c1:=1-a-b; [enter] returns 1.-a-b

c==c1 [enter] returns true

x1:=1/10.;
y1:=1/9.;
x2:=100/8.;
y2:=100/3.;
x3:=100/4.;
y3:=100/9.;
x:=379/70.;
y:=904/63.;
d:=(y2-y3)*(x1-x3)+(x3-x2)*(y1-y3);
na:=(y2-y3)*(x-x3)+(x3-x2)*(y-y3);
nb:=(y3-y1)*(x-x3)+(x1-x3)*(y-y3);
a:=na/d;
b:=nb/d; [enter] ....

c:=1+(-a-b); [enter] returns 0
but
c1:=1-a-b; [enter] returns −1.7763568394*10^−15

Why when evaluate c <> c1? if c is equal to c1


RE: [CAS] inconsistent evaluation - compsystems - 11-07-2016 03:31 AM

aslo I can not run the following program, I can not find error

PHP Code:
#cas
testP():=
    
begin
        local x1
,y1,x2,y2,x3,y3;
        
local x,y,d;
        
local na,nb,a,b,c,c1;
        
x1:=1/10.;
        
y1:=1/9.;
        
x2:=100/8.;
        
y2:=100/3.;
        
x3:=100/4.;
        
y3:=100/9.;
        
x:=379/70.;
        
y:=904/63.;
        
d:=(y2-y3)*(x1-x3)+(x3-x2)*(y1-y3);
        
na:=(y2-y3)*(x-x3)+(x3-x2)*(y-y3);
        
nb:=(y3-y1)*(x-x3)+(x1-x3)*(y-y3);
        
a:=na/d;
        
b:=nb/d;
        
c:=1+(-a-b);
        
c1:=1-a-b;
        return({ 
cc1 });
    
end;
#end 

Who can run the previous program?