Skip to content
Tcl Source Code History Of Ticket bd71dd33055d27d7
Login

History Of Ticket bd71dd33055d27d7

Artifacts Associated With Ticket bd71dd33055d27d7

  1. Ticket change [d1135eb01c] (rid 248577) by anonymous on 2025-11-21 15:22:39:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/x-fossil-plain"
    4. comment initialized to:
      When doing arithmetic operations on numbers as, for example, multiply somme amount by a rate, we need the result to be rounded away from zero to a desired precision (wich excludes usage of "format" command as it simply drops unwanted decimals)
      
      
      Thank you
      
      Jean-Marie
      
    5. is_private initialized to: "0"
    6. login: "anonymous"
    7. priority initialized to: "5 Medium"
    8. resolution initialized to: "None"
    9. severity initialized to: "Minor"
    10. status initialized to: "Open"
    11. submitter initialized to: "anonymous"
    12. subsystem initialized to: "48. Number Handling"
    13. title initialized to:
      round() function with precision argument rounding away from zero
      
    14. type initialized to: "RFE"
  2. Ticket change [dfb17304db] (rid 248809) by dkf on 2025-11-26 14:38:10:

    1. icomment:
      It would definitely be good to have _something_ that gives more control over rounding modes. There are many such methods.
      
      Might be better as a command.
      
    2. login: "dkf"
    3. mimetype: "text/x-markdown"
  3. Ticket change [0c1ebe7dab] (rid 248829) by anonymous on 2025-11-27 09:15:36:

    1. icomment:
      Yes this subject is a wide one ...
      For a general purpose langage, the lack of the most common rounding method of fp numbers is a surprise (compared to the range of mathematical functions offered, on the other hand, in ::tcl::mathfunc).
      I share your point of vue : a new design should provide sufficient flexibility to maximize its usefullness.
      However, I'm not sure about the effective need of other methods than "away from zero" or "toward zero" (in Tcl/Tk projects).
      A possible supplemental argument in favour of a function against a command is that with a sole suplementary precision argument to the existing round() function, some flexibility can be obtained in giving the choice between two methods based on the positive or negative sign of the precision argument (a way wich seems not too counter intuitive to me, convenient, but yes something unusal)
      
      Thenk you
      Jean-Marie
      
    2. login: "anonymous"
    3. mimetype: "text/plain"
  4. Ticket change [f3707b9826] (rid 248831) by anonymous on 2025-11-27 09:40:21:

    1. icomment:
      Sorry, I missed an obvious point in this discussion of a function against a command : the practical convenience in writing, and the low as possible processing overhead
      
      Thank you
      Jean-Marie
      
    2. login: "anonymous"
    3. mimetype: "text/plain"
  5. Ticket change [6bdfda6509] (rid 249491) by anonymous on 2025-12-12 15:31:11:

    1. icomment:
      I just realized that Python' round() method with precision argument choosed "half to even" rounding method.
      As I didn't thought about aggregates of fp numbers (a bad idea, rounded or not), I want to precise that the need expressed in this ticket is about rounding fp numbers used in isolation (I should have written this in the title of this ticket).
      However, if "half to even" method is prefered  by the Development Team for some reason, while producing a result less immediately intuitive for isolated fp numbers, it is netherthess allso fine on our side.
      
      Thank you
      Jean-Marie
      
    2. login: "anonymous"
    3. mimetype: "text/plain"
  6. Ticket change [77b4939d87] (rid 249508) by anonymous on 2025-12-12 17:22:44:

    1. icomment:
      Shame on me : dkf you are right, a command is the solution
      
      Thank you
      Jean-Marie
      
    2. login: "anonymous"
    3. mimetype: "text/plain"
  7. Ticket change [00ca79a183] (rid 250328) by cdubois on 2026-01-12 04:27:04:

    1. icomment:
      Thanks for the clarification, and +1 to dkf’s point: if Tcl ever grows first-class support for selectable rounding modes, a command (or small namespace) is probably the right shape.
      
      For the immediate need of rounding to a given number of decimal places, [format] is often sufficient for producing a rounded decimal representation, e.g.:
      
      set s [format "%.2f" $x]           ;# rounded string
      set y [expr {double($s)}]          ;# numeric value again (if needed)
      
      If a specific tie-breaking rule is required (e.g. “ties away from zero”), it may be better handled by a small helper at the script level, and a broader “multiple rounding modes” design can be discussed separately as its own RFE/TIP.
      
      Given the reporter’s follow-up, this ticket may be closable as “documentation/workaround provided”, leaving any more general rounding-mode support for a dedicated proposal.
      
    2. login: "cdubois"
    3. mimetype: "text/plain"
  8. Ticket change [7b5e0a36fd] (rid 250380) by anonymous on 2026-01-15 08:18:07:

    1. closedate changed to: "2461055.84592338"
    2. closer changed to: "anonymous"
    3. icomment:
      Aggreed : my mistake
      
      Closing this ticket
      
      Jean-Marie
      
    4. login: "anonymous"
    5. mimetype: "text/plain"
    6. status changed to: "Closed"