Misplaced Pages

Zeitpyramide

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.

The Zeitpyramide ( lit.   ' time pyramid ' ) is a work of public art by Manfred Laber (1932–2018) under construction in Wemding , Germany. The pyramid began in 1993, the year of the town's 1,200th anniversary. With a new block added every ten years, the structure should consist of 120 blocks when complete after 1,190 years, in the year 3183 .

#268731

56-447: The town of Wemding dates back to the year 793 and celebrated its 1,200th anniversary in 1993. The Zeitpyramide was conceived by Manfred Laber (a local artist) in June 1993 to mark this 1,200-year period and to give people a sense of what the span of 1,200 years really means. One block is scheduled to be placed every ten years, taking 1,190 years. This time includes the initial block placed at

112-431: A declarative programming language. Within an imperative programming language , a control flow statement is a statement that results in a choice being made as to which of two or more paths to follow. For non-strict functional languages, functions and language constructs exist to achieve the same result, but they are usually not termed control flow statements. A set of statements is in turn generally structured as

168-474: A block , which in addition to grouping, also defines a lexical scope . Interrupts and signals are low-level mechanisms that can alter the flow of control in a way similar to a subroutine , but usually occur as a response to some external stimulus or event (that can occur asynchronously ), rather than execution of an in-line control flow statement. At the level of machine language or assembly language , control flow instructions usually work by altering

224-511: A mathematical context. It often occurs in computer programming when a loop iterates one time too many or too few, usually caused by the use of non-strict inequality (≤) as the terminating condition where strict inequality (<) should have been used, or vice versa. Off-by-one errors also stem from confusion over zero-based numbering . Consider an array of items, and items m through n (inclusive) are to be processed. How many items are there? An intuitive answer may be n − m , but that

280-532: A server ) should loop forever, handling events as they occur, only stopping when the process is terminated by an operator. Infinite loops can be implemented using other control flow constructs. Most commonly, in unstructured programming this is jump back up (goto), while in structured programming this is an indefinite loop (while loop) set to never end, either by omitting the condition or explicitly setting it to true, as while (true) ... . Some languages have special constructs for infinite loops, typically by omitting

336-402: A desire to skip the remainder of the loop body and continue with the next iteration of the loop. Some languages provide a statement such as continue (most languages), skip , cycle (Fortran), or next (Perl and Ruby), which will do this. The effect is to prematurely terminate the innermost loop body and then resume as normal with the next iteration. If the iteration is the last one in

392-431: A final keyword. Conditional expressions and conditional constructs are features of a programming language that perform different computations or actions depending on whether a programmer-specified Boolean condition evaluates to true or false. Less common variations include: Switch statements (or case statements , or multiway branches ) compare a given value with specified constants and take action according to

448-532: A half-open interval from 0 to 5: The loop body is executed first of all with index equal to 0; index then becomes 1, 2, 3, and finally 4 on successive iterations. At that point, index becomes 5, so index < 5 is false and the loop ends. However, if the comparison used were <= (less than or equal to), the loop would be carried out six times: index takes the values 0, 1, 2, 3, 4, and 5. Likewise, if index were initialized to 1 rather than 0, there would only be four iterations: index takes

