473,396 Members | 1,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Re: complex representation

DSM wrote:
From the nothing-is-so-trivial-it's-not-worth-a-usenet-post file:

Shouldn't the default representation of complex numbers be like that of
floats? That is, have a decimal point?
>>1
1
>>1.0
1.0
>>1j
1j
>>1.0j
1j
>>1.0+1.0j
(1+1j)
In the relevant bit of floatobject.c, there's a comment explaining that
1.0 isn't accidental:

/* Subroutine for float_repr and float_print.
We want float numbers to be recognizable as such,
i.e., they should contain a decimal point or an exponent.
However, %g may print the number as an integer;
in such cases, we append ".0" to the string. */

ISTM the same reasoning applies equally to complex numbers.
Not necessarily. The reason that having floats always have a decimal point is
desirable is to ensure roundtripping through eval(repr(x)). The j is sufficient
for complexes. There are no complex integers to confuse it with.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco

Jul 8 '08 #1
0 689

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Marc te Vruchte | last post by:
Over the past years i've been in contact with the same problem a number of times, creating a graphical user interface on complex XML documents. Personally these solutions have never been...
7
by: seia0106 | last post by:
Hello, Writing a program in c++ that should use complex numbers I have two choices before me. 1- define a struct for complex data i.e struct {float real,imag; }ComplexNum; 2-use an array...
17
by: Chris Travers | last post by:
Hi all; I just made an interesting discovery. Not sure if it is a good thing or not, and using it certainly breakes first normal form.... Not even sure if it really works. However, as I am...
4
by: Gerald I. evenden | last post by:
I have found that with the Gnu compiler that undocumented output of a "double comple" value can be successfully performed by: double complex v; printf("%g %gi\n",v); which will print the...
4
by: Mantorok Redgormor | last post by:
With what specifier do I use to print a variable of a complex type? The man page for printf doesn't even say. - nethlek
5
by: Glen Low | last post by:
Suppose I have a complex number as follows: double _Complex d; Can I access the real part as ((double*) d) and the imaginary part as
11
by: of | last post by:
a = 1+3j complex(str(a)) Why does this not work ? It should
6
by: narutocanada | last post by:
hi I think complex numbers should respect the "i" or "I" representation, instead of "j". No reason being cute and using a different character instead of the traditional representation? At least...
0
by: DSM | last post by:
From the nothing-is-so-trivial-it's-not-worth-a-usenet-post file: Shouldn't the default representation of complex numbers be like that of floats? That is, have a decimal point? 1 1.0 1j 1j...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.