Rounding error when converting from double to int

E

Eric Sosman

Nick said:
For the lurkers: io_x doesn't generally know what he's talking about.
[...]

I've formed the opinion that he's just trolling, and have
decided to have nothing further to do with him.
 
N

Nick Keighley

Nick Keighley wrote:

     I've formed the opinion that he's just trolling, and have
decided to have nothing further to do with him.

probably true. I often find him barely comprehensible. I don't
think this is entirely due to english not being his first language.
He may be posting whilst drunk.

On the other hand I thought his opinions about floating point needed
commenting on. If only for The Lurkers.
 
N

Nick Keighley

"Nick Keighley" <[email protected]> ha scritto nel messaggionews:d11277aa-5c5a-
 [...] I often find [io_x] barely comprehensible. I don't
 think this is entirely due to english not being his first language.
 He may be posting whilst drunk.

it easier that you are who "drunk"

thank you for illustrating my point so well
 
P

Phil Carmody

Nick Keighley said:
"Nick Keighley" <[email protected]> ha scritto nel messaggionews:d11277aa-5c5a-
 [...] I often find [io_x] barely comprehensible. I don't
 think this is entirely due to english not being his first language.
 He may be posting whilst drunk.

it easier that you are who "drunk"

thank you for illustrating my point so well

It's morning, but I might just have to take his advice, if people
keep responding to him.

Phil
 
L

luserXtrog

"Nick Keighley" <[email protected]> ha scritto nel messaggio
Nick Keighley said:
[...] I often find [io_x] barely comprehensible. I don't
think this is entirely due to english not being his first language.
He may be posting whilst drunk.
it easier that you are who "drunk"

it is like 2-3 weeks i drink 99% only water and coffie

Whatever else you do, know when to _stop_ fasting.
I speak from experience.
 
U

user923005

"Nick Keighley" <[email protected]> ha scritto nel messaggio
"Nick Keighley" <[email protected]> ha scritto nel
messaggio[...] I often find [io_x] barely comprehensible. I don't
think this is entirely due to english not being his first language.
He may be posting whilst drunk.
it easier that you are who "drunk"
thank you for illustrating my point so well
it is like 2-3 weeks i drink 99% only water and coffie

Whatever else you do, know when to _stop_ fasting.
I speak from experience.

I once went ten days without eating anything (I only drank clear
liquids during that time frame). By the tenth day, I was seeing blue
spots in the air that definitely were not really there. If you made
it 14 days, you are a tough son of a gun.

I guess if you make posts on the 13th day of a fast, they will not be
as clear as those made between fasts.
 
F

Flash Gordon

io_x said:
"Nick Keighley" <[email protected]> ha scritto nel messaggio



For the lurkers: i know what i'm talking about more than you

No, you know a lot less that either Eric or Nick.
to prove this i say that someone has said the right thing:
if x is double C type it has to be print like d.ddddddddddddddE+DDDDD

No, that is only one possible way to print it, and not one that shows
you the exact value stored.
and these type of float are not good, are not the right model
for rappresent operation for float numbers that are too different in size
example: could be ok if all the number for doing operation
are in the range 1e10^9 1e10^10
not ok if they are in the range 1e10^-9 1e10^10

The C print routines always show you the closest approximation to the
stored value that is possible in the format you request.

In any case, if you are saying that the floating point model used in C
(The IEEE standard meets all the requirements of C) is not good then you
are not merely claiming to know more than people on this group, you are
claiming to know more than people who have spent years studying the field.
 
R

Richard Bos

Kaz Kylheku said:
We just need a suitable base. I pick base root-ten.

Funny. Now take the square root of one divided by (your chosen base plus
one). Then re-read WECSSKAFPA.

Richard
 
F

Frank

"Flash Gordon" <[email protected]> ha scritto nel messaggio

No, you know a lot less that either Eric or Nick.
No, that is only one possible way to print it, and not one that shows you the
exact value stored.
The C print routines always show you the closest approximation to the stored
value that is possible in the format you request.
In any case, if you are saying that the floating point model used in C (The
IEEE standard meets all the requirements of C) is not good then you are not
merely claiming to know more than people on this group, you are claiming to
know more than people who have spent years studying the field.

then show where i wrong;
for one example of the example

if i get 2 numbers x=1e-9,  y=1e10
that are in the range [1e-9,  1e10] than the number z=x+y is not
rappresentable in the double 64 bits format (z should lose the x part)

so the range where are the numbers for double has to be more little possible
because if not, it loses numbers

Apparently he has no such example.
 
F

Frank

Funny. Now take the square root of one divided by (your chosen base plus
one). Then re-read WECSSKAFPA.

Richard

If the dutch think that the square root of one makes a suitable base,
I think I've stumbled on the reason that they thought they were at a
suitable height above sea level to make a go at civilization.
 
E

Eric Sosman

Flash said:
I had said all I thought necessary for other people to have a clue that
io_x claiming that computers using a floating point format designed and
agreed upon by experts was broken was not worth taking seriously. Of
course, they are not useful for everything, but then no representation
is useful for everything.

