Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

why is this a minus?

For general discussion related FlowStone

Re: why is this a minus?

Postby VPDannyMan » Wed May 01, 2013 6:49 am

billv wrote:
VPDannyMan wrote:What is the largest number an integer in FS can hold?

A standard 32-bit integer can handle -2,147,483,648 through 2,147,483,647.
I knew it was guru math trick :lol: :lol: thanks for the reminder
thanks VPDannyMan :)
can you tell me why this happens....?? still :?


No worries, I was not sure if that was the cause or not, but in other languages I would have instantly thought about resolution so I mentioned it..
Trog has a pretty good detailed explanation for you above this post..
VPDannyMan
 
Posts: 118
Joined: Mon Jan 04, 2010 4:50 am

Re: why is this a minus?

Postby billv » Wed May 01, 2013 8:42 am

Yeh, I get this part.. :)
trogluddite wrote:error - trying to "fit a quart into a pint pot."

But still struggling with the rest of it...
billv
 
Posts: 1146
Joined: Tue Aug 31, 2010 3:34 pm
Location: Australia

Re: why is this a minus?

Postby Nubeat7 » Wed May 01, 2013 10:47 am

so if ruby converts "normal" int to "long" ints automaticly if there is a overflow, the result is right inside ruby and when you output it via a string because a string dont care about length - its just a row of characters - but if you use the result further and get lower numbers again (if you need to divide it by 100....) it should work right doing all the math inside ruby and output the right number as int to FS as long it is small enough for FS (32 bit int)
User avatar
Nubeat7
 
Posts: 1347
Joined: Sat Apr 14, 2012 9:59 am
Location: Vienna

Re: why is this a minus?

Postby Jay » Thu May 02, 2013 12:05 am

Oh Trogg i never noticed your post, i think i was half cut at the time sorry ha ha!

Thanks for that explanation! everywhere i looked on the net for info after VPDannyMans post, told me the max length of 32bit ints but not much else about the hows and whys of it all so cheers for that! also i never knew what the little e's were in numbers in SM until now! i will read your post a few times to pick it all up

good posts from everyone else as well thanks!

Best Regards
Jay
 
Posts: 276
Joined: Tue Jul 13, 2010 5:42 pm

Re: why is this a minus?

Postby VPDannyMan » Thu May 02, 2013 2:12 am

These are the primary data types that are available to Malc to add and use in FS.

Boolean, 1 byte, True or False (Available in FS)

Short Integer. 2 bytes signed: -32768 to 32767 unsigned: 0 to 65535

Integer. 4 bytes signed: -2147483648 to 2147483647 unsigned: 0 to 4294967295 (Available in FS)

Long integer. 4 bytes signed: -2147483648 to 2147483647 unsigned: 0 to 4294967295

Floating point number. 4 bytes +/- 3.4e +/- 38 (~7 digits) (Available in FS)

Double precision floating point number. 8 bytes +/- 1.7e +/- 308 (~15 digits) (Available in FS)

Long double precision floating point number. 8 bytes +/- 1.7e +/- 308 (~15 digits)

Here is what the above means..
Data Type, followed by Length, followed by Resolution, followed by the Difference in resolution if Unsigned.
The Length part tells you how many bytes of memory it takes to store the value.
Resolution is how large/small the value can be that is stored.
Difference in Resolution if Unsigned is what numbers it can store up to if there is no sign.

As far as I know, Ruby should have the identical set.
Also note I could be wrong on what I identified as (Available in FS). Maybe someone can double check that if they have time..

Hope that helps
VPDannyMan
 
Posts: 118
Joined: Mon Jan 04, 2010 4:50 am

Re: why is this a minus?

Postby trogluddite » Thu May 02, 2013 8:55 am

Yup, that's about right, VP - though we could break it down a little bit further....

Green...
Boolean - see 'integer'...
Integer - 4 byte signed (NB - 'green' booleans are really integers that only have zero and one values)
Float Single - 4 byte
(plus Strings etc...)

Stream...
Boolean - bitmasks containing either 32 'Off' bits, or 32 'On' bits.
Integer - 4 byte
Float Single - 4 byte
Float Double - 8 byte (Limited to just a few primitives - NOT available in code or assembly)

Ruby...
Boolean - the special Ruby values "false" and "true"
FixNum - same as a 4 byte Integer
BigNum - an integer of ay length (Ruby auto-coverts between BigNum and FixNum as requred)
Float - always double precision.
Rational - numbers held as fractions (e.g. 1/3, 345/678) always with the lowest possible denominator.
Complex - complex numbers. e.g. (x + yi) - the 'x' and 'y' could be any of the above number types.

When sending a Ruby number to a 'green' connected, values will be truncated (Integers) or rounded (floats), to 32bit (4byte) versions - 'Rationals' are, I think, turned into Floats, and 'Complex' don't have any 'green' equivalent.
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
User avatar
trogluddite
 
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: why is this a minus?

Postby tiffy » Wed May 22, 2013 8:34 am

Wow, I like that kind of Math!
:mrgreen:
User avatar
tiffy
 
Posts: 400
Joined: Wed May 08, 2013 12:14 pm

Previous

Return to General

Who is online

Users browsing this forum: No registered users and 84 guests