AcademySoftwareFoundation / OpenTimelineIO

Open Source API and interchange format for editorial timeline information.
http://opentimeline.io
Apache License 2.0
1.41k stars 278 forks source link

decimal - binary - string round tripping #1174

Open meshula opened 2 years ago

meshula commented 2 years ago

Feature Request

Use our own decimal/binary and binary/decimal conversion routines for representing time values in strings, instead of relying on each language's standard library, in order to guarantee round trip lossless conversions

Description

it should be the case that any number of iterations of binary_num -> decimal string -> binary_num should result in identical values forever. It occurred to me that if we adopted an algorithm like dragonbox, we could guarantee round tripping, irrespective of what a language's standard runtime is doing. https://github.com/abolz/Drachennest

I'm suggesting dragonbox specifically because not only is it the fastest on the benchmark, it makes explicit round-trip guarantees. https://github.com/jk-jeon/dragonbox

Context

This issue comes up whenever we revisit the formatting strings we use in conversion, our options are usually severely constrained on formatting that works losslessly across conversion in Python and C++.

meshula commented 2 years ago

https://github.com/PixarAnimationStudios/OpenTimelineIO/issues/682