Shop OBEX P1 Docs P2 Docs Learn Events
Mathematics: 2 to the power of -3,3 possible? — Parallax Forums

Mathematics: 2 to the power of -3,3 possible?

philbotphilbot Posts: 2
edited 2007-04-01 20:19 in BASIC Stamp
Hi,

I am trying to use a small neural network to make my Boebot follow a movable light. The one big problem is that I don't know how to raise a number to a negative, decimal power. For instance, I need to calculate 3 to the power of -0,37 or 2.7 to the power of -1434. Can this problem be solved with the BS2 Basic Version? Thanks in advance for your help!

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-04-01 18:45
    The Stamps don't have floating point (they're 16-bit integer only) so you can't have the values -0.37 or 2.7 and there's no built-in Ln or Exp function. Tracy Allen's website (www.emesystems.com) has a page on Stamp math which includes routines to calculate logarithms using fixed point arithmetic and they may be what you need. Have a look at the Stamp math page (follow the links from the main page). His site is full of excellent information for using the Stamps in ways you might not appreciate from just the manual.
  • philbotphilbot Posts: 2
    edited 2007-04-01 20:19
    Thanks a lot. This is exactly what I was looking for.
Sign In or Register to comment.