I need something like uint16_t but for floating point numbers instead of integer. I need to be able to convert a float to it so I can transfer it and convert back to float later (obviously I will lose some precision). Is there a simple solution for this or should I do it manually?
Is there a type with fixed size of two bytes for floating points in c?
181 Views Asked by whoAmI At
1
There are 1 best solutions below
Related Questions in C
- How to call a C language function from x86 assembly code?
- What does: "char *argv[]" mean?
- User input sanitization program, which takes a specific amount of arguments and passes the execution to a bash script
- How to crop a BMP image in half using C
- How can I get the difference in minutes between two dates and hours?
- Why will this code compile although it defines two variables with the same name?
- Compiling eBPF program in Docker fails due to missing '__u64' type
- Why can't I use the file pointer after the first read attempt fails?
- #include Header files in C with definition too
- OpenCV2 on CLion
- What is causing the store latency in this program?
- How to refer to the filepath of test data in test sourcecode?
- 9 Digit Addresses in Hexadecimal System in MacOS
- My server TCP doesn't receive messages from the client in C
- Printing the characters obtained from the array s using printf?
Related Questions in FLOATING-POINT
- Imprecision in float integers in C
- printf floating-point output variations only with alpine docker on Windows
- Is it possible to represent -3/32 as a binary floating-point value using only 7 bits
- Pytorch sum problem (possibly floating point)
- Example of Code with and without strictfp Modifier
- Why does numpy's `2**np.array([64])` produces 0, whereas plain python's 2**64 gives the correct result?
- How does floating-point addition work in "np.finfo(np.float64).max + 1"?
- Problem caused by FP16 group quantization on vit-tiny
- How to format float to omit zeros at the end of the fraction
- TypeError: Cannot cast array data from dtype('O') to dtype('float64') according to the rule 'safe' again
- Why wont variables in the list print to 3 decimal places?
- How to print all the decimals of a float 128 to the console
- How to specify a float/decimal value for a column inside an insert in liquibase changelog?
- Why does gcc -O1 affects std::rint()?
- Sign of result of addition in floating point arithmetic
Related Questions in TYPE-CONVERSION
- Problem converting time series df from chr to date using as.POSIXct
- Is there a way to convert unknow file type to human readable format?
- Is converting uint16_t into uint8_t[2] using a cast valid in C?
- Error in R: column type remains 'character' even after applying as.numeric
- Why is an empty string in JavaScript equals to zero?
- How to convert OpenCvSharp.Mat to Emgu.CV.Mat?
- How do I convert an object value to a str value in Pandas?
- `pandas` datetime - correct way to do linear interpolation
- Convert decimal to string with at least a zero for integer value in C#
- R - Convert various csv numeric columns to date
- How do I represent enum variants in json for serde?
- Implementing generic Borrow transitively for HashMap key lookup
- Why can't I use a list of functions returning a generic class with different type parameters in C#
- How to format an array of numbers into a string in C#?
- Convert numeric column to integer if possible, otherwise keep as numeric
Related Questions in FIXED-SIZE-TYPES
- Jssor How do I make it so the text box within the slider doesn't scale with the screen size. I still want to parent object to scale?
- Clang-tidy: how to configure size_t, uintptr_t and pointers to 32-bits?
- Multiplication / Division format when using <stdint.h>
- Compiler error info : No matching function for call to FUNCTION(TYPES ARGS) with unused typename template
- Is that fixed-size array? a[]
- Understanding fixed width integer types
- Is it possible to create a non-fixed size array in C#?
- Fixed-size Eigen matrices in CppAD
- Contiguous hierarchical struct memory with fixed-size arrays in C#?
- Fixed point precision real numbers arithmetic support for Eigen/Eigen3
- Generate fixed size hash
- Is there a type with fixed size of two bytes for floating points in c?
- std::cout deal with uint8_t as a character
- Optimally passing dimensions of fixed size array in julia
- Workaround on declaring a unsafe fixed custom struct array?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
There is no such thing in the C standard. Some compilers do have __fp16.
You can use Q numbers, but these are limited in a fixed range.
If you really need floating point, with the exponent, then you should implement the ieee standard half precision.
Regular artimetics work on the Q numbers. You should write your own arithmetic for the half precision. Unless your compiler support it.
Or go open source.