Page 2 of 2
Re: why is this a minus?
Posted: Wed May 01, 2013 6:49 am
by VPDannyMan
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

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..
Re: why is this a minus?
Posted: Wed May 01, 2013 8:42 am
by billv
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...
Re: why is this a minus?
Posted: Wed May 01, 2013 10:47 am
by Nubeat7
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)
Re: why is this a minus?
Posted: Thu May 02, 2013 12:05 am
by Jay
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
Re: why is this a minus?
Posted: Thu May 02, 2013 2:12 am
by VPDannyMan
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
Re: why is this a minus?
Posted: Thu May 02, 2013 8:55 am
by trogluddite
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.
Re: why is this a minus?
Posted: Wed May 22, 2013 8:34 am
by tiffy
Wow, I like that kind of Math!
