Re: Another take on decimal data types

2018-01-14 Thread kdevel via Digitalmars-d-announce
On Sunday, 14 January 2018 at 12:35:43 UTC, rumbu wrote: On Sunday, 14 January 2018 at 11:44:39 UTC, kdevel wrote: On Sunday, 14 January 2018 at 07:20:26 UTC, rumbu wrote: On Saturday, 13 January 2018 at 22:51:18 UTC, kdevel wrote: [...] Can you please tell me on your system what are the val

Re: Another take on decimal data types

2018-01-14 Thread rumbu via Digitalmars-d-announce
On Sunday, 14 January 2018 at 11:44:39 UTC, kdevel wrote: On Sunday, 14 January 2018 at 07:20:26 UTC, rumbu wrote: On Saturday, 13 January 2018 at 22:51:18 UTC, kdevel wrote: [...] Can you please tell me on your system what are the values for real.sizeof and real.mant_dig? They are 12 and

Re: Another take on decimal data types

2018-01-14 Thread kdevel via Digitalmars-d-announce
On Sunday, 14 January 2018 at 07:20:26 UTC, rumbu wrote: On Saturday, 13 January 2018 at 22:51:18 UTC, kdevel wrote: [...] Can you please tell me on your system what are the values for real.sizeof and real.mant_dig? They are 12 and 64 (-m32) and 16 and 64 (-m64). [...] [...] For

Re: Another take on decimal data types

2018-01-13 Thread rumbu via Digitalmars-d-announce
On Saturday, 13 January 2018 at 22:51:18 UTC, kdevel wrote: On Saturday, 13 January 2018 at 22:05:02 UTC, rumbu wrote: Now it prints: 1.00+0.84147098480789650669 +0.8414709848078965066525023216302990 +2.653e-18 My values differ slightly 1.00 0.841470984807896506664591

Re: Another take on decimal data types

2018-01-13 Thread kdevel via Digitalmars-d-announce
On Saturday, 13 January 2018 at 22:05:02 UTC, rumbu wrote: Now it prints: 1.00+0.84147098480789650669 +0.8414709848078965066525023216302990 +2.653e-18 My values differ slightly 1.00 0.841470984807896506664591 0.8414709848078965066525023.653e-18 But I would c

Re: Another take on decimal data types

2018-01-13 Thread rumbu via Digitalmars-d-announce
On Saturday, 13 January 2018 at 20:40:20 UTC, kdevel wrote: On Saturday, 13 January 2018 at 19:28:40 UTC, rumbu wrote: On Saturday, 13 January 2018 at 18:37:10 UTC, kdevel wrote: I get large numerical dicrepancies and an exception: That's because you are mixing floating point and decimal. J

Re: Another take on decimal data types

2018-01-13 Thread kdevel via Digitalmars-d-announce
On Saturday, 13 January 2018 at 19:28:40 UTC, rumbu wrote: On Saturday, 13 January 2018 at 18:37:10 UTC, kdevel wrote: I get large numerical dicrepancies and an exception: That's because you are mixing floating point and decimal. Just to take one example: double 1.1 cannot be represented ex

Re: Another take on decimal data types

2018-01-13 Thread rumbu via Digitalmars-d-announce
On Saturday, 13 January 2018 at 18:37:10 UTC, kdevel wrote: I get large numerical dicrepancies and an exception: That's because you are mixing floating point and decimal. Just to take one example: double 1.1 cannot be represented exactly as floating point and it's in fact 1.100238418579

Re: Another take on decimal data types

