Subject:
|
Re: Some comments on LPub
|
Newsgroups:
|
lugnet.cad
|
Date:
|
Tue, 22 Mar 2005 18:35:03 GMT
|
Viewed:
|
945 times
|
| |
| |
In lugnet.cad, Anders Isaksson wrote:
> Kevin L. Clague wrote:
> > > a) For instance, when "l3p_use_seam_width true 0.800000" is in
> > > the config file, then after loading, the seam value appears in LPub
> > > as 0.800000011920929.
> > > [...]
> > > "color_scaling 0.650000 ..." in the config file, it is shown as
> > > 36/64% in L3Pub after loading that config, and after saving it, it
> > > is "color_scaling 0.640000 ..." in the config file. Subsequent
> > > "0.996094 0.996094 0.996094".
> >
> > I will study this problem. I'm sure that I am just using
> > sprintf("%f"), and sscanf("%f"), so I'm not sure what to do here.
> > Anyone out there got ideas on this?
>
> This is exactly what happens when you read string numbers into a float (or
> Pascal single) and then convert it to a double (or extended). Floating point
> numbers are never exact in computers, and storing them with limited
> precision (sprintf("%f")) will not make the situation better.
Anders,
Thanks very much. I'll see what I can do.
Kevin
|
|
Message has 1 Reply: | | Re: Some comments on LPub
|
| (...) One way to adress this is to keep the setting in memory also as a string, and never convert on the way of loading a config file into memory and saving it to a file again. Only when the setting is used to do calculations, it is converted from (...) (20 years ago, 26-Mar-05, to lugnet.cad)
|
Message is in Reply To:
| | Re: Some comments on LPub
|
| (...) This is exactly what happens when you read string numbers into a float (or Pascal single) and then convert it to a double (or extended). Floating point numbers are never exact in computers, and storing them with limited precision (...) (20 years ago, 22-Mar-05, to lugnet.cad)
|
10 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|