[7540] in Perl-Users-Digest
Perl-Users Digest, Issue: 1167 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 13 07:07:34 1997
Date: Mon, 13 Oct 97 04:00:22 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 13 Oct 1997 Volume: 8 Number: 1167
Today's topics:
Re: 5.004_03 test failure on IRIX 5.3 <jclutterbuck@sbs.siemens.co.uk>
Re: 5.004_03 test failure on IRIX 5.3 <jclutterbuck@sbs.siemens.co.uk>
Re: A brief request (string handling) (robert)
an other way? (Gustav Kristoffer Ek)
Re: Can someone look at this and tell me why it doesn't (Casper K. Clausen)
Re: Can someone look at this and tell me why it doesn't <jgostin@shell2.ba.best.com>
Re: Can someone look at this and tell me why it doesn't (Casper K. Clausen)
Re: Getting File Information Quickly (Bart Lateur)
Re: Getting PERL for NT and installing it. <jon.tracey@earthling.net>
makefile problem (john sandstrom)
Re: Newbie question; how to redirect <flavell@mail.cern.ch>
perl mailing list (Eric Mosley)
Re: Protecting Perl source code against copyright...how <gihan@firststep.com.au>
Re: Q: Dynamically creating hashes and arrays (Toutatis)
Re: Searchable Database. (robert)
Re: the oddest syntax error <dehon_olivier@jpmorgan.com>
Re: Wouldn't it be great <jclutterbuck@sbs.siemens.co.uk>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 13 Oct 1997 08:57:11 +0100
From: John Clutterbuck <jclutterbuck@sbs.siemens.co.uk>
To: "James W. Durkin" <jwd@graphics.cornell.edu>
Subject: Re: 5.004_03 test failure on IRIX 5.3
Message-Id: <3441D457.41C6@sbs.siemens.co.uk>
James W. Durkin wrote:
>
> I just redid our Perl installation on various systems, switching from
> 5.004_01 to 5.004_03 in the process. The build/test used to go
> cleanly on our IRIX 5.3 systems, but doesn't now. It fails in the
> tests of lib/complex.
>
>
> Any ideas???
>
I reported this vai perlbug and was sent the enclosed patch file which
solved the problem after I had to installed gnu patch to apply it:
--- lib/Math/Complex.pm.dist Sun Aug 24 18:06:47 1997
+++ lib/Math/Complex.pm Mon Aug 25 13:52:18 1997
@@ -1,8 +1,8 @@
-# $RCSFile$
#
# Complex numbers and associated mathematical functions
-# -- Raphael Manfredi, September 1996
-# -- Jarkko Hietaniemi, March-April 1997
+# -- Raphael Manfredi September 1996
+# -- Jarkko Hietaniemi March-August 1997
+#
require Exporter;
package Math::Complex;
@@ -12,7 +12,7 @@
use vars qw($VERSION @ISA
@EXPORT %EXPORT_TAGS
$package $display
- $i $logn %logn);
+ $i $ip2 $logn %logn);
@ISA = qw(Exporter);
@@ -133,18 +133,30 @@
#
# pi
#
-# The number defined as 2 * pi = 360 degrees
+# The number defined as pi = 180 degrees
#
-
use constant pi => 4 * atan2(1, 1);
#
-# log2inv
+# pit2
#
-# Used in log10().
+# The full circle
+#
+use constant pit2 => 2 * pi;
+
+#
+# pip2
#
+# The quarter circle
+#
+use constant pip2 => pi / 2;
-use constant log10inv => 1 / log(10);
+#
+# uplog10
+#
+# Used in log10().
+#
+use constant uplog10 => 1 / log(10);
#
# i
@@ -155,7 +167,7 @@
return $i if ($i);
$i = bless {};
$i->{'cartesian'} = [0, 1];
- $i->{'polar'} = [1, pi/2];
+ $i->{'polar'} = [1, pip2];
$i->{c_dirty} = 0;
$i->{p_dirty} = 0;
return $i;
@@ -242,7 +254,27 @@
# Computes z1*z2.
#
sub multiply {
- my ($z1, $z2, $regular) = @_;
+ my ($z1, $z2, $regular) = @_;
+ my ($re1, $re2);
+ if (ref $z1) {
+ unless ($z1->{c_dirty}) {
+ my ($re, $im) = @{$z1->cartesian};
+ $re1 = $re if $im == 0;
+ }
+ } else {
+ $re1 = $z1;
+ }
+ if (ref $z2) {
+ unless ($z2->{c_dirty}) {
+ my ($re, $im) = @{$z2->cartesian};
+ $re1 = $re if $im == 0;
+ }
+ } else {
+ $re2 = $z2;
+ }
+ if (defined $re1 and defined $re2) {
+ return cplx($re1 * $re2, 0);
+ }
my ($r1, $t1) = @{$z1->polar};
$z2 = cplxe(abs($z2), $z2 >= 0 ? 0 : pi) unless ref $z2;
my ($r2, $t2) = @{$z2->polar};
@@ -281,6 +313,32 @@
#
sub divide {
my ($z1, $z2, $inverted) = @_;
+ my ($re1, $re2);
+ if (ref $z1) {
+ unless ($z1->{c_dirty}) {
+ my ($re, $im) = @{$z1->cartesian};
+ $re1 = $re if $im == 0;
+ }
+ } else {
+ $re1 = $z1;
+ }
+ if (ref $z2) {
+ unless ($z2->{c_dirty}) {
+ my ($re, $im) = @{$z2->cartesian};
+ $re1 = $re if $im == 0;
+ }
+ } else {
+ $re2 = $z2;
+ }
+ if (defined $re1 and defined $re2) {
+ if ($inverted) {
+ _divbyzero "$re2/0" if ($re1 == 0);
+ return cplx($re2 / $re1, 0);
+ } else {
+ _divbyzero "$re1/0" if ($re2 == 0);
+ return cplx($re1 / $re2, 0);
+ }
+ }
my ($r1, $t1) = @{$z1->polar};
$z2 = cplxe(abs($z2), $z2 >= 0 ? 0 : pi) unless ref $z2;
my ($r2, $t2) = @{$z2->polar};
@@ -392,9 +450,20 @@
#
sub abs {
my ($z) = @_;
- return abs($z) unless ref $z;
+ return $z > 0 ? $z : -$z unless ref $z;
my ($r, $t) = @{$z->polar};
- return abs($r);
+ return $r > 0 ? $r : -$r;
+}
+
+#
+# sgn
+#
+# Compute _real's_ sign.
+#
+sub sgn {
+ return -1 if ($_[0] < 0);
+ return 1 if ($_[0] > 0);
+ return 0;
}
#
@@ -417,6 +486,13 @@
sub sqrt {
my ($z) = @_;
$z = cplx($z, 0) unless ref $z;
+ my ($re, $im);
+ if (ref $z) {
+ ($re, $im) = @{$z->cartesian};
+ } else {
+ ($re, $im) = ($z, 0);
+ }
+ return cplx($re < 0 ? (0, sqrt(-$re)) : (sqrt($re), 0)) if $im == 0;
my ($r, $t) = @{$z->polar};
return (ref $z)->emake(sqrt($r), $t/2);
}
@@ -464,7 +540,7 @@
my ($r, $t) = ref $z ? @{$z->polar} : (abs($z), $z >= 0 ? 0 : pi);
my @root;
my $k;
- my $theta_inc = 2 * pi / $n;
+ my $theta_inc = pit2 / $n;
my $rho = $r ** (1/$n);
my $theta;
my $complex = ref($z) || $package;
@@ -513,7 +589,7 @@
#
# _logofzero
#
-# Die on division by zero.
+# Die on logarithm of zero.
#
sub _logofzero {
my $mess = "$_[0]: Logarithm of zero.\n";
@@ -538,11 +614,25 @@
#
sub log {
my ($z) = @_;
- $z = cplx($z, 0) unless ref $z;
- my ($x, $y) = @{$z->cartesian};
+ my ($re, $im);
+ if (ref $z) {
+ ($re, $im) = @{$z->cartesian};
+ } else {
+ ($re, $im) = ($z, 0);
+ $z = cplx($z, 0);
+ }
+ if (defined $re and $im == 0) {
+ if ($re > 0) {
+ return cplx(log($re), 0);
+ } elsif ($re < 0) {
+ return cplx(log(-$re), pi);
+ } else {
+ _logofzero("log");
+ }
+ }
my ($r, $t) = @{$z->polar};
- $t -= 2 * pi if ($t > pi() and $x < 0);
- $t += 2 * pi if ($t < -pi() and $x < 0);
+ if ($t > pi()) { $t -= pit2 }
+ elsif ($t < -pi()) { $t += pit2 }
return (ref $z)->make(log($r), $t);
}
@@ -562,9 +652,9 @@
sub log10 {
my ($z) = @_;
- return log(cplx($z, 0)) * log10inv unless ref $z;
+ return log(cplx($z, 0)) * uplog10 unless ref $z;
my ($r, $t) = @{$z->polar};
- return (ref $z)->make(log($r) * log10inv, $t * log10inv);
+ return (ref $z)->make(log($r) * uplog10, $t * uplog10);
}
#
@@ -679,20 +769,21 @@
#
sub acos {
my ($z) = @_;
- $z = cplx($z, 0) unless ref $z;
- my ($re, $im) = @{$z->cartesian};
- return atan2(sqrt(1 - $re * $re), $re)
- if ($im == 0 and abs($re) <= 1.0);
- my $acos = ~i * log($z + sqrt($z*$z - 1));
- if ($im == 0 ||
- (abs($re) < 1 && abs($im) < 1) ||
- (abs($re) > 1 && abs($im) > 1
- && !($re > 1 && $im > 1)
- && !($re < -1 && $im < -1))) {
- # this rule really, REALLY, must be simpler
- return -$acos;
+ my ($re, $im);
+ if (ref $z) {
+ ($re, $im) = @{$z->cartesian};
+ } else {
+ ($re, $im) = ($z, 0);
+ $z = cplx($z, 0);
}
- return $acos;
+ return atan2(sqrt(1 - $re * $re), $re)
+ if $im == 0 and abs($re) <= 1.0;
+ my $log = log($z + sqrt($z*$z-1));
+ my ($logre, $logim) = @{$log->cartesian};
+ return cplx( $logim, $logre) if $logim == pi() or $logim == 0;
+ return cplx(-$logim, $logre) if $im == 0;
+ return i * $log if sgn($im) * sgn($re) == -1;
+ return ~i * $log;
}
#
@@ -702,10 +793,15 @@
#
sub asin {
my ($z) = @_;
- $z = cplx($z, 0) unless ref $z;
- my ($re, $im) = @{$z->cartesian};
+ my ($re, $im);
+ if (ref $z) {
+ ($re, $im) = @{$z->cartesian};
+ } else {
+ ($re, $im) = ($z, 0);
+ $z = cplx($z, 0);
+ }
return atan2($re, sqrt(1 - $re * $re))
- if ($im == 0 and abs($re) <= 1.0);
+ if $im == 0 and abs($re) <= 1.0;
return ~i * log(i * $z + sqrt(1 - $z*$z));
}
@@ -719,7 +815,9 @@
$z = cplx($z, 0) unless ref $z;
_divbyzero "atan(i)" if ( $z == i);
_divbyzero "atan(-i)" if (-$z == i);
- return i/2*log((i + $z) / (i - $z));
+ my $log = log((i + $z) / (i - $z));
+ $ip2 = 0.5 * i unless defined $ip2;
+ return $ip2 * $log;
}
#
@@ -730,15 +828,18 @@
sub asec {
my ($z) = @_;
_divbyzero "asec($z)", $z if ($z == 0);
- $z = cplx($z, 0) unless ref $z;
- my ($re, $im) = @{$z->cartesian};
- if ($im == 0 && abs($re) >= 1.0) {
+ my ($re, $im);
+ if (ref $z) {
+ ($re, $im) = @{$z->cartesian};
+ } else {
+ ($re, $im) = ($z, 0);
+ $z = cplx($z, 0);
+ }
+ if ($im == 0 and abs($re) >= 1.0) {
my $ire = 1 / $re;
return atan2(sqrt(1 - $ire * $ire), $ire);
}
my $asec = acos(1 / $z);
- return ~$asec if $re < 0 && $re > -1 && $im == 0;
- return -$asec if $im && !($re > 0 && $im > 0) && !($re < 0 && $im <
0);
return $asec;
}
@@ -750,14 +851,18 @@
sub acsc {
my ($z) = @_;
_divbyzero "acsc($z)", $z if ($z == 0);
- $z = cplx($z, 0) unless ref $z;
- my ($re, $im) = @{$z->cartesian};
- if ($im == 0 && abs($re) >= 1.0) {
+ my ($re, $im);
+ if (ref $z) {
+ ($re, $im) = @{$z->cartesian};
+ } else {
+ ($re, $im) = ($z, 0);
+ $z = cplx($z, 0);
+ }
+ if ($im == 0 and abs($re) >= 1.0) {
my $ire = 1 / $re;
return atan2($ire, sqrt(1 - $ire * $ire));
}
my $acsc = asin(1 / $z);
- return ~$acsc if $re < 0 && $re > -1 && $im == 0;
return $acsc;
}
@@ -928,9 +1033,9 @@
$z = cplx($z, 0) unless ref $z;
my ($re, $im) = @{$z->cartesian};
if ($im == 0 && $re > 1) {
- return cplx(atanh(1 / $re), pi/2);
+ return cplx(atanh(1 / $re), pip2);
}
- return log((1 + $z) / (1 - $z)) / 2;
+ return 0.5 * log((1 + $z) / (1 - $z));
}
#
@@ -980,7 +1085,7 @@
$z = cplx($z, 0) unless ref $z;
my ($re, $im) = @{$z->cartesian};
if ($im == 0 and abs($re) < 1) {
- return cplx(acoth(1/$re) , pi/2);
+ return cplx(acoth(1/$re) , pip2);
}
return log((1 + $z) / ($z - 1)) / 2;
}
@@ -1076,16 +1181,17 @@
my $z = shift;
my ($x, $y) = @{$z->cartesian};
my ($re, $im);
+ my $eps = 1e-14;
- $x = int($x + ($x < 0 ? -1 : 1) * 1e-14)
- if int(abs($x)) != int(abs($x) + 1e-14);
- $y = int($y + ($y < 0 ? -1 : 1) * 1e-14)
- if int(abs($y)) != int(abs($y) + 1e-14);
-
- $re = "$x" if abs($x) >= 1e-14;
- if ($y == 1) { $im = 'i' }
- elsif ($y == -1) { $im = '-i' }
- elsif (abs($y) >= 1e-14) { $im = $y . "i" }
+ $x = int($x + ($x < 0 ? -1 : 1) * $eps)
+ if int(abs($x)) != int(abs($x) + $eps);
+ $y = int($y + ($y < 0 ? -1 : 1) * $eps)
+ if int(abs($y)) != int(abs($y) + $eps);
+
+ $re = "$x" if abs($x) >= $eps;
+ if ($y == 1) { $im = 'i' }
+ elsif ($y == -1) { $im = '-i' }
+ elsif (abs($y) >= $eps) { $im = $y . "i" }
my $str = '';
$str = $re if defined $re;
@@ -1110,10 +1216,9 @@
return '[0,0]' if $r <= $eps;
- my $tpi = 2 * pi;
- my $nt = $t / $tpi;
- $nt = ($nt - int($nt)) * $tpi;
- $nt += $tpi if $nt < 0; # Range [0, 2pi]
+ my $nt = $t / pit2;
+ $nt = ($nt - int($nt)) * pit2;
+ $nt += pit2 if $nt < 0; # Range [0, 2pi]
if (abs($nt) <= $eps) { $theta = 0 }
elsif (abs(pi-$nt) <= $eps) { $theta = 'pi' }
@@ -1131,7 +1236,7 @@
# Okay, number is not a real. Try to identify pi/n and friends...
#
- $nt -= $tpi if $nt > pi;
+ $nt -= pit2 if $nt > pi;
my ($n, $k, $kpi);
for ($k = 1, $kpi = pi; $k < 10; $k++, $kpi += pi) {
--- t/lib/complex.t.dist Sun Aug 24 18:36:51 1997
+++ t/lib/complex.t Mon Aug 25 11:07:50 1997
@@ -99,7 +99,10 @@
'acoth(1)',
);
+my $zero = cplx(0, 0);
+
test_loz(
+ 'log($zero)',
'atanh(-1)',
'acoth(-1)',
);
@@ -372,8 +375,8 @@
|'abs(z)':'r'
|'acot(z)':'acotan(z)'
|'acsc(z)':'acosec(z)'
-|'abs(acsc(z))':'abs(asin(1 / z))'
-|'abs(asec(z))':'abs(acos(1 / z))'
+|'acsc(z)':'asin(1 / z)'
+|'asec(z)':'acos(1 / z)'
|'cbrt(z)':'cbrt(r) * exp(i * t/3)'
|'cos(acos(z))':'z'
|'cos(z) ** 2 + sin(z) ** 2':1
@@ -429,6 +432,20 @@
|'asinh(sinh(z))':'z'
|'atan(tan(z))':'z'
|'atanh(tanh(z))':'z'
+
+&log
+(-2.0,0):( 0.69314718055995, 3.14159265358979)
+(-1.0,0):( 0 , 3.14159265358979)
+(-0.5,0):( -0.69314718055995, 3.14159265358979)
+( 0.5,0):( -0.69314718055995, 0 )
+( 1.0,0):( 0 , 0 )
+( 2.0,0):( 0.69314718055995, 0 )
+
+&log
+( 2, 3):( 1.28247467873077, 0.98279372324733)
+(-2, 3):( 1.28247467873077, 2.15879893034246)
+(-2,-3):( 1.28247467873077, -2.15879893034246)
+( 2,-3):( 1.28247467873077, -0.98279372324733)
&sin
(-2.0,0):( -0.90929742682568, 0 )
--
# John Clutterbuck Tel: +44 1703 765021
# Siemens Business Services email: jclutterbuck@sbs.siemens.co.uk
# Phi House, Enterprise Road
# Chilworth, Hampshire, SO16 7NS
------------------------------
Date: Mon, 13 Oct 1997 10:08:53 +0100
From: John Clutterbuck <jclutterbuck@sbs.siemens.co.uk>
Subject: Re: 5.004_03 test failure on IRIX 5.3
Message-Id: <3441E525.41C6@sbs.siemens.co.uk>
James W. Durkin wrote:
>
> I just redid our Perl installation on various systems, switching from
> 5.004_01 to 5.004_03 in the process. The build/test used to go
> cleanly on our IRIX 5.3 systems, but doesn't now. It fails in the
> tests of lib/complex.
>
> My deviation from the defaults during the configuration are as follows:
>
>
> Any ideas???
>
> --
> James Durkin
> jwd@graphics.cornell.edu
I reported this using perlbug and was sent this patch file. I needed to
install gnu patch to install it:
--- lib/Math/Complex.pm.dist Sun Aug 24 18:06:47 1997
+++ lib/Math/Complex.pm Mon Aug 25 13:52:18 1997
@@ -1,8 +1,8 @@
-# $RCSFile$
#
# Complex numbers and associated mathematical functions
-# -- Raphael Manfredi, September 1996
-# -- Jarkko Hietaniemi, March-April 1997
+# -- Raphael Manfredi September 1996
+# -- Jarkko Hietaniemi March-August 1997
+#
require Exporter;
package Math::Complex;
@@ -12,7 +12,7 @@
use vars qw($VERSION @ISA
@EXPORT %EXPORT_TAGS
$package $display
- $i $logn %logn);
+ $i $ip2 $logn %logn);
@ISA = qw(Exporter);
@@ -133,18 +133,30 @@
#
# pi
#
-# The number defined as 2 * pi = 360 degrees
+# The number defined as pi = 180 degrees
#
-
use constant pi => 4 * atan2(1, 1);
#
-# log2inv
+# pit2
#
-# Used in log10().
+# The full circle
+#
+use constant pit2 => 2 * pi;
+
+#
+# pip2
#
+# The quarter circle
+#
+use constant pip2 => pi / 2;
-use constant log10inv => 1 / log(10);
+#
+# uplog10
+#
+# Used in log10().
+#
+use constant uplog10 => 1 / log(10);
#
# i
@@ -155,7 +167,7 @@
return $i if ($i);
$i = bless {};
$i->{'cartesian'} = [0, 1];
- $i->{'polar'} = [1, pi/2];
+ $i->{'polar'} = [1, pip2];
$i->{c_dirty} = 0;
$i->{p_dirty} = 0;
return $i;
@@ -242,7 +254,27 @@
# Computes z1*z2.
#
sub multiply {
- my ($z1, $z2, $regular) = @_;
+ my ($z1, $z2, $regular) = @_;
+ my ($re1, $re2);
+ if (ref $z1) {
+ unless ($z1->{c_dirty}) {
+ my ($re, $im) = @{$z1->cartesian};
+ $re1 = $re if $im == 0;
+ }
+ } else {
+ $re1 = $z1;
+ }
+ if (ref $z2) {
+ unless ($z2->{c_dirty}) {
+ my ($re, $im) = @{$z2->cartesian};
+ $re1 = $re if $im == 0;
+ }
+ } else {
+ $re2 = $z2;
+ }
+ if (defined $re1 and defined $re2) {
+ return cplx($re1 * $re2, 0);
+ }
my ($r1, $t1) = @{$z1->polar};
$z2 = cplxe(abs($z2), $z2 >= 0 ? 0 : pi) unless ref $z2;
my ($r2, $t2) = @{$z2->polar};
@@ -281,6 +313,32 @@
#
sub divide {
my ($z1, $z2, $inverted) = @_;
+ my ($re1, $re2);
+ if (ref $z1) {
+ unless ($z1->{c_dirty}) {
+ my ($re, $im) = @{$z1->cartesian};
+ $re1 = $re if $im == 0;
+ }
+ } else {
+ $re1 = $z1;
+ }
+ if (ref $z2) {
+ unless ($z2->{c_dirty}) {
+ my ($re, $im) = @{$z2->cartesian};
+ $re1 = $re if $im == 0;
+ }
+ } else {
+ $re2 = $z2;
+ }
+ if (defined $re1 and defined $re2) {
+ if ($inverted) {
+ _divbyzero "$re2/0" if ($re1 == 0);
+ return cplx($re2 / $re1, 0);
+ } else {
+ _divbyzero "$re1/0" if ($re2 == 0);
+ return cplx($re1 / $re2, 0);
+ }
+ }
my ($r1, $t1) = @{$z1->polar};
$z2 = cplxe(abs($z2), $z2 >= 0 ? 0 : pi) unless ref $z2;
my ($r2, $t2) = @{$z2->polar};
@@ -392,9 +450,20 @@
#
sub abs {
my ($z) = @_;
- return abs($z) unless ref $z;
+ return $z > 0 ? $z : -$z unless ref $z;
my ($r, $t) = @{$z->polar};
- return abs($r);
+ return $r > 0 ? $r : -$r;
+}
+
+#
+# sgn
+#
+# Compute _real's_ sign.
+#
+sub sgn {
+ return -1 if ($_[0] < 0);
+ return 1 if ($_[0] > 0);
+ return 0;
}
#
@@ -417,6 +486,13 @@
sub sqrt {
my ($z) = @_;
$z = cplx($z, 0) unless ref $z;
+ my ($re, $im);
+ if (ref $z) {
+ ($re, $im) = @{$z->cartesian};
+ } else {
+ ($re, $im) = ($z, 0);
+ }
+ return cplx($re < 0 ? (0, sqrt(-$re)) : (sqrt($re), 0)) if $im == 0;
my ($r, $t) = @{$z->polar};
return (ref $z)->emake(sqrt($r), $t/2);
}
@@ -464,7 +540,7 @@
my ($r, $t) = ref $z ? @{$z->polar} : (abs($z), $z >= 0 ? 0 : pi);
my @root;
my $k;
- my $theta_inc = 2 * pi / $n;
+ my $theta_inc = pit2 / $n;
my $rho = $r ** (1/$n);
my $theta;
my $complex = ref($z) || $package;
@@ -513,7 +589,7 @@
#
# _logofzero
#
-# Die on division by zero.
+# Die on logarithm of zero.
#
sub _logofzero {
my $mess = "$_[0]: Logarithm of zero.\n";
@@ -538,11 +614,25 @@
#
sub log {
my ($z) = @_;
- $z = cplx($z, 0) unless ref $z;
- my ($x, $y) = @{$z->cartesian};
+ my ($re, $im);
+ if (ref $z) {
+ ($re, $im) = @{$z->cartesian};
+ } else {
+ ($re, $im) = ($z, 0);
+ $z = cplx($z, 0);
+ }
+ if (defined $re and $im == 0) {
+ if ($re > 0) {
+ return cplx(log($re), 0);
+ } elsif ($re < 0) {
+ return cplx(log(-$re), pi);
+ } else {
+ _logofzero("log");
+ }
+ }
my ($r, $t) = @{$z->polar};
- $t -= 2 * pi if ($t > pi() and $x < 0);
- $t += 2 * pi if ($t < -pi() and $x < 0);
+ if ($t > pi()) { $t -= pit2 }
+ elsif ($t < -pi()) { $t += pit2 }
return (ref $z)->make(log($r), $t);
}
@@ -562,9 +652,9 @@
sub log10 {
my ($z) = @_;
- return log(cplx($z, 0)) * log10inv unless ref $z;
+ return log(cplx($z, 0)) * uplog10 unless ref $z;
my ($r, $t) = @{$z->polar};
- return (ref $z)->make(log($r) * log10inv, $t * log10inv);
+ return (ref $z)->make(log($r) * uplog10, $t * uplog10);
}
#
@@ -679,20 +769,21 @@
#
sub acos {
my ($z) = @_;
- $z = cplx($z, 0) unless ref $z;
- my ($re, $im) = @{$z->cartesian};
- return atan2(sqrt(1 - $re * $re), $re)
- if ($im == 0 and abs($re) <= 1.0);
- my $acos = ~i * log($z + sqrt($z*$z - 1));
- if ($im == 0 ||
- (abs($re) < 1 && abs($im) < 1) ||
- (abs($re) > 1 && abs($im) > 1
- && !($re > 1 && $im > 1)
- && !($re < -1 && $im < -1))) {
- # this rule really, REALLY, must be simpler
- return -$acos;
+ my ($re, $im);
+ if (ref $z) {
+ ($re, $im) = @{$z->cartesian};
+ } else {
+ ($re, $im) = ($z, 0);
+ $z = cplx($z, 0);
}
- return $acos;
+ return atan2(sqrt(1 - $re * $re), $re)
+ if $im == 0 and abs($re) <= 1.0;
+ my $log = log($z + sqrt($z*$z-1));
+ my ($logre, $logim) = @{$log->cartesian};
+ return cplx( $logim, $logre) if $logim == pi() or $logim == 0;
+ return cplx(-$logim, $logre) if $im == 0;
+ return i * $log if sgn($im) * sgn($re) == -1;
+ return ~i * $log;
}
#
@@ -702,10 +793,15 @@
#
sub asin {
my ($z) = @_;
- $z = cplx($z, 0) unless ref $z;
- my ($re, $im) = @{$z->cartesian};
+ my ($re, $im);
+ if (ref $z) {
+ ($re, $im) = @{$z->cartesian};
+ } else {
+ ($re, $im) = ($z, 0);
+ $z = cplx($z, 0);
+ }
return atan2($re, sqrt(1 - $re * $re))
- if ($im == 0 and abs($re) <= 1.0);
+ if $im == 0 and abs($re) <= 1.0;
return ~i * log(i * $z + sqrt(1 - $z*$z));
}
@@ -719,7 +815,9 @@
$z = cplx($z, 0) unless ref $z;
_divbyzero "atan(i)" if ( $z == i);
_divbyzero "atan(-i)" if (-$z == i);
- return i/2*log((i + $z) / (i - $z));
+ my $log = log((i + $z) / (i - $z));
+ $ip2 = 0.5 * i unless defined $ip2;
+ return $ip2 * $log;
}
#
@@ -730,15 +828,18 @@
sub asec {
my ($z) = @_;
_divbyzero "asec($z)", $z if ($z == 0);
- $z = cplx($z, 0) unless ref $z;
- my ($re, $im) = @{$z->cartesian};
- if ($im == 0 && abs($re) >= 1.0) {
+ my ($re, $im);
+ if (ref $z) {
+ ($re, $im) = @{$z->cartesian};
+ } else {
+ ($re, $im) = ($z, 0);
+ $z = cplx($z, 0);
+ }
+ if ($im == 0 and abs($re) >= 1.0) {
my $ire = 1 / $re;
return atan2(sqrt(1 - $ire * $ire), $ire);
}
my $asec = acos(1 / $z);
- return ~$asec if $re < 0 && $re > -1 && $im == 0;
- return -$asec if $im && !($re > 0 && $im > 0) && !($re < 0 && $im <
0);
return $asec;
}
@@ -750,14 +851,18 @@
sub acsc {
my ($z) = @_;
_divbyzero "acsc($z)", $z if ($z == 0);
- $z = cplx($z, 0) unless ref $z;
- my ($re, $im) = @{$z->cartesian};
- if ($im == 0 && abs($re) >= 1.0) {
+ my ($re, $im);
+ if (ref $z) {
+ ($re, $im) = @{$z->cartesian};
+ } else {
+ ($re, $im) = ($z, 0);
+ $z = cplx($z, 0);
+ }
+ if ($im == 0 and abs($re) >= 1.0) {
my $ire = 1 / $re;
return atan2($ire, sqrt(1 - $ire * $ire));
}
my $acsc = asin(1 / $z);
- return ~$acsc if $re < 0 && $re > -1 && $im == 0;
return $acsc;
}
@@ -928,9 +1033,9 @@
$z = cplx($z, 0) unless ref $z;
my ($re, $im) = @{$z->cartesian};
if ($im == 0 && $re > 1) {
- return cplx(atanh(1 / $re), pi/2);
+ return cplx(atanh(1 / $re), pip2);
}
- return log((1 + $z) / (1 - $z)) / 2;
+ return 0.5 * log((1 + $z) / (1 - $z));
}
#
@@ -980,7 +1085,7 @@
$z = cplx($z, 0) unless ref $z;
my ($re, $im) = @{$z->cartesian};
if ($im == 0 and abs($re) < 1) {
- return cplx(acoth(1/$re) , pi/2);
+ return cplx(acoth(1/$re) , pip2);
}
return log((1 + $z) / ($z - 1)) / 2;
}
@@ -1076,16 +1181,17 @@
my $z = shift;
my ($x, $y) = @{$z->cartesian};
my ($re, $im);
+ my $eps = 1e-14;
- $x = int($x + ($x < 0 ? -1 : 1) * 1e-14)
- if int(abs($x)) != int(abs($x) + 1e-14);
- $y = int($y + ($y < 0 ? -1 : 1) * 1e-14)
- if int(abs($y)) != int(abs($y) + 1e-14);
-
- $re = "$x" if abs($x) >= 1e-14;
- if ($y == 1) { $im = 'i' }
- elsif ($y == -1) { $im = '-i' }
- elsif (abs($y) >= 1e-14) { $im = $y . "i" }
+ $x = int($x + ($x < 0 ? -1 : 1) * $eps)
+ if int(abs($x)) != int(abs($x) + $eps);
+ $y = int($y + ($y < 0 ? -1 : 1) * $eps)
+ if int(abs($y)) != int(abs($y) + $eps);
+
+ $re = "$x" if abs($x) >= $eps;
+ if ($y == 1) { $im = 'i' }
+ elsif ($y == -1) { $im = '-i' }
+ elsif (abs($y) >= $eps) { $im = $y . "i" }
my $str = '';
$str = $re if defined $re;
@@ -1110,10 +1216,9 @@
return '[0,0]' if $r <= $eps;
- my $tpi = 2 * pi;
- my $nt = $t / $tpi;
- $nt = ($nt - int($nt)) * $tpi;
- $nt += $tpi if $nt < 0; # Range [0, 2pi]
+ my $nt = $t / pit2;
+ $nt = ($nt - int($nt)) * pit2;
+ $nt += pit2 if $nt < 0; # Range [0, 2pi]
if (abs($nt) <= $eps) { $theta = 0 }
elsif (abs(pi-$nt) <= $eps) { $theta = 'pi' }
@@ -1131,7 +1236,7 @@
# Okay, number is not a real. Try to identify pi/n and friends...
#
- $nt -= $tpi if $nt > pi;
+ $nt -= pit2 if $nt > pi;
my ($n, $k, $kpi);
for ($k = 1, $kpi = pi; $k < 10; $k++, $kpi += pi) {
--- t/lib/complex.t.dist Sun Aug 24 18:36:51 1997
+++ t/lib/complex.t Mon Aug 25 11:07:50 1997
@@ -99,7 +99,10 @@
'acoth(1)',
);
+my $zero = cplx(0, 0);
+
test_loz(
+ 'log($zero)',
'atanh(-1)',
'acoth(-1)',
);
@@ -372,8 +375,8 @@
|'abs(z)':'r'
|'acot(z)':'acotan(z)'
|'acsc(z)':'acosec(z)'
-|'abs(acsc(z))':'abs(asin(1 / z))'
-|'abs(asec(z))':'abs(acos(1 / z))'
+|'acsc(z)':'asin(1 / z)'
+|'asec(z)':'acos(1 / z)'
|'cbrt(z)':'cbrt(r) * exp(i * t/3)'
|'cos(acos(z))':'z'
|'cos(z) ** 2 + sin(z) ** 2':1
@@ -429,6 +432,20 @@
|'asinh(sinh(z))':'z'
|'atan(tan(z))':'z'
|'atanh(tanh(z))':'z'
+
+&log
+(-2.0,0):( 0.69314718055995, 3.14159265358979)
+(-1.0,0):( 0 , 3.14159265358979)
+(-0.5,0):( -0.69314718055995, 3.14159265358979)
+( 0.5,0):( -0.69314718055995, 0 )
+( 1.0,0):( 0 , 0 )
+( 2.0,0):( 0.69314718055995, 0 )
+
+&log
+( 2, 3):( 1.28247467873077, 0.98279372324733)
+(-2, 3):( 1.28247467873077, 2.15879893034246)
+(-2,-3):( 1.28247467873077, -2.15879893034246)
+( 2,-3):( 1.28247467873077, -0.98279372324733)
&sin
(-2.0,0):( -0.90929742682568, 0 )
--
# John Clutterbuck Tel: +44 1703 765021
# Siemens Business Services email: jclutterbuck@sbs.siemens.co.uk
# Phi House, Enterprise Road
# Chilworth, Hampshire, SO16 7NS
------------------------------
Date: 13 Oct 1997 12:31:20 +0200
From: robert@il.fontys.nl (robert)
Subject: Re: A brief request (string handling)
Message-Id: <61st9o$la@bsd1.hqehv-internal.ilse.net>
Falcon@darkwave.org.uk:
>textarea1 :lots
> of stuff
> here
>On the QUERY_STRING, I can see the return chars as:
>%0D%0A
>What I want to do, is output the information to ONE line in
>a file as well as mail, and I can do this up until I get to
>the textarea as it writes the return chars in.
>How can I search the string and replace the return chars with
>spaces or other pre-chosen chars?
$textarea =~ s/%0D%0A/ /g;
^ (or whatever character(s) you want)
robert
------------------------------
Date: Sun, 12 Oct 1997 22:37:58 +0200
From: stoffer@netcetera.dk (Gustav Kristoffer Ek)
Subject: an other way?
Message-Id: <stoffer-1210972237580001@loke.netcetera.dk>
Is'n it possible to do the following two matches in one regexp, maybe with
the negative lookahead?
I'm readig from a standard apache 'access_log' file, and only wants the
requst part.
One line could look like:
'host.domaine.name - - [12/Oct/1997:22:24:32 +0200] "GET /index.html
HTTP/1.0" 200 6734'
while (<LOGFILE>) {
if (m/(?:GET|POST) ([\w\d\%\.\-\$\?\=\/]+)/i) {
$request = $1;
unless ($request =~ m/gif|jpeg|jpg$/i) {
print "$request\n";
}
}
}
close LOGFILE;
- gustav
---------------------------------------------------------------------
Gustav Kristoffer Ek - Netcetera - Finsensvej 80 - 2000 Frederiksberg
tlf 38 88 32 22 / 20 40 00 05 / 38 88 20 38 ext 341 - Fax 38 88 30 38
Webdesign, Webhotel, Mailhotel, UUCP og mere http://www.netcetera.dk/
------------------------------
Date: 13 Oct 1997 08:59:26 +0200
From: ckc@dmi.min.dk (Casper K. Clausen)
Subject: Re: Can someone look at this and tell me why it doesn't work!!
Message-Id: <wvp4t6m2lo1.fsf@hobbes.dmi.min.dk>
>>>>> "Jeff" == Jeff Gostin <jgostin@shell2.ba.best.com> writes:
Jeff> Is there a way to determine if a scalar (or an array element, or
Jeff> whatever) contains a numeric sequence or an alphanumeric
Jeff> sequence?
Ummm.... How about:
if ($variable =~ /[\d\.]+/) {
print "It's a number!";
} else {
print "It's a string!";
};
Or is this too easy?
Regards,
Kvan.
--
-------Casper Kvan Clausen------ | 'Ah, Warmark, everything that passes
----------<ckc@dmi.dk>---------- | unattempted is impossible.'
Lokal 544 |
I do not speak for DMI, just me. | - Lord Mhoram, Son of Variol.
------------------------------
Date: 13 Oct 1997 08:02:18 GMT
From: Jeff Gostin <jgostin@shell2.ba.best.com>
Subject: Re: Can someone look at this and tell me why it doesn't work!!
Message-Id: <61skia$3h6$2@nntp1.ba.best.com>
Casper K. Clausen <ckc@dmi.min.dk> wrote:
: if ($variable =~ /[\d\.]+/) {
: print "It's a number!";
: } else {
: print "It's a string!";
: };
: Or is this too easy?
I appreciate the snippet, and tried it out to see how it'd work. Given the
following:
#!/usr/local/bin/perl5 -w
$variable = "123abc123";
# Casper's code below
if ($variable =~ /[\d\.]+/) {
print "It's a number!";
} else {
print "It's a string!";
};
... the code prints "It's a number" when, in fact, $variable is _not_
numeric. However, I thought through what you were doing with the regexp, and
made a slight change:
#!/usr/local/bin/perl5 -w
$variable = "abc123123";
# Jeff's mod of Casper's code -- note the changed regexp.
if ($variable =~ /^\w\d+$/) {
print "It's a number!\n";
} else {
print "It's a string!\n";
};
This does appear to work correctly, tested for "abc123123", "123abc123", and
"123"... and my question is answered. I was wrong in my assumptions, and
glad to be wrong. Thanks for the insight! I appreciate it! :)
--Jeff
------------------------------
Date: 13 Oct 1997 10:36:23 +0200
From: ckc@dmi.min.dk (Casper K. Clausen)
Subject: Re: Can someone look at this and tell me why it doesn't work!!
Message-Id: <wvp3em62h6g.fsf@hobbes.dmi.min.dk>
>>>>> "Jeff" == Jeff Gostin <jgostin@shell2.ba.best.com> writes:
Jeff> I appreciate the snippet, and tried it out to see how it'd
Jeff> work. Given the following:
You tried it out, huh? Well, I just popped it off the top of my head,
so it figures it wouldn't work :) It was a stupid mistake, though, no
excuses there.
One thing, though:
You may still want to allow for \., since that would make
floating-point numbers numeric--which sort of makes sense.
Kvan.
--
-------Casper Kvan Clausen------ | 'Ah, Warmark, everything that passes
----------<ckc@dmi.dk>---------- | unattempted is impossible.'
Lokal 544 |
I do not speak for DMI, just me. | - Lord Mhoram, Son of Variol.
------------------------------
Date: Mon, 13 Oct 1997 09:21:46 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Getting File Information Quickly
Message-Id: <3441d31f.1294033@news.tornado.be>
franklin@nospamingideas4you.com wrote:
>This can be done with opendir() and readdir(). What I need quick access
>to is file size, if it's a directory or not, etc... I finally found the
>stat() function but the problem is the only thing I can see in that
>information that may tell me wether or not it's a directory is $nlink.
How about using the -x type of operators on every entry in the
directory? See PERLFUNC.POD, section"-X EXPR". Something along these
lines:
opendir(DIR,$dirpath);
local($\,$,)=("\n","\t");
my($dirsep,$fullpath,$info) = '/'; #set $dirsep
foreach $file (sort readdir(DIR)){
$fullpath = "$dirpath$dirsep$file";
if (-d $fullpath) {
#It's a directory
$info = "Directory"
} elsif (-f $fullpath) {
#it's a file
$info = "file, size = " . -s $fullpath;
} elsif (-l $fullpath) {
#it's a link
$info = "link";
} else {
$info = "???"
}
print $file,$info;
}
closedir(DIR);
HTH,
Bart.
------------------------------
Date: Mon, 13 Oct 1997 11:52:36 +0100
From: "Jonathan Tracey" <jon.tracey@earthling.net>
Subject: Re: Getting PERL for NT and installing it.
Message-Id: <61suht$dji$1@soap.uunet.pipex.com>
You can download the latest version from www.activeware.com
Jon
------------------------------
Date: Mon, 13 Oct 1997 07:37:34 GMT
From: revok@aol.com (john sandstrom)
Subject: makefile problem
Message-Id: <3441cf4c.5113287@netnews.worldnet.att.net>
Just tried to compile 5.004_01 on WIN95, and nmake understandably had
trouble with the following line in the makefile:
cd .. && miniperl configpm
I know my DOS, but this line makes no sense to me. The compilation
gave me a functional perl.exe and perl.dll, but no perlglob.exe.
Am I doing something wrong? Any help is appreciated.
------------------------------
Date: Mon, 13 Oct 1997 09:17:08 GMT
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Newbie question; how to redirect
Message-Id: <Pine.A41.3.95a.971013111336.84900C-100000@sp051>
On Sun, 12 Oct 1997, Petri Backstrom wrote:
> <meta http-equiv="REFRESH"
> content="2; url=http://newhost.com/newpage.html">
That's not a genuine redirect. And how are you going to make it work
for any text/plain, image/gifs and jpegs etc. that have moved?
Routine gripe: this isn't a Perl language question. Since you
haven't obviously turned it into a CGI question either, I'm setting
f'ups to c.i.w.a.misc
------------------------------
Date: 13 Oct 1997 08:10:48 GMT
From: ericm@iol.ie (Eric Mosley)
Subject: perl mailing list
Message-Id: <61sl28$2ga$1@nuacht.iol.ie>
Can someone forward me information on the most popular perl mailing list
and how to subscribe?
Thanks,
Eric.
------------------------------
Date: Mon, 13 Oct 1997 17:24:54 +0800
From: Gihan Perera <gihan@firststep.com.au>
Subject: Re: Protecting Perl source code against copyright...how?
Message-Id: <3441E8E6.5E8D08F5@firststep.com.au>
[Set followups]
Andrew M. Langmead wrote:
> [Quoting the FAQ here]
> > How can I hide the source for my Perl program?
> >
> > First of all, however, you *can't* take away read permission, because
> > the source code has to be readable in order to be compiled and
> > interpreted. (That doesn't mean that a CGI script's source is readable
> > by people on the web, though.) So you have to leave the permissions at
> > the socially friendly 0755 level.
Actually, you CAN do a bit better than that for CGI. If you use
CGIWrap to run all your CGI programs, then you can set permissions
at 0700, which is a lot better, especially if you have an account
on a public server (e.g. an ISP).
With 0755, while general Web users might not be able to read
your scripts, a thief could get them by the laughably simple
method of signing up for an account on the same machine.
Regards,
Gihan
______________________________________________________________________
Gihan Perera (gihan@firststep.com.au) First Step Communications
http://www.firststep.com.au
How to stay One Step Ahead: Phone: +61 8 9444 1225
http://www.firststep.com.au/newsletter/ Fax: +61 8 9444 1384
------------------------------
Date: 13 Oct 1997 10:30:12 GMT
From: toutatis@_SPAMTRAP_toutatis.net (Toutatis)
Subject: Re: Q: Dynamically creating hashes and arrays
Message-Id: <toutatis-ya023180001310971230120001@news.euro.net>
In article <toutatis-ya023180001310970322550001@news.euro.net>, I wrote:
> I am almost sure there are still bugs in it, but -w
> and 'strict' will help you a long way.
Here's one:
Change:
> while (@lines && ($lines[0] !~ /S-E-Bankens/)){
Into:
while (@lines && ($lines[0] =~ /^\d/)){
#to deal with empty lines
--
Toutatis
------------------------------
Date: 13 Oct 1997 12:43:53 +0200
From: robert@il.fontys.nl (robert)
Subject: Re: Searchable Database.
Message-Id: <61su19$mo@bsd1.hqehv-internal.ilse.net>
Amy Dorsett <adorsett@gonzaga.edu>:
>I am working on a project which entails implementing a searchable database
>via the internet using PERL/CGI. I have programming experience (but
>none with PERL CGI) and know my database pretty well but combinig the two
>(and learning PERL) is not working...
Perhaps you could look around if someone already made a useful Perl
interface to the database you use (look around with your-favourite-
searchengine, or perhaps even post a message on here asking people
if they know of such an interface).
robert
------------------------------
Date: 13 Oct 1997 10:00:17 +0200
From: Olivier Dehon <dehon_olivier@jpmorgan.com>
Subject: Re: the oddest syntax error
Message-Id: <njzd8la6qjy.fsf@jpmorgan.com>
Kenneth Taborek <oberon@nospam.erols.com> writes:
> I have encountered an error which I cannot come to terms with. The
> program below has been stripped of all extraneous lines. But, prior to
> paring it down, I had a small loop which printed the key-element pairs
> of %rot13, and it worked fine. Then I noticed that @temp2 should fall
> in range (a..m) instead of (a..n). When I made this change, I got the
> following syntax error.
>
> syntax error at ./thingy.pl line 12, near "if"
> Execution of ./thingy.pl aborted due to compilation errors.
>
> Here is my script:
>
>
> #! /usr/bin/perl
>
> $i = 0;
> %rot13 = {};
>
> @alpha = (a..z);
> @temp1 = (n..z);
> @temp2 = (a..n);
>
> for ($i = 0; $i < 26; $i++) {
>
> if ($i < 13) {
>
> $rot13{$alpha[$i]} = $alpha[($i + 13)];
> }
> else {
> $rot13{@alpha[$i]} = $alpha[($i - 13)];
> }
> }
>
>
>
> Now, I am a complete beginner to perl, and may have made some basic
> error, but I do not see how changing the range of elements in an array
> could make the difference between working and breaking.
>
m is a reserved keyword (the match operator).
Use @temp2 = ('a'..'m'); instead.
Never forget to use the -w switch ...
Hope this helps.
Olivier Dehon.
------------------------------
Date: Mon, 13 Oct 1997 10:23:18 +0100
From: John Clutterbuck <jclutterbuck@sbs.siemens.co.uk>
Subject: Re: Wouldn't it be great
Message-Id: <3441E886.167E@sbs.siemens.co.uk>
Tracy Bednar wrote:
>
> Wouldn't it be great if there was
>
> Perl Access instead of Access?
> Visual Perl instead of VB?
> Visual Perl++ instead of Visual C++ (This would already be in Visual Perl)
> asm { } code allowed in perl
> The Perl Virtual Machine
>
> - T
We have perl, DBI and perlTK. I think that is pretty Good.
Billy would have us do something else of course!
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 1167
**************************************