Re: misunderstanding

2009-07-19 Thread Chas. Owens
On Sun, Jul 19, 2009 at 03:38, Octavian Râsnita wrote: > From: "Jim Gibson" >> >> PHP is just hiding the inaccuracies of representing decimal fractions >> using binary numbers, because the inaccuracy is insignificant in most >> applications. > > Well, if it wouldn't be significant, why would PHP h

Re: misunderstanding

2009-07-19 Thread Chas. Owens
2009/7/19 Octavian Râşniţă : > From: "Chas. Owens" >> >> What would be the problem if the way of doing calculations by using bignum >> would be the default? >> Does it give errors? It would be helpful to know. >> >> Octavian > >> Because it is slower. > > Well, PHP does it faster than Perl, even i

Re: misunderstanding

2009-07-19 Thread Octavian Râşniţă
From: "Chas. Owens" What would be the problem if the way of doing calculations by using bignum would be the default? Does it give errors? It would be helpful to know. Octavian Because it is slower. Well, PHP does it faster than Perl, even if it also hide the inaccuracy. If you want to us

Re: misunderstanding

2009-07-19 Thread Octavian Râsnita
From: "Jim Gibson" PHP is just hiding the inaccuracies of representing decimal fractions using binary numbers, because the inaccuracy is insignificant in most applications. Well, if it wouldn't be significant, why would PHP hide that inaccuracy as a default? Why doesn't Perl do the same thin

Re: misunderstanding

2009-07-18 Thread Chas. Owens
2009/7/18 Octavian Râşniţă : > From: "Dr.Ruud" >> >> To me that means that you "don't get it" yet. > > Oh yes I get it, but I don't like it. > > What would be the problem if the way of doing calculations by using bignum > would be the default? > Does it give errors? It would be helpful to know. >

Re: misunderstanding

2009-07-18 Thread Jim Gibson
At 4:25 AM +0300 7/19/09, Octavian Râs¸nit¸a˜ wrote: From: "Dr.Ruud" To me that means that you "don't get it" yet. Oh yes I get it, but I don't like it. No, you don't seem to understand. Perl, PHP, and all other languages do floating-point arithmetic using the built-in arithmetic provided

Re: misunderstanding

2009-07-18 Thread Octavian Râşniţă
From: "Dr.Ruud" To me that means that you "don't get it" yet. Oh yes I get it, but I don't like it. What would be the problem if the way of doing calculations by using bignum would be the default? Does it give errors? It would be helpful to know. Octavian -- To unsubscribe, e-mail: begin

Re: misunderstanding

2009-07-18 Thread Dr.Ruud
Octavian Râşniţă wrote: It sounds like a limitation of perl because it makes the calculations at a too low level and not correct the errors automaticly, and not a limitation of computers in general, because PHP does it right, MS Excel does it right, the Windows Calculator does it right, so it

Re: misunderstanding

2009-07-18 Thread Dr.Ruud
Octavian Râşniţă wrote: Dr.Ruud: Octavian Rasnita: print 0.79 - 0.798; -0.00801 which is obviously wrong. And it is obvious to me that you are wrong. Funny hey? Sorry but the calculation is obviously wrong. It is not my fault that the computers can't make a perfect float cal

Re: misunderstanding

2009-07-18 Thread Uri Guttman
> "OR" == Octavian Râşniţă writes: OR> From: "Uri Guttman" OR> sorry to say but you still don't get it. automatically rounding numbers OR> is not higher level NOR correct. there is NO correct way to handle OR> floating numbers like that. none. nada. it is a very well known issue in

Re: misunderstanding

2009-07-18 Thread Octavian Râşniţă
From: "Uri Guttman" sorry to say but you still don't get it. automatically rounding numbers is not higher level NOR correct. there is NO correct way to handle floating numbers like that. none. nada. it is a very well known issue in ALL programming languages that support floats. some choose conven

Re: misunderstanding

2009-07-18 Thread Uri Guttman
> "SHC" == Shawn H Corey writes: SHC> Uri Guttman wrote: >> the correct solution for money has always been to use integers >> for the smallest amount (e.g. cents). this will always be correct in all >> languanges. >> SHC> Sorry, but sometimes you have to use real numbers. On th

Re: misunderstanding

2009-07-18 Thread Shawn H. Corey
Uri Guttman wrote: the correct solution for money has always been to use integers for the smallest amount (e.g. cents). this will always be correct in all languanges. Sorry, but sometimes you have to use real numbers. On the news, exchange rates are given to a thousand of a cent, which is OK

