Commit f00121f
Add BFloat16 (#98643)
* Add api for BFloat16
* Creating
* Equals and GetHashCode
* Comparison
* Constants and comment
* Xml doc
* Using rounding for cast
* Ref source
* Simple tests
* Conversion tests
* Stripping sign is redundant
* Fix test copied from Half
* Fix conversion test cases
* Constants and well-known values
* Categorizing methods
* Reorder conversion members
* Operators batch 1
* Operators batch 2
* TryConvert
* Operators batch 3
* Parsing and formatting
* Add comments about how to determine parse and format info
* Add missing interface implementations
* NumberBufferLength
* Add more comment
* Correct MinFastFloatDecimalExponent
* Add explicit conversion to
* Explicit convert from
* Fullfill casting operators
* Fullfill some formatting
* Apply suggestions from code review
Co-authored-by: Tanner Gooding <tagoo@outlook.com>
* Generic DiyFp
* Generic Grisu3
* Generic Dragon4
* Add MaxRoundTripDigits to MaxPrecisionCustomFormat to FormatInfo
* Generic FormatFloat
* Adapt with existing FP types
* Adapt formatting traits
* Use generic format and delete Number.BFloat16
* Update ref source
* Enable constant value tests
* IsFinite/IsNaN
* IsPositive/IsNegative/IsSubnormal
* ToDouble
* Fix test case
* Add double conversion test
* Parse tests
* Formatting tests
* RoundTripping tests
* Port float->Half conversion algorithm to double->BFloat16 to handle ULP rounding.
* Port function tests from Half
* Convert the precesion of test cases.
* Align with TryWriteBig/LittleEndian
* Remove redundant 'partial'
* Use DefaultParseStyle
* Fill conversion in signed integer
* Fill conversion in unsigned integer and floating point
* Add conversion for S.R.Numerics
* Use float member function instead of MathF
* Fill conversion in decimal
* Add conversion for NFloat
* Use soft rounding for uint->bf16
* Generic math rounding from unsigned and signed integer
* Cleanup helper methods
* Add integer rounding tests
* Move helpers and fix comment
* Update comment
* Fix ILogB
* Apply suggestions from code review
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Move conversion interface to BFloat16
* Add missing conversion to Half
* Remove NFloat conversion
* Tune CreateSingle/CreateDouble
* Adjust constant naming
* Use <summary> for math expression
---------
Co-authored-by: Tanner Gooding <tagoo@outlook.com>
Co-authored-by: Dan Moseley <danmose@microsoft.com>
Co-authored-by: Jeff Handley <jeffhandley@users.noreply.github.com>
Co-authored-by: Tanner Gooding <tagoo@microsoft.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>1 parent e36d92e commit f00121f
File tree
15 files changed
+5007
-29
lines changed- src/libraries
- System.Private.CoreLib/src
- Resources
- System
- Numerics
- System.Runtime.Numerics
- ref
- src/System/Numerics
- System.Runtime
- ref
- tests/System.Runtime.Tests
- System
- Numerics
15 files changed
+5007
-29
lines changedLines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4379 | 4379 | | |
4380 | 4380 | | |
4381 | 4381 | | |
| 4382 | + | |
| 4383 | + | |
| 4384 | + | |
4382 | 4385 | | |
4383 | 4386 | | |
4384 | 4387 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
603 | 603 | | |
604 | 604 | | |
605 | 605 | | |
| 606 | + | |
606 | 607 | | |
607 | 608 | | |
608 | 609 | | |
| |||
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
947 | 948 | | |
948 | 949 | | |
949 | 950 | | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
950 | 955 | | |
951 | 956 | | |
952 | 957 | | |
| |||
1000 | 1005 | | |
1001 | 1006 | | |
1002 | 1007 | | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
1003 | 1012 | | |
1004 | 1013 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
| 165 | + | |
| 166 | + | |
165 | 167 | | |
166 | 168 | | |
167 | 169 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
738 | 738 | | |
739 | 739 | | |
740 | 740 | | |
741 | | - | |
| 741 | + | |
742 | 742 | | |
743 | 743 | | |
744 | 744 | | |
| |||
1015 | 1015 | | |
1016 | 1016 | | |
1017 | 1017 | | |
1018 | | - | |
| 1018 | + | |
1019 | 1019 | | |
1020 | 1020 | | |
1021 | 1021 | | |
| |||
1177 | 1177 | | |
1178 | 1178 | | |
1179 | 1179 | | |
1180 | | - | |
1181 | | - | |
1182 | | - | |
1183 | | - | |
1184 | 1180 | | |
1185 | 1181 | | |
1186 | 1182 | | |
| |||
1360 | 1356 | | |
1361 | 1357 | | |
1362 | 1358 | | |
1363 | | - | |
| 1359 | + | |
1364 | 1360 | | |
1365 | 1361 | | |
1366 | 1362 | | |
| |||
2339 | 2335 | | |
2340 | 2336 | | |
2341 | 2337 | | |
2342 | | - | |
| 2338 | + | |
2343 | 2339 | | |
2344 | 2340 | | |
2345 | 2341 | | |
| |||
2351 | 2347 | | |
2352 | 2348 | | |
2353 | 2349 | | |
2354 | | - | |
| 2350 | + | |
2355 | 2351 | | |
2356 | 2352 | | |
2357 | | - | |
| 2353 | + | |
2358 | 2354 | | |
2359 | 2355 | | |
2360 | 2356 | | |
2361 | 2357 | | |
2362 | | - | |
| 2358 | + | |
2363 | 2359 | | |
2364 | 2360 | | |
2365 | 2361 | | |
| |||
Lines changed: 42 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
53 | 56 | | |
54 | 57 | | |
55 | 58 | | |
| |||
61 | 64 | | |
62 | 65 | | |
63 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
64 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
65 | 75 | | |
66 | 76 | | |
67 | 77 | | |
| |||
73 | 83 | | |
74 | 84 | | |
75 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
76 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
77 | 94 | | |
78 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
79 | 99 | | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
80 | 104 | | |
81 | 105 | | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
82 | 109 | | |
83 | 110 | | |
84 | 111 | | |
85 | 112 | | |
86 | 113 | | |
87 | 114 | | |
88 | 115 | | |
89 | | - | |
90 | | - | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
91 | 123 | | |
92 | 124 | | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
99 | 133 | | |
100 | 134 | | |
101 | 135 | | |
| |||
0 commit comments