AcademySoftwareFoundation / AcademySoftwareFoundation/OpenTimelineIO

Rate should be int/int not float

Open
#190 13 comments 4 reactions 0 assignees View on GitHub
help wanted needs discussion time calculations
Dominant language
C++
Stars
2k
Forks
351
Avg merge
1d 12h
Merged PRs (30d)
1

Description

Currently RationalTime is represented as a float value and a float rate. Unfortunately there are cases where floating point arithmetic leads to precision issues, rounding and undesirable drift.

Some other systems represent rate as an int/int rational number. For example 30000/1001 vs 29.97.

We would like to experiment with this alternate representation of rate for OTIO. In order to do so, we propose two concrete steps:
1. Write a unit test that clearly demonstrates a flaw in using a floating point rate.
2. Create two different time classes (perhaps RationalTime and FractionalTime?) that can be used interchangeably in OTIO, but with different representations of rate.

By doing this we can ensure that we won't break anything by making this switch and we can clearly explain to everyone (ourselves included) the difference between the two and the reasons for choosing one over the other.

Comments?

Contributor guide

Open the contributing guide

Research direction

Start by reading the existing RationalTime implementation and its unit tests, then identify how rate is represented and used across OTIO. Add a test demonstrating floating-point precision or drift, and evaluate interchangeable RationalTime and FractionalTime representations without breaking existing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.