float16cr
float16cr
This shard provides a Float16 type (implementing the IEEE 754 binary16 type), which can be used like any other float.
Internally, the Float16 math operations convert the Float16 to a Float32, run the operation and convert it back.
You should avoid using math operations directly. Rather use this type to convert to other floating types:
# io is some unknown IO
f16 = io.read_bytes(Float16, IO::ByteFormat::BigEndian)
f64 = f16.to_f64
Installation
-
Add the dependency to your
shard.yml
:dependencies: float16cr: gitlab: BlobCodes/float16cr
-
Run
shards install
Usage
require "float16cr"
# Use Float16 like any other float
# Note that Float16 literals are not supported, you'll have to convert from other types.
f16 = 0.12.to_f16
puts f16 * 10 # => 1.2
Development
TODO: Write development instructions here
Contributing
- Fork it (https://gitlab.com/BlobCodes/float16cr/-/forks/new)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- BlobCodes - creator and maintainer
Repository
float16cr
Owner
Statistic
- 1
- 0
- 0
- 0
- 0
- about 3 years ago
- September 24, 2021
License
MIT License
Links
Synced at
Thu, 07 Nov 2024 15:13:27 GMT
Languages