Re: misunderstanding

2009-07-18 Thread Uri Guttman
> "OR" == Octavian Râşniţă writes: OR> From: "Shawn H. Corey" >> Either the programs (not the languages) are doing their calculations >> in cents, not dollars or they are rounding off at a higher level >> than Perl. You just think they are not making errors because they're >> not t

Re: misunderstanding

2009-07-18 Thread Octavian Râşniţă
From: "Shawn H. Corey" Either the programs (not the languages) are doing their calculations in cents, not dollars or they are rounding off at a higher level than Perl. You just think they are not making errors because they're not telling you what they're really doing. They give a different r

Re: misunderstanding

2009-07-18 Thread Shawn H. Corey
Octavian Râşniţă wrote: I read it, and it doesn't sound very well: "Rounding in financial applications can have serious implications, and the rounding method used should be specified precisely. In these cases, it probably pays not to trust whichever system rounding is being used by Perl, but to

Re: misunderstanding

2009-07-18 Thread Shawn H. Corey
Chas. Owens wrote: Before you go blaming computers, what is the exact value of Pi again? Understanding the limitations of reality and computers is your job if you want accurate results. You can't get accurate results, that's the problem. The questions to ask are: * What degree of accuracy

Re: misunderstanding

2009-07-18 Thread Octavian Râşniţă
From: "Shawn H. Corey" Octavian Râşniţă wrote: Sorry but the calculation is obviously wrong. It is not my fault that the computers can't make a perfect float calculation with an infinite number of digits. But yes, it is not just a fault of perl. Since all the languages use the same math co-

Re: misunderstanding (was: Re: bug in perl?)

2009-07-18 Thread Chas. Owens
2009/7/18 Octavian Râşniţă : > From: "Dr.Ruud" > Octavian Rasnita wrote: >> >>> print 0.79 - 0.798; >>> >>> -0.00801 >>> >>> which is obviously wrong. >> >> And it is obvious to me that you are wrong. Funny hey? >> >> -- >> Ruud > > Sorry but the calculation is obviously wrong. It is n

Re: misunderstanding

2009-07-18 Thread Shawn H. Corey
Octavian Râşniţă wrote: Sorry but the calculation is obviously wrong. It is not my fault that the computers can't make a perfect float calculation with an infinite number of digits. But yes, it is not just a fault of perl. Since all the languages use the same math co-processor, they all get i

Re: misunderstanding (was: Re: bug in perl?)

2009-07-18 Thread Octavian Râşniţă
From: "Dr.Ruud" Octavian Rasnita wrote: print 0.79 - 0.798; -0.00801 which is obviously wrong. And it is obvious to me that you are wrong. Funny hey? -- Ruud Sorry but the calculation is obviously wrong. It is not my fault that the computers can't make a perfect float calcu

misunderstanding (was: Re: bug in perl?)

2009-07-18 Thread Dr.Ruud
Octavian Rasnita wrote: print 0.79 - 0.798; -0.00801 which is obviously wrong. And it is obvious to me that you are wrong. Funny hey? -- Ruud -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org

Re: misunderstanding with the function split

2006-07-17 Thread John W. Krahn
sfantar wrote: > John W. Krahn a écrit : >> >> #!/usr/local/bin/perl >> use strict; >> use warnings; >> >> my @authors; >> my @titles; >> >> >> for my $file ( @ARGV ) { >> $file =~ tr/ /_/; >> >> my ( $author, $title ) = split /-/, $file; >> >> push @authors, $author; >> push @title

Re: misunderstanding with the function split

2006-07-17 Thread sfantar
John W. Krahn a écrit : sfantar wrote: Hello everyone Hello, I would like to be able to print the songs'titles according to the author. The format of the songs are as follow : Freda Payne - In motion.mp3 Sylvester - Was it something that i said.mp3 George Benson & A. Franklin - Love All The

Re: misunderstanding with the function split

2006-07-17 Thread John W. Krahn
sfantar wrote: > Hello everyone Hello, > I would like to be able to print the songs'titles according to the author. > The format of the songs are as follow : > > Freda Payne - In motion.mp3 > Sylvester - Was it something that i said.mp3 > George Benson & A. Franklin - Love All The Hurt Away.mp3

misunderstanding with the function split

