336 Commits

Author SHA1 Message Date
Pavel Novikov
1ea4d2563e
made function non-template
+fixed a couple of typos
2025-09-30 12:18:29 +03:00
Daniel Lemire
7262d9454e lint 2025-09-29 15:08:24 -04:00
Daniel Lemire
fd98fd6689
specialize for std::float32_t and std::float64_t explicitly
credit: @lemire
2025-09-29 21:43:36 +03:00
Pavel Novikov
197c0ffca7
clang format 2025-09-29 21:43:35 +03:00
Pavel Novikov
13345cab65
added template overload for integer_times_pow10() 2025-09-18 21:29:25 +03:00
Daniel Lemire
88b1e5321c version 8.1.0 2025-09-18 09:38:45 -06:00
Daniel Lemire
2aa6d0ba72
Merge pull request #326 from fastfloat/patch803
Release candidate 8.0.3
2025-09-18 09:37:20 -06:00
Daniel Lemire
0b6d911220 format 2025-09-18 08:30:28 -06:00
Pavel Novikov
7a77227521
minor fix of forward declaration 2025-09-18 17:02:29 +03:00
Daniel Lemire
e20c952456
Merge pull request #320 from toughengineer/int_multiplication_by_power_of_10
Implemented multiplication of integer by a power of 10
2025-09-18 07:48:09 -06:00
Daniel Lemire
bb956b29db release candidate 8.0.3 2025-09-18 07:44:53 -06:00
Daniel Lemire
48fc5404d4 compatibility fix 2025-09-18 07:44:05 -06:00
InvalidUsernameException
9d81c71aef Do not mis-parse certain wide-character emojis as integer
When calling ch_to_digit() with a UTF-16 or UTF-32 code unit, it simply
truncates away any data stored in the non-low byte(s) of the code unit.
It then uses a lookup table to determine whether the low byte
corresponds to an ASCII digit. This is incorrect because as soon as any
bit outside the low byte is set, the number will never correspond to a
ASCII digit anymore.

To fix this, we produce a mask that is all zeroes if any bit outside the
low byte is set in the code unit, all ones otherwise. Anding this mask
with the original code unit forces the table lookup to return the
sentinel value from the zero-index if any high bit was set and causes
the code unit not to be parsed as integer.

This bug was discovered when loading Mastodon posts inside the Ladybird
browser where some of Mastodon's JavaScript would trigger the code path
that erroneously parsed the emoji as integer. It had the visible effect
that some digits inside the posts would get rendered as one of the
emojis that parsed to that digit. For more details see this issue:
https://github.com/LadybirdBrowser/ladybird/issues/6205

The emojis in the test case are simply all the emojis used on Mastodon
that caused the bug. They can be found here:
06803422da/app/javascript/mastodon/features/emoji/emoji_map.json
2025-09-15 23:12:28 +02:00
WenLei
6677924083 float_common.h: Support RISC-V 2025-09-11 11:11:30 +08:00
Pavel Novikov
0a230326ab
now finally got the anti-ambiguity overloads right, right? 2025-09-06 02:22:43 +03:00
Pavel Novikov
7ae62ee0d5
finally got the anti-ambiguity overloads right? 2025-09-06 02:10:55 +03:00
Pavel Novikov
e12463583f
added lacking overloads to avoid potential ambiguity 2025-09-06 00:12:41 +03:00
Pavel Novikov
20a7383442
renamed the function, cleaned up return type 2025-09-05 13:36:23 +03:00
Daniel Lemire
42db9ac1de
Merge branch 'main' into P2497R0 2025-09-03 12:04:36 -04:00
Pavel Novikov
6be07d66a8
inlining Clinger's fast path because why not,
and it seems to bring performance to the level before the changes somewhat
2025-09-03 16:59:40 +03:00
Daniel Lemire
c0582c27f5 typos in the comments 2025-09-02 17:29:12 -04:00
Pavel Novikov
a134561e4b
added missing inline specifiers 2025-09-02 23:03:38 +03:00
Pavel Novikov
7b8f04500a
implemented multiplication of integer by power of 10 2025-09-02 13:20:36 +03:00
Daniel Lemire
81b8306c5f implementation of https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2497r0.html 2025-05-19 18:08:36 -04:00
Daniel Lemire
50a80a73ab v8.0.2 2025-03-11 09:51:53 -04:00
Daniel Lemire
1bf7010153 v8.0.1 2025-03-10 09:04:05 -04:00
Daniel Lemire
c6732cd28b lint 2025-03-10 09:02:38 -04:00
Daniel Lemire
b29208f93d adding FASTFLOAT_IF_CONSTEXPR17 2025-03-09 17:10:55 -04:00
Daniel Lemire
6f0049a2e7 lint 2025-03-09 15:14:52 -04:00
Daniel Lemire
95dedd0aed turning json option into macro parameter 2025-03-09 15:13:43 -04:00
Joao Paulo Magalhaes
3e9dc96eb4 Fix -Wundef warnings seen in gcc 4.8 and 4.9 2025-02-13 08:45:11 +00:00
Joao Paulo Magalhaes
9cfa5ff4a0 fix warnings from -Wundef 2025-02-12 23:51:44 +00:00
Daniel Lemire
77cc847c84 pushing version change 2025-02-08 11:49:58 -05:00
Daniel Lemire
7a5ee5af60
Merge pull request #296 from dalle/dalle/float16
16-bit float support
2025-02-06 19:41:37 -05:00
Daniel Lemire
1d50f57dd9 better wording. 2025-02-06 00:16:28 -05:00
Johan Råde
d4d5748ec8 Silenced Visual Studio compiler warning
This code caused a C4127 "conditional expression is constant" compiler warning
when compiled with Visual Studio at warning level 4 with T a signed integer type.
2025-01-16 16:12:34 +01:00
Anders Dalvander
ce274f7051 include and order types largerst to smallest 2024-12-04 10:17:05 +01:00
Anders Dalvander
7226c00490 cleanup 2024-12-04 09:35:32 +01:00
Anders Dalvander
2a6c2604b5 check for IEEE 754 compliance 2024-12-04 09:34:34 +01:00
Anders Dalvander
62f526dfd3 fix -Werror=conversion 2024-12-03 23:52:57 +01:00
Anders Dalvander
da819feb74 back to std::bit_cast 2024-12-03 23:23:35 +01:00
Anders Dalvander
8cee025082 add powers_of_ten/max_mantissa for float16_t/bfloat16_t 2024-12-03 23:23:34 +01:00
Daniel Lemire
6f8fd6728d make it build 2024-12-03 23:23:34 +01:00
Daniel Lemire
bfcff49c83 16-bit float support 2024-12-03 23:23:34 +01:00
Anders Dalvander
3775a81ced formatted code 2024-12-01 16:39:28 +01:00
Anders Dalvander
0a1bf11560 harmonize ifdef checks 2024-12-01 16:36:45 +01:00
Anders Dalvander
3146e686d0 introduce equiv_uint_t 2024-12-01 16:36:17 +01:00
Anders Dalvander
d3f7113d6e add char8_t support 2024-11-23 10:21:48 +01:00
Anders Dalvander
1a15c66fb9 harmonize files to use "east const"
manually checked modified files for errors, but not committing .clang-format due to the following warning:
>>> Setting `QualifierAlignment` to something other than `Leave`, COULD lead to incorrect code formatting due to incorrect decisions made due to clang-formats lack of complete semantic information. As such extra care should be taken to review code changes made by the use of this option.
2024-11-23 09:46:18 +01:00
Anders Dalvander
7f476cd259 fix clang unused-function warning 2024-11-23 09:04:46 +01:00