New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugs with non-default pillar.sigfig settings #98

Closed
tmelconian opened this Issue Feb 7, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@tmelconian

tmelconian commented Feb 7, 2018

Depending on where the decimal point falls, the pillar.sigfig option sometimes does not work correctly when set to a non-default value.

Here is the result with the default setting, which works as expected:

> pillar::pillar(c(1234.56, 123.456, 12.3456, 1.23456, 0.123456))
   <dbl>
1235    
 123    
  12.3  
   1.23 
   0.123

(in the terminal, the 123 are highlighted, which doesn't come through the cut and paste).

So far, so good. Now, my expectation is that if I change sigfig to 6, I will get 6 significant figures, but I don't:

> options(pillar.sigfig=6)
> pillar::pillar(c(1234.56, 123.456, 12.3456, 1.23456, 0.123456))
      <dbl>
1234       
 123.46    
  12.3456  
   1.23456 
   0.123456

The first two of these provide too few significant figures. Additionally, the rounding on the 1234 is now wrong.

Version: pillar_1.1.0

@krlmlr krlmlr closed this in f9e9737 Feb 8, 2018

@krlmlr

This comment has been minimized.

Member

krlmlr commented Feb 8, 2018

Thanks for the concise example!

@tmelconian

This comment has been minimized.

tmelconian commented Feb 9, 2018

Thanks for the quick fix!

krlmlr added a commit that referenced this issue Feb 9, 2018

Merge tag 'v1.1.0.9000'
- New styling helper `style_subtle_num()`.
- Very small numbers (like `1e-310`) are now printe corectly (tidyverse/tibble#377).
- Fix representation of right-hand side for `getOption(pillar.sigfig) >= 6` (tidyverse/tibble#380).
- The decimal dot is now always printed for numbers of type `numeric`. Trailing zeros are not displayed anymore if all displayed numbers are whole numbers.
- The new option `pillar.subtle_num` (default: `FALSE`) decides if numbers use subtle highlighting for digits that are considered insignificant.
- For decimal numbers, every third digit is underlined. This gives a better idea of the order of magnitude of the numbers. The first and last digit is never underlined.
- Decimal values longer than 13 characters always print in
  scientific notation.
- Fix computation of significant figures for numbers with absolute value >= 1 (#98).
- Logical columns are displayed as `TRUE` and `FALSE` again (#95).

krlmlr added a commit that referenced this issue Feb 26, 2018

Merge tag 'v1.2.0'
Display
-------

- Turned off using subtle style for digits that are considered insignificant.  Set the new option `pillar.subtle_num` to `TRUE` to turn it on again (default: `FALSE`).
- The negation sign is printed next to the number again (#91).
- Scientific notation uses regular digits again for exponents (#90).
- Groups of three digits are now underlined, starting with the fourth before/after the decimal point. This gives a better idea of the order of magnitude of the numbers (#78).
- Logical columns are displayed as `TRUE` and `FALSE` again (#95).
- The decimal dot is now always printed for numbers of type `numeric`. Trailing zeros are not displayed anymore if all displayed numbers are whole numbers (#62).
- Decimal values longer than 13 characters always print in scientific notation.

Bug fixes
---------

- Numeric values with a `"class"` attribute (e.g., `Duration` from lubridate) are now formatted using `format()` if the `pillar_shaft()` method is not implemented for that class (#88).
- Very small numbers (like `1e-310`) are now printed corectly (tidyverse/tibble#377).
- Fix representation of right-hand side for `getOption(pillar.sigfig) >= 6` (tidyverse/tibble#380).
- Fix computation of significant figures for numbers with absolute value >= 1 (#98).

New functions
-------------

- New styling helper `style_subtle_num()`, formatting depends on the `pillar.subtle_num` option.

krlmlr added a commit that referenced this issue Feb 27, 2018

Merge tag 'v1.2.1'
Display
-------

- Turned off using subtle style for digits that are considered insignificant.  Negative numbers are shown all red.  Set the new option `pillar.subtle_num` to `TRUE` to turn it on again (default: `FALSE`).
- The negation sign is printed next to the number again (#91).
- Scientific notation uses regular digits again for exponents (#90).
- Groups of three digits are now underlined, starting with the fourth before/after the decimal point. This gives a better idea of the order of magnitude of the numbers (#78).
- Logical columns are displayed as `TRUE` and `FALSE` again (#95).
- The decimal dot is now always printed for numbers of type `numeric`. Trailing zeros are not shown anymore if all displayed numbers are whole numbers (#62).
- Decimal values longer than 13 characters always print in scientific notation.

Bug fixes
---------

- Numeric values with a `"class"` attribute (e.g., `Duration` from lubridate) are now formatted using `format()` if the `pillar_shaft()` method is not implemented for that class (#88).
- Very small numbers (like `1e-310`) are now printed corectly (tidyverse/tibble#377).
- Fix representation of right-hand side for `getOption("pillar.sigfig") >= 6` (tidyverse/tibble#380).
- Fix computation of significant figures for numbers with absolute value >= 1 (#98).

New functions
-------------

- New styling helper `style_subtle_num()`, formatting depends on the `pillar.subtle_num` option.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment