our own decimal math lib

2004-06-23 Thread Uri Guttman
> "SB" == Scott Bronson <[EMAIL PROTECTED]> writes:

  SB> On Wed, 2004-06-23 at 08:12, Dan Sugalski wrote:
  >> The license issues there require that the full source of GMP ship with any
  >> binary copy. (the license has no "provide a place to fetch it"
  >> provision--the source is required) Which would make the Gameboy version
  >> of Parrot somewhat cumbersome. :)

  SB> Has anybody inquired to the GMP project as to the possibility of
  SB> relaxing that restriction?  If GMP truly is the best bignum
  SB> implementation, I definitely think it's worth asking.

  SB> If nobody else is pursuing this then sure, I volunteer to subscribe to
  SB> some lists and try to find the people to ask.  I'll wait for a "Yes"
  SB> from Dan or Leo before I run off trying to represent the Parrot project,
  SB> of course.  :)

i still have my stillborn bignum (using bcd registers and efficient
algorithms) implementation if anyone wants to pick it up. i have some
working base code and the overall design. it has features and stuff that
i don't see in the other packages. the main thing is that it uses bcd
all the way and numbers can be any scale and precision (effectively
including floating point since that is just a scaled number). numbers
can grow infinitely long if desired as well.

initialization (constructor) for ints and floats and add/subtract
work. more alignment support of registers is needed for that as well as
multiply/divide. i have all the rest of the design in my feverish brane
including various optimization tricks.

it currently uses c's malloc so that needs to be changed to use parrot's
malloc.

the reason for bcd is that it makes conversions to/from ascii (or
unicode, gack!) very easy and you get exact representations at any
precision and scale (including fractions). the algorithms are decent and
add/subtract work on binary words at a time and not individual bcd
digits.

i am willing to help out anyone who wants to take this on but i can't
lead it now. it would be a great way to learn some neat bcd math
tricks! :) these are classic ideas from the heyday of bcd math from the
60's.

the code is in pure c and of course since i wrote it i won't charge
parrot too much to licence it :)

this is about 700 lines of code including test code.

uri

-- 
Uri Guttman  --  [EMAIL PROTECTED]   http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs    http://jobs.perl.org


Re: This fortnight's summary

2004-06-23 Thread Scott Bronson
On Wed, 2004-06-23 at 08:12, Dan Sugalski wrote:
> The license issues there require that the full source of GMP ship with any
> binary copy. (the license has no "provide a place to fetch it"
> provision--the source is required) Which would make the Gameboy version
> of Parrot somewhat cumbersome. :)

Has anybody inquired to the GMP project as to the possibility of
relaxing that restriction?  If GMP truly is the best bignum
implementation, I definitely think it's worth asking.

If nobody else is pursuing this then sure, I volunteer to subscribe to
some lists and try to find the people to ask.  I'll wait for a "Yes"
from Dan or Leo before I run off trying to represent the Parrot project,
of course.  :)

- Scott





Re: This fortnight's summary

2004-06-23 Thread Dan Sugalski
On Wed, 23 Jun 2004, The Perl 6 Summarizer wrote:

>   Bignums!
> Dan asked for a volunteer to get Bignums working. Alin Iacob stepped up
> to the plate. Leo suggested that, rather than starting from
> types/bignum.c, it might be better to use an existing, maintained, maths
> (Look, I'll spell 'summarise' with a 'z' -- the OED does -- but it will
> be a cold, cold day in hell when I start abbreviating 'mathematics' as
> 'math'. Ahem.) package. Dan worried about license compatibility; the
> proposed GMP package is licensed under the LGPL which may (or may not)
> be compatible with Parrots Artistic/GPL dual licence. After a closer
> reading he reckoned that GMP's license is definitely incompatible with
> Parrot.
>
> http://groups.google.com/[EMAIL PROTECTED]

The license issues there require that the full source of GMP ship with any
binary copy. (the license has no "provide a place to fetch it"
provision--the source is required) Which would make the Gameboy version
of Parrot somewhat cumbersome. :)

>   Resizeable*Array classes
> Fresh from his Fixed Array triumph, Matt Fowles posted a patch
> implementing naÃve Resizeable Arrays. Leo thought it a little too naÃve,
> and worried about duplication of existing functionality. Dan wasn't
> worried about the naÃvetÃ, or the duplication of functionality. He
> pointed out that it was more important to get *something* which could be
> improved and that the duplication was okay given that the idea was to
> get a standard framework in place and then eliminate the duplication. (I
> admit that I'm a little surprised to hear Dan, who's normally a strong
> advocate of up front design, preaching the refactorers creed...)

Ah, but the design is already fixed. And I'm a big advocate of "I don't
care if it's implemented by the appropriate application of garden gnomes
so long as it works" school of thought. The code is close to irrelevant,
it's the architecture and API of a black box and the system that
box exists in that's important.

Dan

--"it's like this"---
Dan Sugalski  even samurai
[EMAIL PROTECTED] have teddy bears and even
  teddy bears get drunk




Re: cmd line like switches for functions and operators.

