Re: How to make a Currency class from std.BigInt?

2015-02-15 Thread Jay Norwood via Digitalmars-d-learn
This library allow to specify the internal base of the arbitrary precision numbers( default is decimal), as well as allows specification of the precision of floating point values. Each floating point number precision can be read with .precision(). Also supports specification of rounding modes

Re: How to make a Currency class from std.BigInt?

2015-02-14 Thread RuZzz via Digitalmars-d-learn
The next version https://bpaste.net/show/dc3c5f10f2ca I use https://github.com/dsimcha/Rational/blob/master/rational.d I want to do it: auto c = new Currencies!Rational.rational.Rational!(BigInt); where Rational.rational.Rational it is std.rational.Rational I get the error: Error: template instanc

Re: How to make a Currency class from std.BigInt?

2015-02-11 Thread RuZzz via Digitalmars-d-learn
https://github.com/acmeism/RosettaCodeData/blob/master/Task/Arithmetic-Rational/D/arithmetic-rational.d

Re: How to make a Currency class from std.BigInt?

2015-02-11 Thread RuZzz via Digitalmars-d-learn
With "eris" lib some problems, the first error: .../.dub/packages/eris-0.0.1/eris/integer/digits.d(241): Error: cannot implicitly convert expression (digits.length) of type ulong to int What can I import to use rational numbers? I found it https://github.com/dsimcha/Rational/blob/master/ration

Re: How to make a Currency class from std.BigInt?

2015-01-31 Thread RuZzz via Digitalmars-d-learn
The next version https://bpaste.net/show/9468f24d9df0

Re: How to make a Currency class from std.BigInt?

2015-01-31 Thread zeljkog via Digitalmars-d-learn
On 31.01.15 15:56, zeljkog wrote: On 31.01.15 15:45, RuZzz wrote: Maybe I need good examples on C++, for this class, because a lot of examples on C++. Maybe this can help you: https://github.com/andersonpd/decimal Also http://code.dlang.org/packages/eris

Re: How to make a Currency class from std.BigInt?

2015-01-31 Thread RuZzz via Digitalmars-d-learn
On Saturday, 31 January 2015 at 15:02:09 UTC, Colin wrote: Maybe you can articulate it in one post what this class is trying to achieve? Maybe this? https://github.com/andersonpd/decimal/blob/master/decimal/bigfloat.d The main thing is not to lose currency in calculations that use arithmetic.

Re: How to make a Currency class from std.BigInt?

2015-01-31 Thread Colin via Digitalmars-d-learn
On Saturday, 31 January 2015 at 14:26:45 UTC, RuZzz wrote: The next version, which does not work: https://bpaste.net/show/b9c85de68d07 I really dont understand what your trying to achieve here. Maybe you can articulate it in one post what this class is trying to achieve?

Re: How to make a Currency class from std.BigInt?

2015-01-31 Thread zeljkog via Digitalmars-d-learn
On 31.01.15 15:45, RuZzz wrote: Maybe I need good examples on C++, for this class, because a lot of examples on C++. Maybe this can help you: https://github.com/andersonpd/decimal

Re: How to make a Currency class from std.BigInt?

2015-01-31 Thread RuZzz via Digitalmars-d-learn
I am looking for not only free solutions.

Re: How to make a Currency class from std.BigInt?

2015-01-31 Thread RuZzz via Digitalmars-d-learn
Maybe I need good examples on C++, for this class, because a lot of examples on C++.

Re: How to make a Currency class from std.BigInt?

2015-01-31 Thread RuZzz via Digitalmars-d-learn
The next version, which does not work: https://bpaste.net/show/b9c85de68d07

Re: How to make a Currency class from std.BigInt?

2015-01-31 Thread Ivan Kazmenko via Digitalmars-d-learn
On Saturday, 31 January 2015 at 13:45:22 UTC, RuZzz wrote: I want to understand the correct architecture of the class. Sorry, you still did not state your problem (or what you are trying to achieve) clearly. Writing down a clear problem description is likely to get you halfway to the solution

Re: How to make a Currency class from std.BigInt?

2015-01-31 Thread RuZzz via Digitalmars-d-learn
I want to understand the correct architecture of the class.

Re: How to make a Currency class from std.BigInt?

2015-01-31 Thread RuZzz via Digitalmars-d-learn
Thanks. Do I need to use rational fractions for the Currencies class?

Re: How to make a Currency class from std.BigInt?

2015-01-31 Thread Colin via Digitalmars-d-learn
On Saturday, 31 January 2015 at 12:07:23 UTC, RuZzz wrote: How to get amount of digit after point in a double for to get integer from a double? assert(amountAfterPoint(1.456) == 3); assert(amountAfterPoint(0.6) == 5); How about a loop like import std.stdio; void main(){ w

Re: How to make a Currency class from std.BigInt?

2015-01-31 Thread RuZzz via Digitalmars-d-learn
without to!string

Re: How to make a Currency class from std.BigInt?

2015-01-31 Thread RuZzz via Digitalmars-d-learn
How to get amount of digit after point in a double for to get integer from a double? assert(amountAfterPoint(1.456) == 3); assert(amountAfterPoint(0.6) == 5);

Re: How to make a Currency class from std.BigInt?

2015-01-30 Thread Ivan Kazmenko via Digitalmars-d-learn
On Friday, 30 January 2015 at 20:34:53 UTC, RuZzz wrote: What do I need to learn? c["BTC"]["N-01"] = 1.0002;//Error: cannot implicitly convert expression (1) of type double to axfinance.api.currencies.Currencies As I see it, there is no constructor in your class with a double argument.

Re: How to make a Currency class from std.BigInt?

2015-01-30 Thread RuZzz via Digitalmars-d-learn
What do I need to learn?

How to make a Currency class from std.BigInt?

2015-01-30 Thread RuZzz via Digitalmars-d-learn
module axfinance.api.currencies; import std.array, std.stdio, std.system, std.bigint, std.conv; class Currencies { public: this(ulong pf) { exponent(pf); } bool integer(BigInt pb) {