You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This proposal details the workings of the planned upgrade to arbitrary precision numbers. Details are yet to be worked out
Overview
At the moment Cheddar has limited 64-bit numbers. These can loose precision with large numbers and also have floating point errors. This is not at all wanted in Cheddar and therefore, after a certain limit has been reached, should be implicitly upgraded to "bigints".
Definition
Using Number.MAX_SAFE_INT to detail the largest integer than can be reached. Use an alternative CheddarNumber#big_value to store an array detailing the number. The array should be a Uint32Array typed arrays allocated to the size of the number, where each item is exactly 32-bits. With each item representing a 32-bit uint (4294967295). CheddarNumber#bigsize stores the number of allocated sections in the array which will be referenced by each operation to determine whether or not the number has been promoted. During any operation if the Number.MAX_SAFE_INT has been exceeded, the promotion will occur if and only if, the number stores a CheddarClass#Reference to a variable or, the number has lost precision. This is too avoid needlessly promoting where the final value is near Number.MAX_SAFE_INT but still has precision.
Changelist
The following needs to be changed:
CheddarNumber#value getters and setters
CheddarNumber.Operator promotion
and probably some more stuff...
The text was updated successfully, but these errors were encountered:
Okay, so I'll be implementing this in C++ forked off cheddar-lang/Cheddar (2f52151). However platform-independent code gets more difficult to product due to the wide amount of different platforms that need to be supported. Particularity since Windows does not like to play nice with like... everything else. Anyway, I can greatly accelerate all work on this if anyone would like to volunteer to help me test on Windows.
This proposal details the workings of the planned upgrade to arbitrary precision numbers. Details are yet to be worked out
Overview
At the moment Cheddar has limited 64-bit numbers. These can loose precision with large numbers and also have floating point errors. This is not at all wanted in Cheddar and therefore, after a certain limit has been reached, should be implicitly upgraded to "bigints".
Definition
Using
Number.MAX_SAFE_INT
to detail the largest integer than can be reached. Use an alternativeCheddarNumber#big_value
to store an array detailing the number. The array should be aUint32Array
typed arrays allocated to the size of the number, where each item is exactly 32-bits. With each item representing a 32-bit uint (4294967295
).CheddarNumber#bigsize
stores the number of allocated sections in the array which will be referenced by each operation to determine whether or not the number has been promoted. During any operation if theNumber.MAX_SAFE_INT
has been exceeded, the promotion will occur if and only if, the number stores aCheddarClass#Reference
to a variable or, the number has lost precision. This is too avoid needlessly promoting where the final value is nearNumber.MAX_SAFE_INT
but still has precision.Changelist
The following needs to be changed:
CheddarNumber#value
getters and settersCheddarNumber.Operator
promotionand probably some more stuff...
The text was updated successfully, but these errors were encountered: