Topic: Text form of ::std:: complex


Author: Krzysztof =?UTF-8?B?xbtlbGVjaG93c2tp?=<giecrilj@stegny.2a.pl>
Date: Sat, 24 Sep 2011 21:47:00 -0700 (PDT)
Raw View
Is there any reason why the text form of ::std:: complex is (u,v) and not
(u+v*i)?  The text form of fundamental types is human-readable and
intuitive, except for complex numbers.

Chris


--
[ comp.std.c++ is moderated.  To submit articles, try posting with your ]
[ newsreader.  If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]




Author: =?UTF-8?B?RGFuaWVsIEtyw7xnbGVy?=<daniel.kruegler@googlemail.com>
Date: Sun, 25 Sep 2011 08:27:16 -0700 (PDT)
Raw View
Am 25.09.2011 06:47, schrieb Krzysztof   elechowski:
>  Is there any reason why the text form of ::std:: complex is (u,v) and not
>  (u+v*i)?
>  The text form of fundamental types is human-readable and
>  intuitive, except for complex numbers.

Well, the criteria for intuition are not the only once that determine
such a decision, efficiency and simplicity have similar weights. Given
your alternative example, I would argue that "u+v*i" is even more
natural and I would expect that "v*i" just works as well. But given the
fact that C++ does not have direct support for imaginary numbers, the
current format decision is IMO a logical conclusion.

HTH&  Greetings from Bremen,

Daniel Kr  gler





--
[ comp.std.c++ is moderated.  To submit articles, try posting with your ]
[ newsreader.  If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]




Author: Krzysztof =?UTF-8?B?xbtlbGVjaG93c2tp?=<giecrilj@stegny.2a.pl>
Date: Mon, 26 Sep 2011 08:58:55 -0700 (PDT)
Raw View
Daniel Kr  gler wrote:

>  Am 25.09.2011 06:47, schrieb Krzysztof   elechowski:
>>   Is there any reason why the text form of ::std:: complex is (u,v) and
>>   not (u+v*i)?
>>   The text form of fundamental types is human-readable and
>>   intuitive, except for complex numbers.
>
>  Well, the criteria for intuition are not the only once that determine
>  such a decision, efficiency and simplicity have similar weights. Given
>  your alternative example, I would argue that "u+v*i" is even more
>  natural and I would expect that "v*i" just works as well.

I would expect that (v*i) be well-formed input for complex and I consider it
possible for the library to implement.

>  But given the
>  fact that C++ does not have direct support for imaginary numbers, the
>  current format decision is IMO a logical conclusion.

I am sorry, I do not understand.  C++ has native support for integer numbers
but the decision how to format them as text is on the library.  So is the
decision how to format complex numbers.  I can see no difference.

Note that the format (u+v*i) would not require the showpoint option, which
is currently required for my locale and it looks very hackish.

Thanks,
Chris


--
[ comp.std.c++ is moderated.  To submit articles, try posting with your ]
[ newsreader.  If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]




Author: Christopher Dearlove<christopher.dearlove@googlemail.com>
Date: Fri, 7 Oct 2011 16:09:25 -0700 (PDT)
Raw View
On Sep 25, 5:47 am, Krzysztof    elechowski<giecr...@stegny.2a.pl>
wrote:
>  Is there any reason why the text form of ::std:: complex is (u,v) and not
>  (u+v*i)?  The text form of fundamental types is human-readable and
>  intuitive, except for complex numbers.

  Why the *? i before after the v? i or j? Manipulators to control
these?


--
[ comp.std.c++ is moderated.  To submit articles, try posting with your ]
[ newsreader.  If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]