# Data Types

**URL:** <https://forums.digi.com/t/data-types/10318>\
**Category:** Rabbit\
**Created:** [June 9, 2009, 6:06pm UTC](https://forums.digi.com/t/data-types/10318 "2009-06-09T18:06:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Natalia](https://avatars.discourse-cdn.com/v4/letter/n/b3f665/32.png) [@Natalia](https://forums.digi.com/u/Natalia)\
**Post date:** [June 9, 2009, 6:06pm UTC](https://forums.digi.com/t/data-types/10318/1 "2009-06-09T18:06:03Z")

</div>

Hi! I’m trying to make a calculation, but the answer isn’t right.  
It should be 2592788242.73, but get 2592788224.

Here’s the code:

```auto
void main()
{
	unsigned long a;
        a = test(37.325, 180.0, -180.0);
}

unsigned long test (double value, double maximum, double minimum)
{
	unsigned long ret;

        if( value &gt; maximum )
            value = maximum;
        if( value &lt; minimum )
            Vavaluelor = minimum;

        ret = ((value - minimum) * 4294967295) / (maximum - minimum);

        return ret;
}

```

Am I using the wrong data type?

Thanks!

---

<div class="post-metadata">

**Author:** ![sgt](https://avatars.discourse-cdn.com/v4/letter/s/df705f/32.png) [@sgt](https://forums.digi.com/u/sgt)\
**Post date:** [June 10, 2009, 1:13am UTC](https://forums.digi.com/t/data-types/10318/2 "2009-06-10T01:13:13Z")

</div>

You’re losing precision in your constant. Try this:

```auto
	double multi;

   multi = 4294967295.0;
   printf("multi = %f
", multi);

```

I get multi = 4294967290.000000 in the printout.

According to the Dynamic C manual, float and double are both 32-bit values.

---

<div class="post-metadata">

**Author:** ![robertkliu](https://avatars.discourse-cdn.com/v4/letter/r/e47c2d/32.png) [@robertkliu](https://forums.digi.com/u/robertkliu)\
**Post date:** [July 29, 2009, 10:33am UTC](https://forums.digi.com/t/data-types/10318/3 "2009-07-29T10:33:27Z")

</div>

Environment DC 9.62

Code:  
double a;

a=217347.620000;  
printf("%f  
“,a);  
a=2666813.350000;  
printf(”%f  
“,a);  
a=217349.520000;  
printf(”%f  
“,a);  
a=2666813.350000;  
printf(”%f  
“,a);  
a=217350.220000;  
printf(”%f  
",a);

Result:  
217347.625000  
2666813.250000  
217349.515000  
2666813.250000  
217350.218000
