- const char *cs = term.c_str();
- // CLN's short types are not useful within the GiNaC framework, hence
- // we go straight to the construction of a long float. Simply using
- // cl_N(s) would require us to use add a CLN exponent mark, otherwise
- // we would not be save from over-/underflows.
- if (strchr(cs, '.'))
+ if (term.find(".") != std::string::npos) {
+ // CLN's short type cl_SF is not very useful within the GiNaC
+ // framework where we are mainly interested in the arbitrary
+ // precision type cl_LF. Hence we go straight to the construction
+ // of generic floats. In order to create them we have to convert
+ // our own floating point notation used for output and construction
+ // from char * to CLN's generic notation:
+ // 3.14 --> 3.14e0_<Digits>
+ // 31.4E-1 --> 31.4e-1_<Digits>
+ // and s on.
+ // No exponent marker? Let's add a trivial one.
+ if (term.find("E") == std::string::npos)
+ term += "E0";
+ // E to lower case
+ term = term.replace(term.find("E"),1,"e");
+ // append _<Digits> to term
+#if defined(HAVE_SSTREAM)
+ std::ostringstream buf;
+ buf << unsigned(Digits) << std::ends;
+ term += "_" + buf.str();
+#else
+ char buf[14];
+ std::ostrstream(buf,sizeof(buf)) << unsigned(Digits) << std::ends;
+ term += "_" + string(buf);
+#endif
+ // construct float using cln::cl_F(const char *) ctor.