Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

string_of_float output inconsistence with Camltk #3867

Closed
vicuna opened this issue Oct 10, 2002 · 2 comments
Closed

string_of_float output inconsistence with Camltk #3867

vicuna opened this issue Oct 10, 2002 · 2 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Oct 10, 2002

Original bug ID: 1423
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

Full_Name: Gianluca Moro
Version: Objective Caml version 3.06
OS: Linux version 2.4.7-10
Submission from: host7-75.pool21757.interbusiness.it (217.57.75.7)

string_of_float output inconsistence with Camltk expected value

Dear Sirs,

First of all, thanks for your invaluable work with the
Ocaml language.

I've uptaded my system to Caml 3.06, and I have seen the
new output of string_of_float, as reported in the release
posting:

  • Module Pervasives:
    string_of_float distinguishes its output from a plain integer;

That is the float 1.0 is not returned as "1." and not as "1"

The problem is that the Camltk module functions which are expecting
an integer (such as the Width attribute of a Widget), are given
a value (string_of_float v): if v = 1.0, Tk got a string "1.",
which is not recognized as an int.

I have fixed my sources: source availability is a great thing!!!
My solution was simply to return to the old string_of_float
function (just curious: why that point have been added?).

Thank ofr your work

Best regards
Gianluca Moro - Biomedin

@vicuna
Copy link
Author

vicuna commented Oct 11, 2002

Comment author: administrator

Thanks for your bug report.

That is the float 1.0 is now returned as "1." and not as "1"

The problem is that the Camltk module functions which are expecting
an integer (such as the Width attribute of a Widget), are given
a value (string_of_float v): if v = 1.0, Tk got a string "1.",
which is not recognized as an int.

This is clearly a bug in Camltk. If TK is expecting an integer,
we shouldn't be giving it a float.

I have fixed it to use Printf.sprintf instead of string_of_float,
which gives better control of the output format.

function (just curious: why that point have been added?).

Because if we don't do that, the toplevel reports a float as:
val x = 1 : float
and you cannot copy the value and paste it back as a float to the
toplevel.

This bug is now fixed in the working version (3.06+8).

-- Damien

@vicuna
Copy link
Author

vicuna commented Oct 15, 2002

Comment author: administrator

Fixed by DD 2002-10-11

@vicuna vicuna closed this as completed Oct 15, 2002
@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant