« first day (1362 days earlier)      last day (3926 days later) » 

22:00
@MichaelT ...? huh?
I put it in a Message Box. It still says 0.002.
@MichaelT what does any of that equation have to do with .002?
@RobertHarvey What says 0.002?
user55340
@JimmyHoffa Its what Robert is getting!
as the result?
user55340
apparently.
22:02
weird, the code you put on that ideone link gives me....
double secondsInMinorFrame = pGroup.BitsInMinorFrame / pGroup.BitRate;
BitsInMinorFrame is (int)834
BitRate is (double)1050000
0
0.000794285714285714
Yep. Debugger says 0.002.
Message box says 0.002.
that's what those two Console.WriteLine's produce
what I pasted above
@RobertHarvey it's being rounded for presentation likely.
That's some pretty fucked up rounding.
22:04
look for an overload that let's you decide the .ToString() format of the value.
I suppose your right, 0.0007 shouldn't round to 0.002, it should round to 0.001 if anything...
Ack. It's probably displaying it as hex
@RobertHarvey ? I suspect not...
God, I hate that. Half the shit in this debugger is displayed in hex, the other half in decimal.
Doesn't matter either way. A simple Console.ReadLine proves the runtime has the correct value in memory, it's just displaying that value that you're getting wrong.
@RobertHarvey What debugger are you using?
user55340
22:05
~ $ bc
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
scale=20
obase=16
834 / 1050000
.00340DE72AA22D9E0
Visual Studio 2010
@MichaelT stop knowing arcane tools that are just...weird!
user55340
@JimmyHoffa bc is not weird... if you want weird... I'll switch to dc.
@JimmyHoffa Says the monad man.
@MichaelT my point exactly, bc, dc, ed, next you're going to paste something in here from awk to prove some point... won't prove anything, everybody knows those tools are just jokes the unix folks put in to screw with people's heads
user55340
22:08
bc is a nice infix calculator... dc is a postfix one.
user55340
(originally, bc was a compiler to dc...)
@Dr.Ibb monads are just like burritos, I mean buckets, or gonads (macroids?), I mean, there's nothing weird about them, monads have mohaws and will mostab you. Wait I think I might be getting something wrong...
@JimmyHoffa I think I just had a moaneurysm.
@RobertHarvey floating point are always in decimal; all integral depend on the show hex setting in the context menu
Yeah, that's what it was. Fuck.
22:13
recognized by the 0x prefix
Yeah, you're right.
Fuck.
@RobertHarvey From now on, just use F# interactive, you don't even need to launch an application to run some code live and see what it does. View->Other Windows->F# Interactive, or Ctrl+Alt+F
I'm good at seeing those kind of flags designers leave
F#? Jimmy Hoffa is recommending F# for something?
@RobertHarvey just the tool in visual studio. Want to see how .NET does something without creating a command line project or running something in the debugger just to access the immediate window? F# Interactive window acts like the immediate window, without anything being run in debug for you to have to execute code.
22:15
That's pretty cool.
I use it when I want to test different .ToString() formatters and things for instance.
or rounding
a repl loop in VS?
Except that I don't think you can type c# code into it.
> let bah = 33 in bah.ToString("C");;
val it : string = "$33.00"
Should have used 42. leet fail.
22:18
@ratchetfreak yep. F# only though, but the whole .NET library is accessible there so you may need to create a variable with a let statement, but then you access the innards of it the same as in C#. Just end the statement with 2 semicolons instead of one for some reason.
using 1337 is just lame though
Interactive mode probably doesn't know the light syntax.
> > System.DateTime.Now.ToString("D");;
> val it : string = "Tuesday, May 27, 2014"
> >
> > (double)834 / (double)105000;;
> val it : float = 0.007942857143
> >
but (double) 0x834/(double)1050000=0.002
@RobertHarvey I believe the interactive mode can actually have it's mode changed in this fashion.
It's really just a terminal window in visual studio to the command line F# REPL: fsi.exe
22:28
The thing runs at 500 hertz, so .002 does actually make sense.
user55340
23:03
@Ampt btw, some useful code for you: ideone.com/X2iCJy
4
23:14
Oh, that's just evil.
How does one instantiate a List<T> if all you have is a runtime type T?
You can't just say new List<T>()
psr
psr
reflection. Not that I actually know how or anything, off the top of my head.
Wait, do you mean a type that is entirely unknown at compile time?
23:29
How do you get output in ideone from C#?
Ah, never mind.
user55340
Its a useful 'I want to run this code' for something I don't have on my system.
user55340
Nice for making mvce - here's the code (paste in to SO), here's where you can run it so you can see the output. Kind of like a jsfiddle, but for everything else.
I did not know ideone existed until today and it was promptly added to my bookmarks.
user55340
I've used it in some answers where I need C# or VB.
user55340
Example:
user55340
23:36
2
A: Is this a good way to compare two numbers?

MichaelTUnderstanding the decimal format and working with a properly crafted number, it is not difficult to find two values that have differing values. using System; public class Example { public static void Main() { double[] values = { //12345678901234567 0.100000000000000...

user55340
> (If you want to play with this code online, it is at ideone.com/fwsq5o )
It's too bad SO doesn't have the option to run code directly from the question/answer.
I bet it would save a lot of questions from being closed.
"Paste your code here and run it before you submit this question"
ideone seems to fall down when presented with exotic things like Activator.CreateInstance.
Then again, it's been awhile since I coded a C# program in notepad.
Yeah, I could see that.
user55340
It has a limited set of libraries in the sandbox... so some things are not going to work.
23:43
But still, even catching things like missing semicolons or unclosed parentheses could save a lot of headaches.
Unless you're submitting a question about Haskell. Then the only thing to prevent those headaches is three fingers of scotch.
user55340
@Dr.Ibb A hard (liquor) three finger reboot?
user55340
@AustinMoore The answer to that question is found in programming sucks... though don't take it too seriously.

« first day (1362 days earlier)      last day (3926 days later) »