Math.Floor() shouldn't do anything to a whole number, that's no precision issue.
Math.Floor() shouldn't do anything to a whole number, that's no precision issue.
.95f * 100 is not a whole number.
Edited:
In fact, I believe in single precision it is just below 95
I love the idea but before we just jumpeed in, i think we should think of what language to use and what IDE, and library
I vote for SFML, and VS if C# or CodeBlocks if C++
Why restrict IDE choice?
You can also just reuse the same buffer by adding faces where other faces got removed.
I don't think so.
![]()
Maybe so the project files are interchangeable?
More like CMake if C# or CMake if C++
I think it's weird enough that those two lines output a different number.
Why real developers go for C/C++. :smug:
Put cast in there just to make sure.
I like Premake 4, it's Lua. :biggrin:
what.
Seriously, what.
That is what it is compiled into.
So uh, a float CAN contain 95 as a whole but it doesn't when it's supposed to?
I think we might just have found the first bug ever in C#.
I was 'what'ing the compiler's choice to turn 0.95 into.. that.
Edited:
I doubt it.
It works if you cast the float you calculate inside the floor function into a float manually
Math.Floor((float)(.95f * 100))
for non-believers
![]()
Okay it has to do with going from a float to a double.
0.95 float turns into a 0.949999988079071 double.
What .net version because the C#4 compiler is just optimizing it out for me, even in debug.
What about:
Will that have any effect?Code:Console.WriteLine(Math.Floor(.95f * 100f));
As long as everyone sets up their IDEs to use the same source files, you can have as many project files as you want. It really doesn't matter.
3.5
Maybe resharper is getting rid of it.
Anyways the compiler most likely is storing the result in a double when it does the compile time evaluation. Resulting in .95 becoming .949 and then multiplying by 100.
But that's a stupid idea, Use CMake or your obscure build system/Project generator of choice.
And..doubles work
![]()
I think we're all in agreement that floats store a value slightly under 0.95, and doubles do not
Then again, I don't have any content either so... I guess I'm not really helping.
WAYWO v17 - Rounding to 95
Edited:
Constant floating point numbers are (In (many of) the C family languages) doubles by default, hence it working without the 'd'.
Conclusion: fuck floats they can't do 95 right
Oh, of course. I was just throwing the idea out there. Without any planning there'd be a near zero-chance of getting anything done. Restricting the IDE sounds a bit much though. I'd personally be fine with any language: I don't have as much experience in the C family of languages, but how hard can it be?![]()
Considering that 95 rounds to 94, probably quite hard![]()
It wasn't always like this.
Maybe it has something to do with Windows 95?![]()
I'd like to see how the CIL bytecode looks like...
Next thing we know, it'll turn out that C# is just some massive ARG leading up to the release of Microsoft's next product...
Just added zlib compression to my package format, so far it's doing very well reducing the file size one kilobyte.
I'm writing a little Interactive Fiction parser. I [mostly] don't care about the Interactive Fiction part, but disassembling natural language always intersted me![]()
Natural Language systems are very interesting indeed. I still look forward to the day when I can command my computer to do things, in common English instead of specific, pre-recorded commands...
Edit:
I really hope they don't get clever enough to talk back at you though
"Computer, open Steam"
...
"no"
Sorta like this?
Code:$ vim Fuck you, use emacs $
Looking at .NETs System.ServiceModel (mono supports it <3). It looks very nice. Kinda weird though.
host = new ServiceHost(typeof(WebHost), new Uri("net.tcp://localhost:5123/")); host.AddServiceEndpoint(typeof(IWebHost), new NetTcpBinding(SecurityMode.None), "servicename");
It creates an instance of WebHost and calls the method that the client called. Was kinda expecting to give it a handler instance. I am assuming you can still do that, this is just the default behavior. Still a hell of a lot better than writing the server end in php and translating between the 2.
I decided to make an add function for 8 bit numbers that only uses logic operators.
// Headers #include <iostream> // Binary addition void add( bool a[], bool b[], bool r[] ) { bool c; r[0] = a[0] ^ b[0]; c = a[0] & b[0]; r[1] = ( a[1] ^ b[1] ) ^ c; c = ( c & ( a[1] | b[1] ) ) | ( a[1] & b[1] ); r[2] = ( a[2] ^ b[2] ) ^ c; c = ( c & ( a[2] | b[2] ) ) | ( a[2] & b[2] ); r[3] = ( a[3] ^ b[3] ) ^ c; c = ( c & ( a[3] | b[3] ) ) | ( a[3] & b[3] ); r[4] = ( a[4] ^ b[4] ) ^ c; c = ( c & ( a[4] | b[4] ) ) | ( a[4] & b[4] ); r[5] = ( a[5] ^ b[5] ) ^ c; c = ( c & ( a[5] | b[5] ) ) | ( a[5] & b[5] ); r[6] = ( a[6] ^ b[6] ) ^ c; c = ( c & ( a[6] | b[6] ) ) | ( a[6] & b[6] ); r[7] = ( a[7] ^ b[7] ) ^ c; } // Helpers void dec2bin( unsigned char in, bool out[] ) { out[0] = in & 1; out[1] = in & 2; out[2] = in & 4; out[3] = in & 8; out[4] = in & 16; out[5] = in & 32; out[6] = in & 64; out[7] = in & 128; } unsigned char bin2dec( bool in[] ) { return in[0] + in[1]*2 + in[2]*4 + in[3]*8 + in[4]*16 + in[5]*32 + in[6]*64 + in[7]*128; } // Example int main() { bool res[8]; bool a[8]; bool b[8]; dec2bin( 117, a ); dec2bin( 25, b ); add( a, b, res ); std::cout << (int)bin2dec( res ) << std::endl; std::cin.get(); return 0; }
Eventually I want to make my own ALU by implementing the logic with electronics. (That is why I'm using arrays)