Code Monkey home page Code Monkey logo

Comments (3)

eworm-de avatar eworm-de commented on August 25, 2024 2

You can use a simple function for that:

:global Exp do={
  :if ($2 = 0) do={ :return 1; }
  :local Return 1;
  :for I from=1 to=$2 do={
    :set Return ($Return * $1);
  }
  :return $Return;
}

... store it as script mod/exp if you want to make it permanent.

To use the function:

[admin@MikroTik] > :put [ $Exp 2 4 ]
16
[admin@MikroTik] > :put [ $Exp 2 8 ]
256
[admin@MikroTik] > :put [ $Exp 4 4 ]
256

I do not have a use case for this in my scripts, so not adding.

from routeros-scripts.

eworm-de avatar eworm-de commented on August 25, 2024

What is exponentiation operations?

File move is not supported by RouterOS. Use a SCP/SFTP client...

from routeros-scripts.

wy16W2pIilK1xgqN avatar wy16W2pIilK1xgqN commented on August 25, 2024

Sorry, didn't make it clear.
I don't know English and use translation software to communicate with you.

The mathematical formula goes like this.

2⁴ = 16

2⁸ = 256

4⁴ = 256

This is true in linux bash.

root@archlinux:~#  echo $[2**4]
16
root@archlinux:~#  echo $[2**8]
256
root@archlinux:~#  echo $[4**4]
256

from routeros-scripts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.