Skip to content

v1.5.0 (Jan. 12, 2020)

Compare
Choose a tag to compare
@fxamacker fxamacker released this 13 Jan 04:51
· 535 commits to master since this release

This release adds encoding options while maintaining backward compatibility.

With EncOptions.ShortestFloat = ShortestFloat16, floating-point values (including subnormals) encode
float64 -> float32 -> float16 when values can round-trip. This is optimized by avoiding the round-trip test except for a subset of subnormal input values and using a faster test for other values.

Conversions for infinity and NaN use InfConvert and NaNConvert settings.

New functions like CanonicalEncOptions(), CTAP2EncOptions(), etc. return predefined EncOptions that can be modified to create custom configurations.

Changes include:

  • Use x448/float16 (same team as this library) because all 4+ billion possible conversions are tested.
  • Feature: Add funcs that return predefined EncOptions (commit b7b5733, e203b29)
    • CanonicalEncOptions() -- Canonical CBOR (RFC 7049)
    • CTAP2EncOptions() -- CTAP2 Canonical CBOR
    • CoreDetEncOptions() -- Core Deterministic Encoding (draft RFC, subject to change)
    • PreferredUnsortedEncOptions() - Preferred unsorted serialization (draft RFC, subject to change)
  • Feature: Add ShortestFloat option for encoding (commit 29e78ee)
    • ShortestFloatNone (default)
    • ShortestFloat16
  • Feature: Add NanConvertMode for encoding (commit 16c573c)
    • NaNConvertNone
    • NanConvert7e00
    • NanConvertQuiet
    • NaNConvertPreserveSignal
  • Feature: Add InfConvertMode for encoding (commit 16c573c)
    • InfConvertNone
    • InfConvertFloat16
  • Refactor and improve quality of code, docs, and tests

UPDATE: Fuzzing passed 4.75+ billion execs with Go 1.12 on Jan. 22, 2020.
Fuzzing passed 2.88+ billion execs with Go 1.13 on Jan. 31, 2020 (slower machine).