]> www.ginac.de Git - ginac.git/commitdiff
- Eduardo Kalinowskis documentation add-on.
authorRichard Kreckel <Richard.Kreckel@uni-mainz.de>
Fri, 8 Dec 2000 03:41:56 +0000 (03:41 +0000)
committerRichard Kreckel <Richard.Kreckel@uni-mainz.de>
Fri, 8 Dec 2000 03:41:56 +0000 (03:41 +0000)
doc/tutorial/ginac.texi

index 5183e465fb8a993e6b1ebe26437011e964332c3b..ce2e7b9514270e1a01b251b06010acd78da91d2b 100644 (file)
@@ -1300,6 +1300,9 @@ avoided.
 
 @subsection Checking expression types
 @cindex @code{is_ex_of_type()}
 
 @subsection Checking expression types
 @cindex @code{is_ex_of_type()}
+@cindex @code{ex_to_numeric()}
+@cindex @code{ex_to_@dots{}}
+@cindex @code{Converting ex to other classes}
 @cindex @code{info()}
 
 Sometimes it's useful to check whether a given expression is a plain number,
 @cindex @code{info()}
 
 Sometimes it's useful to check whether a given expression is a plain number,
@@ -1311,6 +1314,20 @@ bool is_ex_of_type(const ex & e, TYPENAME t);
 bool ex::info(unsigned flag);
 @end example
 
 bool ex::info(unsigned flag);
 @end example
 
+When the test made by @code{is_ex_of_type()} returns true, it is safe to
+call one of the functions @code{ex_to_@dots{}}, where @code{@dots{}} is
+one of the class names (@xref{The Class Hierarchy}, for a list of all
+classes). For example, assuming @code{e} is an @code{ex}:
+
+@example
+@{
+    @dots{}
+    if (is_ex_of_type(e, numeric))
+        numeric n = ex_to_numeric(e);
+    @dots{}
+@}
+@end example
+
 @code{is_ex_of_type()} allows you to check whether the top-level object of
 an expression @samp{e} is an instance of the GiNaC class @samp{t}
 (@xref{The Class Hierarchy}, for a list of all classes). This is most useful,
 @code{is_ex_of_type()} allows you to check whether the top-level object of
 an expression @samp{e} is an instance of the GiNaC class @samp{t}
 (@xref{The Class Hierarchy}, for a list of all classes). This is most useful,