Are 'double' and 'float' data types fixed size in Protobuf? Do they occupy a fixed number of bytes (say 8 or 4 bytes) when serialized no matter what value (big or small) they actually keep? I want to use one of them to keep latitude and longitude. If they're fixed, then I think it makes sense to use 'float' instead as it seems to be enough?
In Protobuf, are double or float types fixed size when serialized?
1.2k Views Asked by losingsleeep At
1
There are 1 best solutions below
Related Questions in JAVA
- I need the BIRT.war that is compatible with Java 17 and Tomcat 10
- Creating global Class holder
- No method found for class java.lang.String in Kafka
- Issue edit a jtable with a pictures
- getting error when trying to launch kotlin jar file that use supabase "java.lang.NoClassDefFoundError"
- Does the && (logical AND) operator have a higher precedence than || (logical OR) operator in Java?
- Mixed color rendering in a JTable
- HTTPS configuration in Spring Boot, server returning timeout
- How to use Layout to create textfields which dont increase in size?
- Function for making the code wait in javafx
- How to create beans of the same class for multiple template parameters in Spring
- How could you print a specific String from an array with the values of an array from a double array on the same line, using iteration to print all?
- org.telegram.telegrambots.meta.exceptions.TelegramApiException: Bot token and username can't be empty
- Accessing Secret Variables in Classic Pipelines through Java app in Azure DevOps
- Postgres && statement Error in Mybatis Mapper?
Related Questions in GEOMETRY
- WorldToScreen function
- Intersection of Cartesian Box and Polygon in 3D
- find point in inside polygon ..with mysql
- How do I find the line segments formed by the meeting of two sides of two polygons?
- How to create a pareto distribution prediction function?
- How to estimate the memory size of a binary voxelized geometry?
- Spacing out overlapping rectangles: how to translate pseudocode?
- Sympy manipulation of wedge products
- how to create a sector and check if some point is in it's area?
- Get third control point quadratic Bezier curve for parabola with given fucus and directrix, Lua
- CGSRegionRef: How is an arbitrary region represented as union of rects?
- Distribution of n number of equi-distant point in polygon
- Selecting suitable triangles to intersect with a line
- How to distribute n number of points into a svg polygon javascript
- How to offset a shaply polygon without chnaging corner shape
Related Questions in PROTOCOL-BUFFERS
- Custom rewriter for json
- Cannot resolve method 'merge(String, Builder)' on JsonFormat after upgrading protobuf-java-util from 3.25.3 -> 4.26.0
- "No map fields found in com.google.cloud.compute.v1.Instance" error when getting instances in Google Cloud API Java
- How can I decode a Protocol Buffer that uses NanoPB?
- Is it possible to add a "this is what you should use" message when deprecating a Protocol buffer field?
- File passthrough in Meson project
- Least Connection Load balancing using Grpc
- Fatal Exception: java.lang.VerifyError when using Datastore with my own data class on some devices
- using gdscript procotcol buffers
- Use google.api.field_behavior with protoc-gen-ts_proto
- Unmarshalling json into protobuf having oneof type
- How can I export Pub/Sub messages using a Protobuf schema to a GCS bucket?
- Whats the proper way to fill a recyclerView with data from a proto datastore
- Having shared swagger (openapi) type definitions alongside with protobuf ones
- Errors with reading GTFS tripupdates.pb real time data using get() function
Related Questions in PROTOBUF-JAVA
- Cannot resolve method 'merge(String, Builder)' on JsonFormat after upgrading protobuf-java-util from 3.25.3 -> 4.26.0
- GCP Pubsub - protobuf message - Timestamp - Read issue
- Could not initialize class org.apache.pulsar.jetty.tls.JettySslContextFactory
- Why does the text field of DialogFlow's ResponseMessage contain a string array?
- Java protobuf serialization as empty byte array
- Grpc file is missing when using protoc to generate code
- Writing a gradle task to generate gRPC files for java and javascript
- Cannot deserialize protobuf
- how to map Object type variable of java in protobuf 3 for grpc
- Using protobuf-java in GraalVM native image
- Convert Json to protobuf DynamicMessage fails to convert unix timestamp dates
- In Protobuf, are double or float types fixed size when serialized?
- De/Serialzing custom java types with protobuf in java
- Android proto import files
- Use bloomRpc for protobuf request
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?
According to Google protobuf encoding docs,
doublewill be fixed of 8-bytes, andfloatis fixed 4-bytes when serializedWhen it comes to representing latitude and longitude, your choice between
doubleandfloatwould depend on your specific needs for precision:A float provides approximately 6-9 decimal digits of precision. In the context of latitude and longitude, this would allow you to specify a location to within about a meter.
A double, on the other hand, provides approximately 15-17 decimal digits of precision. This level of precision is generally more than you would need for geolocation data.
In summary, if you don't require extremely high precision, a float should be sufficient for storing latitude and longitude coordinates. Using float over double could also save some space, especially if you have a large dataset of such coordinates to store or transmit.
I hope this helps clarify your question!