[tor-bugs] #23368 [Core Tor/Tor]: Add design and coding guidelines for using floating point

Tor Bug Tracker & Wiki blackhole at torproject.org
Thu Aug 31 08:25:29 UTC 2017


#23368: Add design and coding guidelines for using floating point
-----------------------------+------------------------------------
 Reporter:  teor             |          Owner:  (none)
     Type:  enhancement      |         Status:  needs_review
 Priority:  Medium           |      Milestone:  Tor: 0.3.2.x-final
Component:  Core Tor/Tor     |        Version:
 Severity:  Normal           |     Resolution:
 Keywords:  doc, tor-safety  |  Actual Points:
Parent ID:                   |         Points:  0.5
 Reviewer:                   |        Sponsor:
-----------------------------+------------------------------------

Comment (by teor):

 4. Try to do as many of your calculations in integer precision as
 possible, and convert to floating point for display or transfer.

 It might also help to link to a general list of do's and don't's, like:
 * don't compare floating-point numbers using equals (comparing with 0.0 is
 an exception)
 * always check for division by zero, even if the inputs to a function are
 non-zero, the result can round to zero

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/23368#comment:2>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list