Re: [fun] unsigned int is not big enough (was: lfs-chat Digest, Vol 1288, Issue 1)

Aleksandar Kuktin <[email protected]>
Newsgroups gmane.linux.lfs.general
Message-ID <20120910162141.07963957@tekarot>
>On Sun, 9 Sep 2012 06:13:48 -0500 (CDT)
>[email protected] wrote:
>
> While I agree float is not exact I'm not sure what is being
> calculated needs exact precision.
> 
> 
> ----- Original Message -----
> From: "Andy Bennett" <[email protected]>
> To: [email protected]
> Sent: Saturday, September 8, 2012 8:37:49 AM GMT -06:00 US/Canada
> Central Subject: Re: [fun] unsigned int is not big enough (was:
> lfs-chat Digest, Vol 1288, Issue 1)
> 
> Hi,
> 
> > Use unsigned long long or float.
> 
> float is not exact.
> 
> (un)signed long long is the one to use. Avoid floating point
> arithmetic: stick to integer or fixed point. You still have to be
> careful with rounding when you divide. ;-)
> 
> 
> 
> 
> 
> Regards,
> @ndy
> 

I went with unsigned long long. In the interest of writing
architecture-agnostic code, I also pondered useing uint64_t but
couldn't remember an alternative to strtoull() so I just slapped that
second 'long' on my unsigned long and called it a day.

Yo dawg, I heard you like longs so we made you longs for your longs.
LOL :D

-- 
   Fourth law of programming:
   Anything that can go wrong wi
sendmail: segmentation violation - core dumped
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-chat
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.