Re: [Vala] Patch to include fabs, abs, MAX and MIN



Hi,

On Sat, 2007-10-13 at 19:56 -0500, Mario Carrión wrote:
The attached patch adds to GLib.Math the following methods:
- max
- min
- fabs
- abs

However, what do you think about using max and min methods with
different signatures, let say:

fmax, fmin: floats
max, min: integers
dmax, dmin: doubles

Attached patch defines the parameters for max and min as doubles.

We should probably add this functionality as static methods to the
appropriate datatypes instead of the Math class.

Sou you'd call for example:
double.min (a, b) instead of Math.dmin (a, b)

Would that be ok for everyone?

We still have the issue that macros don't cope well with side-effects,
so we probably want a special attribute, so that Vala can take care of
temporary copies, if necessary.

BTW: The CLAMP macro is already bound for int and uint.

Jürg




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]