Ticket #160 (new enhancement)

Opened 1 year ago

Last modified 1 year ago

(Resolved) Builtins: double.explode() and double.implode()

Reported by: lth Assigned to: anonymous
Type: enhancement Priority: trivial
Milestone: Component: Spec
Version: 4 Keywords:
Cc: brendan, jeffdyer, graydon

Description

Proposal for two new methods on the double class.

The explode method returns a pair of uints [hi,lo], where hi is the high part of the number (sign, exponent, and high bits of the significand) and lo is the low part of the number (low bits of the significand). If the double is a NaN, explode always returns the same representation regardless of the representation of the NaN. This representation is TBD but is platform-independent (QNaN does not have a platform-independent representation).

The implode method takes two arguments hi and lo and returns a double constructed from those parts. If the number constructed is a NaN, the method returns the value of the global NaN constant.

Rationale: picking apart and putting together doubles is useful for serialization, formatting, scanning, etc.

(Something similar is probably useful for decimal.)

Attachments

Change History

Changed 1 year ago by lth

  • priority changed from major to minor

Changed 1 year ago by lth

  • cc changed from brendan,jeffdyer to brendan, jeffdyer, graydon
  • owner deleted
  • component changed from Proposals to Spec
  • priority changed from minor to major

Brendan agrees. We'll do this.

We'll also do something for decimal, explode will return four words, highest first; implode will take four words, highest first.

Rumor has it that there are competing representations for decimal in IEEE754. We'd have to choose one of them.

Changed 1 year ago by lth

  • summary changed from builtins: double.explode() and double.implode() to (Resolved) Builtins: double.explode() and double.implode()

Changed 1 year ago by lth

  • priority changed from major to trivial
Note: See TracTickets for help on using tickets.