caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] abs min_int
@ 2003-08-29  8:22 Christoph Bauer
  2003-08-29  8:30 ` IKEDA Katsumi
  2003-09-01  6:51 ` Florian Hars
  0 siblings, 2 replies; 3+ messages in thread
From: Christoph Bauer @ 2003-08-29  8:22 UTC (permalink / raw)
  To: OCaml List

Hi,

the manual describes the function "abs" as

"Return the absolute value of the argument."

This is not quite true:

        Objective Caml version 3.07+beta 2

# abs min_int;;
- : int = -1073741824

IMO abs should thow an Failure exception or the manual should 
point out this behavior.

Christoph Bauer

-- 
proc self {} {foreach c [split [info body self] ""] d {14 -7 0 0 4 -67 4 73 11
69 24 -83 -15 6 -4 -84 78 20 11 -78 -1 -1 79 19 -8 4} { binary scan $c c c
if {[catch {append r [format %c [expr $c+$d]]}]} {return $r};}};puts [self]

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] abs min_int
  2003-08-29  8:22 [Caml-list] abs min_int Christoph Bauer
@ 2003-08-29  8:30 ` IKEDA Katsumi
  2003-09-01  6:51 ` Florian Hars
  1 sibling, 0 replies; 3+ messages in thread
From: IKEDA Katsumi @ 2003-08-29  8:30 UTC (permalink / raw)
  To: caml-list

Hi,

From: Christoph Bauer <c_bauer@informatik.uni-kl.de>
Date: Fri, 29 Aug 2003 10:22:01 +0200
> 
> This is not quite true:
> 
>         Objective Caml version 3.07+beta 2
> 
> # abs min_int;;
> - : int = -1073741824

        Objective Caml version 3.06

# abs (-1073741824);;
- : int = -1073741824
# abs (-1073741823);;
- : int = 1073741823
# print_int max_int;;
1073741823- : unit = ()

1073741824 is larger than max_int;

-- 
IKEDA Katsumi  <ikeda@msi.co.jp>

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] abs min_int
  2003-08-29  8:22 [Caml-list] abs min_int Christoph Bauer
  2003-08-29  8:30 ` IKEDA Katsumi
@ 2003-09-01  6:51 ` Florian Hars
  1 sibling, 0 replies; 3+ messages in thread
From: Florian Hars @ 2003-09-01  6:51 UTC (permalink / raw)
  To: Christoph Bauer; +Cc: OCaml List

Christoph Bauer wrote:
> # abs min_int;;
> - : int = -1073741824
> 
> IMO abs should thow an Failure exception or the manual should 
> point out this behavior.

This is the expected behaviour as documented in the manual.

Yours, Florian

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-09-01  6:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-29  8:22 [Caml-list] abs min_int Christoph Bauer
2003-08-29  8:30 ` IKEDA Katsumi
2003-09-01  6:51 ` Florian Hars

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).