[Gambas-user] Financial program

Norarg norarg at ...2311...
Tue Dec 15 12:31:51 CET 2009


Doriano Blengino schrieb:
> nando ha scritto:
>   
>> My contribution to this conversation is..
>> Always INT or LONG for money.
>> Keep a global variable to divide by (for example 2 decimal places) 100
>> when printing/displaying things to humans...
>> -OR- to take the string and insert a period for cents (North America)
>> Make a really nice SUB to return a formatted string is good.
>> It is the utmost importance not to use FLOAT from the beginning
>> because calculations will be wrong after a while and it will not balance.
>> You will have headaches!!!
>>   
>>     
> You are perfectly true. It seems that floating point does not like base 
> 10 numbers... :-)
>
> But here comes in place the power of a programming language; a good 
> language is a wrapper around bad or annoying things. All we love gambas 
> because it is easy to construct user interface. But there would be no 
> necessity of its power - one can write external functions and interface 
> to X11 directly...
>
> So when you tell me "don't use floats for accounting" I agree. When you 
> say "use a global variable to divide", "insert a decimal point" and so 
> on, I think "100% of gambas users want to use graphical interfaces, 
> while only 2% of them want to use financial capabilities. So, that 2% 
> must live with a language not very suitable for accounting". "Use long 
> integers, divide them, use format$()..." is the reply from Benoit. Does 
> someone remember the Cobol? With a simple declaration "picture 99.9999" 
> it created a datatype and managed all the roundings and conversions on 
> that datatype; this was the power of that language. I don't say that 
> gambas should implement this, but it would not hurt... it is a matter of 
> choice; I understand that this kind of things is difficult to implement 
> (or, who knows... with OO programming... but the really hard part is the 
> mixing of different types in the same expression).
>
> The most important application I've written with gambas is something 
> similar to a financial one. I faced problems with gridviews, tableviews, 
> formats, roundings... all the things we are speaking about just now, and 
> they are not yet fully solved. I think that the way you describe is a 
> hard work, even if it is the only possible at the moment.
>
> Regards,
>
>   

Hi

I remember Cobol, it was very much used in the 80'es, and the company in 
which I was employed at that time used it for all commercial software. 
Then C got more and more modern to use, and one had to write a lot of 
functions to get the same results - in the accounting-context. Cobol had 
its own "database", just datafiles, it did not have to convert anything 
from any SQL-Server, and as far as I can remember, it stored the data 
without any floats - the picture 9.99 just told it where to set the 
decimalpoint.

regards



More information about the User mailing list