This "io_x" is either too stupid to draw breath without
being reminded, or is (more likely) feigning such stupidity
to draw well-meaning, helpful people into ever-more-strenuous
efforts at explication. The efforts are then ignored as a
fresh spate of nonsense spews forth, baiting the suckers
(that's you'n me, Flash, you'n me) into further efforts to
dispel the artificial clouds of pretended ignorance.

I haven't yet made up my mind about "Frank." Might be a
newbie who's unable to distinguish between knonsense and
nowledge, might be a shill for the troll. Dunno. But as
for "io_x" -- Well, he she or it trolled me for a while and
now seems to be trolling you. I suggest a brief meditation
on the fact that Good Samaritans are ipso facto vulnerable to
unprincipled pretenders, followed by an even briefer session
editing your killfile.
 
F

Frank

Flash said:
     This "io_x" is either too stupid to draw breath without
being reminded, or is (more likely) feigning such stupidity
to draw well-meaning, helpful people into ever-more-strenuous
efforts at explication.  The efforts are then ignored as a
fresh spate of nonsense spews forth, baiting the suckers
(that's you'n me, Flash, you'n me) into further efforts to
dispel the artificial clouds of pretended ignorance.

Dr. Sosman, I think the cat may not understand english as well as do
you and I.
     I haven't yet made up my mind about "Frank."  Might be a
newbie who's unable to distinguish between knonsense and
nowledge, might be a shill for the troll.  Dunno.  But as
for "io_x" -- Well, he she or it trolled me for a while and
now seems to be trolling you.  I suggest a brief meditation
on the fact that Good Samaritans are ipso facto vulnerable to
unprincipled pretenders, followed by an even briefer session
editing your killfile.

I'm asking *him* questions, which seems to fit your definition of
something you defined in a paragraph that sported the following words:

1) Good Samaritan
2) ipso facto
3) unprincipled pretenders
4) knonsens
5) troll (multiplicity 3)

What is your fucking damage?
 
R

Richard Bos

Eric Sosman said:
I haven't yet made up my mind about "Frank." Might be a
newbie who's unable to distinguish between knonsense and
nowledge,

*AAAarrrghhhHHH!!!!!11!!!*

Look at his email address, and _have a memory of more than a few weeks_.

Furrfu.

Richard
 
K

Keith Thompson

*AAAarrrghhhHHH!!!!!11!!!*

Look at his email address, and _have a memory of more than a few weeks_.

Ok, his e-mail address is (e-mail address removed), my memory
for *some* things goes back considerably more than a few weeks,
and I still don't know what you're talking about. Can you be
more specific?
 
K

Keith Thompson

Richard Heathfield said:
Eric Sosman said:



A perusal of

<118d969e-5a37-4290-b2c3-41c6eb3b54c3@a37g2000prf.googlegroups.com>

should help you to do that.

<snip>

That was a response to an article speculating that Frank might be
a troll. If he isn't one (at least deliberately), I can't blame
him too much for not responding kindly; I probably wouldn't myself.
I'm inclined to cut him some slack, at least in this one instance.
 
F

Frank

That was a response to an article speculating that Frank might be
a troll.  If he isn't one (at least deliberately), I can't blame
him too much for not responding kindly; I probably wouldn't myself.
I'm inclined to cut him some slack, at least in this one instance.

Well I appreciate your Einsatz, Keith, and wanted to say a few words.

There have been differing times when Eric and Richard were friends.
There have been other differing times when Keith and Richard H. were
enemies. Heathfield in my killfile proved that it worked. I could
claim that we had philosophical differences, but I was getting a
divorce.

Anyways, they can say what they like about me here. Where they are
specifically disinvited is on threads where I'm OP. By "them" I mean
Eric and Richard B.

I bought a Harbison and Steele V a couple days ago ;(
 
F

Flash Gordon

io_x said:
"io_x" <[email protected]> ha scritto nel messaggio

All you claim that is impossible to round double!

Until you find an exact representation of 0.1 in the floating point
representation of your choice you will have just a few difficulties...

// this means that only 7999999999.1149993
// not print the righ result "7999999999.11"
// but print "7999999999.12"

Seems you know it is broken.

<snip>

Inserisci un numero> 0.14499999999999999999
Round05(0.14499999999999999001)=0.15000000000000002220=0.15
Inserisci un numero>

Seems your code really is broken.

If you want to represent exact decimal numbers don't use float or
double, it's not what they are for. With a lot of care and knowledge you
can do certain exact things with them, but you don't understand them
well enough if you are still trying to round to x decimal places.
 
F

Flash Gordon

io_x said:
Seems i know it is *not* broken

Ah, so rounding code that produces the wrong answer is not broken, the
example above being one you provided where your code produced the wrong
answer.
why? It print instead the correct answer

Nope. The correct final answer would have been 0.14.
i forget to say that the imput has to be limited to numbers of apparence
y.xxxx or y.xxx or y.xx or y.x where 'x' is one digit and y one
integer number
i have always say all :(

In other words it is of no use for any real application, since given
that restriction there are far better solutions.

example [0, 79_999_999] (because ieee double seems not very serius
and could be something wrong for number too big)

<snip>

Either you are failing to communicate because you are using the wrong
words or you are wrong, plain and simple. IEEE double is a very serious
format used in a lot of very serious software and hardware..
in pratical; it will not be possible to say if the programme
has numbers in the form +oo digits for fractional part,

<snip>

Complete and utter rubbish. There is a LOT of software where it is
entirely possible to know, and indeed where it IS known. I know this
having spent a lot of time working on software where it is known.
 
K

Keith Thompson

Keith Thompson said:
Ok, his e-mail address is (e-mail address removed), my memory
for *some* things goes back considerably more than a few weeks,
and I still don't know what you're talking about. Can you be
more specific?

Apparently not.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,177
Latest member
OrderGlucea
Top