develooper Front page | perl.perl6.language | Postings from October 2001

Re: NaN semantics

Thread Previous | Thread Next
Jonathan Scott Duff
October 10, 2001 09:28
Re: NaN semantics
Message ID:
On Wed, Oct 10, 2001 at 05:21:02PM +0200, raptor wrote:
> | So the imaginary numbers would be standard literals? Like
> |
> |     $x=2+10i;
> |
> | Great idea, as well as sqrt(-1) returning 1i istead of raising the
> | exception. BTW, I was thinking once that numeral literals like 4k or 10G
> | (meaning 4*2**10, 10*2**30) would be very nice. What do you think?
> I like the idea ... this is one of the ways to suspend the calculations to
> the last moment...
> But one probelm comes to my mind, what the k,G etc mean
> 1000 or 1024
> or k => 1000, K => 1024
> Or probably the best way will be to have a hook so that we can specify what
> is a Number and how it has to be calculated down to the real number...!!!

How about we let users define their own postfix operators such that
they can make 10K, 10M, 10G mean whatever they want.  Perhaps this is
also where the postfix "?" and "!" from Ruby can come in.

I'd still advocate supporting imaginary numbers in core somehow
though.  With a pragma would be best I think so that exceptions are
thrown on sqrt(-1) unless they really want imaginaries.

Jonathan Scott Duff

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About