off-by-one error

back to index

description: type of numerical or counting error

21 results

Smart and Gets Things Done: Joel Spolsky's Concise Guide to Finding the Best Technical Talent

by Joel Spolsky  · 1 Jun 2007  · 194pp  · 36,223 words

find them. With string functions in C, most college kids forget to nullterminate the new string. With almost any function, they are likely to have off-by-one errors. They will forget semicolons sometimes. Their function won’t work correctly on 0 length strings, or it will GPF if malloc fails ... Very, very rarely

The Art of Readable Code

by Dustin Boswell and Trevor Foucher  · 14 Sep 2010

short, it’s doing a lot. There are lots of intricate details, and it’s hard to tell at a glance whether there are any off-by-one errors, typos, or other bugs. The code may seem to be doing only one thing (updating the score), but there are actually two tasks being performed

Functional Programming in Scala

by Paul Chiusano and Rúnar Bjarnason  · 13 Sep 2014

also promote our type alias to a data type.5 Footnote 5mWe aren't using Scala's standard library streams here. They have an unfortunate "off-by-one" error—they strictly evaluate their first element. Generic code like what we are writing in this chapter can't assume it is desireable to evaluate any

Practical C Programming, 3rd Edition

by Steve Oualline  · 15 Nov 2011  · 544pp  · 96,029 words

middle= 0 high= 1 The item we are seeking (value 5) falls between element (value 4) and element 1 (value 6). Our algorithm has an off-by-one error. This type of error occurs when one variable in a program is just one off the value it should have. In this case, the variable

Python Tricks: The Book

by Dan Bader  · 14 Oct 2017  · 262pp  · 60,248 words

:1] index returned a slice of the original list ranging from index 1 to index 2, with a step size of one element. To avoid off-by-one errors, it’s important to remember that the upper bound is always exclusive. This is why we got [2, 3] as the sublist from the [1

Empire of the Sum: The Rise and Reign of the Pocket Calculator

by Keith Houston  · 22 Aug 2023  · 405pp  · 105,395 words

Fylstra set about selling it. There is an old joke that there are only two hard problems in software engineering: cache invalidation, naming things, and off-by-one errors. At some point along the way, in the early hours at a diner in Cambridge, Massachusetts, Frankston and Fylstra solved the second problem.26 That

Machine Learning for Hackers

by Drew Conway and John Myles White  · 10 Feb 2012  · 451pp  · 103,606 words

the 2-core example you’ll notice that we subtract one from the vector returned by the which function, lest we run into the dreaded “off by one” error. The second key subgraph we will extract is the seed’s ego-network. Recall that this is the subgraph induced by the seed’s neighbors

Practical Vim: Edit Text at the Speed of Thought

by Drew Neil  · 6 Oct 2012  · 722pp  · 90,903 words

can get around quicker using word-wise or character search motions (see Tip 48, and Tip 49). I use the h and l keys for off-by-one errors, when I narrowly miss my target. Apart from that, I hardly touch them. Given how little I use the h key, I’m happy to

selection by searching for the short “ge” string, which puts the cursor where we want it in a single bound. Well, almost—we have an off-by-one error. The selection includes the “g” at the start of the word, but we don’t want to delete that. We’ll use h to back

The Pragmatic Programmer

by Andrew Hunt and Dave Thomas  · 19 Oct 1999  · 509pp  · 92,141 words

," but I don't know when to stop), fencepost errors (not knowing whether to count the fenceposts or the spaces between them), and the ubiquitous "off by one" error [URL 52]. Invariants can help in these situations: a loop invariant is a statement of the eventual goal of a loop, but is generalized so

Beautiful Testing: Leading Professionals Reveal How They Improve Software (Theory in Practice)

by Adam Goucher and Tim Riley  · 13 Oct 2009  · 351pp  · 123,876 words

some object out of boundary without violating the memory itself but breaking the internal structure of another object. This kind of problem, often caused by off-by-one errors, can be very nasty and hard to debug, and the tools described earlier won’t detect them. Mudflap has already saved us a lot of

Kill It With Fire: Manage Aging Computer Systems

by Marianne Bellotti  · 17 Mar 2021  · 232pp  · 71,237 words

Joel on Software

by Joel Spolsky  · 1 Aug 2004  · 370pp  · 105,085 words

Programming Ruby 1.9: The Pragmatic Programmer's Guide

by Dave Thomas, Chad Fowler and Andy Hunt  · 15 Dec 2000  · 936pp  · 85,745 words

Test-Driven Development With Python

by Harry J. W. Percival  · 10 Jun 2014  · 779pp  · 116,439 words

Producing Open Source Software: How to Run a Successful Free Software Project

by Karl Fogel  · 13 Oct 2005

Practical Vim, Second Edition (for Stefano Alcazi)

by Drew Neil

Practical Vim

by Drew Neil

Programming in Scala

by Martin Odersky, Lex Spoon and Bill Venners  · 15 Jan 2008  · 754pp  · 48,930 words

Code Complete (Developer Best Practices)

by Steve McConnell  · 8 Jun 2004  · 1,758pp  · 342,766 words

Humble Pi: A Comedy of Maths Errors

by Matt Parker  · 7 Mar 2019

The Art of Software Security Assessment: Identifying and Preventing Software Vulnerabilities

by Justin Schuh  · 20 Nov 2006  · 2,054pp  · 359,149 words