Re: [fpc-pascal] Help creating generic class: division problem

2010-04-05 Thread leledumbo
That's fine, thanks. It's between integers and floating points actually, so declaring the floating point one with Extended is better, I guess. -- View this message in context: http://old.nabble.com/Help-creating-generic-class%3A-division-problem-tp28140305p28147009.html Sent from the Free Pascal

Re: [fpc-pascal] Help creating generic class: division problem

2010-04-05 Thread Martin
If it is only between int and double, maybe this will help have on overload function class function TMedian.Div(Value, Divider: Integer): Integer; // Result := Value div Divider class function TMedian.Div(Value, Divider: Double): Double; // Result := Value / Divider then the compiler choose

[fpc-pascal] Help creating generic class: division problem

2010-04-05 Thread leledumbo
consider the following generic class declaration: {$mode objfpc}{$H+} type generic TMedian = class class function Find(x: array of T): T; end; class function TMedian.Find(x: array of T): T; var i, j, Middle: Integer; Temporary: T; begin // Use truncated selection sort to find medi