Gamestudio Links
Zorro Links
Newest Posts
Lapsa's very own thread
by rki. 06/18/24 15:32
A simple game ...
by VoroneTZ. 06/18/24 10:50
Face player all the time ...
by bbn1982. 06/18/24 10:25
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
6 registered members (rki, Martin_HH, AndrewAMD, squik, Ayumi, alibaba), 1,150 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
squik, AemStones, LucasJoshua, Baklazhan, Hanky27
19060 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