504-541: A label is an identifier , usually appearing at the start of a line and immediately followed by a colon. For example, in C: The language ALGOL 60 allowed both whole numbers and identifiers as labels (both linked by colons to the following statement), but few if any other ALGOL variants allowed whole numbers. Early Fortran compilers only allowed whole numbers as labels. Beginning with Fortran-90, alphanumeric labels have also been allowed. The goto statement (a combination of

560-409: A major issue. In smaller numbers, however, and specific cases where accuracy is paramount, committing an off-by-one error can be disastrous. Sometimes such an issue will also be repeated and, therefore, worsened, by someone passing on an incorrect calculation, if the following person makes the same kind of mistake again (of course, the error might also be reversed). An example of this error can occur in

616-501: A multilevel break or continue – this was proposed in PEP 3136 , and rejected on the basis that the added complexity was not worth the rare legitimate use. The notion of multi-level breaks is of some interest in theoretical computer science , because it gives rise to what is today called the Kosaraju hierarchy . In 1973 S. Rao Kosaraju refined the structured program theorem by proving that it

SECTION 10

#1733085014269

672-423: A security-related bug is caused by misuse of the C standard library strncat routine. A common misconception with strncat is that the guaranteed null termination will not write beyond the maximum length. In reality it will write a terminating null character one byte beyond the maximum length specified. The following code contains such a bug: Off-by-one errors are common in using the C library because it

728-453: A set or collection. Scala has for-expressions , which generalise collection-controlled loops, and also support other uses, such as asynchronous programming . Haskell has do-expressions and comprehensions, which together provide similar function to for-expressions in Scala. General iteration constructs such as C's for statement and Common Lisp 's do form can be used to express any of

784-401: A state variable which is tested to break out another level; exceptions, which are caught at the level being broken out to; placing the nested loops in a function and using return to effect termination of the entire nested loop; or using a label and a goto statement. C does not include a multilevel break, and the usual alternative is to use a goto to implement a labeled break. Python does not have

840-493: A statement without disrupting the control flow. In other words, they were composable . (Later developments, such as non-strict programming languages – and more recently, composable software transactions – have continued this strategy, making components of programs even more freely composable.) Some academics took a purist approach to the Böhm–Jacopini result and argued that even instructions like break and return from

896-676: Is at the start, the body may be skipped completely; if it is at the end, the body is always executed at least once. A control break is a value change detection method used within ordinary loops to trigger processing for groups of values. Values are monitored within the loop and a change diverts program flow to the handling of the group event associated with them. Several programming languages (e.g., Ada , D , C++11 , Smalltalk , PHP , Perl , Object Pascal , Java , C# , MATLAB , Visual Basic , Ruby , Python , JavaScript , Fortran 95 and later) have special constructs which allow implicit looping through all elements of an array, or all members of

952-474: Is found. Some programming languages provide a statement such as break (most languages), Exit (Visual Basic), or last (Perl), which effect is to terminate the current loop immediately, and transfer control to the statement immediately after that loop. Another term for early-exit loops is loop-and-a-half . The following example is done in Ada which supports both early exit from loops and loops with test in

1008-404: Is important to consider when dealing with the reverse error. The reverse error occurs when the number of posts is known and the number of sections is assumed to be the same. Depending on the design of the fence, this assumption can be correct or incorrect. The following problem demonstrates the reverse error: If you have n posts, how many sections are there between them? The interpretation for

1064-553: Is met, or indefinitely . When one of those items is itself also a loop, it is called a "nested loop". In functional programming languages, such as Haskell and Scheme , both recursive and iterative processes are expressed with tail recursive procedures instead of looping constructs that are syntactic. Most programming languages have constructions for repeating a loop a certain number of times. In most cases counting can go downwards instead of upwards and step sizes other than 1 can be used. In these examples, if N < 1 then

1120-468: Is not consistent with respect to whether one needs to subtract 1 byte – functions like fgets() and strncpy will never write past the length given them ( fgets() subtracts 1 itself, and only retrieves (length − 1) bytes), whereas others, like strncat will write past the length given them. So the programmer has to remember for which functions they need to subtract 1. On some systems ( little endian architectures in particular) this can result in

1176-400: Is off by one, exhibiting a fencepost error ; the correct answer is n − m + 1 . For this reason, ranges in computing are often represented by half-open intervals ; the range from m to n (inclusive) is represented by the range from m (inclusive) to n + 1 (exclusive) to avoid fencepost errors. For example, a loop that iterates five times (from 0 to 4 inclusive) can be written as

SECTION 20

#1733085014269

1232-466: Is possible to avoid adding additional variables in structured programming, as long as arbitrary-depth, multi-level breaks from loops are allowed. Furthermore, Kosaraju proved that a strict hierarchy of programs exists: for every integer n , there exists a program containing a multi-level break of depth n that cannot be rewritten as a program with multi-level breaks of depth less than n without introducing added variables. One can also return out of

1288-457: Is scheduled to take 1,190 years to build (not 1,200), from the installation of the first block to the last block. One of the earliest fencepost errors involved time, where the Julian calendar originally calculated leap years incorrectly , due to counting inclusively rather than exclusively, yielding a leap year every three years rather than every four. In larger numbers, being off by one is often not

1344-401: Is wrong. This response comes from dividing the length of the fence by the spacing apart from each post, with the quotient being erroneously classified as the number of posts. In actuality, the fence has 10 sections and 11 posts. In this scenario, a fence with n sections will have n + 1 posts. Conversely, if the fence contains n posts, it will contain n − 1 sections. This relationship

1400-515: The Great Pyramid of Giza —which is made from limestone, mortar, and granite, and which has lasted more than 4500 years—the lifespan of reinforced concrete and regular blocks of concrete is typically only 50–100 years. However, concrete blocks can last indefinitely when properly maintained or weatherproofed. According to Youtuber Stand-up Maths , the Zeitpyramide has a mathematical issue known as

1456-669: The Isla San Antonio ; in Alcanar , Spain; and Mormoiron , France. Alcanar was also his part-time place of residence. Laber died in Wemding on 17 August 2018, aged 86. The time pyramid is located on a concrete pad on a rounded hilltop, the Robertshöhe , on the northern edge of Wemding. The first block was placed in October 1993. The 6.5-tonne (6.4-long-ton; 7.2-short-ton) fourth and most recent block

1512-479: The program counter . For some central processing units (CPUs), the only control flow instructions available are conditional or unconditional branch instructions, also termed jumps. The kinds of control flow statements supported by different languages vary, but can be categorized by their effect: A label is an explicit name or number assigned to a fixed position within the source code , and which may be referenced by control flow statements appearing elsewhere in

1568-436: The " picket fence error ". For a picket fence of n elements, you need to have n+1 posts. The error arises because the project started with the placement of the first block in 1993, rather than waiting for the first decade to pass. This means the pyramid will be completed in 3183, and not 3193, which is only 1,190 years from the start date, not 1,200 as it was promised. Stand-up Maths pointed out this error during his visit to

1624-479: The 1950s, computer memories were very small by current standards so subroutines were used mainly to reduce program size. A piece of code was written once and then used many times from various other places in a program. Today, subroutines are more often used to help make a program more structured, e.g., by isolating some algorithm or hiding some data access method. If many programmers are working on one program, subroutines are one kind of modularity that can help divide

1680-767: The English words go and to , and pronounced accordingly) is the most basic form of unconditional transfer of control. Although the keyword may either be in upper or lower case depending on the language, it is usually written as: The effect of a goto statement is to cause the next statement to be executed to be the statement appearing at (or immediately after) the indicated label. Goto statements have been considered harmful by many computer scientists, notably Dijkstra . The terminology for subroutines varies; they may alternatively be known as routines, procedures, functions (especially if they return results) or methods (especially if they belong to classes or type classes ). In

1736-517: The Haus des Gastes. If the time pyramid project proceeds according to plan, it will fall into four stages based on tier layer: The pyramid, when completed in the year 3183 , is scheduled to consist of 120 stone or concrete blocks, each measuring 1.2 m (3.9 ft) long, 1.2 m (3.9 ft) wide and 1.8 m (5.9 ft) tall. Adjacent blocks are separated by gaps of half a block or 0.6 m (2.0 ft). Unlike ancient human structures such as

Zeitpyramide - Misplaced Pages Continue

1792-470: The Pascal-provided control structures, the correct solution was given by only 20% of the subjects, while no subject wrote incorrect code for this problem if allowed to write a return from the middle of a loop. Most programming languages with control structures have an initial keyword which indicates the type of control structure involved. Languages then divide as to whether or not control structures have

1848-701: The above example is linked to the for statement, and not the inner if statement. Both Python's for and while loops support such an else clause, which is executed only if early exit of the loop has not occurred. Some languages support breaking out of nested loops; in theory circles, these are called multi-level breaks. One common use example is searching a multi-dimensional table. This can be done either via multilevel breaks (break out of N levels), as in bash and PHP, or via labeled breaks (break out and continue at given label), as in Go, Java and Perl. Alternatives to multilevel breaks include single breaks, together with

1904-450: The above sorts of loops, and others, such as looping over some number of collections in parallel. Where a more specific looping construct can be used, it is usually preferred over the general iteration construct, since it often makes the purpose of the expression clearer. Infinite loops are used to assure a program segment loops forever or until an exceptional condition arises, such as an error. For instance, an event-driven program (such as

1960-614: The addition of Boolean variables (true/false flags). Later authors showed that choice can be replaced by loops (and yet more Boolean variables). That such minimalism is possible does not mean that it is necessarily desirable; computers theoretically need only one machine instruction (subtract one number from another and branch if the result is negative), but practical computers have dozens or even hundreds of machine instructions. Other research showed that control structures with one entry and one exit were much easier to understand than any other form, mainly because they could be used anywhere as

2016-440: The array indices after the problem domain. A fencepost error (occasionally called a telegraph pole, lamp-post, or picket fence error ) is a specific type of off-by-one error. An early description of this error appears in the works of Vitruvius . The following problem illustrates the error: If you build a straight fence 30 feet long with posts spaced 3 feet apart, how many posts do you need? The common answer of 10 posts

2072-525: The beginning of the project, which explains the apparent off-by-one error of ten years. So far, the blocks have all been concrete, but the material of future blocks may be altered in future generations depending on availability of materials. Manfred Laber was born in Wemding on 5 May 1932 and studied painting at the Hochschule für Bildende Künste in Berlin in the 1950s. He has other artwork on permanent display on

2128-436: The body of loop may execute once (with I having value 1) or not at all, depending on the programming language. In many programming languages, only integers can be reliably used in a count-controlled loop. Floating-point numbers are represented imprecisely due to hardware constraints, so a loop such as might be repeated 9 or 10 times, depending on rounding errors and/or the hardware and/or the compiler version. Furthermore, if

2184-501: The computational language MATLAB with the linspace() linear interpolation function, whose parameters are ( lower value , upper value , number of values ) and not ( lower value , upper value , number of increments ) . A programmer who misunderstands the third parameter to be the number of increments might hope that linspace(0,10,5) would achieve a sequence [0, 2, 4, 6, 8, 10] but instead would get [0, 2.5, 5, 7.5, 10] . A common off-by-one error which results in

2240-400: The condition from an indefinite loop. Examples include Ada ( loop ... end loop ), Fortran ( DO ... END DO ), Go ( for { ... } ), and Ruby ( loop do ... end ). Often, an infinite loop is unintentionally created by a programming error in a condition-controlled loop, wherein the loop condition uses variables that never change within the loop. Sometimes within the body of a loop there is

2296-484: The default case as a glob matching any string. Case logic can also be implemented in functional form, as in SQL 's decode statement. A loop is a sequence of statements which is specified once but which may be carried out several times in succession. The code "inside" the loop (the body of the loop, shown below as xxx ) is obeyed a specified number of times, or once for each of a collection of items, or until some condition

Zeitpyramide - Misplaced Pages Continue

2352-441: The end of a buffer. (In the code example above, calling strlcat(buf, s, sizeof(buf)) instead would remove the bug.) Program loop In computer science , control flow (or flow of control ) is the order in which individual statements , instructions or function calls of an imperative program are executed or evaluated. The emphasis on explicit control flow distinguishes an imperative programming language from

2408-455: The ends of a line-segment-like fence (e.g., a fence between and wall-anchored to two buildings). The precise problem definition must be carefully considered, as the setup for one situation may give the wrong answer for other situations. Fencepost errors can also occur in units other than length. For example, the Time Pyramid , consisting of 120 blocks placed at 10-year intervals between blocks,

2464-400: The fence's design changes the answer to this problem. The correct number of sections for a fence is n − 1 if the fence is a free-standing line segment bounded by a post at each of its ends (e.g., a fence between two passageway gaps), n if the fence forms one complete, free-standing loop (e.g., enclosure accessible by surmounting, such as a boxing ring), or n + 1 if posts do not occur at

2520-404: The first constant to match. There is usually a provision for a default action ("else", "otherwise") to be taken if no match succeeds. Switch statements can allow compiler optimizations, such as lookup tables . In dynamic languages , the cases may not be limited to constant expressions, and might extend to pattern matching , as in the shell script example on the right, where the *) implements

2576-404: The increment of X occurs by repeated addition, accumulated rounding errors may mean that the value of X in each iteration can differ quite significantly from the expected sequence 0.1, 0.2, 0.3, ..., 1.0. Most programming languages have constructions for repeating a loop until some condition changes. Some variations test the condition at the start of the loop; others test it at the end. If the test

2632-402: The loop, the effect is to terminate the entire loop early. Some languages, like Perl and Ruby, have a redo statement that restarts the current iteration from the start. Ruby has a retry statement that restarts the entire loop from the initial iteration. When using a count-controlled loop to search through a table, it might be desirable to stop searching as soon as the required item

2688-429: The middle . Both features are very similar and comparing both code snippets will show the difference: early exit must be combined with an if statement while a condition in the middle is a self-contained construct. Python supports conditional execution of code depending on whether a loop was exited early (with a break statement) or not by using an else-clause with the loop. For example, The else clause in

2744-456: The middle of loops are bad practice as they are not needed in the Böhm–Jacopini proof, and thus they advocated that all loops should have a single exit point. This purist approach is embodied in the language Pascal (designed in 1968–1969), which up to the mid-1990s was the preferred tool for teaching introductory programming in academia. The direct application of the Böhm–Jacopini theorem may result in additional local variables being introduced in

2800-555: The overwriting of the least significant byte of the frame pointer . This can cause an exploitable condition where an attacker can hijack the local variables for the calling routine. One approach that often helps avoid such problems is to use variants of these functions that calculate how much to write based on the total length of the buffer, rather than the maximum number of characters to write. Such functions include strlcat and strlcpy , and are often considered "safer" because they make it easier to avoid accidentally writing past

2856-432: The placement of the fourth block in 2023. He also proposed an alternative design that would take 121 blocks to complete. His design is not a pyramid and would be 19.8 meters tall. Off-by-one error An off-by-one error or off-by-one bug (known by acronyms OBOE , OBO , OB1 and OBOB ) is a logic error that involves a number that differs from its intended value by 1. An off-by-one error can sometimes appear in

SECTION 50

#1733085014269

2912-554: The source code. A label marks a position within source code and has no other effect. Line numbers are an alternative to a named label used in some languages (such as BASIC ). They are whole numbers placed at the start of each line of text in the source code. Languages which use these often impose the constraint that the line numbers must increase in value in each following line, but may not require that they be consecutive. For example, in BASIC: In other languages such as C and Ada ,

2968-467: The structured chart, and may also result in some code duplication . Pascal is affected by both of these problems and according to empirical studies cited by Eric S. Roberts , student programmers had difficulty formulating correct solutions in Pascal for several simple problems, including writing a function for searching an element in an array. A 1980 study by Henry Shapiro cited by Roberts found that using only

3024-484: The values 1, 2, 3, and 4. Both of these alternatives can cause off-by-one errors. Another such error can occur if a do-while loop is used in place of a while loop (or vice versa.) A do-while loop is guaranteed to run at least once. Array-related confusion may also result from differences in programming languages. Numbering from 0 is most common, but some languages start array numbering with 1. Pascal has arrays with user-defined indices. This makes it possible to model

3080-609: The work. In structured programming, the ordered sequencing of successive commands is considered one of the basic control structures, which is used as a building block for programs alongside iteration, recursion and choice. In May 1966, Böhm and Jacopini published an article in Communications of the ACM which showed that any program with goto s could be transformed into a goto-free form involving only choice (IF THEN ELSE) and loops (WHILE condition DO xxx), possibly with duplicated code and/or

3136-407: Was placed at 15:06 on 9 September 2023. Following the construction schedule, the fifth block will be placed in 2033. The project's initial financing was mostly achieved through donations by local companies, which, for example, supplied the materials for the concrete slab for free. The project is administered by a foundation based in Wemding. A model of the final artwork is exhibited at Wemding, at

#268731