Re: Identify if a scalar is int, double or text



"K" == Klaus <klaus03@xxxxxxxxx> writes:

K> I want to stay with the standard built-in "int / double" arithmetic,
K> but I want additional control of the transition between the (as I see
K> it) 3 types of numerical values:

K> type 1. (int)
K> type 2. (double, with only integral values)
K> type 3. (double, with free decimal values)

K> This control should be implemented efficiently, hence my preference
K> for subroutines written in C.

you can force integer match with use integer. but the normal way to
manage money exactly has always been to use an integer for the lowest
denomination. this means for dollars you count integer cents. only when
you convert in/out for printing do you deal with the decimal point. this
way you get total control, speed, accuracy, and easy rounding with
int(). if you want more accuracy (.1 cents) just make that your count
size. and you can overflow to float as a large int (> 32 bits) and get
47 bits of int so there will never be a loss of digits until you get to
be richer than uncle bill.

and i agree with paul, needing to know so much detail is not
perlish. using ints for money is what you want to do and is easy in
perl.

uri

--
Uri Guttman ------ uri@xxxxxxxxxxxxxxx -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
.



Relevant Pages

  • Re: How can I use C# GUI component in my MFC application.
    ... Here's some stuff I had written on this topic for my book (Extending MFC ... Using a .NET control in an MFC dialog ... we have seen how Windows Forms makes GUI development slightly easier ... BOOL Create(CWnd* pWnd, int x, int y, int cx, int cy); ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Repost for MS: UnsafeNativeMethods.CallWindowProc NullReferenc
    ... The error message that led me to my solution was "Cannot call Dispose while ... Using the .NET Reflector to look at the Control ... NativeWindow has a pointer to a previous window and a pointer to a next ... hWnd, int msg, int wparam, int lparam) + 0x30 bytes ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: Question about printing
    ... int nXDest, // x-coord of destination upper-left corner ... > control and graphics can not be drawed with this class. ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: Possible to pass strings back to ASP from ActriveX?
    ... afx_msg int AboutBox; ... helpstring("AxTemplateTest1 ActiveX Control module"), ... // Primary dispatch interface for CAxTemplateTest1Ctrl ... helpstring("Dispatch interface for AxTemplateTest1 Control")] ...
    (microsoft.public.windowsce.embedded)
  • Re: Possible to pass strings back to ASP from ActriveX?
    ... afx_msg int AboutBox; ... helpstring("AxTemplateTest1 ActiveX Control module"), ... // Primary dispatch interface for CAxTemplateTest1Ctrl ... helpstring("Dispatch interface for AxTemplateTest1 Control")] ...
    (microsoft.public.windowsce.embedded)