2006-07-17 Thread sfantar
Hello everyone I would like to be able to print the songs'titles according to the author. The format of the songs are as follow : Freda Payne - In motion.mp3 Sylvester - Was it something that i said.mp3 George Benson & A. Franklin - Love All The Hurt Away.mp3 #!/usr/local/bin/perl -w use s

Re: misunderstanding the /g modifier on REGEX

2003-06-13 Thread Rob Dixon
M Z wrote: > hello all - > > I am trying to do the following to this data: > input: > X|YZ||A > > desired output: > X|Y| | | |Z| |A > > simply replacing || with | | > whereever it may occur in the string. > > This bit of code doesn't seem to do all of the job. > > What is wrong with this code?

Re: misunderstanding the /g modifier on REGEX

2003-06-13 Thread John W. Krahn
Tim Johnson wrote: > > I'm not really giving you the answer you're looking for, but here is one way > to go about it: > > while(<>){ > my @temp = split(/\|/,$_); > foreach my $item(@temp){ > if($item eq ''){ > $item .= ' '; > } > } > print join('|',@temp); > } Or you could

Re: misunderstanding the /g modifier on REGEX

2003-06-13 Thread Sudarshan Raghavan
CTED] Sent: Thursday, June 12, 2003 5:28 PM To: [EMAIL PROTECTED] Subject: Re: misunderstanding the /g modifier on REGEX M Z wrote: hello all - I am trying to do the following to this data: input: X|YZ||A desired output: X|Y| | | |Z| |A simply replacing || with | | whereever it may occur in

RE: misunderstanding the /g modifier on REGEX

2003-06-12 Thread Tim Johnson
To: [EMAIL PROTECTED] Subject: Re: misunderstanding the /g modifier on REGEX M Z wrote: > hello all - > > I am trying to do the following to this data: > input: > X|YZ||A > > desired output: > X|Y| | | |Z| |A > > simply replacing || with | | > whereever it may oc

RE: misunderstanding the /g modifier on REGEX

2003-06-12 Thread Tim Johnson
Original Message- From: M z [mailto:[EMAIL PROTECTED] Sent: Thursday, June 12, 2003 3:35 PM To: [EMAIL PROTECTED] Subject: misunderstanding the /g modifier on REGEX hello all - I am trying to do the following to this data: input: X|YZ||A desired output: X|Y| | | |Z| |A simply replacing ||

Re: misunderstanding the /g modifier on REGEX

2003-06-12 Thread david
M Z wrote: > hello all - > > I am trying to do the following to this data: > input: > X|YZ||A > > desired output: > X|Y| | | |Z| |A > > simply replacing || with | | > whereever it may occur in the string. > > This bit of code doesn't seem to do all of the job. > > What is wrong with this

misunderstanding the /g modifier on REGEX

2003-06-12 Thread M z
hello all - I am trying to do the following to this data: input: X|YZ||A desired output: X|Y| | | |Z| |A simply replacing || with | | whereever it may occur in the string. This bit of code doesn't seem to do all of the job. What is wrong with this code? while (<>) { while($_ =~ /([|])([|

misunderstanding the /g modifier on REGEX

2003-06-12 Thread M z
hello all - I am trying to do the following to this data: input: X|YZ||A desired output: X|Y| | | |Z| |A simply replacing || with | | whereever it may occur in the string. This bit of code doesn't seem to do all of the job. What is wrong with this code? while (<>) { while($_ =~ /([|])([|

Re: split with LIMIT misunderstanding?

2002-05-13 Thread Zachary Buckholz
Think I figured it out properly. if ($_ =~ /^\$myquery/) { quotemeta($_); (undef, $line{myquery}) = split(/=/, $_, 2); } This gives me MYQUERY = "url=$url&email=$email&i_rank=yes"; If this is not the 'proper' way please let me know of a better way. Thanks zack "Zachary Buckholz" <[EMAIL PROT

split with LIMIT misunderstanding?

2002-05-13 Thread Zachary Buckholz
I have a bunch of text files that follow the format variable = value I am trying to read each file and insert it into SQL but before I can do that I need to parse the values into a hash. One of the fields has the URL which can contain & and = characters, so after the first split I seem to miss

Re: Sorry for the misunderstanding

2002-05-10 Thread Felix Geerinckx
on Wed, 08 May 2002 20:38:14 GMT, [EMAIL PROTECTED] (Richard Mr Usarec Buskirk) wrote: > I fixed my problem: > [...] > I have no errors and it works. I am glad you got it working. > I am new to cgi but i catch on quickly. Even though i didnt get a > response to help me. > I was hoping you guy