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.
>
On Sat, Jul 18, 2009 at 21:54, David
Christensen wrote:
> Steve Bertrand wrote:
>> I've been reading both the Cookbook and HOP
>
> HOP?
snip
Higher Order Perl: http://hop.perl.plover.com
--
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.
--
To unsu
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
Steve Bertrand wrote:
> I've been reading both the Cookbook and HOP
HOP?
> My question is, is if it is common practise to use named parameters
> for incoming arguments to functions/methods.
I tend to code for personal, private use, so I have the luxury of
changing my mind as the mood suits me.
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
Sorry, original message had wrong address for this list and I didn't
notice. Here is the chain.
Regards,
Jeff
-- Forwarded message --
From: Jefferson Kirkland
Date: Sat, Jul 18, 2009 at 9:17 PM
Subject: Re: NET::FTP object constructor's host option as array reference
To: Core
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
I'm building an FTP client using NET::FTP. The documentation states that the
new constructor has a host option which can be a reference to an array with
hosts to try in turn. I don't seem to be able to get this to work. I'm using
ActivePerl under Windows XP. Here's my code:
@try_these = ("turi
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
> "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
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
> "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
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
> "SB" == Steve Bertrand writes:
SB> I tend to read past the finer points that people refer to. For
SB> instance... dispatch tables. It is hard for me to wrap my head around
SB> how immensely useful such subtle things can be!
dispatch tables are very easy in perl and extremely useful.
> "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
2009/7/18 Jenn G. :
> next if /\/0$|^127\./;
>
> ( the regex means when meet something like 192.168.1.0/0 or 127.0.0.1
> it will be next.)
When you say, "it will be next" it sounds like you want it to be
processed. The next keyword stops this loop iteration short, and
continues at the next iterati
Thanks to all of the on, and off-list feedback I've received over the
last month, I've realized I've been missing out on quite a bit.
I tend to read past the finer points that people refer to. For
instance... dispatch tables. It is hard for me to wrap my head around
how immensely useful such subtl
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
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
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
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-
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
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
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
Steve Bertrand wrote:
> However, I needed to take two seconds to at least state that my claim,
> that the second param into Test::More "is forced into qr//" was
> unfounded and unjustified.
>
> I don't know if that is what happens
For completeness (and as a code tracking exercise for myself),
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
Robert Citek wrote:
This doesn't:
$ perl -le '@a=(1,2,3,4) ; $a[0,1]=$a[1,0] ; print join("\t", @a) ; '
perl -Mstrict -Mwarnings -le '@a=(1,2,3,4) ; $a[0,1]=$a[1,0] ; print
join("\t", @a) ; '
Always use strict and warnings :)
--
Just my 0.0002 million dollars worth,
Shawn
Prog
Is there an easier way to swap two values in an array?
This works:
$ perl -le '@a=(1,2,3,4) ; ($a[0],$a[1])=($a[1],$a[0]) ; print
join("\t", @a) ; '
2 1 3 4
This doesn't:
$ perl -le '@a=(1,2,3,4) ; $a[0,1]=$a[1,0] ; print join("\t", @a) ; '
1 1 3 4
Regar
Nevermind, I knew I was overlooking something simple: use @ symbol.
$ perl -le '@a=(1,2,3,4) ; @a[0,1...@a[1,0] ; print join("\t", @a) ; '
2 1 3 4
Regards,
- Robert
On Fri, Jul 17, 2009 at 2:03 PM, Robert Citek wrote:
> Is there an easier way to swap two values in an array?
>
From: "Telemachus"
On Fri Jul 17 2009 @ 3:18, Octavian Rasnita wrote:
From: "Shawn H. Corey"
Octavian Rasnita wrote:
Well, in PHP that calculation is made well, so I think there is a bug
in perl.
No, it's not. PHP rounds off the number before printing. In Perl:
printf "%.2f", $x;
or
30 matches
Mail list logo