Overview
| Artifact ID: | 323cf06b47554c40fdb22ab7695f2c3d6805012a84e3517c10b0a2aa93547631 |
|---|---|
| Ticket: | 8dd2807066d7cc4d8604164f39b7f0d65c0dc321
bug in single-argument 'max' with bignums |
| User & Date: | apnadkarni on 2025-11-10 11:14:09 |
Changes
- icomment:
Jan, Huh! How about [this](https://core.tcl-lang.org/tcl/info/2bef43598265a9f3) then? Still WIP because I have two questions. Would it not be safer to use `Tcl_GetBignumFromObj` instead of `Tcl_TakeBignumFromObj` in `TclCompareTwoNumbers`? The latter requires callers to be aware that unshared objects may be modified and that is not really intuitive for a function that is only *comparing* two values. It is natural for callers to assume the values will be read-only and unmodified. There would be a small cost in performance in the unshared case but still, I think it is safer to guard against inadvertent misuse. What do you think? Second, when comparing integers/doubles against bigints, the code only checks whether the `bigint` is < 0 or > 0. This implies that Tcl guarantees that it will never store a value that fits in a `double` or `Tcl_WideInt` as a `bigint`. Is there such a guarantee?
- login: "apnadkarni"
- mimetype: "text/x-markdown"