HP Forums

Full Version: error in subst function
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all

In CAS mode, with (non-CAS) variable T initialized to 100:

subst('S + 10', 'S=T') yields T+ 10 (desired result)
subst('S + 0.1', 'S=T') yields 100.1 (which is not correct)

Using CAS variables s and t leads to same strange behaviour.

ANyone, any explanation for this ? Seems like an error to me ...

Thanks for your help.
I'd guess that CAS is able to provide a symbolic answer when integers are in play.

When you used 0.1 instead of 10, approximate values are used instead and the expression is evaluated.
Thanks for your reply, but I don't see why this would be the case.

Is this behaviour documented somewhere ?
(11-16-2018 10:49 AM)hata Wrote: [ -> ]Is this behaviour documented somewhere ?

I don't know if this is documented somewhere, but it was mentioned many times here on the forums.

So, you must use integers. If you want for example 0.1 then you must rewrite it as 1/10.

This works:
subst('S+(1/10)','S = T')
OK thanks
Reference URL's