Commit 541e9d7
authored
Rollup merge of rust-lang#141521 - ruancomelli:const-float-rounding, r=RalfJung
Add `const` support for float rounding methods
# Add `const` support for float rounding methods
This PR makes the following float rounding methods `const`:
- `f64::{floor, ceil, trunc, round, round_ties_even}`
- and the corresponding methods for `f16`, `f32` and `f128`
Tracking issue: rust-lang#141555
## Procedure
I followed rust-lang@c09ed3e as closely as I could in making float methods `const`, and also received great guidance from https://internals.rust-lang.org/t/const-rounding-methods-in-float-types/22957/3?u=ruancomelli.
## Note
This is my first code contribution to the Rust project, so please let me know if I missed anything - I'd be more than happy to revise and learn more. Thank you for taking the time to review it!10 files changed
+220
-56
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2212 | 2212 | | |
2213 | 2213 | | |
2214 | 2214 | | |
2215 | | - | |
| 2215 | + | |
2216 | 2216 | | |
2217 | 2217 | | |
2218 | 2218 | | |
2219 | 2219 | | |
2220 | 2220 | | |
2221 | 2221 | | |
2222 | | - | |
| 2222 | + | |
2223 | 2223 | | |
2224 | 2224 | | |
2225 | 2225 | | |
2226 | 2226 | | |
2227 | 2227 | | |
2228 | 2228 | | |
2229 | | - | |
| 2229 | + | |
2230 | 2230 | | |
2231 | 2231 | | |
2232 | 2232 | | |
2233 | 2233 | | |
2234 | 2234 | | |
2235 | 2235 | | |
2236 | | - | |
| 2236 | + | |
2237 | 2237 | | |
2238 | 2238 | | |
2239 | 2239 | | |
2240 | 2240 | | |
2241 | 2241 | | |
2242 | 2242 | | |
2243 | 2243 | | |
2244 | | - | |
| 2244 | + | |
2245 | 2245 | | |
2246 | 2246 | | |
2247 | 2247 | | |
2248 | 2248 | | |
2249 | 2249 | | |
2250 | 2250 | | |
2251 | | - | |
| 2251 | + | |
2252 | 2252 | | |
2253 | 2253 | | |
2254 | 2254 | | |
2255 | 2255 | | |
2256 | 2256 | | |
2257 | 2257 | | |
2258 | | - | |
| 2258 | + | |
2259 | 2259 | | |
2260 | 2260 | | |
2261 | 2261 | | |
2262 | 2262 | | |
2263 | 2263 | | |
2264 | 2264 | | |
2265 | | - | |
| 2265 | + | |
2266 | 2266 | | |
2267 | 2267 | | |
2268 | 2268 | | |
2269 | 2269 | | |
2270 | 2270 | | |
2271 | 2271 | | |
2272 | 2272 | | |
2273 | | - | |
| 2273 | + | |
2274 | 2274 | | |
2275 | 2275 | | |
2276 | 2276 | | |
2277 | 2277 | | |
2278 | 2278 | | |
2279 | 2279 | | |
2280 | | - | |
| 2280 | + | |
2281 | 2281 | | |
2282 | 2282 | | |
2283 | 2283 | | |
2284 | 2284 | | |
2285 | 2285 | | |
2286 | 2286 | | |
2287 | | - | |
| 2287 | + | |
2288 | 2288 | | |
2289 | 2289 | | |
2290 | 2290 | | |
2291 | 2291 | | |
2292 | 2292 | | |
2293 | 2293 | | |
2294 | | - | |
| 2294 | + | |
2295 | 2295 | | |
2296 | 2296 | | |
2297 | 2297 | | |
| |||
2300 | 2300 | | |
2301 | 2301 | | |
2302 | 2302 | | |
2303 | | - | |
| 2303 | + | |
2304 | 2304 | | |
2305 | 2305 | | |
2306 | 2306 | | |
| |||
2309 | 2309 | | |
2310 | 2310 | | |
2311 | 2311 | | |
2312 | | - | |
| 2312 | + | |
2313 | 2313 | | |
2314 | 2314 | | |
2315 | 2315 | | |
| |||
2318 | 2318 | | |
2319 | 2319 | | |
2320 | 2320 | | |
2321 | | - | |
| 2321 | + | |
2322 | 2322 | | |
2323 | 2323 | | |
2324 | 2324 | | |
| |||
2327 | 2327 | | |
2328 | 2328 | | |
2329 | 2329 | | |
2330 | | - | |
| 2330 | + | |
2331 | 2331 | | |
2332 | 2332 | | |
2333 | 2333 | | |
2334 | 2334 | | |
2335 | 2335 | | |
2336 | 2336 | | |
2337 | 2337 | | |
2338 | | - | |
| 2338 | + | |
2339 | 2339 | | |
2340 | 2340 | | |
2341 | 2341 | | |
2342 | 2342 | | |
2343 | 2343 | | |
2344 | 2344 | | |
2345 | | - | |
| 2345 | + | |
2346 | 2346 | | |
2347 | 2347 | | |
2348 | 2348 | | |
2349 | 2349 | | |
2350 | 2350 | | |
2351 | 2351 | | |
2352 | | - | |
| 2352 | + | |
2353 | 2353 | | |
2354 | 2354 | | |
2355 | 2355 | | |
2356 | 2356 | | |
2357 | 2357 | | |
2358 | 2358 | | |
2359 | | - | |
| 2359 | + | |
2360 | 2360 | | |
2361 | 2361 | | |
2362 | 2362 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1447 | 1447 | | |
1448 | 1448 | | |
1449 | 1449 | | |
| 1450 | + | |
| 1451 | + | |
1450 | 1452 | | |
1451 | | - | |
| 1453 | + | |
1452 | 1454 | | |
1453 | 1455 | | |
1454 | 1456 | | |
| |||
1477 | 1479 | | |
1478 | 1480 | | |
1479 | 1481 | | |
| 1482 | + | |
| 1483 | + | |
1480 | 1484 | | |
1481 | | - | |
| 1485 | + | |
1482 | 1486 | | |
1483 | 1487 | | |
1484 | 1488 | | |
| |||
1513 | 1517 | | |
1514 | 1518 | | |
1515 | 1519 | | |
| 1520 | + | |
| 1521 | + | |
1516 | 1522 | | |
1517 | | - | |
| 1523 | + | |
1518 | 1524 | | |
1519 | 1525 | | |
1520 | 1526 | | |
| |||
1547 | 1553 | | |
1548 | 1554 | | |
1549 | 1555 | | |
| 1556 | + | |
| 1557 | + | |
1550 | 1558 | | |
1551 | | - | |
| 1559 | + | |
1552 | 1560 | | |
1553 | 1561 | | |
1554 | 1562 | | |
| |||
1579 | 1587 | | |
1580 | 1588 | | |
1581 | 1589 | | |
| 1590 | + | |
| 1591 | + | |
1582 | 1592 | | |
1583 | | - | |
| 1593 | + | |
1584 | 1594 | | |
1585 | 1595 | | |
1586 | 1596 | | |
| |||
1610 | 1620 | | |
1611 | 1621 | | |
1612 | 1622 | | |
| 1623 | + | |
| 1624 | + | |
1613 | 1625 | | |
1614 | | - | |
| 1626 | + | |
1615 | 1627 | | |
1616 | 1628 | | |
1617 | 1629 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1423 | 1423 | | |
1424 | 1424 | | |
1425 | 1425 | | |
| 1426 | + | |
| 1427 | + | |
1426 | 1428 | | |
1427 | | - | |
| 1429 | + | |
1428 | 1430 | | |
1429 | 1431 | | |
1430 | 1432 | | |
| |||
1453 | 1455 | | |
1454 | 1456 | | |
1455 | 1457 | | |
| 1458 | + | |
| 1459 | + | |
1456 | 1460 | | |
1457 | | - | |
| 1461 | + | |
1458 | 1462 | | |
1459 | 1463 | | |
1460 | 1464 | | |
| |||
1489 | 1493 | | |
1490 | 1494 | | |
1491 | 1495 | | |
| 1496 | + | |
| 1497 | + | |
1492 | 1498 | | |
1493 | | - | |
| 1499 | + | |
1494 | 1500 | | |
1495 | 1501 | | |
1496 | 1502 | | |
| |||
1523 | 1529 | | |
1524 | 1530 | | |
1525 | 1531 | | |
| 1532 | + | |
| 1533 | + | |
1526 | 1534 | | |
1527 | | - | |
| 1535 | + | |
1528 | 1536 | | |
1529 | 1537 | | |
1530 | 1538 | | |
| |||
1555 | 1563 | | |
1556 | 1564 | | |
1557 | 1565 | | |
| 1566 | + | |
| 1567 | + | |
1558 | 1568 | | |
1559 | | - | |
| 1569 | + | |
1560 | 1570 | | |
1561 | 1571 | | |
1562 | 1572 | | |
| |||
1586 | 1596 | | |
1587 | 1597 | | |
1588 | 1598 | | |
| 1599 | + | |
| 1600 | + | |
1589 | 1601 | | |
1590 | | - | |
| 1602 | + | |
1591 | 1603 | | |
1592 | 1604 | | |
1593 | 1605 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1591 | 1591 | | |
1592 | 1592 | | |
1593 | 1593 | | |
| 1594 | + | |
1594 | 1595 | | |
1595 | | - | |
| 1596 | + | |
1596 | 1597 | | |
1597 | 1598 | | |
1598 | 1599 | | |
| |||
1621 | 1622 | | |
1622 | 1623 | | |
1623 | 1624 | | |
1624 | | - | |
| 1625 | + | |
| 1626 | + | |
1625 | 1627 | | |
1626 | 1628 | | |
1627 | 1629 | | |
| |||
1655 | 1657 | | |
1656 | 1658 | | |
1657 | 1659 | | |
1658 | | - | |
| 1660 | + | |
| 1661 | + | |
1659 | 1662 | | |
1660 | 1663 | | |
1661 | 1664 | | |
| |||
1688 | 1691 | | |
1689 | 1692 | | |
1690 | 1693 | | |
1691 | | - | |
| 1694 | + | |
| 1695 | + | |
1692 | 1696 | | |
1693 | 1697 | | |
1694 | 1698 | | |
| |||
1718 | 1722 | | |
1719 | 1723 | | |
1720 | 1724 | | |
1721 | | - | |
| 1725 | + | |
| 1726 | + | |
1722 | 1727 | | |
1723 | 1728 | | |
1724 | 1729 | | |
| |||
1747 | 1752 | | |
1748 | 1753 | | |
1749 | 1754 | | |
| 1755 | + | |
1750 | 1756 | | |
1751 | | - | |
| 1757 | + | |
1752 | 1758 | | |
1753 | 1759 | | |
1754 | 1760 | | |
| |||
0 commit comments