I wanted to test complex (and float) functions, with code like:
println (log 1.2);
for example. The problem here is that the result is system
dependent. println x calls fprint$ cout, str x, and
for floats str x calls the C++ helper routine xstr, which uses an
ostringstream to format x.
Not realising this I tried to set the precision on cout,
but it had no effect .. because the formatting is done using
a transient ostringstream. Furthermore I have:
instance Str[fcomplex] {
fun str (z:fcomplex) => str(real z) + "+" + str(imag z)+"i";
}
for complex numbers. So there is no way at all to control
the format here, which makes print/println style
output not only non-deterministic, but also leaves no possible
way to fix it.
The 'right' solution is to use, for example:
str_float (x, (width=10, prec=5, fmt=fixed))
[where the second argument is one of those new fangled
record things ..] Or something similar of course .. :)
--
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net
-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell. From the desktop to the data center, Linux is going
mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language