Jump to page: 1 25  
Page
Thread overview
Another take on decimal data types
Jan 08
rumbu
Jan 09
rumbu
Jan 09
aberba
Jan 11
Seb
Jan 11
rumbu
Jan 11
jmh530
Jan 11
kdevel
Jan 11
kdevel
Jan 12
Joakim
Jan 11
kdevel
Jan 11
kdevel
Jan 11
rumbu
Jan 11
kdevel
Jan 12
rumbu
Jan 12
rumbu
Jan 12
kdevel
Jan 12
kdevel
Jan 13
rumbu
Jan 13
kdevel
Jan 13
kdevel
Jan 13
kdevel
Jan 13
rumbu
Jan 13
mark_mcs
Jan 13
kdevel
Jan 13
kdevel
Jan 13
rumbu
Jan 13
kdevel
Jan 13
rumbu
Jan 13
kdevel
Jan 13
rumbu
Jan 13
kdevel
Jan 14
rumbu
Jan 14
kdevel
Jan 14
rumbu
Jan 14
kdevel
January 08
This is my first D finalized project (+16k loc).

I know that there are other two projects intended to provide a decimal data type for D, but I consider mine the most complete and most compliant to the standards (at least until now).

There are two years of since I'm working on it (and learning D in the same time), but I concentrated most of the efforts in the last two months.

It was a nice exercise because I was happy to remember the math I learn through my college years (trigonometry, logarithms, Taylor series, derivatives, etc). Unfortunately I'm not using the same math during my day-to day job.

Maybe in another post I will share my struggles I encountered during the development (plenty of). But a big thank you goes to Rainer Schuetze: without Visual Studio and without the integrated debugger this project was impossible to maintain.

Now on topic:

- fully IEEE-754-2008 compliant;
- one flat file;
- using Intel's binary decimal enconding;
- three decimal data types: decimal32, decimal64 and decimal128
- all D operators supported for all numeric types (left and right side integrals, floats, chars);
- conversion supported from/to integrals, floats, bools, chars
- conversion to/from other decimal formats (Microsoft Currency, Microsoft Decimal, IBM Densely Packed Decimal)
- all std.math functions implemented (even logarithms and trigonometry);
- all format specifiers implemented (%f, %e, %g, %a);
- integrated with phobos format and conversion functions (to, format, writef);
- thread local precision (from 1 to 34 decimal digits);
- new rounding mode - Europe's most used - tiesToAway;
- alternate exception handling (through flags);
- minimal dependencies (some traits and some floating point functions);
- comprehensive documentation;

Source code: https://github.com/rumbu13/decimal/blob/master/src/decimal.d

Documentation: http://rumbu13.github.io/decimal/doc/decimal.html

The project is more than in an alpha state, all operations were tested but not exhaustively.

What's next:
- more tests;
- benchmarks;


January 08
Wow awesome, it would be nice if you could add it as a dub package (
http://code.dlang.org/publish) to dub repository (http://code.dlang.org)

On Mon, Jan 8, 2018 at 11:16 PM, rumbu via Digitalmars-d-announce < digitalmars-d-announce@puremagic.com> wrote:

> This is my first D finalized project (+16k loc).
>
> I know that there are other two projects intended to provide a decimal data type for D, but I consider mine the most complete and most compliant to the standards (at least until now).
>
> There are two years of since I'm working on it (and learning D in the same time), but I concentrated most of the efforts in the last two months.
>
> It was a nice exercise because I was happy to remember the math I learn through my college years (trigonometry, logarithms, Taylor series, derivatives, etc). Unfortunately I'm not using the same math during my day-to day job.
>
> Maybe in another post I will share my struggles I encountered during the development (plenty of). But a big thank you goes to Rainer Schuetze: without Visual Studio and without the integrated debugger this project was impossible to maintain.
>
> Now on topic:
>
> - fully IEEE-754-2008 compliant;
> - one flat file;
> - using Intel's binary decimal enconding;
> - three decimal data types: decimal32, decimal64 and decimal128
> - all D operators supported for all numeric types (left and right side
> integrals, floats, chars);
> - conversion supported from/to integrals, floats, bools, chars
> - conversion to/from other decimal formats (Microsoft Currency, Microsoft
> Decimal, IBM Densely Packed Decimal)
> - all std.math functions implemented (even logarithms and trigonometry);
> - all format specifiers implemented (%f, %e, %g, %a);
> - integrated with phobos format and conversion functions (to, format,
> writef);
> - thread local precision (from 1 to 34 decimal digits);
> - new rounding mode - Europe's most used - tiesToAway;
> - alternate exception handling (through flags);
> - minimal dependencies (some traits and some floating point functions);
> - comprehensive documentation;
>
> Source code: https://github.com/rumbu13/decimal/blob/master/src/decimal.d
>
> Documentation: http://rumbu13.github.io/decimal/doc/decimal.html
>
> The project is more than in an alpha state, all operations were tested but not exhaustively.
>
> What's next:
> - more tests;
> - benchmarks;
>
>
>


January 08
Great job.

1) Assembly
2) That file needs to be split up. I can feel the lag as I scroll it.
January 09
On Monday, 8 January 2018 at 22:16:25 UTC, rumbu wrote:
> Documentation: http://rumbu13.github.io/decimal/doc/decimal.html

