Sign In
Fabulous Adventures In Coding
Eric Lippert's Blog
Tags
Aargh! (8)
accuracy (6)
Arrays (8)
ASP (11)
AStar (5)
Async (15)
bad jokes (14)
Begging the question (4)
Benford's Law (3)
Best Of FAIC (12)
Big Words (5)
Books (23)
Breaking Changes (24)
Brittle Base Classes (6)
C# (326)
C# 4.0 (39)
C# 5.0 (10)
Cargo Cult Programming (4)
cast operator (3)
Channel 9 (6)
Charts (6)
closures (3)
Code Generation (10)
Code Quality (29)
COM Programming (57)
Conditional Operator (3)
Continuation Passing Style (11)
Conversions (16)
Covariance and Contravariance (22)
customer service (4)
declaration spaces (5)
definite assignment (3)
Dialogue (14)
English Usage (11)
exception handling (9)
Floating Point Arithmetic (15)
grammars (9)
graph colouring (5)
GUIDs (3)
Hashing (9)
High Dimensional Spaces (5)
Immutability (27)
integer arithmetic (5)
Interviewing (8)
Introduction (6)
It Hurts When I Do This (5)
Iterators (10)
JScript (93)
JScript .NET (29)
keywords (4)
Lambda Expressions (20)
Language Design (62)
local variables (3)
localization (3)
Mathematics (18)
Memory Management (13)
Metablogging (9)
Mistakes (6)
Music (6)
myths (7)
namespaces (5)
Non-computer (37)
Optional arguments (5)
Overload Resolution (9)
Pages (25)
Performance (48)
precedence (4)
precision (7)
protected (7)
Puzzles (49)
quotable quotations (4)
Rants (51)
Rarefied Heights (52)
reachability (4)
Recursion (26)
reference (4)
Regular Expressions (13)
Relationships (4)
Salt (4)
Science (12)
scope (5)
Scripting (189)
Security (46)
shadowcasting (6)
SimpleScript (30)
Software development methodology (13)
Static Methods (6)
Threading (18)
Topological Sort (4)
Type Inference (18)
type safety (4)
unsafe code (4)
Value Types (11)
VBScript (80)
Video (12)
virtual dispatch (9)
VSTO (10)
warnings (5)
What's The Difference? (11)
Zombies (4)
Browse by Tags
MSDN Blogs
>
Fabulous Adventures In Coding
>
All Tags
>
floating point arithmetic
Tagged Content List
Blog Post:
The Solution To The Simple Puzzle
Eric Lippert
The first time I ran my histogram visualizer I asked for a Cauchy distribution with a minimum of -10 and a maximum of 10, and of course I got a graph that looks much like the one from my article of last week: Looks perfectly reasonable; I guess my program is correct right out of the gate, because I am...
on
27 Feb 2012
Blog Post:
Looking inside a double
Eric Lippert
Occasionally when I'm debugging the compiler or responding to a user question I'll need to quickly take apart the bits of a double-precision floating point number. Doing so is a bit of a pain, so I've whipped up some quick code that takes a double and tells you all the salient facts about it. I present...
on
17 Feb 2011
Blog Post:
Precision and accuracy of DateTime
Eric Lippert
The DateTime struct represents dates as a 64 bit number that measures the number of “ticks” since a particular start date. Ten million ticks equals one second. That’s a quite high degree of precision . You can represent dates and times to sub-microsecond accuracy with a DateTime, which is typically more...
on
8 Apr 2010
Blog Post:
Is there such a thing as too much precision?
Eric Lippert
Well, enough chit-chat, back to programming language design. Suppose you’re building electronic piano software. As we’ve discussed before, the “equal temperament” tuning for a piano goes like this: the 49th note from the left on a standard 88 key piano is A, and its frequency is 440 Hz. Each octave...
on
7 Jan 2010
Blog Post:
As Timeless As Infinity
Eric Lippert
User: Recently I found out about a peculiar behaviour concerning division by zero in floating point numbers in C#. It does not throw an exception, as with integer division, but rather returns an "infinity". Why is that? Eric: As I've often said, "why" questions are difficult for me to answer. My first...
on
15 Oct 2009
Blog Post:
Every Number Is Special In Its Own Special Way
Eric Lippert
I got a question recently about where in the .NET framework the "special numbers" were defined. The questioner was actually asking about the Double.NaN , Double.PositiveInfinity , etc, special values for floating point numbers. Of course there are other "special numbers" defined by the framework, such...
on
28 Nov 2006
Blog Post:
Fun With Floating Point Arithmetic, Part Six
Eric Lippert
One more thing -- I said earlier that the VBScript float-to-string algorithm was a little bit different than the JScript algorithm. We can demonstrate quite easily by comparing the outputs of two nigh-identical programs: ' VBScript print 9.2 * 100.0 < 920.0 print 919.9999999999999 < 920.0 print...
on
26 Jan 2005
Blog Post:
Fun with Floating Point Arithmetic, Part Five
Eric Lippert
I went to Joel Spolsky's geek dinner at Crossroads the other night, which was a lot of fun. I didn't get much of a chance to chat with Joel, as he was surrounded by a cadre of adoring fans three deep the whole time. I mostly hung out with KC and Larry and some other attendees and had an interesting talk...
on
20 Jan 2005
Blog Post:
Fun with Floating Point Arithmetic, Part Four
Eric Lippert
A reader also asked the other day why it is that in VBScript, CSng(0.1) = CDbl(0.1) is False . Forget about binary floating point for a moment. Suppose that we had two fixed-point decimal systems, say one with five digits after the decimal place and one with ten. You want to represent one-third. In our...
on
18 Jan 2005
Blog Post:
Fun With Floating Point Arithmetic, Part Three
Eric Lippert
I've been getting lots of mail, questions and pointers to interesting articles on some of the trials and tribulations of using floating point arithmetic correctly. Please do keep it coming! Though I am certainly no expert in this area, I'm happy to take a crack at any questions you might have. To sum...
on
17 Jan 2005
Blog Post:
Floating Point And Benford's Law, Part Two
Eric Lippert
A number of readers asked for an explanation of my offhand comment that Benford's Law can be used to show that binary is the best base for doing floating point math. One of the desired properties of a floating point system is that the "representation error" is as small as possible. For example, suppose...
on
13 Jan 2005
Blog Post:
Benford's Law
Eric Lippert
While I was poking through my old numeric analysis textbooks to refresh my memory for this series on floating point arithmetic, I came across one of my favourite weird facts about math. A nonzero base-ten integer starts with some digit other than zero. You might naively expect that given a bunch of ...
on
12 Jan 2005
Blog Post:
Floating Point Arithmetic, Part One
Eric Lippert
A month ago I was discussing some of the issues in integer arithmetic , and I said that issues in floating point arithmetic were a good subject for another day. Over the weekend I got some questions from a reader about floating point arithmetic, so this seems like as good a time as any to address them...
on
10 Jan 2005
Blog Post:
Bankers' Rounding
Eric Lippert
A number of people have pointed out to me over the years that VBScript's Round function is a bit weird. It seems like it should be pretty straightforward -- you pick the integer closest to the number you've got, end of story. But what about, say, 1.5? There are two closest integers. Do you go up or down...
on
26 Sep 2003
Blog Post:
Why does JScript have rounding errors?
Eric Lippert
Try this in JScript: window.alert(9.2 * 100.0); You might expect to get 920, but in fact you get 919.9999999999999. What the heck is going on here? Boy, have I ever heard this question a lot. Well, let me answer that question with another question. Suppose...
on
15 Sep 2003
Page 1 of 1 (15 items)