Skip to content

Commit 5a99bd1

Browse files
authored
Enhance comments in _writeFloatNoCheck method
Added comments explaining the choice of float representation in _writeFloatNoCheck method.
1 parent 253ccac commit 5a99bd1

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

cbor/src/main/java/tools/jackson/dataformat/cbor/CBORGenerator.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,12 @@ private final void _writeLongNoCheck(long l) throws JacksonException
658658

659659
private final void _writeFloatNoCheck(float f) throws JacksonException {
660660
_ensureRoomForOutput(5);
661+
/*
662+
* 17-Apr-2010, tatu: could also use 'floatToIntBits', but it seems more
663+
* accurate to use exact representation; and possibly faster. However,
664+
* if there are cases where collapsing of NaN was needed (for non-Java
665+
* clients), this can be changed
666+
*/
661667
_outputBuffer[_outputTail++] = BYTE_FLOAT32;
662668
if (CBORVarHandleUtil.FLOAT_BE != null) {
663669
CBORVarHandleUtil.FLOAT_BE.set(_outputBuffer, _outputTail, f);

0 commit comments

Comments
 (0)