Absolute value, aka modulus

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
Marco
Posts: 2354
Joined: 27 Jun 2011 15:20

Absolute value, aka modulus

Post by Marco »

Am I missing something or there really isn't a function that, given a number, returns the modulus of a number?
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]

admin
Site Admin
Posts: 67269
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Absolute value, aka modulus

Post by admin »


Marco
Posts: 2354
Joined: 27 Jun 2011 15:20

Re: Absolute value, aka modulus

Post by Marco »

Ditto, man!
My scenario would be

Code: Select all

|a - b| < c
I know I could square both sides, so to get positive numbers, but I don't know if it is the correct way performance-wise.
EDIT:

Code: Select all

v11.70.0105 - 2012-11-03 12:04
    + Scripting got a new function.
      Name:   Abs
      Action: Returns the absolute value of number.
      Syntax: abs(number)
        number:   Must be a number. A string will raise an error.
      Examples:
        echo abs(1);  // 1
        echo abs(0);  // 0
        echo abs(-1); // 1
        echo abs(-2.3456); // 2.3456
The quickest addition I've ever seen! Thank you Don! :appl: :appl: :appl:
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]

Post Reply