Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007174OCamldocumentationpublic2016-03-11 13:502017-02-17 16:13
ReporterMonsieurPi 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version4.02.3 
Target Version4.05.0 +dev/beta1/beta2/beta3/rc1Fixed in Version4.05.0 +dev/beta1/beta2/beta3/rc1 
Summary0007174: OCaml bug with out of the box coordinates
DescriptionI found a "bug" in the Graphics library in OCaml :

If you write

  let () =
    let open Graphics in
    open_graph " 800x800";
    draw_segments [|200,0,200,33567|];
    ignore (read_key ())

No problem.

But if you write

  let () =
    let open Graphics in
    open_graph " 800x800";
    draw_segments [|200,0,200,33568|];
    ignore (read_key ())

(I just changed 33567 to 33568.)

You have no line.

Strange, no ?

Well, actually, no. The coordinates are coded on 16 bits signed integers which corresponds to a range between [-32768, 32767] and if you add to it the size of my graph (here, 800) + 1 it goes out (which corresponds to 33568)

This behaviour is normal but the documentation of Graphics should add a remark about it because in the OCaml manual (http://caml.inria.fr/pub/docs/manual-ocaml-4.00/manual040.html [^]) it's specified that "Drawing is clipped to the screen."

Regards
Steps To Reproducelet () =
    let open Graphics in
    open_graph " 800x800";
    draw_segments [|200,0,200,33568|];
    ignore (read_key ())
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0015472)
goswin (reporter)
2016-03-11 23:25

shouldn't Graphics be fixed to use ints? Physical displays are not even one magnitue below the limit for int16 and virtual displays can easily be larger than int16 allows.
(0015474)
MonsieurPi (reporter)
2016-03-12 08:41

I'm not sure I understand what you're saying. From what I read, Graphics is implemented under the X11 windows system.

What you're saying is that Graphics should manipulate unsigned integers or the 64 bits integers of OCaml ?
(0015485)
goswin (reporter)
2016-03-14 11:41

I'm saying draw_segments [|200,0,200,33568|]; should work. One might have a window that large soon.

Are you saying the problem is X11 window system using int16 and not ocaml?
(0015488)
MonsieurPi (reporter)
2016-03-14 12:31

Yes, exactly. That's why I think it would be better to document it in the Graphics documentation since Graphics functions use int64 (or int32) and this can lead to errors hardly understandable.
(0017311)
xleroy (administrator)
2017-02-17 16:13

Brief mention added to documentation. In version 4.05.

- Issue History
Date Modified Username Field Change
2016-03-11 13:50 MonsieurPi New Issue
2016-03-11 23:25 goswin Note Added: 0015472
2016-03-12 08:41 MonsieurPi Note Added: 0015474
2016-03-14 11:41 goswin Note Added: 0015485
2016-03-14 12:31 MonsieurPi Note Added: 0015488
2016-03-24 17:14 doligez Status new => acknowledged
2016-03-24 17:14 doligez Target Version => 4.03.1+dev
2017-02-16 14:01 doligez Target Version 4.03.1+dev => undecided
2017-02-17 16:13 xleroy Note Added: 0017311
2017-02-17 16:13 xleroy Status acknowledged => resolved
2017-02-17 16:13 xleroy Resolution open => fixed
2017-02-17 16:13 xleroy Fixed in Version => 4.05.0 +dev/beta1/beta2/beta3/rc1
2017-02-17 16:13 xleroy Target Version undecided => 4.05.0 +dev/beta1/beta2/beta3/rc1
2017-02-23 16:35 doligez Category OCaml documentation => Documentation
2017-02-23 16:44 doligez Category Documentation => documentation


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker