Commit Graph

1132 Commits

Author SHA1 Message Date
Victor Zverovich
8bbe76af3a Add a missing decimal point in exponent notation with trailing zeros 2019-12-02 11:36:33 -08:00
Victor Zverovich
6037b3cae9 Fix dangling else problem in FMT_ASSERT 2019-11-30 07:52:33 -08:00
Victor Zverovich
2f9acd1838 Remove dependency on <cassert> 2019-11-29 09:37:18 -08:00
Victor Zverovich
b994a0ab13 Fix handling of missing fraction in snprintf_float 2019-11-29 06:17:29 -08:00
Victor Zverovich
bb205d940d Fix fallback pointer formatting on big endian 2019-11-29 05:15:59 -08:00
Victor Zverovich
9c7e2a6c6f Add missing newline 2019-11-27 11:06:40 -08:00
Victor Zverovich
c3be0f593d Refactor floating-point formatting 2019-11-27 08:08:22 -08:00
Victor Zverovich
c68703c9f4 float_spec -> float_specs 2019-11-26 15:53:24 -08:00
Victor Zverovich
3de36e9348 Enable -Wswitch-enum in CI 2019-11-26 10:17:48 -08:00
Victor Zverovich
0d07db1234 Fix handling of streamable and convertible to string types 2019-11-25 16:46:33 -08:00
Victor Zverovich
d19ed6716d Fix hexfloat buffer reallocation 2019-11-25 15:54:04 -08:00
Victor Zverovich
99b6e928d4 Fix handling of types with deleted rvalue conversion to string (#1421) 2019-11-25 08:30:47 -08:00
Victor Zverovich
111fc127fe Remove fp::operator- 2019-11-24 13:28:15 -08:00
Victor Zverovich
6003ec3f25 Simplify Grisu implementation 2019-11-24 13:24:28 -08:00
Victor Zverovich
28d7191c27 Don't print trailing zero with fixed, precision=0, and showpoint (#1417) 2019-11-24 08:23:10 -08:00
Victor Zverovich
43271ba8e8 Handle null terminator at the end of the buffer 2019-11-24 07:15:25 -08:00
Victor Zverovich
4cf59ce734 Integrate Grisu and sprintf digit generators 2019-11-23 06:56:29 -08:00
Victor Zverovich
7395472dde Refactor floating-point formatting 2019-11-22 18:49:19 -08:00
Victor Zverovich
3e1f70fe02 Merge write_fp into write 2019-11-20 12:20:17 -08:00
Victor Zverovich
66d7746bb3 Use grisu for exponent notation 2019-11-19 16:55:11 -08:00
Victor Zverovich
57b6f2966d Deprecate the fmt macro 2019-11-19 11:28:17 -08:00
Leon Klingele
78842ce0d6 test: add default constructor for a const value
This fixed a compilation error of the OS X 10.11.6 C++ compiler:

    ./fmt/test/format-test.cc:1861:16: error: default initialization of an object of const type 'const Answer' without a user-provided default constructor
      const Answer const_answer;
                   ^
                               {}
2019-11-19 08:32:35 -08:00
Victor Zverovich
5420bcce2d Make % an opt-in to improve compatibility with std::format 2019-11-18 08:04:43 -08:00
Victor Zverovich
56a2e2075c Refactor float spec parsing 2019-11-18 07:37:36 -08:00
Victor Zverovich
9b7fe2a4a1 Don't use POSIX API on UWP 2019-11-17 08:29:08 -08:00
Victor Zverovich
dcde089b4e Improve POSIX API detection 2019-11-15 07:28:02 -08:00
David P. Sicilia
2145a7bdcc Move has_formatter into the public fmt namespace. (#1407)
* Move has_formatter into the public fmt namespace.

This will allow users to do SFINAE-friendly checks for
the formattability of a type.

Fixes #1369
2019-11-14 07:08:24 -08:00
daniel
f1559e1d56 Use grouping() from locale for specifier 'n' 2019-11-05 07:22:12 +00:00
Attila Tajti
0889856d61 Fix UTF-8 truncation 2019-11-03 11:53:15 +00:00
Victor Zverovich
213e09644f Workaround X11 madness (#1388) 2019-11-01 08:47:11 -07:00
Victor Zverovich
40414b3446 Don't emit trailing zeros in exponential notation (#1376) 2019-10-28 12:31:00 -07:00
Victor Zverovich
d39ebf3ff2 Optimize counting 2019-10-21 06:57:42 -07:00
Victor Zverovich
8498bc97dd Initialize all the things 2019-10-20 17:53:18 -07:00
Victor Zverovich
e2ea940673 Handle assymetric boundaries 2019-10-20 07:55:05 -07:00
Victor Zverovich
2bc5585ff0 Fix computing lower boundaries for smallest normalized double 2019-10-18 17:56:52 -07:00
Victor Zverovich
36d1390e67 Implement round half to even 2019-10-18 07:21:12 -07:00
Orivej Desh
599e0aef45 Support single precision floats in grisu formatting
Fixes #1336
2019-10-18 07:08:41 -07:00
Victor Zverovich
a5abe5d95c Handle negative exponent and nonnegative power 2019-10-13 13:16:09 -07:00
Victor Zverovich
1cbc5fa6cb Handle negative exponent and rename value/pow10 to numerator/denominator 2019-10-13 12:50:48 -07:00
Victor Zverovich
f7a5748fd3 Partially implement (FPP)^2 2019-10-13 09:28:35 -07:00
Victor Zverovich
5e58eb97b1 Implement add_compare 2019-10-13 08:05:06 -07:00
Orivej Desh
3a15ea3ea5 Rename write_double to write_fp
It handles all floating point types, not just doubles.
2019-10-12 11:41:24 -07:00
Orivej Desh
b87ac4d840 Distinguish float from double 2019-10-12 11:41:24 -07:00
Victor Zverovich
b55551f900 Implement more comparison operators 2019-10-12 09:22:24 -07:00
Deniz Evrenci
96f91428c6 Add defaulted copy and move operations to format_error and system_error (#1347)
* Avoid weak vtables by providing a private virtual member function

* Add warning Wweak-vtables to clang when FMT_PEDANTIC is on

* Add defaulted copy and move operations to format_error and system_error

Compiler generated copy operations are deprecated and move operations
are not generated altogether.

* Add warning Wdeprecated to clang when FMT_PEDANTIC is on
2019-10-11 10:44:20 -07:00
Victor Zverovich
e4d6d9d7c8 Implement divmod 2019-10-09 13:40:50 -07:00
Orivej Desh
a1079e9fd6 Fix undefined in format-test (#1349)
When `MoveCtor` performs `check_move_buffer`, the buffer allocator becomes null,
but then `MoveCtor` attempts to use it to allocate a dynamic buffer. This
succeeds nevertheless because a typical `std::allocator<char>::allocate` does
not use `this`, so it does not crash when `this` is null.

Fixes #1344
2019-10-08 15:42:51 -07:00
Orivej Desh
b66bb6b71f Fix undefined in core-test and printf-test (#1345)
* Fix undefined in core-test

Fixes "reference binding to null pointer" in BufferTest.Ctor

buffer.operator[] attempts to return a reference to `buffer.ptr_[0]` when `ptr_`
in `mock_buffer<int> buffer` is null.

* Fix undefined in printf-test

Fixes "signed integer overflow" in PrintfTest.Length

This occurs in `TestLength<long long>("ll")`, since its minimum value minus one
does not fit in long long.

* Fix undefined in printf %0$

Printf counts arguments from 1.

Fixes "shift exponent -4 is negative" in PrintfTest.InvalidArgIndex.

`do_get` is called with index -1 when `basic_printf_context.arg` is called with
id 4294967295 when basic_printf_context::get_arg subtracts 1 from arg_index 0 in
the format string "%0$d".
2019-10-08 06:28:39 -07:00
Victor Zverovich
b60114533f Implement more bigint operations 2019-10-06 12:49:23 -07:00
Victor Zverovich
c41cea8b18 Initial implementation of square 2019-10-05 16:37:52 -07:00