How to simulate 8bytes double???

Discussion in 'C++' started by Auronc, Sep 8, 2004.

  1. Auronc

    Auronc Guest

    Because my special compiler,I am looking for some class, which support
    8 bytes double. I found my machine only supports 4 bytes for (double).
    I need the operation: + - * / sin() cos() atan2()..etc.
    Are there any kind soul to help me? Thanks a lot.
     
    Auronc, Sep 8, 2004
    #1
    1. Advertising

  2. Auronc

    Howard Guest

    "Auronc" <> wrote in message
    news:...
    > Because my special compiler,I am looking for some class, which support
    > 8 bytes double. I found my machine only supports 4 bytes for (double).
    > I need the operation: + - * / sin() cos() atan2()..etc.
    > Are there any kind soul to help me? Thanks a lot.


    I don't know what kind of machine only supports 4-byte doubles, but you
    might try asking others who use that machine. Perhaps there's a newsgroup
    devoted to that machine? Or search at groups.google.com.

    -Howard
     
    Howard, Sep 8, 2004
    #2
    1. Advertising

  3. Auronc

    JKop Guest

    Auronc posted:

    > Because my special compiler,I am looking for some class,

    which support
    > 8 bytes double. I found my machine only supports 4 bytes

    for (double).
    > I need the operation: + - * / sin() cos() atan2()..etc.
    > Are there any kind soul to help me? Thanks a lot.


    Yes I could help you, but not to be rude, that would result
    in me writing the (long) class for you. I can suggest
    methods though: instead of using decimals, define a minimal
    unit, let's say 0.0000000000001 or whatever. You'll store
    this as integer 1. Maybe try something along the following
    lines:

    class 8ByteDouble
    {
    private:
    char bytes[4];

    public:
    8ByteDouble& operator+=(...
    };

    8ByteDouble sin(8ByteDouble& k)
    {
    ....
    }

    Then again you could search the net and find one that's
    already been done for you.

    Have you tried "long double"?

    Note that a "byte" is different sizes on different
    machines. Most of them though are 8-Bit.


    -JKop
     
    JKop, Sep 8, 2004
    #3
  4. Auronc

    Auronc Guest

    Dear :
    I use the Product:"TI TMS320VC5510", related link:
    http://focus.ti.com/docs/prod/folders/print/tms320vc5510.html

    In this environment, its data type "double" is 4 bytes, and it doesn't
    support 8bytes-double. The precision is not good enough for me. So I
    need the class "8ByteDouble" to improve the precision.

    For example,in this environment,
    double dvar = 0.123456789999;
    the compiler compiles the dvar : 0.1234568
    caused by the length of the double is 4 bytes,not 8bytes.

    But I need the 0.----9999.

    The class 8ByteDouble could sovle this problem??
    If no, any solution could sovle it??
    Thanks for your help.




    JKop <> wrote in message news:<GHG%c.26841$>...
    > Yes I could help you, but not to be rude, that would result
    > in me writing the (long) class for you. I can suggest
    > methods though: instead of using decimals, define a minimal
    > unit, let's say 0.0000000000001 or whatever. You'll store
    > this as integer 1. Maybe try something along the following
    > lines:
    >
    > class 8ByteDouble
    > {
    > private:
    > char bytes[4];
    >
    > public:
    > 8ByteDouble& operator+=(...
    > };
    >
    > 8ByteDouble sin(8ByteDouble& k)
    > {
    > ...
    > }
    >
    > Then again you could search the net and find one that's
    > already been done for you.
    >
    > Have you tried "long double"?
    >
    > Note that a "byte" is different sizes on different
    > machines. Most of them though are 8-Bit.
    >
    >
    > -JKop
     
    Auronc, Sep 9, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Web learner

    from List <double> to double[]

    Web learner, Apr 25, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    484
  2. sb
    Replies:
    4
    Views:
    307
    Alberto Barbati
    Feb 19, 2004
  3. Jacek Dziedzic
    Replies:
    5
    Views:
    385
    Old Wolf
    Apr 8, 2004
  4. Sydex
    Replies:
    12
    Views:
    6,505
    Victor Bazarov
    Feb 17, 2005
  5. LabJack Support
    Replies:
    0
    Views:
    508
    LabJack Support
    Aug 7, 2009
Loading...

Share This Page