Bugs item #1996275, was opened at 2008-06-17 12:38
Message generated for change (Comment added) made by eighthave
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=478070&aid=1996275&group_…
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: puredata
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Hans-Christoph Steiner (eighthave)
Assigned to: Nobody/Anonymous (nobody)
Summary: floats show as 6 digits, but implemented at higher precision
Initial Comment:
Sometimes some duplicates get through [change] since it is doing a != for the comparison. Instead it should do a comparison with a set precision, something like this:
http://howto.wikia.com/wiki/Howto_compare_float_numbers_in_the_C_programmin…
//compares if the float f1 is equal with f2 and returns 1 if true and 0 if false
int compare_float(float f1, float f2)
{
float precision = 0.00001;
if (((f1 - precision) < f2) &&
((f1 + precision) > f2))
{
return 1;
}
else
{
return 0;
}
}
----------------------------------------------------------------------
>Comment By: Hans-Christoph Steiner (eighthave)
Date: 2008-07-24 23:37
Message:
Logged In: YES
user_id=27104
Originator: YES
"floats show as 6 digits, but implemented at higher precision" outlines
the inconsistency, which is the bug in question. Feel free to rewrite the
title if you think you can make a clearer description. (But please don't
do it out of spite, like switching the bug to Invalid.)
This is the key to this problem:
[float 0.100000001490116119384765625] gets rounded to 6 digits. I don't
know the exact source of the problem. If you do, please tell us.
----------------------------------------------------------------------
Comment By: IOhannes m zmlnig (zmoelnig)
Date: 2008-07-24 11:21
Message:
Logged In: YES
user_id=564396
Originator: NO
my patch 10percent.pd illustrated exactly the problem you initially
reported and which is still described in the summary line.
i don't know what bug you want to report exactly, but what you say in the
subject ("floats show as 6 digits, but implemented at higher precision") is
imho invalid as a bug-report (and thus a waste of time; we agree here). so
i closed it (but of course i will now leave it open)
if you want a binary patch-format with full precision, you should file a
feature request (preferrably a new one).
if you think that the text patch-format should is buggy as it discards
precision, you should say so in the bug-report.
your analogy to C's printf is invalid insofar, as you can do the same with
Pd, either as shown in my 10percent.pd patch or by using [makefilename]'s
formatting.
----------------------------------------------------------------------
Comment By: Hans-Christoph Steiner (eighthave)
Date: 2008-07-24 11:05
Message:
Logged In: YES
user_id=27104
Originator: YES
Why would you close the bug if you agree that there is a problem? "The
only valid issue i can see is, that precision gets lost when saving and
re-loading a patch". As for the 10percent.pd patch, that is just wasting
our time, since that is demonstrating the manual control of display
precision, not the bug that we are talking about.
No other programming language that I use has this problem. With C, you
have the power to control the precision that is displayed with printf(),
for example. And if you set a variable in C, the editor doesn't
automatically round it off to 6 digits when you save it.
float myNumber = 0.100000001490116119384765625;
versus:
[float 0.100000001490116119384765625]
----------------------------------------------------------------------
Comment By: IOhannes m zmlnig (zmoelnig)
Date: 2008-07-24 04:26
Message:
Logged In: YES
user_id=564396
Originator: NO
imho, this bug-report "floats show as 6 digits, but implemented at higher
precision" is invalid.
first of all, i don't see how loat-precision-misrepresentation.pd is any
more helpful than my patch.
it only illustrates that Pd is working correctly (0.999999+9e-7 is
0.9999999 which IS smaller than 1 and therefore correctly outputs the value
to the left outlet of [moses]).
the rest is just a matter of representation (see attached 10percent.pd
patch)
you are surely aware that "all that is gold does not glitter" and a visual
representation is not necessary the thing per se.
showing a 32bit floating point value is always problematic: either you
sacrifice precision (in the display!) or you sacrifice readability.
this get's worse by the fact that floating point numbers do a bad job in
representing numbers whose nominators are not power-of-2.
e.g. "0.1" really cannot be expressed with a floating point number; the
closest you can get is about "0.100000001490116119384765625".
this is the reason why Pd does not try to display the _exact_ value of a
number but rather accepts a little rounding:
i guess you would file a bug-report if the result of 1/10 would show up as
"0.100000001490116119384765625"
see
http://en.wikipedia.org/wiki/Floating_point#Representable_numbers.2C_conver…
for more information on this dilemma.
a less sophisticated way would be to display the floating-point numbers as
4byte binaries (display "0x3DCCCCCD" instead of "0.1")
it needs some time to get used to it, but once you are there...
another way to make Pd represent all numbers exactly, is to limit Pd's
valid numbers, e.g. to just integers.
the only valid issue i can see is, that precision gets lost when saving
and re-loading a patch; the obvious fix for this is to use a binary
format.
you could file a feature-request for such a thing if you really need it.
File Added: 10percent.pd
----------------------------------------------------------------------
Comment By: Hans-Christoph Steiner (eighthave)
Date: 2008-07-23 16:56
Message:
Logged In: YES
user_id=27104
Originator: YES
This is a more fundamental bug then. It is not just [print] that is
limited to 6 digits. You can't represent more than six digits in anything
that gets saved. Yet things in the C implementation are working at higher
precision. That's a pretty serious disconnect between what's happening in
the implementation and how it is represented in Pd.
For example, anytime you have you any number with more than 6 digits in an
object or message box, and you save the patch, it'll be automatically
rounded to 6 digits. Also, consider the attached patch, it shows that
using [moses] can be similarly misrepresented. I don't think that the
pd_precision.pd patch represents this issue very well.
Yes, this is a known issue, but this is just another illustration of where
it's a problem. I have forgotten what is the source of this disconnect.
File Added: float-precision-misrepresentation.pd
----------------------------------------------------------------------
Comment By: IOhannes m zmlnig (zmoelnig)
Date: 2008-07-23 10:33
Message:
Logged In: YES
user_id=564396
Originator: NO
attached is a patch that simulates what you experienced.
btw, it is rather simple to quantize your numbers with an abstraction, if
you don't need full precision.
also it might be a nice feature to [change] to allow a certain fuzziness.
i guess you could submit a feature-request for this instead of this
bug-report.
File Added: pd_precision.pd
----------------------------------------------------------------------
Comment By: IOhannes m zmlnig (zmoelnig)
Date: 2008-07-23 10:23
Message:
Logged In: YES
user_id=564396
Originator: NO
ah i see, but this is a misunderstanding on your side.
Pd uses _full_ precision of floats. however it will only display (and
save) a number with a limited precision.
i don't think we should change [change] just because [print] is unable to
show enough precision.
if you use [tgl] instead of [print] you will notice that even more values
look the same :-)
----------------------------------------------------------------------
Comment By: Hans-Christoph Steiner (eighthave)
Date: 2008-07-23 10:08
Message:
Logged In: YES
user_id=27104
Originator: YES
Since this comparison is happening in C space, it is done using the full
precision of the float. But Pd only uses 6 digits of precision, so the
comparison should match that, not what is happening in C space.
Basically, I hooked up a [change]-[print] to some sensor data, and it was
quite common to see the exact same number printed out one after the other.
----------------------------------------------------------------------
Comment By: IOhannes m zmlnig (zmoelnig)
Date: 2008-07-23 03:26
Message:
Logged In: YES
user_id=564396
Originator: NO
do you have a practical example that exposes the bug?
in theory you are of course right, but in practice i wonder how this can
be applied to [change].
e.g. if i send "1" and the result of "2/2" to change, i might consider
these two as different enough :-)
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=478070&aid=1996275&group_…
Bugs item #2026128, was opened at 2008-07-23 17:02
Message generated for change (Comment added) made by eighthave
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=478070&aid=2026128&group_…
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: puredata
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Hans-Christoph Steiner (eighthave)
Assigned to: Miller Puckette (millerpuckette)
Summary: [list trim] outputs mystery type after conversion
Initial Comment:
If you start with a symbolic atom in a symbol message, then run it thru a [list trim], you end up with a mystery type that is just a numeric atom, but does not work as a float message.
see attached patch for an example
----------------------------------------------------------------------
>Comment By: Hans-Christoph Steiner (eighthave)
Date: 2008-07-24 23:24
Message:
Logged In: YES
user_id=27104
Originator: YES
This discussion is going quite far afield from the original issue. I can
see no reason why there should be such a mystery type, given the current
type system. So either it should be fixed or documented.
----------------------------------------------------------------------
Comment By: Frank Barknecht (fbar)
Date: 2008-07-24 02:20
Message:
Logged In: YES
user_id=569446
Originator: NO
Oh, and logically the negation of "Anything that is not a valid number is
considered a symbol." is not: "Everything that looks like a valid number is
a float." Numeric symbols created with makefilename aren't valid numbers.
Besides that, the sentence you quote is in chapter "2.1.2. object boxes"
and only deals with how Pd reads the content of object boxes, not with the
general type system of Pd. Pointers or gemstates wouild be example of "not
a valid number"s which still aren't symbols. But pointers cannot be used in
object boxes neither.
----------------------------------------------------------------------
Comment By: Frank Barknecht (fbar)
Date: 2008-07-24 02:09
Message:
Logged In: YES
user_id=569446
Originator: NO
Then you should report that "inconsistency" and not something else. The
behaviour you dislike has nothing to do with [list trim] nor with
conversions nor mysteries.
The only problem here is, that certain symbols cannot directly be
represented in Pd's patch format. This includes symbols with a pure numeric
content - which Pd reads as numbers in a patch file - but also many other
symbols like those for whitespace characters (SPACE, TAB,...), the
backslash etc. To use these, you have to create them with something like
[makefilename], but after that, they get treated correctly by all builtin
objects, especially [select] or [list].
See attached example.
File Added: numeric-symbol.pd
----------------------------------------------------------------------
Comment By: Hans-Christoph Steiner (eighthave)
Date: 2008-07-24 00:40
Message:
Logged In: YES
user_id=27104
Originator: YES
This is a question of how should Pd behave, now how it currently does. If
there is supposed to be such a thing as "a symbolic atom that is a number,
but without a symbol selector", then it should be fully supported and
documented. But this is the current definition of a symbolic atom (Pd
manual 2.1.2):
"Anything that is not a valid number is considered a symbol."
By taking the converse of the above rule, "1234" looks like a valid number
so it should be a float. That inconsistency is the bug that I am trying to
highlight.
----------------------------------------------------------------------
Comment By: Frank Barknecht (fbar)
Date: 2008-07-23 19:38
Message:
Logged In: YES
user_id=569446
Originator: NO
I hope even with all my spelling mistakes you can understand my previous
post ... Is it possible to edit posts?
----------------------------------------------------------------------
Comment By: Frank Barknecht (fbar)
Date: 2008-07-23 19:36
Message:
Logged In: YES
user_id=569446
Originator: NO
Yeah, these "mystery types" can be confusing, but in reality they are just
ordinary symbols with a pure numeric data part. Note that these numeric
symbols are not numbers or floats!
[list trim] removes the selector, so after that you have a "1234" string
without selector (or with "symbol 1234" as selector, but minus the "symbol"
part. You can covert this back to a Pd-symbol with a [symbol] or [list]
object. However as you cannot represent numberic symbols in a saved Pd
patch, you cannot use [select 1234] or [route 1234] to select or route
them.
However you can use [select -DUMMY-] and prime that with a numeric symbol
created with [makefilename %d] construct to its left inlet to select
numeric symbols. The same "trick" is used to select backslashes or other
for example split a symbol at any other "unusual" symbol using
[list2symbol]. Try 92---[makefilename %c] to split at backslashes, for
example.
Anyway, there's nothing mysterious about numeric symbols, they are just
unusual in Pd. I think, we had similar confusions before in the bug
tracker, but I didn't check.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=478070&aid=2026128&group_…
Bugs item #1996275, was opened at 2008-06-17 18:38
Message generated for change (Comment added) made by zmoelnig
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=478070&aid=1996275&group_…
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: puredata
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Hans-Christoph Steiner (eighthave)
Assigned to: Nobody/Anonymous (nobody)
Summary: floats show as 6 digits, but implemented at higher precision
Initial Comment:
Sometimes some duplicates get through [change] since it is doing a != for the comparison. Instead it should do a comparison with a set precision, something like this:
http://howto.wikia.com/wiki/Howto_compare_float_numbers_in_the_C_programmin…
//compares if the float f1 is equal with f2 and returns 1 if true and 0 if false
int compare_float(float f1, float f2)
{
float precision = 0.00001;
if (((f1 - precision) < f2) &&
((f1 + precision) > f2))
{
return 1;
}
else
{
return 0;
}
}
----------------------------------------------------------------------
>Comment By: IOhannes m zmlnig (zmoelnig)
Date: 2008-07-24 17:21
Message:
Logged In: YES
user_id=564396
Originator: NO
my patch 10percent.pd illustrated exactly the problem you initially
reported and which is still described in the summary line.
i don't know what bug you want to report exactly, but what you say in the
subject ("floats show as 6 digits, but implemented at higher precision") is
imho invalid as a bug-report (and thus a waste of time; we agree here). so
i closed it (but of course i will now leave it open)
if you want a binary patch-format with full precision, you should file a
feature request (preferrably a new one).
if you think that the text patch-format should is buggy as it discards
precision, you should say so in the bug-report.
your analogy to C's printf is invalid insofar, as you can do the same with
Pd, either as shown in my 10percent.pd patch or by using [makefilename]'s
formatting.
----------------------------------------------------------------------
Comment By: Hans-Christoph Steiner (eighthave)
Date: 2008-07-24 17:05
Message:
Logged In: YES
user_id=27104
Originator: YES
Why would you close the bug if you agree that there is a problem? "The
only valid issue i can see is, that precision gets lost when saving and
re-loading a patch". As for the 10percent.pd patch, that is just wasting
our time, since that is demonstrating the manual control of display
precision, not the bug that we are talking about.
No other programming language that I use has this problem. With C, you
have the power to control the precision that is displayed with printf(),
for example. And if you set a variable in C, the editor doesn't
automatically round it off to 6 digits when you save it.
float myNumber = 0.100000001490116119384765625;
versus:
[float 0.100000001490116119384765625]
----------------------------------------------------------------------
Comment By: IOhannes m zmlnig (zmoelnig)
Date: 2008-07-24 10:26
Message:
Logged In: YES
user_id=564396
Originator: NO
imho, this bug-report "floats show as 6 digits, but implemented at higher
precision" is invalid.
first of all, i don't see how loat-precision-misrepresentation.pd is any
more helpful than my patch.
it only illustrates that Pd is working correctly (0.999999+9e-7 is
0.9999999 which IS smaller than 1 and therefore correctly outputs the value
to the left outlet of [moses]).
the rest is just a matter of representation (see attached 10percent.pd
patch)
you are surely aware that "all that is gold does not glitter" and a visual
representation is not necessary the thing per se.
showing a 32bit floating point value is always problematic: either you
sacrifice precision (in the display!) or you sacrifice readability.
this get's worse by the fact that floating point numbers do a bad job in
representing numbers whose nominators are not power-of-2.
e.g. "0.1" really cannot be expressed with a floating point number; the
closest you can get is about "0.100000001490116119384765625".
this is the reason why Pd does not try to display the _exact_ value of a
number but rather accepts a little rounding:
i guess you would file a bug-report if the result of 1/10 would show up as
"0.100000001490116119384765625"
see
http://en.wikipedia.org/wiki/Floating_point#Representable_numbers.2C_conver…
for more information on this dilemma.
a less sophisticated way would be to display the floating-point numbers as
4byte binaries (display "0x3DCCCCCD" instead of "0.1")
it needs some time to get used to it, but once you are there...
another way to make Pd represent all numbers exactly, is to limit Pd's
valid numbers, e.g. to just integers.
the only valid issue i can see is, that precision gets lost when saving
and re-loading a patch; the obvious fix for this is to use a binary
format.
you could file a feature-request for such a thing if you really need it.
File Added: 10percent.pd
----------------------------------------------------------------------
Comment By: Hans-Christoph Steiner (eighthave)
Date: 2008-07-23 22:56
Message:
Logged In: YES
user_id=27104
Originator: YES
This is a more fundamental bug then. It is not just [print] that is
limited to 6 digits. You can't represent more than six digits in anything
that gets saved. Yet things in the C implementation are working at higher
precision. That's a pretty serious disconnect between what's happening in
the implementation and how it is represented in Pd.
For example, anytime you have you any number with more than 6 digits in an
object or message box, and you save the patch, it'll be automatically
rounded to 6 digits. Also, consider the attached patch, it shows that
using [moses] can be similarly misrepresented. I don't think that the
pd_precision.pd patch represents this issue very well.
Yes, this is a known issue, but this is just another illustration of where
it's a problem. I have forgotten what is the source of this disconnect.
File Added: float-precision-misrepresentation.pd
----------------------------------------------------------------------
Comment By: IOhannes m zmlnig (zmoelnig)
Date: 2008-07-23 16:33
Message:
Logged In: YES
user_id=564396
Originator: NO
attached is a patch that simulates what you experienced.
btw, it is rather simple to quantize your numbers with an abstraction, if
you don't need full precision.
also it might be a nice feature to [change] to allow a certain fuzziness.
i guess you could submit a feature-request for this instead of this
bug-report.
File Added: pd_precision.pd
----------------------------------------------------------------------
Comment By: IOhannes m zmlnig (zmoelnig)
Date: 2008-07-23 16:23
Message:
Logged In: YES
user_id=564396
Originator: NO
ah i see, but this is a misunderstanding on your side.
Pd uses _full_ precision of floats. however it will only display (and
save) a number with a limited precision.
i don't think we should change [change] just because [print] is unable to
show enough precision.
if you use [tgl] instead of [print] you will notice that even more values
look the same :-)
----------------------------------------------------------------------
Comment By: Hans-Christoph Steiner (eighthave)
Date: 2008-07-23 16:08
Message:
Logged In: YES
user_id=27104
Originator: YES
Since this comparison is happening in C space, it is done using the full
precision of the float. But Pd only uses 6 digits of precision, so the
comparison should match that, not what is happening in C space.
Basically, I hooked up a [change]-[print] to some sensor data, and it was
quite common to see the exact same number printed out one after the other.
----------------------------------------------------------------------
Comment By: IOhannes m zmlnig (zmoelnig)
Date: 2008-07-23 09:26
Message:
Logged In: YES
user_id=564396
Originator: NO
do you have a practical example that exposes the bug?
in theory you are of course right, but in practice i wonder how this can
be applied to [change].
e.g. if i send "1" and the result of "2/2" to change, i might consider
these two as different enough :-)
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=478070&aid=1996275&group_…
Bugs item #1996275, was opened at 2008-06-17 12:38
Message generated for change (Comment added) made by eighthave
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=478070&aid=1996275&group_…
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: puredata
Group: None
>Status: Open
>Resolution: None
Priority: 5
Private: No
Submitted By: Hans-Christoph Steiner (eighthave)
Assigned to: Nobody/Anonymous (nobody)
Summary: floats show as 6 digits, but implemented at higher precision
Initial Comment:
Sometimes some duplicates get through [change] since it is doing a != for the comparison. Instead it should do a comparison with a set precision, something like this:
http://howto.wikia.com/wiki/Howto_compare_float_numbers_in_the_C_programmin…
//compares if the float f1 is equal with f2 and returns 1 if true and 0 if false
int compare_float(float f1, float f2)
{
float precision = 0.00001;
if (((f1 - precision) < f2) &&
((f1 + precision) > f2))
{
return 1;
}
else
{
return 0;
}
}
----------------------------------------------------------------------
>Comment By: Hans-Christoph Steiner (eighthave)
Date: 2008-07-24 11:05
Message:
Logged In: YES
user_id=27104
Originator: YES
Why would you close the bug if you agree that there is a problem? "The
only valid issue i can see is, that precision gets lost when saving and
re-loading a patch". As for the 10percent.pd patch, that is just wasting
our time, since that is demonstrating the manual control of display
precision, not the bug that we are talking about.
No other programming language that I use has this problem. With C, you
have the power to control the precision that is displayed with printf(),
for example. And if you set a variable in C, the editor doesn't
automatically round it off to 6 digits when you save it.
float myNumber = 0.100000001490116119384765625;
versus:
[float 0.100000001490116119384765625]
----------------------------------------------------------------------
Comment By: IOhannes m zmlnig (zmoelnig)
Date: 2008-07-24 04:26
Message:
Logged In: YES
user_id=564396
Originator: NO
imho, this bug-report "floats show as 6 digits, but implemented at higher
precision" is invalid.
first of all, i don't see how loat-precision-misrepresentation.pd is any
more helpful than my patch.
it only illustrates that Pd is working correctly (0.999999+9e-7 is
0.9999999 which IS smaller than 1 and therefore correctly outputs the value
to the left outlet of [moses]).
the rest is just a matter of representation (see attached 10percent.pd
patch)
you are surely aware that "all that is gold does not glitter" and a visual
representation is not necessary the thing per se.
showing a 32bit floating point value is always problematic: either you
sacrifice precision (in the display!) or you sacrifice readability.
this get's worse by the fact that floating point numbers do a bad job in
representing numbers whose nominators are not power-of-2.
e.g. "0.1" really cannot be expressed with a floating point number; the
closest you can get is about "0.100000001490116119384765625".
this is the reason why Pd does not try to display the _exact_ value of a
number but rather accepts a little rounding:
i guess you would file a bug-report if the result of 1/10 would show up as
"0.100000001490116119384765625"
see
http://en.wikipedia.org/wiki/Floating_point#Representable_numbers.2C_conver…
for more information on this dilemma.
a less sophisticated way would be to display the floating-point numbers as
4byte binaries (display "0x3DCCCCCD" instead of "0.1")
it needs some time to get used to it, but once you are there...
another way to make Pd represent all numbers exactly, is to limit Pd's
valid numbers, e.g. to just integers.
the only valid issue i can see is, that precision gets lost when saving
and re-loading a patch; the obvious fix for this is to use a binary
format.
you could file a feature-request for such a thing if you really need it.
File Added: 10percent.pd
----------------------------------------------------------------------
Comment By: Hans-Christoph Steiner (eighthave)
Date: 2008-07-23 16:56
Message:
Logged In: YES
user_id=27104
Originator: YES
This is a more fundamental bug then. It is not just [print] that is
limited to 6 digits. You can't represent more than six digits in anything
that gets saved. Yet things in the C implementation are working at higher
precision. That's a pretty serious disconnect between what's happening in
the implementation and how it is represented in Pd.
For example, anytime you have you any number with more than 6 digits in an
object or message box, and you save the patch, it'll be automatically
rounded to 6 digits. Also, consider the attached patch, it shows that
using [moses] can be similarly misrepresented. I don't think that the
pd_precision.pd patch represents this issue very well.
Yes, this is a known issue, but this is just another illustration of where
it's a problem. I have forgotten what is the source of this disconnect.
File Added: float-precision-misrepresentation.pd
----------------------------------------------------------------------
Comment By: IOhannes m zmlnig (zmoelnig)
Date: 2008-07-23 10:33
Message:
Logged In: YES
user_id=564396
Originator: NO
attached is a patch that simulates what you experienced.
btw, it is rather simple to quantize your numbers with an abstraction, if
you don't need full precision.
also it might be a nice feature to [change] to allow a certain fuzziness.
i guess you could submit a feature-request for this instead of this
bug-report.
File Added: pd_precision.pd
----------------------------------------------------------------------
Comment By: IOhannes m zmlnig (zmoelnig)
Date: 2008-07-23 10:23
Message:
Logged In: YES
user_id=564396
Originator: NO
ah i see, but this is a misunderstanding on your side.
Pd uses _full_ precision of floats. however it will only display (and
save) a number with a limited precision.
i don't think we should change [change] just because [print] is unable to
show enough precision.
if you use [tgl] instead of [print] you will notice that even more values
look the same :-)
----------------------------------------------------------------------
Comment By: Hans-Christoph Steiner (eighthave)
Date: 2008-07-23 10:08
Message:
Logged In: YES
user_id=27104
Originator: YES
Since this comparison is happening in C space, it is done using the full
precision of the float. But Pd only uses 6 digits of precision, so the
comparison should match that, not what is happening in C space.
Basically, I hooked up a [change]-[print] to some sensor data, and it was
quite common to see the exact same number printed out one after the other.
----------------------------------------------------------------------
Comment By: IOhannes m zmlnig (zmoelnig)
Date: 2008-07-23 03:26
Message:
Logged In: YES
user_id=564396
Originator: NO
do you have a practical example that exposes the bug?
in theory you are of course right, but in practice i wonder how this can
be applied to [change].
e.g. if i send "1" and the result of "2/2" to change, i might consider
these two as different enough :-)
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=478070&aid=1996275&group_…
Bugs item #1996275, was opened at 2008-06-17 18:38
Message generated for change (Comment added) made by zmoelnig
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=478070&aid=1996275&group_…
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: puredata
Group: None
>Status: Pending
>Resolution: Invalid
Priority: 5
Private: No
Submitted By: Hans-Christoph Steiner (eighthave)
Assigned to: Nobody/Anonymous (nobody)
Summary: floats show as 6 digits, but implemented at higher precision
Initial Comment:
Sometimes some duplicates get through [change] since it is doing a != for the comparison. Instead it should do a comparison with a set precision, something like this:
http://howto.wikia.com/wiki/Howto_compare_float_numbers_in_the_C_programmin…
//compares if the float f1 is equal with f2 and returns 1 if true and 0 if false
int compare_float(float f1, float f2)
{
float precision = 0.00001;
if (((f1 - precision) < f2) &&
((f1 + precision) > f2))
{
return 1;
}
else
{
return 0;
}
}
----------------------------------------------------------------------
>Comment By: IOhannes m zmlnig (zmoelnig)
Date: 2008-07-24 10:26
Message:
Logged In: YES
user_id=564396
Originator: NO
imho, this bug-report "floats show as 6 digits, but implemented at higher
precision" is invalid.
first of all, i don't see how loat-precision-misrepresentation.pd is any
more helpful than my patch.
it only illustrates that Pd is working correctly (0.999999+9e-7 is
0.9999999 which IS smaller than 1 and therefore correctly outputs the value
to the left outlet of [moses]).
the rest is just a matter of representation (see attached 10percent.pd
patch)
you are surely aware that "all that is gold does not glitter" and a visual
representation is not necessary the thing per se.
showing a 32bit floating point value is always problematic: either you
sacrifice precision (in the display!) or you sacrifice readability.
this get's worse by the fact that floating point numbers do a bad job in
representing numbers whose nominators are not power-of-2.
e.g. "0.1" really cannot be expressed with a floating point number; the
closest you can get is about "0.100000001490116119384765625".
this is the reason why Pd does not try to display the _exact_ value of a
number but rather accepts a little rounding:
i guess you would file a bug-report if the result of 1/10 would show up as
"0.100000001490116119384765625"
see
http://en.wikipedia.org/wiki/Floating_point#Representable_numbers.2C_conver…
for more information on this dilemma.
a less sophisticated way would be to display the floating-point numbers as
4byte binaries (display "0x3DCCCCCD" instead of "0.1")
it needs some time to get used to it, but once you are there...
another way to make Pd represent all numbers exactly, is to limit Pd's
valid numbers, e.g. to just integers.
the only valid issue i can see is, that precision gets lost when saving
and re-loading a patch; the obvious fix for this is to use a binary
format.
you could file a feature-request for such a thing if you really need it.
File Added: 10percent.pd
----------------------------------------------------------------------
Comment By: Hans-Christoph Steiner (eighthave)
Date: 2008-07-23 22:56
Message:
Logged In: YES
user_id=27104
Originator: YES
This is a more fundamental bug then. It is not just [print] that is
limited to 6 digits. You can't represent more than six digits in anything
that gets saved. Yet things in the C implementation are working at higher
precision. That's a pretty serious disconnect between what's happening in
the implementation and how it is represented in Pd.
For example, anytime you have you any number with more than 6 digits in an
object or message box, and you save the patch, it'll be automatically
rounded to 6 digits. Also, consider the attached patch, it shows that
using [moses] can be similarly misrepresented. I don't think that the
pd_precision.pd patch represents this issue very well.
Yes, this is a known issue, but this is just another illustration of where
it's a problem. I have forgotten what is the source of this disconnect.
File Added: float-precision-misrepresentation.pd
----------------------------------------------------------------------
Comment By: IOhannes m zmlnig (zmoelnig)
Date: 2008-07-23 16:33
Message:
Logged In: YES
user_id=564396
Originator: NO
attached is a patch that simulates what you experienced.
btw, it is rather simple to quantize your numbers with an abstraction, if
you don't need full precision.
also it might be a nice feature to [change] to allow a certain fuzziness.
i guess you could submit a feature-request for this instead of this
bug-report.
File Added: pd_precision.pd
----------------------------------------------------------------------
Comment By: IOhannes m zmlnig (zmoelnig)
Date: 2008-07-23 16:23
Message:
Logged In: YES
user_id=564396
Originator: NO
ah i see, but this is a misunderstanding on your side.
Pd uses _full_ precision of floats. however it will only display (and
save) a number with a limited precision.
i don't think we should change [change] just because [print] is unable to
show enough precision.
if you use [tgl] instead of [print] you will notice that even more values
look the same :-)
----------------------------------------------------------------------
Comment By: Hans-Christoph Steiner (eighthave)
Date: 2008-07-23 16:08
Message:
Logged In: YES
user_id=27104
Originator: YES
Since this comparison is happening in C space, it is done using the full
precision of the float. But Pd only uses 6 digits of precision, so the
comparison should match that, not what is happening in C space.
Basically, I hooked up a [change]-[print] to some sensor data, and it was
quite common to see the exact same number printed out one after the other.
----------------------------------------------------------------------
Comment By: IOhannes m zmlnig (zmoelnig)
Date: 2008-07-23 09:26
Message:
Logged In: YES
user_id=564396
Originator: NO
do you have a practical example that exposes the bug?
in theory you are of course right, but in practice i wonder how this can
be applied to [change].
e.g. if i send "1" and the result of "2/2" to change, i might consider
these two as different enough :-)
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=478070&aid=1996275&group_…
Bugs item #2026128, was opened at 2008-07-23 23:02
Message generated for change (Comment added) made by fbar
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=478070&aid=2026128&group_…
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: puredata
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Hans-Christoph Steiner (eighthave)
Assigned to: Miller Puckette (millerpuckette)
Summary: [list trim] outputs mystery type after conversion
Initial Comment:
If you start with a symbolic atom in a symbol message, then run it thru a [list trim], you end up with a mystery type that is just a numeric atom, but does not work as a float message.
see attached patch for an example
----------------------------------------------------------------------
>Comment By: Frank Barknecht (fbar)
Date: 2008-07-24 08:20
Message:
Logged In: YES
user_id=569446
Originator: NO
Oh, and logically the negation of "Anything that is not a valid number is
considered a symbol." is not: "Everything that looks like a valid number is
a float." Numeric symbols created with makefilename aren't valid numbers.
Besides that, the sentence you quote is in chapter "2.1.2. object boxes"
and only deals with how Pd reads the content of object boxes, not with the
general type system of Pd. Pointers or gemstates wouild be example of "not
a valid number"s which still aren't symbols. But pointers cannot be used in
object boxes neither.
----------------------------------------------------------------------
Comment By: Frank Barknecht (fbar)
Date: 2008-07-24 08:09
Message:
Logged In: YES
user_id=569446
Originator: NO
Then you should report that "inconsistency" and not something else. The
behaviour you dislike has nothing to do with [list trim] nor with
conversions nor mysteries.
The only problem here is, that certain symbols cannot directly be
represented in Pd's patch format. This includes symbols with a pure numeric
content - which Pd reads as numbers in a patch file - but also many other
symbols like those for whitespace characters (SPACE, TAB,...), the
backslash etc. To use these, you have to create them with something like
[makefilename], but after that, they get treated correctly by all builtin
objects, especially [select] or [list].
See attached example.
File Added: numeric-symbol.pd
----------------------------------------------------------------------
Comment By: Hans-Christoph Steiner (eighthave)
Date: 2008-07-24 06:40
Message:
Logged In: YES
user_id=27104
Originator: YES
This is a question of how should Pd behave, now how it currently does. If
there is supposed to be such a thing as "a symbolic atom that is a number,
but without a symbol selector", then it should be fully supported and
documented. But this is the current definition of a symbolic atom (Pd
manual 2.1.2):
"Anything that is not a valid number is considered a symbol."
By taking the converse of the above rule, "1234" looks like a valid number
so it should be a float. That inconsistency is the bug that I am trying to
highlight.
----------------------------------------------------------------------
Comment By: Frank Barknecht (fbar)
Date: 2008-07-24 01:38
Message:
Logged In: YES
user_id=569446
Originator: NO
I hope even with all my spelling mistakes you can understand my previous
post ... Is it possible to edit posts?
----------------------------------------------------------------------
Comment By: Frank Barknecht (fbar)
Date: 2008-07-24 01:36
Message:
Logged In: YES
user_id=569446
Originator: NO
Yeah, these "mystery types" can be confusing, but in reality they are just
ordinary symbols with a pure numeric data part. Note that these numeric
symbols are not numbers or floats!
[list trim] removes the selector, so after that you have a "1234" string
without selector (or with "symbol 1234" as selector, but minus the "symbol"
part. You can covert this back to a Pd-symbol with a [symbol] or [list]
object. However as you cannot represent numberic symbols in a saved Pd
patch, you cannot use [select 1234] or [route 1234] to select or route
them.
However you can use [select -DUMMY-] and prime that with a numeric symbol
created with [makefilename %d] construct to its left inlet to select
numeric symbols. The same "trick" is used to select backslashes or other
for example split a symbol at any other "unusual" symbol using
[list2symbol]. Try 92---[makefilename %c] to split at backslashes, for
example.
Anyway, there's nothing mysterious about numeric symbols, they are just
unusual in Pd. I think, we had similar confusions before in the bug
tracker, but I didn't check.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=478070&aid=2026128&group_…
Bugs item #2026128, was opened at 2008-07-23 23:02
Message generated for change (Comment added) made by fbar
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=478070&aid=2026128&group_…
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: puredata
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Hans-Christoph Steiner (eighthave)
Assigned to: Miller Puckette (millerpuckette)
Summary: [list trim] outputs mystery type after conversion
Initial Comment:
If you start with a symbolic atom in a symbol message, then run it thru a [list trim], you end up with a mystery type that is just a numeric atom, but does not work as a float message.
see attached patch for an example
----------------------------------------------------------------------
>Comment By: Frank Barknecht (fbar)
Date: 2008-07-24 08:09
Message:
Logged In: YES
user_id=569446
Originator: NO
Then you should report that "inconsistency" and not something else. The
behaviour you dislike has nothing to do with [list trim] nor with
conversions nor mysteries.
The only problem here is, that certain symbols cannot directly be
represented in Pd's patch format. This includes symbols with a pure numeric
content - which Pd reads as numbers in a patch file - but also many other
symbols like those for whitespace characters (SPACE, TAB,...), the
backslash etc. To use these, you have to create them with something like
[makefilename], but after that, they get treated correctly by all builtin
objects, especially [select] or [list].
See attached example.
File Added: numeric-symbol.pd
----------------------------------------------------------------------
Comment By: Hans-Christoph Steiner (eighthave)
Date: 2008-07-24 06:40
Message:
Logged In: YES
user_id=27104
Originator: YES
This is a question of how should Pd behave, now how it currently does. If
there is supposed to be such a thing as "a symbolic atom that is a number,
but without a symbol selector", then it should be fully supported and
documented. But this is the current definition of a symbolic atom (Pd
manual 2.1.2):
"Anything that is not a valid number is considered a symbol."
By taking the converse of the above rule, "1234" looks like a valid number
so it should be a float. That inconsistency is the bug that I am trying to
highlight.
----------------------------------------------------------------------
Comment By: Frank Barknecht (fbar)
Date: 2008-07-24 01:38
Message:
Logged In: YES
user_id=569446
Originator: NO
I hope even with all my spelling mistakes you can understand my previous
post ... Is it possible to edit posts?
----------------------------------------------------------------------
Comment By: Frank Barknecht (fbar)
Date: 2008-07-24 01:36
Message:
Logged In: YES
user_id=569446
Originator: NO
Yeah, these "mystery types" can be confusing, but in reality they are just
ordinary symbols with a pure numeric data part. Note that these numeric
symbols are not numbers or floats!
[list trim] removes the selector, so after that you have a "1234" string
without selector (or with "symbol 1234" as selector, but minus the "symbol"
part. You can covert this back to a Pd-symbol with a [symbol] or [list]
object. However as you cannot represent numberic symbols in a saved Pd
patch, you cannot use [select 1234] or [route 1234] to select or route
them.
However you can use [select -DUMMY-] and prime that with a numeric symbol
created with [makefilename %d] construct to its left inlet to select
numeric symbols. The same "trick" is used to select backslashes or other
for example split a symbol at any other "unusual" symbol using
[list2symbol]. Try 92---[makefilename %c] to split at backslashes, for
example.
Anyway, there's nothing mysterious about numeric symbols, they are just
unusual in Pd. I think, we had similar confusions before in the bug
tracker, but I didn't check.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=478070&aid=2026128&group_…
Bugs item #2026128, was opened at 2008-07-23 17:02
Message generated for change (Comment added) made by eighthave
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=478070&aid=2026128&group_…
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: puredata
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Hans-Christoph Steiner (eighthave)
Assigned to: Miller Puckette (millerpuckette)
Summary: [list trim] outputs mystery type after conversion
Initial Comment:
If you start with a symbolic atom in a symbol message, then run it thru a [list trim], you end up with a mystery type that is just a numeric atom, but does not work as a float message.
see attached patch for an example
----------------------------------------------------------------------
>Comment By: Hans-Christoph Steiner (eighthave)
Date: 2008-07-24 00:40
Message:
Logged In: YES
user_id=27104
Originator: YES
This is a question of how should Pd behave, now how it currently does. If
there is supposed to be such a thing as "a symbolic atom that is a number,
but without a symbol selector", then it should be fully supported and
documented. But this is the current definition of a symbolic atom (Pd
manual 2.1.2):
"Anything that is not a valid number is considered a symbol."
By taking the converse of the above rule, "1234" looks like a valid number
so it should be a float. That inconsistency is the bug that I am trying to
highlight.
----------------------------------------------------------------------
Comment By: Frank Barknecht (fbar)
Date: 2008-07-23 19:38
Message:
Logged In: YES
user_id=569446
Originator: NO
I hope even with all my spelling mistakes you can understand my previous
post ... Is it possible to edit posts?
----------------------------------------------------------------------
Comment By: Frank Barknecht (fbar)
Date: 2008-07-23 19:36
Message:
Logged In: YES
user_id=569446
Originator: NO
Yeah, these "mystery types" can be confusing, but in reality they are just
ordinary symbols with a pure numeric data part. Note that these numeric
symbols are not numbers or floats!
[list trim] removes the selector, so after that you have a "1234" string
without selector (or with "symbol 1234" as selector, but minus the "symbol"
part. You can covert this back to a Pd-symbol with a [symbol] or [list]
object. However as you cannot represent numberic symbols in a saved Pd
patch, you cannot use [select 1234] or [route 1234] to select or route
them.
However you can use [select -DUMMY-] and prime that with a numeric symbol
created with [makefilename %d] construct to its left inlet to select
numeric symbols. The same "trick" is used to select backslashes or other
for example split a symbol at any other "unusual" symbol using
[list2symbol]. Try 92---[makefilename %c] to split at backslashes, for
example.
Anyway, there's nothing mysterious about numeric symbols, they are just
unusual in Pd. I think, we had similar confusions before in the bug
tracker, but I didn't check.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=478070&aid=2026128&group_…
Bugs item #2026159, was opened at 2008-07-23 17:36
Message generated for change (Comment added) made by eighthave
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=478070&aid=2026159&group_…
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: pd-extended
Group: v0.40.2
>Status: Pending
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Thomas Mayer (elvettsemic)
Assigned to: Hans-Christoph Steiner (eighthave)
>Summary: update LAME packages from Debian Multimedia
Initial Comment:
As the Debian multimedia repositories (deb http://www.debian-multimedia.org lenny main) have switched from lame 3.97 to 3.98, the name of the library has changed as well from liblame0 to libmp3lame0. As the Debian packages of Pd-extended depend on that lib, pd-extended should do the switch as well.
----------------------------------------------------------------------
>Comment By: Hans-Christoph Steiner (eighthave)
Date: 2008-07-24 00:10
Message:
Logged In: YES
user_id=27104
Originator: NO
Ok, I updated debian-stable-i386, debian-stable-powerpc, and
debian-testing-i386 with the latest LAME packages from Debian Multimedia.
Ideally, this wouldn't be a strict dependency for installing, but rather a
"recommends" so people could install Pd-extended using the stock Debian
repositories.
Tomorrow's auto-build should have the updated dependency.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=478070&aid=2026159&group_…
Bugs item #2026128, was opened at 2008-07-23 23:02
Message generated for change (Comment added) made by fbar
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=478070&aid=2026128&group_…
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: puredata
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Hans-Christoph Steiner (eighthave)
Assigned to: Miller Puckette (millerpuckette)
Summary: [list trim] outputs mystery type after conversion
Initial Comment:
If you start with a symbolic atom in a symbol message, then run it thru a [list trim], you end up with a mystery type that is just a numeric atom, but does not work as a float message.
see attached patch for an example
----------------------------------------------------------------------
>Comment By: Frank Barknecht (fbar)
Date: 2008-07-24 01:38
Message:
Logged In: YES
user_id=569446
Originator: NO
I hope even with all my spelling mistakes you can understand my previous
post ... Is it possible to edit posts?
----------------------------------------------------------------------
Comment By: Frank Barknecht (fbar)
Date: 2008-07-24 01:36
Message:
Logged In: YES
user_id=569446
Originator: NO
Yeah, these "mystery types" can be confusing, but in reality they are just
ordinary symbols with a pure numeric data part. Note that these numeric
symbols are not numbers or floats!
[list trim] removes the selector, so after that you have a "1234" string
without selector (or with "symbol 1234" as selector, but minus the "symbol"
part. You can covert this back to a Pd-symbol with a [symbol] or [list]
object. However as you cannot represent numberic symbols in a saved Pd
patch, you cannot use [select 1234] or [route 1234] to select or route
them.
However you can use [select -DUMMY-] and prime that with a numeric symbol
created with [makefilename %d] construct to its left inlet to select
numeric symbols. The same "trick" is used to select backslashes or other
for example split a symbol at any other "unusual" symbol using
[list2symbol]. Try 92---[makefilename %c] to split at backslashes, for
example.
Anyway, there's nothing mysterious about numeric symbols, they are just
unusual in Pd. I think, we had similar confusions before in the bug
tracker, but I didn't check.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=478070&aid=2026128&group_…