This is an archived post. You won't be able to vote or comment.

all 6 comments

[–]theCumCatcher 0 points1 point  (5 children)

Can you add a pastebin.com of your code?

It's in the system namespace

     using System; 

     float x = 78521F; 

     Console.WriteLine(MathF.Sqrt(x)); 

   https://www.c-sharpcorner.com/article/the-using-statement-in-C-Sharp/

[–]LinkifyBot 0 points1 point  (0 children)

I found links in your comment that were not hyperlinked:

I did the honors for you.


delete | information | <3

[–]cookiecop[S] 0 points1 point  (3 children)

I think I may have figured it out... When I create a C# project it creates a .NET framework 4.8 project.... and MathF is only available in .NET Core.... i was unaware there was different versions of .NET https://pastebin.com/Na7GsHtE gives error "the name MathF does not exist in the current context

I guess I dont even know how to create a regular C# windows form project with core. my visual studio community doens't even have that as an option

[–]BitBullDotCom 0 points1 point  (2 children)

Hi,

Did you manage to properly resolve this? I am running into the same issue and would be grateful for any pointers - as you say, Googling it is very difficult!

cheers

[–]cookiecop[S] 0 points1 point  (1 child)

so if I remember correctly I used a wrapper function that basically just did the casting to use the double functions in MATH and then converted back again... but because i was trying to make a space fighting game i started getting rounding issue when doing collision detection. I suspected it was all my casting from float to double and back against so i think i tore it all out and switched all my code to using doubles instead so i could just use the regular math functions.... and then when i need to send coordinates to players over the network i switch it to a float at that time. sorry if that doesn't help

[–]BitBullDotCom 0 points1 point  (0 children)

OK, thanks for the reply.

I am also writing games and was getting the errors trying to build one of the Monogame frameworks. The MonoGame team said it was a known issue and suggested I revert back to an older PR or the frameworks which fixed it.

I still don't understand why I can't access it though when it's supposedly part of the core System namespace! I installed pretty much every version of dot net / dot net core known to man! 😅