+ Reply to Thread
Results 1 to 4 of 4

Thread: Request for Python "decimal" class

  1. #1

    Request for Python "decimal" class

    (If the class is already available and I missed it when I looked, please ignore this.)

    I recently wanted to be able to round floating point numbers to 10 digits of precision, and the "decimal" class was the first thing I thought of. It didn't seem to be available, so I wrote an awful hack instead, and I hope it works.

    I would really appreciate having the Python "decimal" class. For predictable arithmetic there is nothing like it.

  2. #2
    Senior Member Steve Baer's Avatar
    Join Date
    Apr 2010
    Location
    Seattle
    Posts
    1,464
    Blog Entries
    19
    Hi Randolph,
    This appears to already work
    Python Code:
      from decimal import *
      print Decimal(1)/Decimal(7)

  3. #3
    D'oh! I'll confirm this when I get my desktop system back from running simulations.

  4. #4
    Right you are. Apparently "decimal" isn't in the Rhino Python Editor's list of modules, but once it's imported, it works just fine.

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts