On 2018-01-11 18:15:23 +0000, rumbu said:
On Thursday, 11 January 2018 at 11:19:41 UTC, Robert M. Münch wrote:
Great stuff! Will this work in betterC mode?
It will not work without some refactory. Most of phobos/druntime
dependencies are minimal an can be rewritten - in fact there are only 9
dependencies: bsr, bsf, addu, subu, adds, subs from druntime and isNaN,
isinfinity, signbit from std.math.
The rest of the dependencies are simply traits that must work by
default under betterC.
Ok, that doesn't sound impossible.
Once dependencies are solved, another problem will be the exception
mechanism. 90% of arithmetic operations are meant to throw exceptions,
but this can be overridden by the alternate exception handling -
raising and setting flags.
Yes, makes sense.
BUT - a very big but - the most important issue is the formatting thing.
a printf equivalent for decimal types is rewritten from scratch or -
decimal values must be converted to binary float before printing them -
but this will negate the main purpose of the decimal type - precision.
Well, I think even using a decimal128 for some calculations to have
higher precision intermediate results and only converting them to float
for UI interaction would make a lot of sense.
At least in our use-case, that would be quite interesting.
Looking forward to see some benchmarks.
Robert M. Münch
smarter | better | faster