Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (AndrewAMD, chsmac85, NeoDumont, dr_panther, TedMar), 1,095 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 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