title: How to achieve the same functionality with (**) operator instead of pow
body: <p>I am trying to participate in a coding <a href="https://www.hackerearth.com/problem/algorithm/moving-d6f7a605/description/" rel="nofollow noreferrer">challenge</a> where for the large numbers I need to take a modulo with (10 ^ 9 + 7). Since the website support only ruby 2.3.1 version so I can't make use of pow() <a href="https://apidock.com/ruby/v2_5_5/Integer/pow" rel="nofollow noreferrer">function</a>. When I am trying to solve the same problem with (**) operator. It is giving me infinity. So, my questions are </p>
  
  <p>1) What exactly is the difference between (**) and pow operator</p>
  
  <p>2) I need a way to achieve the same functionality what pow operator provides</p>
  
  <p>Below is the program</p>
  
  <pre><code>mod = ((10 ** 9) + 7)
  q = gets.to_i
  while q != 0 do
    n = gets.to_i
    if (n % 2 == 0 || n == 1)
      puts 0
    else
      val = (n - 3)/2
      puts 2.pow(val, mod)
      ### now If I do puts (2 ** ( val % mod)) it will give me infinite
    end
    q -= 1
  end
  </code></pre>
  
  <p>input 
  q = 3</p>
  
  <p>n - will be a very large number such as 899187440761857221 or 889644209960741769</p>
  
  <p>If I am running the program in my local machine I am able to run it because I am using ruby latest version whereas on the website they support 2.3.1 version</p>
  
  <p>Any help would be appreciated</p>