https://github.com/mintlu8/i2f
Macros that turns integer literals to float literals and vice versa.
https://github.com/mintlu8/i2f
Last synced: 11 months ago
JSON representation
Macros that turns integer literals to float literals and vice versa.
- Host: GitHub
- URL: https://github.com/mintlu8/i2f
- Owner: mintlu8
- License: mit
- Created: 2023-10-15T01:34:46.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-15T02:45:21.000Z (over 2 years ago)
- Last Synced: 2025-01-15T13:10:37.534Z (over 1 year ago)
- Language: Rust
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# i2f
Macros that converts number literals into int or float literals.
In addition to literals, we also accept negative literals `-literal`.
## Examples
```rust
i2f!(90) //90.0
i2f!(-462) //-462.0
i2f!(3.14) //3.14
f2i!(3), //3
f2i!(3.0), //3
trunc!(3.14), //3
f2i!(-12.0), //-12
```