Re: [fpc-devel] Format Function

2019-01-29 Thread Michael Van Canneyt
On Mon, 28 Jan 2019, a...@aavani.net wrote: Hi,   I am looking for a version of Format function that works with WideStrings. One way to implement this is to use something like the folllowing: function GetNames(const FirstName, LastName: WideString; ID: Integer): WideString; begin   Resu

[fpc-devel] Format Function

2019-01-28 Thread a...@aavani.net
Hi,   I am looking for a version of Format function that works with WideStrings. One way to implement this is to use something like the folllowing: function GetNames(const FirstName, LastName: WideString; ID: Integer): WideString; begin   Result := ReadWideString(Format('%d %s %s', [ID, Wi

Re: [fpc-devel] format function

2006-10-13 Thread Micha Nelissen
Daniël Mantione wrote: The difference is of scientific meaning. If there were no negative zero, the precision around zero would be halved. While true, its precision would be the same as the precision "around" all other numbers. 0 = -0.5 .. 0.4 1 = 0.5 .. 1.4 2 = 1.5 .. 2.4 etc... Micha

Re: [fpc-devel] format function

2006-10-13 Thread John Briggs
On Thu, Oct 12, 2006 at 03:24:14PM +0200, Florian Klaempfl wrote: > Andrea Mauri wrote: > > Jonas Maebe wrote: > >> > >> Not only that, but -0.000 is different from 0.000 (at least for the fpu) > >> > >> > >> Jonas > > In a mathematical way of view I think that -0.000 has no meaning. It does it me

Re: Re[3]: [fpc-devel] format function

2006-10-12 Thread Rimgaudas Laucius
TED]> To: "FPC developers' list" Sent: Thursday, October 12, 2006 5:51 PM Subject: Re[3]: [fpc-devel] format function Why do you think that scientific notation is used by default? I personally prefer "-0.000" in this case. It's just a personal preference. A

Re[3]: [fpc-devel] format function

2006-10-12 Thread Пётр Косаревский
> Why do you think that scientific notation is used by default? >> I personally prefer "-0.000" in this case. It's just a personal preference. A weak argument: If you write a program "grandma" should use, you can always add an extra check if she complains (and it will be only one of the many "ex

Re: [fpc-devel] format function

2006-10-12 Thread Micha Nelissen
Jonas Maebe wrote: examples when you answered with "Like?". I therefore gave a link to a wikipedia article which shows that the sign matters e.g. when dividing by zero (positive or negative infinity), and the article also gives some Well I meant a "real practical" difference, not something at

Re[2]: [fpc-devel] format function

2006-10-12 Thread Daniël Mantione
Op Thu, 12 Oct 2006, schreef ???: > "Format" primarily produces strings for users, not for programmers. Why do you think that scientific notation is used by default? Daniël___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://

Re: [fpc-devel] format function

2006-10-12 Thread Jonas Maebe
On 12 okt 2006, at 16:31, Micha Nelissen wrote: Michael Van Canneyt wrote: Like ? http://en.wikipedia.org/wiki/Negative_zero Jonas being succinct as ever :) And not answering the question ... sigh. As shown there, you never notice the difference in result. I don't understand what you m

Re[2]: [fpc-devel] format function

2006-10-12 Thread Пётр Косаревский
> http://en.wikipedia.org/wiki/Negative_zero > Jonas Nice link: "In science, −0 may be used to denote a quantity which is less than zero, but which is too small in magnitude to be rounded down to −1." "Format" primarily produces strings for users, not for programmers. ___

Re[4]: [fpc-devel] format function

2006-10-12 Thread Daniël Mantione
Op Thu, 12 Oct 2006, schreef ???: > > representable in an exact way on any IEEE standard-compliant fpu. The > > Of course. But the result of "format" is user-oriented. User is not supposed > to know about negative zero, denormal numbers, negative infinity and the > whole IEEE 7

Re: [fpc-devel] format function

2006-10-12 Thread Micha Nelissen
Michael Van Canneyt wrote: Like ? http://en.wikipedia.org/wiki/Negative_zero Jonas being succinct as ever :) And not answering the question ... sigh. As shown there, you never notice the difference in result. Micha ___ fpc-devel maillist - fpc

Re: [fpc-devel] format function

2006-10-12 Thread Michael Van Canneyt
On Thu, 12 Oct 2006, Jonas Maebe wrote: > > On 12 okt 2006, at 15:46, Micha Nelissen wrote: > > >Jonas Maebe wrote: > > >can still be one (meaning that it's a negative zero). And for some fpu > > >calculations this even matters. > > > >Like ? > > http://en.wikipedia.org/wiki/Negative_zero he

Re: [fpc-devel] format function

2006-10-12 Thread Jonas Maebe
On 12 okt 2006, at 15:46, Micha Nelissen wrote: Jonas Maebe wrote: can still be one (meaning that it's a negative zero). And for some fpu calculations this even matters. Like ? http://en.wikipedia.org/wiki/Negative_zero Jonas ___ fpc-devel mai

Re[4]: [fpc-devel] format function

2006-10-12 Thread Пётр Косаревский
> representable in an exact way on any IEEE standard-compliant fpu. The Of course. But the result of "format" is user-oriented. User is not supposed to know about negative zero, denormal numbers, negative infinity and the whole IEEE 754. If the user is supposed to understand that "-0.000" mea

Re: [fpc-devel] format function

2006-10-12 Thread Vinzent Hoefler
On Thursday 12 October 2006 13:46, Micha Nelissen wrote: > Jonas Maebe wrote: > > can still be one (meaning that it's a negative zero). And for some > > fpu calculations this even matters. > > Like ? Divide by signed zero. That decides if the result is positive or negative infinity. :D Vinzent.

Re: Re[2]: [fpc-devel] format function

2006-10-12 Thread Christian Ulrich
velopers' list" Sent: Thursday, October 12, 2006 3:46 PM Subject: Re: Re[2]: [fpc-devel] format function On 12 okt 2006, at 15:41, Пётр Косаревский wrote: In the othe case, if the user is supposed to understand, that he looks at some representation of binary representation of a re

Re: [fpc-devel] format function

2006-10-12 Thread Micha Nelissen
Jonas Maebe wrote: can still be one (meaning that it's a negative zero). And for some fpu calculations this even matters. Like ? Micha ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel

Re: Re[2]: [fpc-devel] format function

2006-10-12 Thread Jonas Maebe
On 12 okt 2006, at 15:41, Пётр Косаревский wrote: In the othe case, if the user is supposed to understand, that he looks at some representation of binary representation of a real number, "-0.000" obviously means "little negative number". No, it means the value 0, but with a negative sign.

Re[2]: [fpc-devel] format function

2006-10-12 Thread Пётр Косаревский
> >> Not only that, but -0.000 is different from 0.000 (at least for the fpu) > >> Jonas > > In a mathematical way of view I think that -0.000 has no meaning. > Well, despite the fact that -0.000 is probably indeed wrong in this case, a > mathematical view is often wrong when using an fpu :) > > If

Re: [fpc-devel] format function

2006-10-12 Thread Florian Klaempfl
Andrea Mauri wrote: > Jonas Maebe wrote: >> >> Not only that, but -0.000 is different from 0.000 (at least for the fpu) >> >> >> Jonas > In a mathematical way of view I think that -0.000 has no meaning. Well, despite the fact that -0.000 is probably indeed wrong in this case, a mathematical view i

Re: [fpc-devel] format function

2006-10-12 Thread Andrea Mauri
Jonas Maebe wrote: Not only that, but -0.000 is different from 0.000 (at least for the fpu) Jonas In a mathematical way of view I think that -0.000 has no meaning. If I round something and the resulting value is zero, well zero is zero. Not +0 or -0. a. _

Re: [fpc-devel] format function

2006-10-12 Thread Andrea Mauri
Michael Van Canneyt wrote: Because your number is negative... The original number is taken to decide whether it should put the - sign or not. What does delphi do ? Michael. ___ Delphi gives 0.000 as result. a. __

Re: [fpc-devel] format function

2006-10-12 Thread Jonas Maebe
On 12 okt 2006, at 14:22, Michael Van Canneyt wrote: I noticed a strange behavior of the format function. I'm not sure it can be considered as a bug. If I use format('%.3f', [-0.0001]) the resulting string is -0.000 and not 0.000 Why? Because your number is negative... The original number i

Re: [fpc-devel] format function

2006-10-12 Thread Michael Van Canneyt
On Thu, 12 Oct 2006, Andrea Mauri wrote: > Dear all, > this is my first mail to this mailing list, I'm not sure this is the correct > one to post this topic. > I noticed a strange behavior of the format function. I'm not sure it can be > considered as a bug. > If I use > format('%.3f', [-0.0001]

Re: [fpc-devel] format function

2006-10-12 Thread Vinzent Hoefler
On Thursday 12 October 2006 12:16, Andrea Mauri wrote: > Dear all, > this is my first mail to this mailing list, I'm not sure this is the > correct one to post this topic. > I noticed a strange behavior of the format function. I'm not sure it > can be considered as a bug. > If I use > format('%.3f'

[fpc-devel] format function

2006-10-12 Thread Andrea Mauri
Dear all, this is my first mail to this mailing list, I'm not sure this is the correct one to post this topic. I noticed a strange behavior of the format function. I'm not sure it can be considered as a bug. If I use format('%.3f', [-0.0001]) the resulting string is -0.000 and not 0.000 Why? A