Various abs

Hi,
On Island whats the difference between the two abs ?

var val3:=RemObjects.Elements.System.ABS(val2-val1);

var val3:=rtl.abs(val2-val1);

The second one has no overloads and just takes int

On toffee this works

namespace ConsoleApplication;

uses
  Foundation;

begin
  var val1:CGFloat := 12.1;
  var val2:CGFloat := 13.2;
  
  var val3:=abs(val2-val1);
  
  if(val3>0)then
  begin
    
  end;

On Island it doesnt have a double overload so it wont compile.

Cheers,
John

rtl is the OS namespace, ie the C Apis provided by UNIX/Darwin/macOS

RemObjects.Elements.System is the (cross-platform) API we provide with Island RTL, for Island only.

If here’s an abs in both, I assume we provide one because not all OSs have it in rtl.

you should not use rtl.abs, it’s something exposed by the C rtl. The Math one is correct.

1 Like

Thanks. Yes I picked the Math one