Skip to content

Construction of canonical exponential strings is overly cumbersome #113

@gibson042

Description

@gibson042

#112 (comment)

I see four uses of RenderInExponentialNotation:

  • in the Amount constructor, with the fields of an Intl MV Record derived from a FormatNumericToString output string
  • in Amount.prototype.convertTo (here), with the fields of an Intl MV Record derived from a FormatNumericToString output string
  • in Amount.prototype.toString, with the fields of an Intl MV Record derived from a Number
  • in Amount.prototype.toString, with the fields of an Intl MV Record derived from a BigInt::toString(v, 10) decimal digit sequence (where those fields could alternatively be defined directly by counting the digits in the decimal representation of _v_, e.g. ceiling(log10(abs(_v_) + 1)) or a named equivalent)

The uses of FormatNumericToString seem to be necessary, but it occurs to me that we could probably remove a lot of translation, e.g. carrying non-exponential decimal strings from FormatNumericToString and maybe-exponential decimal strings from Number::toString all the way to the exponent-ensuring and decimal-point-shifting work of RenderInExponentialNotation without passing through non-string intermediaries.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions