Gamestudio Links
Zorro Links
Newest Posts
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
neural function for Python to [Train]
by TipmyPip. 11/26/23 09:37
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
Zorro Trader GPT
by TipmyPip. 11/22/23 16:53
Finding the right Broker(s)
by steyr. 11/21/23 09:17
Are live data stored?
by Nightmarek. 11/19/23 13:29
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
Tactics of World War I
Who's Online Now
4 registered members (TipmyPip, FranzIII, PeWi, AndrewAMD), 390 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Harry5, KelvinC, wai, ChaosTrader, sleakz
19016 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Return type of floor() #487517
05/25/23 13:45
05/25/23 13:45
Joined: May 2023
Posts: 5
JMMAC Offline OP
JMMAC  Offline OP

Joined: May 2023
Posts: 5
I'm at the start of my learning curve with Zorro and I have a couple of questions.

1) The Zorro manual says floor() returns a var/double but then gives an example where it returns an int.

int a = floor(b);

This obviously doesn't work and "a" will be 0 or have the wrong value. I guess it's an error in the manual.

But this leads to another question, why do floor(), ceil() and round() return doubles and not ints?

In my Zorro code I'm using "Lots" to enter my position size which I believe is an int. So should I use something like:

Lots = (int)round(...); ?

2) When I print to the log file, to have the output well formatted, it seems I have to put a \n at the beginning of the string and not at the end as one would expect when printing to a terminal:

print(TO_LOG,"\nLotAmmount = %f", LotAmount);

Is there a reason for that?

Thank you,

Re: Return type of floor() [Re: JMMAC] #487520
05/25/23 14:17
05/25/23 14:17
Joined: Feb 2017
Posts: 1,697
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,697
1) Double casts to int, so it's not wrong, so long as you don't need floating point values.

Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1