Sign in

username:

password:



Not a member?

Search basicx



Search tips

Subscribe to basicx



basicx by Keywords

Accelerometer | ADC | ADXL | Adxl20 | AVR | BasicStamp | BX-35 | BX28 | BX35 | COM3 | Compiler | Downloader | EEPROM | Electromagnet | GetADC | GP2D1 | GPS | I2C | IDE | Keypad | LCD | LCD+ | MIDI | Motors | Multitasking | Netmedia | Networking | PCB | PID | PlaySound | PWM | Relays | RTC | Servo | ShiftOut | SitePlayer | SPI | Stack | Timer | USB

Ads

Discussion Groups

Discussion Groups | BasicX | Re: Float mantissa?

Discussion forum for the BasicX family of microcontroller chips.

Re: Float mantissa? - Tom Becker - Mar 2 21:36:55 2007

> ... I need the exponent of a loop counter, but I get a "float
mantissa" error when I do so.

What is an exponent of a loop counter? What code produces this error?
Tom


(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )


Re: Float mantissa? - Chris - Mar 7 19:51:56 2007

The basic algorithm is as follows:

for t = 1 to 16
number = 2^t
next

I can post the actual code at some point soon, but the basic
relevant info is above.

--- In b...@yahoogroups.com, "Tom Becker" wrote:
>
> > ... I need the exponent of a loop counter, but I get a "float
> mantissa" error when I do so.
>
> What is an exponent of a loop counter? What code produces this
error?
> Tom
>



(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Re: Re: Float mantissa? - Tom Becker - Mar 7 20:12:48 2007


> for t = 1 to 16
> number = 2^t
> next

Oh! The loop count as an exponent! All parameters must be floats.

Try:

sub Main()
dim t as byte, number as single
for t = 1 to 16
number = 2.0 ^ csng(t)
debug.print cstr(t) &": "& cstr(number)
next
end sub
Tom



(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )