A buggy single declaration?

Declaration of variables.
I’m very confused! What is wrong?
Dim s as Single
s = 3.1416
The result of s = 3 WHY ???

u declare s as single. should be Dim s as Double

No, single is correct.
This was an example from the docu:
http://documentation.xojo.com/index.php/Single

That is my problem…

How are you determining s = 3?

In the debugger an in my program s= s x 10
then s = 30 and not 31.416

Since 10 is an integer the compiler defaults to integer math.

Try s = s * 10.0

No. The same result s=30
I tried it with double and it works!!!
What is the difference between single and integer. That is an incredible bug!!!

[quote=58995:@Peter Marx]No, single is correct.
This was an example from the docu:
http://documentation.xojo.com/index.php/Single

That is my problem…[/quote]

you are right… i never use single… always double.

I’ve tried
s = s * 10
s = s * 10.0
and both give the correct result of 3.1416 with a mac on OS 10.9

Someone else might have some ideas.

Sorry for the incorrect response above.

[quote=59000:@Peter Marx]No. The same result s=30
I tried it with double and it works!!!
What is the difference between single and integer. That is an incredible bug!!![/quote]
It would be if anyone could reproduce it
In a desktop app in the open event of a window I put

[code] dim s as single = 3.1416

dim y as string = format(s*10000, “0000000.0000000”)

break
[/code]

in the debugger s shows as 3.14199999999
y shows as 0031415.9989357

so I’m puzzled at what you’re seeing

dim s as single = 3.1416

dim y as string = format(s*10000, “0000000.0000000”)

break

Y = 0030000,0000000

I use Mint Petra Mate and Xojo 4.1
I know that Xojo is made for Mac. For Linux it is very slow and buggy.

[quote=59006:@Peter Marx]
I use Mint Petra Mate and Xojo 4.1
I know that Xojo is made for Mac. [/quote]
Actually Windows, OS X and certain Linux distros - Mint is not officially supported
See http://documentation.xojo.com/index.php/System_requirements

On Ubuntu 13.04 I get the same results I posted above

However, what happens if you happen to change your locale settings so that the decimal point is . and the thousands separator is , ?

Hello Mint is Ubuntu (base).
I have to use double and closed this thread.
This bug is a bug!

(I don’t have the time to write a program which sets all the locale settings of the customers computers in Italy, Poland or Taiwan to a format that Xojo works…)

Mint is a separate distro from Ubuntu
While it strives to be compatible it isn’t Ubuntu and we don’t / can’t test on every distro - we’d never finish testing.

This DOES appear to be a bug in the compiler and I’ve been able to reproduce it in a simple project for our compiler engineer

Great! Thank you, Norman.
The next bug is that the cursor is not at that place that i would expect.
If i want to delete something, sometimes a complete window will be deleted.
If this is the default window, the App doesn’t start.
Without any warning!!!
I wrote a lot of programs for some times, because i doesn’t know what happens.
It’s terrible for a beginner! (I’m a beginner).

[quote=59006:@Peter Marx]dim s as single = 3.1416

dim y as string = format(s*10000, “0000000.0000000”)

break

Y = 0030000,0000000

I use Mint Petra Mate and Xojo 4.1
I know that Xojo is made for Mac. For Linux it is very slow and buggy.[/quote]

where is there a comma between the ‘0030000,0000000’?

Because his locale setting use . for thousands and , for the decimal

i see… i see…