Project

General

Profile

Actions

Feature #1410

open

Add pretty-print sink options to override how to format floating point numbers

Added by Mathieu Desnoyers 10 months ago. Updated about 1 month ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
Start date:
02/21/2024
Due date:
% Done:

0%

Estimated time:

Description

Babeltrace 2, just like its predecessor babeltrace 1.5, uses "%g" to print floating point numbers.

It would be useful to let users optionally override the formatting for floating point numbers, perhaps with a pretty print sink option. They could then choose if exponent notation should be used or not, choose the precision, etc.

Actions #1

Updated by Philippe Proulx about 1 month ago

I wouldn't let a user control the exact partial format string (it's dangerous and we could even use something else to format in the future, for example {fmt}), but she could provide all the details as dedicated parameters, for example (using YAML for clarity):

params:
  format:
    float:
      mode: exponential
      show-sign: yes
      zero-pad: yes
      minimum-width: 7
      precision: 4

Would this work?

Actions

Also available in: Atom PDF