If a programmer calls a function with an argument that has a
well-established type, s/he may very well expect a result according
to that type, (considering that overloading isn't just a word for not
caring about type).
So, calling sqrt with a real < 0, should not come back with a complex
number.
C
HaloO,
Moritz Lenz via RT wrote:
On Wed Nov 19 07:35:48 2008, masak wrote:
what should the behaviour of sign($x) be when $x is complex?
I'd argue that it's a Failure.
This is a bit drastic. If one computes in the complex domain
a complex valued sign function is appropriate.
multi sub s
# New Ticket Created by Ross Alexander
# Please include the string: [perl #60702]
# in the subject line of all future correspondence about this issue.
# http://rt.perl.org/rt3/Ticket/Display.html?id=60702 >
Hello,
I have already sent this to the parrot list but I noticed a post saying rakodo
I'd rather retain the dwimmishness of p5.
$ perl -MMath::Complex -le 'print sqrt(-1)'
i
Note that I didn't have to pass in Math::Complex->make(-1,0). Just -1.
On 11/20/08, Chris Dolan <[EMAIL PROTECTED]> wrote:
>> Mark (>):
>>> I think the most sensible thing is to be consistent. sgn() fails
> Mark (>):
>> I think the most sensible thing is to be consistent. sgn() fails for
>> non-real input as long as sqrt() returns NaN for negative input.
>> Change the latter behavior (via a pragma or whatever) so that sqrt()
>> returns complex numbers, and then sgn() should start behaving on such
>
On Thu, Nov 20, 2008 at 04:31:22PM +0100, Carl Mäsak wrote:
: Mark (>):
: > I think the most sensible thing is to be consistent. sgn() fails for
: > non-real input as long as sqrt() returns NaN for negative input.
: > Change the latter behavior (via a pragma or whatever) so that sqrt()
: > returns
Mark (>):
> I think the most sensible thing is to be consistent. sgn() fails for
> non-real input as long as sqrt() returns NaN for negative input.
> Change the latter behavior (via a pragma or whatever) so that sqrt()
> returns complex numbers, and then sgn() should start behaving on such
> numbe
On Thu, Nov 20, 2008 at 8:34 AM, Carl Mäsak <[EMAIL PROTECTED]> wrote:
> I guess the question is more about the programmer's expectations. Is
> this a case where we serve the programmer better by returning Failure,
> or by generalizing the C function to the complex plane?
This is parallel to the c
Wolfgang (>):
> There is a definition for the signum function for a complex argument.
>
> sign( z ) = z / |z| for all z != 0
> sign( 0 ) = 0
>
> See e.g. http://en.wikipedia.org/wiki/Sign_function
>
> Shouldn't be too difficult to implement.
It isn't, and note that I also proposed it in my first e
There is a definition for the signum function for a complex argument.
sign( z ) = z / |z| for all z != 0
sign( 0 ) = 0
See e.g. http://en.wikipedia.org/wiki/Sign_function
Shouldn't be too difficult to implement.
-Original Message-
From: Carl Mäsak [mailto:[EMAIL PROTECTED]
Sent: Mittw
# New Ticket Created by "Carl Mäsak"
# Please include the string: [perl #60674]
# in the subject line of all future correspondence about this issue.
# http://rt.perl.org/rt3/Ticket/Display.html?id=60674 >
what should the behaviour of sign($x) be when $x is complex?
rakudo: say sign($_) for
# New Ticket Created by "Carl Mäsak"
# Please include the string: [perl #60670]
# in the subject line of all future correspondence about this issue.
# http://rt.perl.org/rt3/Ticket/Display.html?id=60670 >
Rakudo r32873 cannot parse the Unicode version of Texas quotes («»),
and misunderstands
# New Ticket Created by "Carl Mäsak"
# Please include the string: [perl #60672]
# in the subject line of all future correspondence about this issue.
# http://rt.perl.org/rt3/Ticket/Display.html?id=60672 >
According to S29, there should be an sprintf directive %C, but Rakudo
r32874 doesn't rec
13 matches
Mail list logo