temporal
temporal copied to clipboard
TotalTimeDuration needs
This is related to https://github.com/boa-dev/temporal/issues/613 but is not the same issue
This is the reason behind test failures in built-ins/Temporal/Duration/prototype/total/precision-exact-mathematical-values-6 and built-ins/Temporal/Duration/prototype/total/precision-exact-mathematical-values-7.
- Let divisor be the value in the "Length in Nanoseconds" column of the row of Table 21 whose "Value" column contains unit.
- NOTE: The following step cannot be implemented directly using floating-point arithmetic when 𝔽(timeDuration) is not a safe integer. The division can be implemented in C++ with the __float128 type if the compiler supports it, or with software emulation such as in the SoftFP library.
- Return timeDuration / divisor.
cc @nekevss
Some options:
- We use rustc_apfloat (https://docs.rs/rustc_apfloat/latest/rustc_apfloat/ieee/type.Quad.html)
- We do something like FractionalToDouble from SpiderMonkey https://searchfox.org/firefox-main/source/js/src/builtin/temporal/Temporal.cpp#487
Note that our divisors are from a known, small set. We may be able to also get out of things by e.g. separating out the power of ten division.
This was addressed by #622, correct?
Yes, I believe so.