Useless instructions: Difference between revisions

→‎{{header|ALGOL 68}}: Updated for the latest version of Algol 68G
(→‎{{header|ALGOL 68}}: Updated for the latest version of Algol 68G)
Line 28:
 
=={{header|ALGOL 68}}==
{{works with|ALGOL 68G|Any - tested with release 23.80.31.win32}}
As well as being able to write <code>IF TRUE THEN SKIP ELSE some code that will never be executed FI</code> and <code>WHILE FALSE DO some code that will never be executed OD</code>, as in other languages shown here, Algol 68 has a feature that was presumably intended to aid portability (though whether it does in practice is another matter...):<br>
Algol 68 has a notionally infinite number of integer, real and comples types. THe standard types INT, REAL and COMPL, can have an arbitrary number of LONG or SHORT prefixes to indicate larger or smaller types. Whether these are actually larger or smaller depends on the implementation - no warning is issued (at least, not in Algol 68G) to indicate that e.g. LONG LONG LONG REAL is not longer than LONG LONG REAL. In addition, there are "environment enquiries" that will reveal how big the types are, so e.g. max int is the largest INT value, long max int is the largest LONG INT value, etc. An arbitrary number of long and short prefixes can be applied.<br>
<br>
As this sample shows, Algol 68G has only three sies of integer. The precission of LONG LONG INT can be specified by a pragmatic comment. The value shown here is the default.<br>
(Interestingly, I always assumed Algol 68G's LONG INT was 64 bits but I see this isn't so...)
<br>Algol 68G has 64 bit INT and 128 bit LONG LONG INT. In previous versions, INT was 32 bit and LONG INT had a precision of 35 decimal digits.<br>
<lang algol68>print( ( long long long max int, newline ) );
print( ( long long max int, newline ) );
Line 47 ⟶ 48:
{{out}}
<pre>
+999999999999999999999999999999999999999999999999999999999999999999999999
+9999999999999999999999999999999999999999999999999999999999999999999999
+999999999999999999999999999999999999999999999999999999999999999999999999
+9999999999999999999999999999999999999999999999999999999999999999999999
+170141183460469231731687303715884105727
+99999999999999999999999999999999999
+9223372036854775807
+2147483647
+9223372036854775807
+2147483647
+9223372036854775807
+2147483647
+9223372036854775807
+2147483647
+9223372036854775807
+2147483647
</pre>
 
=={{header|AWK}}==
<lang AWK>
3,043

edits