2004-06-23 Thread Juerd
Luke Palmer skribis 2004-06-22 16:32 (-0600):
> &*rename.wrap -> $orig, $new, *%opt {
> say "Renaming '$orig' to '$new'" if %opt{'verbose' | 'v'};
> call;
> }

Would it be possible to just add a named argument, without repeating any
part of the existing signature? Like:

&*foo.wrap sub (&*foo.signature, +$new_thingy) { 
# or whatever syntax
...
call;
}

Or is the original signature not usable, and does one need to consult
the manual/source and copy it?


Juerd


This fortnight's summary

2004-06-23 Thread The Perl 6 Summarizer
The Perl 6 Summary for the fortnight ending 20040621
Good evening. You find me typing away in a motel room on the edge of the
Lake District on the shortest night of the year. I suppose, by rites, I
should be spending the night by some stone circle drinking, dancing and
generally making merry, but as I'm a teetotal, unfit, atheistical nerd
with a mission to summarize I'll skip that and plough straight into the
activities of another arcane sect. Yes, it's perl6-internals again...

  Towards an accurate README
Andy Dougherty sent in a patch adjusting the Parrot README so that it
accurately reflected the toolset needed to build parrot. For some
reason, as well as the requirement for a C++ compiler if you want to
build the ICU library, we've moved to needing Perl 5.6.0 rather than
5.005. Nicholas Clark suggested that, rather than bumping the Perl
version requirement, we bundle appropriate versions of modules Parrot
required, but chromatic thought it better to check the for the correct
versions of said modules at Configure time and bail out if they weren't
there.

There was further discussion about whether going to Perl 5.6.0 as a
requirement was the right thing to do -- the issue is that some OSes
(FreeBSD and Solaris 8 were cited) still only ship with 5.005 family
Perls. My feeling (which I didn't mention in the thread, more fool me)
is that, as eventually the goal is to eliminate the need for Perl at all
in the build process, then require 5.6.0 rather than 5.005 isn't exactly
the end of the world.

http://groups.google.com/[EMAIL PROTECTED]

http://groups.google.com/[EMAIL PROTECTED]

  OS X Builds again
Someone finally summoned up the tuits to fix the OS X build. Step
forward Nicholas Clark and accept your plaudits.

http://groups.google.com/[EMAIL PROTECTED]

  Basics of the PMC class set
Dan announced that he was about to make some changes to the repository,
including establishing a basic set of PMC classes. Matt Fowles wondered
about Array PMCs, which seemed to be missing from Dan's list. Dan agreed
that they should be rationalized as well.

Bernhard Schmalhofer suggested adding a complex number class to Dan's
basic menagerie, but Dan was unconvinced.

http://groups.google.com/[EMAIL PROTECTED]

  Correct use of #define
Nicholas Clark was moved to growl by a section of
include/parrot/string.h that used a #define to define a type. Actually,
he was moved to 'swearing and cursing and time wasted grepping to find
out what a STRING is'. Dan agreed that this was bad and decreed:
'Typedefs for types, #defines for constants and bizarre (*temporary!*)
debugging things.'

  http://groups.google.com/[EMAIL PROTECTED]

  The next release
During a lull while Leo TÃtsch was away at a conference, Dan mused on
the next release of parrot. His goal for that is a rejig of classes/,
aiming to make sure that all the PMCs we want are in and working, and
that the ones we don't care about are neatly deprecated.

Warnock applies.

http://groups.google.com/[EMAIL PROTECTED]

  A small task for the interested
Stretching the definition of 'small' somewhat, Dan asked for volunteers
to implement the missing PMCs detailed in PDD 17. He reckoned it should
be 'fairly straightforward'. A new entrant in these summaries, Ion
Alexandru Morega took a crack at the String PMC and posted a patch to
the list which was promptly ignored. Which seems a little unfair really.

http://groups.google.com/[EMAIL PROTECTED]

  Bignums!
Dan asked for a volunteer to get Bignums working. Alin Iacob stepped up
to the plate. Leo suggested that, rather than starting from
types/bignum.c, it might be better to use an existing, maintained, maths
(Look, I'll spell 'summarise' with a 'z' -- the OED does -- but it will
be a cold, cold day in hell when I start abbreviating 'mathematics' as
'math'. Ahem.) package. Dan worried about license compatibility; the
proposed GMP package is licensed under the LGPL which may (or may not)
be compatible with Parrots Artistic/GPL dual licence. After a closer
reading he reckoned that GMP's license is definitely incompatible with
Parrot.

http://groups.google.com/[EMAIL PROTECTED]

  Adding Fixed*Array classes
Matt Fowles posted a patch implementing Fixed Array classes. Dan applied
it. Leo wondered about the patch's use of malloc(3) instead of Parrot's
memory management. Dan wasn't worried in the case of fixed size arrays.

  http://groups.google.com/[EMAIL PROTECTED]

  Resizeable*Array classes
Fresh from his Fixed Array triumph, Matt Fowles posted a patch
implementing naÃve Resizeable Arrays. Leo thought it a little too naÃve,
and worried about duplication of existing functionality. Dan wasn't
worried about the naÃvetÃ, or the duplication of functionality. H