> Here is a proposal for the numerical part of the SV API that
> provides a framework for arbitrary precision arithmetic, while still
> allowing standard ints and floats to be handled efficiently.

[some quick very high-level comments]

Don't forget bigrats.

> 1) binary operators should in general always return
> an SV rather rather than just an int or char* say.

Hear ye, hear ye.

> 2) in general we want the result of a binop to be of the
> same type as the 'biggest' of its operands, eg
> 
> $real + $int                  is a real
> $int + $real                  is a real
> $bigint + $int                        is a bigint
> $real + $complex              is a complex
> $complex + $bigcomplex                is a bigcomplex

Well, kinda.  But sometimes it is perfectly fine or even desirable to
'collapse' back to the 'smaller' kind: when computing with bigints and
bigrats.  In other words, I would like 
87238382456823758823554867875243 - 87238382456823758823554867875242
to be int (an IV) 1, not a bigint 1.

-- 
$jhi++; # http://www.iki.fi/jhi/
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen

Reply via email to