Moin,
On Monday 29 September 2008 12:57:34 Mark Overmeer via RT wrote:
Show quoted text> Mon Sep 29 06:57:33 2008: Request 39682 was acted upon.
> Transaction: Ticket created by MARKOV
> Queue: Math-BigFloat
> Subject: accept INF/+INF/-INF
> Broken in: (no value)
> Severity: Wishlist
> Owner: Nobody
> Requestors: MARKOV@cpan.org
> Status: new
> Ticket <URL:
http://rt.cpan.org/Ticket/Display.html?id=39682 >
>
>
> XML defines huge integers and floats, and my XML::Compile therefore
> uses Math::BigInt and Math::BigFloat to represent them. Translating
> the Math::* repr of infinite is expensive, though, because XML uses
> [+-]?INF, not [+-]inf.
>
> My request is twofold
>
> (1) please accept captilized INF
>
> # handle '+inf', '-inf' first
> - if ($wanted =~ /^[+-]?inf\z/)
> - { return $downgrade->new($wanted) if $downgrade;
> - $self->{sign} = $wanted;
> + if ($wanted =~ /^[+-]?inf\z/i)
> + { return $downgrade->new(lc $wanted) if $downgrade;
> + $self->{sign} = lc $wanted;
That should probably run by the perl5porters mailinglist, as the "inf"
and "-inf" are the things that perl accepts, and I am not sure what
would speak against or for accepting "INF", too.
I guess at the same time "infinity" should also be accepted, Perl
however, seems to accept anything starting with "inf" like "infbar"
(which I find kinda silly, tho).
$ perl -wle 'print 1+INF+1'
inf
$ perl -wle 'print 1+inf+1'
Unquoted string "inf" may clash with future reserved word at -e line 1.
inf
Show quoted text> (2) some output optimization: now I have to recheck your module's
> output for 'inf' to capitalize it. The complication is that
> 'NaN' is written with a small 'a' :(
I am not sure why that is a complication :) However, NaN is what Perl
uses, so BigInt just mirrors this. Please note that you can create a
subclass of BigInt, and could overload that behaviour. (I am not sure,
tho, if a subclass would be easy, because "NaN" could be used all over
the place - IIRC I used a constant for it, but my memory may be
faulty).
All the best,
Tels
--
Signed on Tue Sep 30 20:47:08 2008 with key 0x93B84C15.
Get one of my photo posters:
http://bloodgate.com/posters
PGP key on
http://bloodgate.com/tels.asc or per email.
Finagle's First Law: If an experiment works, something has gone wrong.