Raised This Month: $12 Target: $400
 3% 

amxx giving strange output on sum of float and any


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 06-02-2021 , 11:49   amxx giving strange output on sum of float and any
Reply With Quote #1

So, I was testing something and noticed that if you add a variable of type float to one of type any, it will give you a strange result. I guess this is a bug with the compiler.

Code:
#include <amxmodx> public plugin_init() {     register_plugin("Plugin", "Version", "Author")     new any:number1 = 100.0     new Float:number2 = 200.0     server_print("^t^tnumber1 + number2: %f", number1+number2) }

Output:
Code:
number1 + number2: -0.000000
I'm currently running amxmodx version 1.9.0.5271
__________________









Last edited by CrazY.; 06-02-2021 at 11:50.
CrazY. is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 06-02-2021 , 14:34   Re: amxx giving strange output on sum of float and any
Reply With Quote #2

Float operators are defined only for (Float, Float), (_, Float) and (Float, _) tagged operands. "any" is literally anything and you shouldn't just treat it as an integer.
__________________

Last edited by klippy; 06-02-2021 at 14:36.
klippy is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:23.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode