Define a primitive data type: Difference between revisions
Content added Content deleted
(Adds Clojure solution) |
(Adds Clojure sample usage output) |
||
Line 296: | Line 296: | ||
(longValue [] value)) |
(longValue [] value)) |
||
(throw (ArithmeticException. "integer overflow"))))</lang> |
(throw (ArithmeticException. "integer overflow"))))</lang> |
||
{{out}} |
|||
<pre>user=> (+ (tinyint 1) (tinyint 9)) |
|||
10 |
|||
user=> (* 4 (tinyint 6)) |
|||
24 |
|||
user=> (* 4 (tinyint 6.0)) |
|||
24 |
|||
user=> (/ (tinyint 3) (tinyint 5)) |
|||
3/5 |
|||
user=> (tinyint 11) |
|||
ArithmeticException integer overflow |
|||
user=> (.doubleValue (tinyint 9.4)) |
|||
9.0</pre> |
|||
=={{header|Common Lisp}}== |
=={{header|Common Lisp}}== |