# HP Forums

Full Version: [Help: CAS Code] Comparing answers history view
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Example #1:

Steps

Step 1:
root:=√(2.) [enter] 1.41421356237

Step 2:
exact(root) == approx(root) [enter] true

Where:
left(exact(root)) ->1607521/1136689
right(approx(root)) -> 1.41421356237
then
1607521/1136689 == 1.41421356237 -> true

now

Step 3:
approx(root) [enter] 1.41421356237
Step 4:
exact(root) [enter] 1607521/1136689
Step 5:
Ans == [up][up][up] -> (0) false
1607521/1136689 == 1.41421356237 -> 0 // expr 2

1607521/1136689 == 1.41421356237 // expr1
1607521/1136689 == 1.41421356237 // expr2

expr1 same expr2 yes
Because they are two different things.
Si quieres comparar 2 datos, puedes crear un función que identifique si es una 'expresión', en caso de serlo lo evaluas, y puedes realizar la comparación.
(11-02-2016 08:01 PM)Tim Wessman Wrote: [ -> ]Because they are two different things.
Ok Ans Documentation
A value in Ans is stored internally with the full precision of the calculated result,

(11-02-2016 08:31 PM)Carlos295pz Wrote: [ -> ]Si quieres comparar 2 datos, puedes crear un función que identifique si es una 'expresión', en caso de serlo lo evaluas, y puedes realizar la comparación.
ok
`Igual(Dat1,Dat2)BEGIN IFTE(TYPE(Dat1)=8,EVAL(Dat1)▶Dat1,0); IFTE(TYPE(Dat2)=8,EVAL(Dat2)▶Dat2,0); Dat1=Dat2END; `