Re: Comparission cause problem

From: ranjeet (ranjeet.gupta_at_gmail.com)
Date: 02/17/05


Date: 16 Feb 2005 21:27:57 -0800

Francis Glassborow <francis@robinton.demon.co.uk> wrote in message news:<Jb6t49EUKcECFwT6@robinton.demon.co.uk>...
> In article <wQiQd.49196$2e4.38460@news.chello.at>, marbac
> <marbac@chello.at> writes
> >Due to higher precision i would recommend to use the datatype double
> >which uses 64 Bits instead of 32 Bits.
> >double uses 1Bit sign, 11Bits for the exponent and 52Bit for the
> >mantissa while float only uses 1Bit sign, 8Bits for the exponent and
> >23Bit for the mantissa.
>
> Which neither answers the OP's problem nor is strictly correct. However
> on modern equipment there is rarely any need to use float, double will
> usually be as fast or faster (note this would not be the case if you
> were using some old or embedded system processors).

  So you mean to say that when ever we need to go for the comutation for the
  floating points then we should take the prefrence for the double data type.
  as you suggested that double will be faster as compared with the float. But
  what I think is if we have the 32 bit processor then we will have the float
  computation far much better(faster) as compared with the double. This I
  make the conclusion from the fact that as the processor is 32 bit, Means that
  it has the word length of 32 means 4 bytes and float is of 4 bytes, So
  computation for the float data type will be faster as compared with the
  double data type as doube is of 8 bytes.
  
  I think I may be missing some points thats why, I have some doubts on the
  above. Please guide me to clear the things in brief. what I am missing.

 
 
  
> Neither the C nor C++ Standards specify how floating point types are
> represented nor even
> the number of bits they should use. They specify minimum ranges and
> precision.
>
> Now, when it comes to comparing floating point types for equality you
> need to decide how close two values should be in order to treat them as
> equal (and note that such a method will mean that 'equality' is not
> transitive, i.e. a(==)b, b(==)c does not imply that a(==)c where (==)
> represents sufficiently close to equality). If you know the approximate
> magnitude something such as:
>
> if(fabs(fabs(a) - fabs(b)) < eta) // process as equal
> else // process as not equal
>
> Where eta represents a positive tolerance.
>
>
> Alternatively you can try:
>
> if(fabs(fabs(a/b -1)) < eta) // process as equal
> else //process as unequal

  Thanks to all the GM for the guidence given to me from all of you.
  Thanks once again for clearing my doubts and understanding.



Relevant Pages

  • Re: inherit from data type
    ... I want to create a new data type, which inherits from float. ... infromations about the class, but i need to get more information about ... I just want to test what is possible with python and what not. ...
    (comp.lang.python)
  • Best way to Import data from EXCEL using a TSQL
    ... FloatField - Float. ... This method gives me the following error message. ... "Error converting data type nvarchar to float." ... So i then change the data type in the table to VarChar on the Fload field ...
    (microsoft.public.sqlserver.datamining)
  • Best way to Import data from EXCEL using a TSQL
    ... FloatField - Float. ... This method gives me the following error message. ... "Error converting data type nvarchar to float." ... So i then change the data type in the table to VarChar on the Fload field ...
    (microsoft.public.sqlserver.server)
  • Re: Converting Reals into Floats
    ... the same data type family. ... float types in SQL Server derive from the internal format ... Real and float store values exactly ... Floats can store a wider range and precision than reals, ...
    (microsoft.public.sqlserver.server)
  • Best way to Import data from EXCEL using a TSQL
    ... FloatField - Float. ... This method gives me the following error message. ... "Error converting data type nvarchar to float." ... So i then change the data type in the table to VarChar on the Fload field ...
    (microsoft.public.sqlserver.programming)