title: Logarithmic Interpolation and 0 values
body: <p>I have a function that interpolates between two values on a logarithmic scale, so as to have more values around the lower end of my values.</p>
  
  <pre><code>public void logspace(double lower, double upper, double amount) {
      double start = Math.log(Math.min(lower, upper));
      double end = Math.log(Math.max(lower, upper));
      double step = (end - start) / amount;
  
      for(double level = start; level &lt;= end; level += step) {
          System.out.println(Math.exp(level));
      }
  }
  </code></pre>
  
  <p>However I do not know how to correctly handle if one of the values is 0. If one of the values if 0 then we end up with -Infinity as one of our boundaries, which produces unexpected results.</p>
  
  <p>I can't simply use 0 in place of <code>log(0)</code> as this would result in 0 values between 0 and 1, as <code>log(1)</code> is 0.</p>
  
  <p>How can I produce logarithmically spaced values between two arbitrary values?</p>