Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.acorn.programmer > #632
| Date | 2011-08-15 09:24 +0100 |
|---|---|
| From | cferris@freeRemoveuk.com.invalid |
| Newsgroups | comp.sys.acorn.programmer |
| Subject | Re: Is there an equivalent piece of BASIC that will return the size (in bits) of a number. |
| Message-ID | <56b10d0352.cferris@cferris.freeuk.com> (permalink) |
| References | <d515591d-7af9-4e9d-afb9-110bdc721e53@a31g2000vbt.googlegroups.com> <j28loh$5p7$1@dont-email.me> |
| Organization | Home |
In message <j28loh$5p7$1@dont-email.me>
druck <news@druck.org.uk> wrote:
> On 14/08/2011 12:39, Gazza wrote:
> > I'm looking for a routine that performs the equivalent of C/C++
> > sizeof(<num>) function. This returns the number of bits taken up by
> > the number currently stored, NOT the memory footprint of the
> > variable. So...
[snip]
>
> No sizeof function does that. What you need to do is to take the base
> 2 log of the number and round up to the nearest integer.
>
> e.g. bitsused% = (LOG(number%)/LOG(2))+0.5
As a small note - you can use/call the 'SharedCLib' from BASIC.
--
Colin Ferris Cornwall UK
Back to comp.sys.acorn.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Is there an equivalent piece of BASIC that will return the size (in bits) of a number. Gazza <usenet@garethlock.com> - 2011-08-14 04:39 -0700
Re: Is there an equivalent piece of BASIC that will return the size (in bits) of a number. Michael Gerbracht <nospam@cityweb.de> - 2011-08-14 14:17 +0100
Re: Is there an equivalent piece of BASIC that will return the size (in bits) of a number. Matthew Phillips <spam2011m@yahoo.co.uk> - 2011-08-14 15:02 +0100
Re: Is there an equivalent piece of BASIC that will return the size (in bits) of a number. druck <news@druck.org.uk> - 2011-08-14 15:23 +0100
Re: Is there an equivalent piece of BASIC that will return the size (in bits) of a number. Gazza <usenet@garethlock.com> - 2011-08-14 08:43 -0700
Re: Is there an equivalent piece of BASIC that will return the size (in bits) of a number. cferris@freeRemoveuk.com.invalid - 2011-08-15 09:24 +0100
Re: Is there an equivalent piece of BASIC that will return the size (in bits) of a number. druck <news@druck.org.uk> - 2011-08-15 10:04 +0100
Re: Is there an equivalent piece of BASIC that will return the size (in bits) of a number. Matthew Phillips <spam2011m@yahoo.co.uk> - 2011-08-15 20:07 +0100
Re: Is there an equivalent piece of BASIC that will return the size (in bits) of a number. Rick Murray <heyrickmail-usenet@yahoo.co.uk> - 2011-08-14 18:48 +0200
Re: Is there an equivalent piece of BASIC that will return the size (in bits) of a number. Stewart Brodie <stewart.brodie@ntlworld.com> - 2011-08-14 18:27 +0100
Re: Is there an equivalent piece of BASIC that will return the size (in bits) of a number. jeff <jeffrey.a.doggett@gmail.com> - 2011-08-16 01:00 -0700
Re: Is there an equivalent piece of BASIC that will return the size (in bits) of a number. Rick Murray <heyrickmail-usenet@yahoo.co.uk> - 2011-08-16 18:39 +0200
csiph-web