Re: Fastcode RoundTo B&V 0.1

From: John Herbster (herb-sci1_AT_sbcglobal.net)
Date: 06/13/04


Date: Sun, 13 Jun 2004 09:24:36 -0500


"Solerman Kaplon" <solerman@wonder.com.br> wrote
 
> Is there an advantage in caching the multiplier/divisor
> (100 in 2, 1000 in 3)?

Solerman,

You could cache an array [0..27] of extended (Int64 only
has enough bits for 10^19) or just build it in to the code.

Const Multipliers: array [0..27] of extended = (
      1e00,1e01,1e02,1e03,1e04,1e05,1e06,1e07,1e08,1e09,
      1e10,1e11,1e12,1e13,1e14,1e15,1e16,1e17,1e18,1e19,
      1e20,1e21,1e22,1e23,1e24,1e25,1e26,1e27);

These are calculated correctly by D7.1 compiler.

Beyond 27, an extended type cannot hold the precision and
the roundings would not be precise. I am tempted to raise
an exception for abs(Digits) > 27.

Regards, JohnH



Relevant Pages

  • Re: Fastcode RoundTo B&V 0.1
    ... Solerman, ... You could cache an array of extended or Int64 or ...
    (borland.public.delphi.language.basm)
  • Re: Call Array valued Fortran function from C
    ... documentation about gfortran array descriptors for you. ... double precision, dimension:: array ... type, bind:: descr ... integerunknown1 ...
    (comp.lang.fortran)
  • Re: SNGL intrinsic question
    ... You have initialized an array of double- ... precision numbers with single-precision literals. ... The compiler bug ...
    (comp.lang.fortran)
  • Re: What is wrong with this code?
    ... Uh, yeah, for me on this compiler, just a warning, I think. ... ridiculous contortions to avoid using a pointer to an ARRAY. ... The use of a global struct is another unnecessary design flaw. ... the extra precision. ...
    (comp.lang.c)
  • Re: Fast integer distance formula
    ... array of signed 16-bit numbers, but x and y themselves are 32-bit numbers in the ... stored back into an array of 16-bit integers, since the distance formula can ... It is likely more accurate than you need, but I think you can simply truncate the algorithm sooner for less precision. ...
    (comp.dsp)