2018-01-13 Thread kdevel via Digitalmars-d-announce
On Saturday, 13 January 2018 at 17:46:15 UTC, rumbu wrote: The following code works: real r; for (r = 1; r < 6; r += .1L) { decimal128 d = r; auto dsin = sin (d); auto rsin = sin (r); auto delta = dsin - rsin; //delta is decimal128 writefln ("%9.2f

Re: Another take on decimal data types

2018-01-13 Thread rumbu via Digitalmars-d-announce
On Saturday, 13 January 2018 at 17:19:31 UTC, kdevel wrote: How can I convert a decimalX to float/double/real? Implicit conversion is not available at library level, D does not have an implicit conversion operator; Subtracting decimalX - real will result in a decimalX. This was a design de

Re: Another take on decimal data types

2018-01-13 Thread kdevel via Digitalmars-d-announce
On Saturday, 13 January 2018 at 14:43:53 UTC, rumbu wrote: I received a suggestion to reorganize the file structure because of some bug in dub (https://issues.dlang.org/show_bug.cgi?id=11847). The dub.json remained out of sync. I changed it, but I am not 100% sure that it's working. I am not

Re: Another take on decimal data types

2018-01-13 Thread kdevel via Digitalmars-d-announce
On Saturday, 13 January 2018 at 14:43:53 UTC, rumbu wrote: On Saturday, 13 January 2018 at 13:56:20 UTC, kdevel wrote: Now my code does no longer compiles against the decimal package. This is my directory structure: I received a suggestion to reorganize the file structure because of some bu

Re: Another take on decimal data types

2018-01-13 Thread mark_mcs via Digitalmars-d-announce
On Saturday, 13 January 2018 at 14:43:53 UTC, rumbu wrote: Personally I hate dub because it's polluting my %APPDATA% folder and each time I connect my laptop to the company domain network, I must wait to sync zillions of files. Dub uses the roaming profile directory for its cache storage. Thi

Re: Another take on decimal data types

2018-01-13 Thread rumbu via Digitalmars-d-announce
On Saturday, 13 January 2018 at 13:56:20 UTC, kdevel wrote: Now my code does no longer compiles against the decimal package. This is my directory structure: I received a suggestion to reorganize the file structure because of some bug in dub (https://issues.dlang.org/show_bug.cgi?id=11847)

Re: Another take on decimal data types

2018-01-13 Thread kdevel via Digitalmars-d-announce
On Saturday, 13 January 2018 at 13:49:59 UTC, kdevel wrote: diff --git a/dub.json b/dub.json index c48899f..d8882c1 100644 --- a/dub.json +++ b/dub.json @@ -10,16 +10,16 @@ "configurations": [ { "name": "library", -"excludedSourceFiles": [ "src/benchmark.d",

Re: Another take on decimal data types

2018-01-13 Thread kdevel via Digitalmars-d-announce
On Saturday, 13 January 2018 at 13:44:20 UTC, kdevel wrote: $ dub Performing "debug" build using dmd for x86_64. decimal ~master: building configuration "library"... src/test/test.d(4,5): Error: only one main allowed. Previously found main at src/benchmark/benchmark.d(143,5) dmd failed with exi

Re: Another take on decimal data types

2018-01-13 Thread kdevel via Digitalmars-d-announce
On Saturday, 13 January 2018 at 01:30:12 UTC, rumbu wrote: On Friday, 12 January 2018 at 13:09:42 UTC, kdevel wrote: $ dmd nosine.d decimal.git/libdecimal.a decimal/package.d(10505): Error: undefined identifier decimalCapAngle Sorry, broke some code when I made the split. Now it's working.

Re: Another take on decimal data types

2018-01-12 Thread rumbu via Digitalmars-d-announce
On Friday, 12 January 2018 at 13:09:42 UTC, kdevel wrote: $ dmd nosine.d decimal.git/libdecimal.a decimal/package.d(10505): Error: undefined identifier decimalCapAngle Sorry, broke some code when I made the split. Now it's working.

Re: Another take on decimal data types

2018-01-12 Thread Jack Stouffer via Digitalmars-d-announce
On Monday, 8 January 2018 at 22:16:25 UTC, rumbu wrote: Source code: https://github.com/rumbu13/decimal/blob/master/src/decimal.d Documentation: http://rumbu13.github.io/decimal/doc/decimal.html This looks really good. I think with a little work it would be ready for proposal into Phobos. I

Re: Another take on decimal data types

2018-01-12 Thread Joakim via Digitalmars-d-announce
On Thursday, 11 January 2018 at 22:07:42 UTC, H. S. Teoh wrote: On Thu, Jan 11, 2018 at 04:38:57PM -0500, Steven Schveighoffer via Digitalmars-d-announce wrote: On 1/11/18 4:12 PM, kdevel wrote: > On Thursday, 11 January 2018 at 20:40:01 UTC, Dmitry > Olshansky wrote: > > What did you expect?

Re: Another take on decimal data types

2018-01-12 Thread kdevel via Digitalmars-d-announce
On Monday, 8 January 2018 at 22:16:25 UTC, rumbu wrote: - all std.math functions implemented (even logarithms and trigonometry); nosine.d ``` import std.stdio; // import std.math; import decimal; void nosine (T) () { T d = T(1.1); writeln (sin(d)); } void main () { nosine!decimal32;

Re: Another take on decimal data types

2018-01-12 Thread kdevel via Digitalmars-d-announce
On Friday, 12 January 2018 at 05:18:15 UTC, rumbu wrote: On Thursday, 11 January 2018 at 23:57:29 UTC, kdevel wrote: What about the failed comparison: You are right in fact, there is also a failed comparison. Now corrected. Works. Thanks for the changes!

Re: Another take on decimal data types

2018-01-11 Thread rumbu via Digitalmars-d-announce
On Thursday, 11 January 2018 at 23:57:29 UTC, kdevel wrote: What about the failed comparison: You are right in fact, there is also a failed comparison. Now corrected.

Re: Another take on decimal data types

2018-01-11 Thread rumbu via Digitalmars-d-announce
On Thursday, 11 January 2018 at 23:57:29 UTC, kdevel wrote: What about the failed comparison: gt.d ``` import std.stdio; import decimal; void loopme(T) () { "---".writeln; T e = 10; while (e > 1e-6) { e /= 10; writeln (e, ' ', e > 1e-6); } } void main () { loopme!dec

Re: Another take on decimal data types

2018-01-11 Thread kdevel via Digitalmars-d-announce
On Thursday, 11 January 2018 at 22:36:40 UTC, rumbu wrote: 1000 100 10 1 0.1 0.01 0.001 0.0001 1e-05 Regarding printf, I cannot help, this is a C function, has nothing to do with D formatting. Sure. What about the failed comparison: gt.d ``` import std.stdio; import decimal; void loopme(T)

Re: Another take on decimal data types

2018-01-11 Thread rumbu via Digitalmars-d-announce
On Thursday, 11 January 2018 at 21:24:30 UTC, kdevel wrote: On Thursday, 11 January 2018 at 20:44:13 UTC, kdevel wrote: On Thursday, 11 January 2018 at 20:35:03 UTC, kdevel wrote: <--- loop output missing loop.d ``` import std.stdio; import decimal; void loopme(T) () { "---".

Re: Another take on decimal data types

2018-01-11 Thread H. S. Teoh via Digitalmars-d-announce
On Thu, Jan 11, 2018 at 04:38:57PM -0500, Steven Schveighoffer via Digitalmars-d-announce wrote: > On 1/11/18 4:12 PM, kdevel wrote: > > On Thursday, 11 January 2018 at 20:40:01 UTC, Dmitry Olshansky wrote: > > > What did you expect? > > > > To be honest: A compile time error. Modern C compilers

Re: Another take on decimal data types

2018-01-11 Thread Robert M. Münch via Digitalmars-d-announce
On 2018-01-11 15:34:04 +, Seb said: 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 Hi, thanks. Should have been more precise: An informaiton for every lib if it is compatible with

Re: Another take on decimal data types

2018-01-11 Thread Dmitry Olshansky via Digitalmars-d-announce
On Thursday, 11 January 2018 at 21:12:59 UTC, kdevel wrote: On Thursday, 11 January 2018 at 20:40:01 UTC, Dmitry Olshansky wrote: printf ("%.2f\n", d); C’s printf by definition can’t be customized. Sure. “”” GNU C Library lets you define “”” Here is your compatibility story. What di

Re: Another take on decimal data types

2018-01-11 Thread Robert M. Münch via Digitalmars-d-announce
On 2018-01-11 18:15:23 +, 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

Re: Another take on decimal data types

2018-01-11 Thread Steven Schveighoffer via Digitalmars-d-announce
On 1/11/18 4:12 PM, kdevel wrote: On Thursday, 11 January 2018 at 20:40:01 UTC, Dmitry Olshansky wrote: What did you expect? To be honest: A compile time error. Modern C compilers can check such format strings. Example: GCC 6: But dmd isn't a C compiler, nor does it have to worry about the

Re: Another take on decimal data types

2018-01-11 Thread kdevel via Digitalmars-d-announce
On Thursday, 11 January 2018 at 20:44:13 UTC, kdevel wrote: On Thursday, 11 January 2018 at 20:35:03 UTC, kdevel wrote: <--- loop output missing loop.d ``` import std.stdio; import decimal; void loopme(T) () { "---".writeln; T e = T(1000); while (e > T(1e-6)) { e.w

Re: Another take on decimal data types

2018-01-11 Thread kdevel via Digitalmars-d-announce
On Thursday, 11 January 2018 at 20:40:01 UTC, Dmitry Olshansky wrote: printf ("%.2f\n", d); C’s printf by definition can’t be customized. Sure. http://www.gnu.org/software/libc/manual/html_node/Customizing-Printf.html What did you expect? To be honest: A compile time error. Modern C co

Re: Another take on decimal data types

2018-01-11 Thread kdevel via Digitalmars-d-announce
On Thursday, 11 January 2018 at 20:35:03 UTC, kdevel wrote: printf ("%.2f\n", d); This must read writefln ("%.2f", d); Would have expected a compile time/run time error. This prints: 0.735 0.00 <--- expected: 0.74 Good. writefln prints the expected value. 0.735 0

Re: Another take on decimal data types

2018-01-11 Thread Dmitry Olshansky via Digitalmars-d-announce
On Thursday, 11 January 2018 at 20:35:03 UTC, kdevel wrote: Great project! On Monday, 8 January 2018 at 22:16:25 UTC, rumbu wrote: - all format specifiers implemented (%f, %e, %g, %a); Really? [...] What's next: - more tests; Here you are: ``` import std.stdio; import decimal; void mai

Re: Another take on decimal data types

2018-01-11 Thread kdevel via Digitalmars-d-announce
Great project! On Monday, 8 January 2018 at 22:16:25 UTC, rumbu wrote: - all format specifiers implemented (%f, %e, %g, %a); Really? [...] What's next: - more tests; Here you are: ``` import std.stdio; import decimal; void main () { decimal32 d = "0.7"; d *= decimal32("1.05");

Re: Another take on decimal data types

2018-01-11 Thread Steven Schveighoffer via Digitalmars-d-announce
On 1/11/18 1:15 PM, rumbu wrote: On Thursday, 11 January 2018 at 11:19:41 UTC, Robert M. Münch wrote: On 2018-01-08 22:16:25 +, rumbu said: This is my first D finalized project (+16k loc). Great stuff! Will this work in betterC mode? It will not work without some refactory. Most of ph

Re: Another take on decimal data types

2018-01-11 Thread jmh530 via Digitalmars-d-announce
On Thursday, 11 January 2018 at 18:15:23 UTC, rumbu wrote: [snip] BUT - a very big but - the most important issue is the formatting thing. Even there is no direct dependency on std.format or std.stdio, the formatting mechanism is designed to fit nicely into phobos formatting paradigm. That mea

Re: Another take on decimal data types

2018-01-11 Thread rumbu via Digitalmars-d-announce
On Thursday, 11 January 2018 at 11:19:41 UTC, Robert M. Münch wrote: On 2018-01-08 22:16:25 +, rumbu said: This is my first D finalized project (+16k loc). Great stuff! Will this work in betterC mode? It will not work without some refactory. Most of phobos/druntime dependencies are mi

Re: Another take on decimal data types

2018-01-11 Thread Seb via Digitalmars-d-announce
On Thursday, 11 January 2018 at 11:19:41 UTC, Robert M. Münch wrote: On 2018-01-08 22:16:25 +, 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

Re: Another take on decimal data types

2018-01-11 Thread Robert M. Münch via Digitalmars-d-announce
On 2018-01-08 22:16:25 +, 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 | bette

Re: Another take on decimal data types

2018-01-09 Thread Dennis Cote via Digitalmars-d-announce
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

Re: Another take on decimal data types

2018-01-09 Thread rumbu via Digitalmars-d-announce
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 yo

Re: Another take on decimal data types

2018-01-09 Thread aberba via Digitalmars-d-announce
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 complet

Re: Another take on decimal data types

2018-01-09 Thread Mike Franklin via Digitalmars-d-announce
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

Re: Another take on decimal data types

2018-01-09 Thread Bastiaan Veelo via Digitalmars-d-announce
On Monday, 8 January 2018 at 22:16:25 UTC, rumbu wrote: Documentation: http://rumbu13.github.io/decimal/doc/decimal.html Wow, slick documentation!

Re: Another take on decimal data types

2018-01-08 Thread Daniel Kozak via Digitalmars-d-announce
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 (+1

Re: Another take on decimal data types

2018-01-08 Thread rikki cattermole via Digitalmars-d-announce
Great job. 1) Assembly 2) That file needs to be split up. I can feel the lag as I scroll it.