Wow, slick documentation!
January 09
On Monday, 8 January 2018 at 22:16:25 UTC, rumbu wrote:
> This is my first D finalized project (+16k loc).
>
> I know that there are other two projects intended to provide a decimal data type for D, but I consider mine the most complete and most compliant to the standards (at least until now).

Wow!.  So thorough.  Documentation is fantastic.  Very nice work, indeed!

Mike
January 09
On Tuesday, 9 January 2018 at 10:41:42 UTC, Mike Franklin wrote:
> On Monday, 8 January 2018 at 22:16:25 UTC, rumbu wrote:
>> This is my first D finalized project (+16k loc).
>>
>> I know that there are other two projects intended to provide a decimal data type for D, but I consider mine the most complete and most compliant to the standards (at least until now).
>
> Wow!.  So thorough.  Documentation is fantastic.  Very nice work, indeed!
>
> Mike

I couldn't say it better. Its really well done...
January 09
On Monday, 8 January 2018 at 22:54:06 UTC, rikki cattermole wrote:
> Great job.
>
> 1) Assembly
> 2) That file needs to be split up. I can feel the lag as I scroll it.

1) I don't understand :)
2) Done.

On Monday, 8 January 2018 at 22:46:27 UTC, Daniel Kozak wrote:
> Wow awesome, it would be nice if you could add it as a dub package (
> http://code.dlang.org/publish) to dub repository (http://code.dlang.org)

Done.


Github project: https://github.com/rumbu13/decimal
Documentation: http://rumbu13.github.io/decimal/doc/package.html
Dub package: https://code.dlang.org/packages/decimal
January 09
On Tuesday, 9 January 2018 at 22:00:13 UTC, rumbu wrote:
> Documentation: http://rumbu13.github.io/decimal/doc/package.html

I noticed a minor typo in the documentation:

    auto b = decimal32(123456789); //inexact, represented as 1234568 * x 10^^2

I believe the "*" should be deleted.

This is great documentation!
January 11
On 2018-01-08 22:16:25 +0000, rumbu said:

> This is my first D finalized project (+16k loc).

Great stuff! Will this work in betterC mode?

Side-Note: I'm always missing the betterC information or is the philosophy to just try it out?

-- 
Robert M. Münch
http://www.saphirion.com
smarter | better | faster

January 11
On Thursday, 11 January 2018 at 11:19:41 UTC, Robert M. Münch wrote:
> On 2018-01-08 22:16:25 +0000, rumbu said:
>
>> This is my first D finalized project (+16k loc).
>
> Great stuff! Will this work in betterC mode?
>
> Side-Note: I'm always missing the betterC information or is the philosophy to just try it out?

We have now this page:

https://dlang.org/spec/betterc.html


Well, betterC it's still a WIP feature and its feature subset is improved from release to release.
In doubt you can always use run.dlang.io to quickly try out things.
« First   ‹ Prev
1 2 3 4 5