[WEBINAR] The New Normal: Dealing with the Reality of an Unsecure World

Fencepost Error

Definition - What does Fencepost Error mean?

A fencepost error is a specific type of off-by-one error that has to do with unlikely or misunderstood algorithms for development.

Fencepost errors are also known as telegraph pole errors and lamppost errors.

Techopedia explains Fencepost Error

At the heart of the fencepost error is the idea that the number of posts used for a fence project differs based on whether the fence is long with two opposite ends, or whether it circles back to a closed loop. In the former scenario, a fencepost error can occur if a person makes an intuitive supposition that a fence only needs as many posts as dividing the length by the length between posts. For example, if the fence is 50 feet long and has posts every 5 feet, the human working on this problem might suppose that the fence needs 10 posts. However, if the fence is not a closed loop, it needs an additional post at the end — in other words, it needs a post at the starting point or zero, as well as a post at the ending point or end number. Algorithms demonstrating the fencepost principle would use a phrase like “n+1” posts. However, it must be noted that if the fence is a closed loop, the additional fencepost is not needed.

The fencepost error has multiple allegories and applications to coding and development. It represents one of many logical errors that cause programs to experience bugs or produce inaccurate results.

Techopedia Deals

Connect with us

Techopedia on Linkedin
Techopedia on Linkedin
"Techopedia" on Twitter

Sign up for Techopedia's Free Newsletter!

Email Newsletter

Join thousands of others with our weekly newsletter

Free Whitepaper: The Path to Hybrid Cloud
Free Whitepaper: The Path to Hybrid Cloud:
The Path to Hybrid Cloud: Intelligent Bursting To Amazon Web Services & Microsoft Azure
Free E-Book: Public Cloud Guide
Free E-Book: Public Cloud Guide:
This white paper is for leaders of Operations, Engineering, or Infrastructure teams who are creating or executing an IT roadmap.
Free Tool: Virtual Health Monitor
Free Tool: Virtual Health Monitor:
Virtual Health Monitor is a free virtualization monitoring and reporting tool for VMware, Hyper-V, RHEV, and XenServer environments.
Free 30 Day Trial – Turbonomic
Free 30 Day Trial – Turbonomic:
Turbonomic delivers an autonomic platform where virtual and cloud environments self-manage in real-time to assure application performance.