Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (AbrahamR, wdlmaster, 7th_zorro, dr_panther, 1 invisible), 764 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
conversion float #481271
08/21/20 08:45
08/21/20 08:45
Joined: Aug 2020
Posts: 1
germany
P
physical_love Offline OP
Guest
physical_love  Offline OP
Guest
P

Joined: Aug 2020
Posts: 1
germany
hi,
Code
inline var _VAR(int i) { return i<<10; }					// int -> var
inline var _VAR(double f) { return (var)(f * (1 << 10)); }		// double -> var, overloaded
inline int _INT(var x) { return x>>10; }					// var -> int
inline float _FLOAT(var x) { return ((float)x)/(1<<10); }	// var -> float

There are these in the adll header but float-> var does not exist. (float to var)
can someone tell me how to do this?

Re: conversion float [Re: physical_love] #481282
08/21/20 13:52
08/21/20 13:52
Joined: Sep 2009
Posts: 993
Budapest
Aku_Aku Offline
User
Aku_Aku  Offline
User

Joined: Sep 2009
Posts: 993
Budapest
I would cast the float to double and the way is straitforward from that.
Like this: var the_var = (var)((double)the_float));
Or use the _VAR((double)the_float)) format.
Hope this helps.

Last edited by Aku_Aku; 08/21/20 13:54.

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

Gamestudio download | chip programmers | 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