Open cmpute opened 1 year ago
After some investigation, it's hard to ensure that the buffer for constant is passed around easily without duplication. So I guess the implementation should rely on a thread local static buffer with RefCell
. Then the implementation won't result in a break change and can be postponed to v0.5
Support the following math constants under the
dashu_float::consts
module:e(precision: usize) -> FBig<B, R>
pi(precision: usize) -> FBig<B, R>
ln2(precision: usize) -> FBig<B, R>
ln10(precision: usize) -> FBig<B, R>
sqrt2(precision: usize) -> FBig<B, R>
(ref)Furthermore, we might consider create a global buffer to store commonly used math constants (specifically
pi
,ln2
andln10
). This requires one of the following modifications:Rc
to the constants. In that case, theContext
will be!Send
and!Sync
and we need to inform users that onlyRepr
isSend
andSync
.Context
type) to clear the buffer.