Double 64 Bits WinAvr

25 posts / 0 new
Last post
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Dear all,
I am Simone from the University of Rome 'Tor Vergata'.

I am using the compiler WinAvr in order to program the ATMEL microcontroller AT90USB646. The problem I am facing with is that I need the 'Double' type at 64 bits (8 Bytes), but the GCC in AVR version handles 'Double' as 'Float' (4 Bytes). Can you suggest me some library or in alternative any solutions in order to solve my issue?

Thanks.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Nope, but if you end up writing this the avr-gcc project would dearly like it contributed.

There are other "accurate maths" libs that don't integrate completely into the compiler (like adding a type and supporting +-*/) but that provide a number of add_number(), sub_number() style functions. IBM has a "decimal library" you should be able to find that might be used (assuming the AVR has sufficient resource to support it)

EDIT the IBM work appears to be located here:

http://speleotrove.com/decimal/

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Perhaps if you told us why you need such precision we could point you in other directions, such as fixed point math. There are not many applications on micros that require doubles or even floats. Most things can be handled just fine with integer or fixed point alternatives.

Regards,
Steve A.

The Board helps those that help themselves.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The application regards the GPS pseudorange, that is the number of meters between the satellite and the receiver. Such distance is something as 20 million, so to reach the precision of the millimeter I need at least a number like this: xxxxxxx.xxx

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

xxxxxxx.xxx is the format of the number

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I see 9 decimal digits. 32 bit floats are good for about 8.5 - is that not enough? You might be out by a millimeter or two.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Such distance is something as 20 million, so to reach the precision of the millimeter I need at least a number like this: xxxxxxx.xxx

I guess I didn't know that mm accuracy from GPS was practical. ;)

20 million meters => 2 billion millimeters. Fits nicely into a 32-bit integer (signed or not).

So us simple old guys would just do all the work in integer/millimeters.

Lee

You can put lipstick on a pig, but it is still a pig.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

20 million meters => 2 billion millimeters

Problems with the metric system :)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

(LOL)

[not enough fingers and toes]

You can put lipstick on a pig, but it is still a pig.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Presumably this is why God invented centimeters?

(does it really matter if your missile guidance system drops the bottom 2 cm's to the left?)

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Not wholly your fault. The OP said 20 million, then gave a format that is not capable of that amount.

Regards,
Steve A.

The Board helps those that help themselves.

Pages