Skip to content

Improve formatting for various types #10

@cmpute

Description

@cmpute
  • For UBig / IBig
    • Implement {:x?} and {:X?} formatting (Wait until the format flags are exposed through public API)
  • For FBig
    • Implement {:x} and {:X} formatting for base 2. It should print the float as something like 0xabcp-n.
    • Implement {:e} and {:E} formatting. It should prints 999e-n for base 10, and xxx@-yy for other bases.
  • For RBig / Relaxed
    • Implement Debug
    • Implement {:b}, {:x}, {:X} by printing the components separately
    • Implement .in_radix() by printing the components separately
    • Implement .in_expanded() by printing the decimal form, which prints to certain digits after the radix point by default. It will support {:e}, {:E} as well. It should also supports printing the repeatant with the alternative flag set. Might also support other radices as well.
      format!("{}", rbig!(1/3).in_expanded(10)) -> 1.3333333 (maybe depends on the word size)
      format!("{:.4}", rbig!(1/3).in_expanded(10)) -> 1.3333
      format!("{:#.4}", rbig!(1/3).in_expanded(10)) -> 1.(3)
      format!("{:e}", rbig!(1/3).in_expanded(10)) -> 1.3e0
      format!("{:.4e}", rbig!(1/3).in_expanded(10)) -> 1.3333e0
      

(See here for repeatant detection implementation example)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions