Gamestudio Links
Zorro Links
Newest Posts
Experiences with cTrader
by JeyKey II. 11/27/26 09:04
make a complaint
by EW_bytes. 11/26/26 23:00
FXCM => AVA Trade Plugin???
by Martin_HH. 11/25/26 21:59
No connection to MT4
by Martin_HH. 11/23/26 06:38
MinMax function on History t6 file
by LucasJoshua. 11/21/26 14:28
What are you working on?
by rayp. 11/20/26 18:10
contractUpdate() is filtering if >2 rows
by mistery. 11/09/26 12:06
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
3 registered members (AndrewAMD, JeyKey II, Grant), 4,541 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EvanTJ, rht, MaliceTheMaker, Haitao_Ren, JimSimons
19250 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
var conversion issue? #247100
01/19/09 02:23
01/19/09 02:23
Joined: Dec 2008
Posts: 43
D
DavidM Offline OP
Newbie
DavidM  Offline OP
Newbie
D

Joined: Dec 2008
Posts: 43
Code:
	var test = 100.5;
	printf( "Test %i", (int) test );
	float test2 = floatv(test);
	printf( "Test2 %d", (double)test2 );
	float test3 = test;
	printf( "Test3 %d", (double)test3 );


Results:
Test: 100
Test2: 0
Test3: 0

I have tried this test with fprintf(..) and get the same results.

Why are the conversions failing?

A7 version 7.60

Re: var conversion issue? [Re: DavidM] #247102
01/19/09 02:54
01/19/09 02:54
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
I'll be interested in this answer too, Ive only ever found
printf( "Test %.0f", (anynum) test); to actually work.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: var conversion issue? [Re: EvilSOB] #247168
01/19/09 09:46
01/19/09 09:46
Joined: Oct 2004
Posts: 4,134
Netherlands
Joozey Offline
Expert
Joozey  Offline
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
%.0f is for the var display. The conversion to int seems to work fine. Double is not %d, but %f or %u. %d is also int.

http://www.cplusplus.com/reference/clibrary/cstdio/printf.html


Click and join the 3dgs irc community!
Room: #3dgs

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1