#### Environment details 1. Specify the API at the beginning of the title (for example, "BigQuery: ...") General, Core, and Other are also allowed as types 2. OS type and version: any 3. Java version: any 4. google-cloud-java version(s): 1.96.0 #### Steps to reproduce Create a row with this timestamp: 1337-09-02 11:43:21.622894 UTC, query and use fieldValue.getTimestamp(). Microseconds wouldn't be equal. #### Code example @Test public void testFloatingPointPrecisionLoss() { FieldValue fieldValue = FieldValue.of(Attribute.PRIMITIVE, "-1.9954383398377106E10"); long received = fieldValue.getTimestampValue(); long expected = -19954383398377106L; assertEquals(expected, received); } #### Any additional information below Cause - floating point conversation causes it; need to use BigDecimal (or equivalent) to perform lossless conversion.
Environment details
General, Core, and Other are also allowed as types
Steps to reproduce
Create a row with this timestamp: 1337-09-02 11:43:21.622894 UTC, query and use fieldValue.getTimestamp(). Microseconds wouldn't be equal.
Code example
@test
public void testFloatingPointPrecisionLoss() {
FieldValue fieldValue = FieldValue.of(Attribute.PRIMITIVE, "-1.9954383398377106E10");
long received = fieldValue.getTimestampValue();
long expected = -19954383398377106L;
assertEquals(expected, received);
}
Any additional information below
Cause - floating point conversation causes it; need to use BigDecimal (or equivalent) to perform lossless conversion.