golden hour
/usr/share/perl5/vendor_perl
⬆️ Go Up
Upload
File/Folder
Size
Actions
App
-
Del
OK
Archive
-
Del
OK
B
-
Del
OK
Bundle
-
Del
OK
Business
-
Del
OK
CGI
-
Del
OK
CGI.pm
255.24 KB
Del
OK
CPAN
-
Del
OK
CPANPLUS
-
Del
OK
CPANPLUS.pm
7.05 KB
Del
OK
Carp
-
Del
OK
Carp.pm
19.93 KB
Del
OK
DBIx
-
Del
OK
Data
-
Del
OK
Date
-
Del
OK
Devel
-
Del
OK
Digest
-
Del
OK
Digest.pm
10.35 KB
Del
OK
Encode
-
Del
OK
Env.pm
5.39 KB
Del
OK
Error
-
Del
OK
Error.pm
24.27 KB
Del
OK
Expect.pm
53.44 KB
Del
OK
Expect.pod
42.71 KB
Del
OK
Exporter
-
Del
OK
Exporter.pm
18.31 KB
Del
OK
ExtUtils
-
Del
OK
Fatal.pm
45.16 KB
Del
OK
File
-
Del
OK
Getopt
-
Del
OK
Git
-
Del
OK
Git.pm
42.55 KB
Del
OK
HTML
-
Del
OK
HTTP
-
Del
OK
IO
-
Del
OK
IPC
-
Del
OK
JSON
-
Del
OK
LWP
-
Del
OK
Locale
-
Del
OK
Log
-
Del
OK
Module
-
Del
OK
Mozilla
-
Del
OK
Net
-
Del
OK
POD2
-
Del
OK
Params
-
Del
OK
Parse
-
Del
OK
Perl
-
Del
OK
Perl4
-
Del
OK
Pod
-
Del
OK
RPC
-
Del
OK
Switch.pm
27.79 KB
Del
OK
TAP
-
Del
OK
Term
-
Del
OK
Test
-
Del
OK
Text
-
Del
OK
Thread
-
Del
OK
Time
-
Del
OK
Try
-
Del
OK
Types
-
Del
OK
Version
-
Del
OK
WWW
-
Del
OK
abbrev.pl
819 B
Del
OK
assert.pl
1.27 KB
Del
OK
autodie
-
Del
OK
autodie.pm
11.83 KB
Del
OK
bigfloat.pl
7.14 KB
Del
OK
bigint.pl
8.71 KB
Del
OK
bigrat.pl
4.35 KB
Del
OK
cacheout.pl
1.1 KB
Del
OK
chat2.pl
9.73 KB
Del
OK
common
-
Del
OK
complete.pl
3.12 KB
Del
OK
constant.pm
13.04 KB
Del
OK
ctime.pl
1.93 KB
Del
OK
dotsh.pl
2.12 KB
Del
OK
exceptions.pl
1.7 KB
Del
OK
fastcwd.pl
1019 B
Del
OK
find.pl
1.16 KB
Del
OK
finddepth.pl
1.1 KB
Del
OK
flush.pl
642 B
Del
OK
ftp.pl
23.53 KB
Del
OK
getcwd.pl
1.37 KB
Del
OK
getopt.pl
1.27 KB
Del
OK
getopts.pl
1.35 KB
Del
OK
hostname.pl
727 B
Del
OK
importenv.pl
283 B
Del
OK
inc
-
Del
OK
lib
-
Del
OK
local
-
Del
OK
look.pl
1.23 KB
Del
OK
newgetopt.pl
2.15 KB
Del
OK
open2.pl
185 B
Del
OK
open3.pl
185 B
Del
OK
parent.pm
2.83 KB
Del
OK
perldoc.pod
8.25 KB
Del
OK
pwd.pl
1.44 KB
Del
OK
shellwords.pl
280 B
Del
OK
stat.pl
525 B
Del
OK
syslog.pl
4.69 KB
Del
OK
tainted.pl
164 B
Del
OK
termcap.pl
4.02 KB
Del
OK
timelocal.pl
690 B
Del
OK
validate.pl
3.64 KB
Del
OK
Edit: bigfloat.pl
package bigfloat; require "bigint.pl"; # # This library is no longer being maintained, and is included for backward # compatibility with Perl 4 programs which may require it. # # In particular, this should not be used as an example of modern Perl # programming techniques. # # Suggested alternative: Math::BigFloat # # Arbitrary length float math package # # by Mark Biggar # # number format # canonical strings have the form /[+-]\d+E[+-]\d+/ # Input values can have embedded whitespace # Error returns # 'NaN' An input parameter was "Not a Number" or # divide by zero or sqrt of negative number # Division is computed to # max($div_scale,length(dividend)+length(divisor)) # digits by default. # Also used for default sqrt scale $div_scale = 40; # Rounding modes one of 'even', 'odd', '+inf', '-inf', 'zero' or 'trunc'. $rnd_mode = 'even'; # bigfloat routines # # fadd(NSTR, NSTR) return NSTR addition # fsub(NSTR, NSTR) return NSTR subtraction # fmul(NSTR, NSTR) return NSTR multiplication # fdiv(NSTR, NSTR[,SCALE]) returns NSTR division to SCALE places # fneg(NSTR) return NSTR negation # fabs(NSTR) return NSTR absolute value # fcmp(NSTR,NSTR) return CODE compare undef,<0,=0,>0 # fround(NSTR, SCALE) return NSTR round to SCALE digits # ffround(NSTR, SCALE) return NSTR round at SCALEth place # fnorm(NSTR) return (NSTR) normalize # fsqrt(NSTR[, SCALE]) return NSTR sqrt to SCALE places # Convert a number to canonical string form. # Takes something that looks like a number and converts it to # the form /^[+-]\d+E[+-]\d+$/. sub main'fnorm { #(string) return fnum_str local($_) = @_; s/\s+//g; # strip white space if (/^([+-]?)(\d*)(\.(\d*))?([Ee]([+-]?\d+))?$/ && ($2 ne '' || defined($4))) { my $x = defined($4) ? $4 : ''; &norm(($1 ? "$1$2$x" : "+$2$x"), (($x ne '') ? $6-length($x) : $6)); } else { 'NaN'; } } # normalize number -- for internal use sub norm { #(mantissa, exponent) return fnum_str local($_, $exp) = @_; if ($_ eq 'NaN') { 'NaN'; } else { s/^([+-])0+/$1/; # strip leading zeros if (length($_) == 1) { '+0E+0'; } else { $exp += length($1) if (s/(0+)$//); # strip trailing zeros sprintf("%sE%+ld", $_, $exp); } } } # negation sub main'fneg { #(fnum_str) return fnum_str local($_) = &'fnorm($_[0]); vec($_,0,8) ^= ord('+') ^ ord('-') unless $_ eq '+0E+0'; # flip sign if ( ord("\t") == 9 ) { # ascii s/^H/N/; } else { # ebcdic character set s/\373/N/; } $_; } # absolute value sub main'fabs { #(fnum_str) return fnum_str local($_) = &'fnorm($_[0]); s/^-/+/; # mash sign $_; } # multiplication sub main'fmul { #(fnum_str, fnum_str) return fnum_str local($x,$y) = (&'fnorm($_[0]),&'fnorm($_[1])); if ($x eq 'NaN' || $y eq 'NaN') { 'NaN'; } else { local($xm,$xe) = split('E',$x); local($ym,$ye) = split('E',$y); &norm(&'bmul($xm,$ym),$xe+$ye); } } # addition sub main'fadd { #(fnum_str, fnum_str) return fnum_str local($x,$y) = (&'fnorm($_[0]),&'fnorm($_[1])); if ($x eq 'NaN' || $y eq 'NaN') { 'NaN'; } else { local($xm,$xe) = split('E',$x); local($ym,$ye) = split('E',$y); ($xm,$xe,$ym,$ye) = ($ym,$ye,$xm,$xe) if ($xe < $ye); &norm(&'badd($ym,$xm.('0' x ($xe-$ye))),$ye); } } # subtraction sub main'fsub { #(fnum_str, fnum_str) return fnum_str &'fadd($_[0],&'fneg($_[1])); } # division # args are dividend, divisor, scale (optional) # result has at most max(scale, length(dividend), length(divisor)) digits sub main'fdiv #(fnum_str, fnum_str[,scale]) return fnum_str { local($x,$y,$scale) = (&'fnorm($_[0]),&'fnorm($_[1]),$_[2]); if ($x eq 'NaN' || $y eq 'NaN' || $y eq '+0E+0') { 'NaN'; } else { local($xm,$xe) = split('E',$x); local($ym,$ye) = split('E',$y); $scale = $div_scale if (!$scale); $scale = length($xm)-1 if (length($xm)-1 > $scale); $scale = length($ym)-1 if (length($ym)-1 > $scale); $scale = $scale + length($ym) - length($xm); &norm(&round(&'bdiv($xm.('0' x $scale),$ym),&'babs($ym)), $xe-$ye-$scale); } } # round int $q based on fraction $r/$base using $rnd_mode sub round { #(int_str, int_str, int_str) return int_str local($q,$r,$base) = @_; if ($q eq 'NaN' || $r eq 'NaN') { 'NaN'; } elsif ($rnd_mode eq 'trunc') { $q; # just truncate } else { local($cmp) = &'bcmp(&'bmul($r,'+2'),$base); if ( $cmp < 0 || ($cmp == 0 && ( $rnd_mode eq 'zero' || ($rnd_mode eq '-inf' && (substr($q,0,1) eq '+')) || ($rnd_mode eq '+inf' && (substr($q,0,1) eq '-')) || ($rnd_mode eq 'even' && $q =~ /[24680]$/) || ($rnd_mode eq 'odd' && $q =~ /[13579]$/) )) ) { $q; # round down } else { &'badd($q, ((substr($q,0,1) eq '-') ? '-1' : '+1')); # round up } } } # round the mantissa of $x to $scale digits sub main'fround { #(fnum_str, scale) return fnum_str local($x,$scale) = (&'fnorm($_[0]),$_[1]); if ($x eq 'NaN' || $scale <= 0) { $x; } else { local($xm,$xe) = split('E',$x); if (length($xm)-1 <= $scale) { $x; } else { &norm(&round(substr($xm,0,$scale+1), "+0".substr($xm,$scale+1,1),"+10"), $xe+length($xm)-$scale-1); } } } # round $x at the 10 to the $scale digit place sub main'ffround { #(fnum_str, scale) return fnum_str local($x,$scale) = (&'fnorm($_[0]),$_[1]); if ($x eq 'NaN') { 'NaN'; } else { local($xm,$xe) = split('E',$x); if ($xe >= $scale) { $x; } else { $xe = length($xm)+$xe-$scale; if ($xe < 1) { '+0E+0'; } elsif ($xe == 1) { # The first substr preserves the sign, which means that # we'll pass a non-normalized "-0" to &round when rounding # -0.006 (for example), purely so that &round won't lose # the sign. &norm(&round(substr($xm,0,1).'0', "+0".substr($xm,1,1),"+10"), $scale); } else { &norm(&round(substr($xm,0,$xe), "+0".substr($xm,$xe,1),"+10"), $scale); } } } } # compare 2 values returns one of undef, <0, =0, >0 # returns undef if either or both input value are not numbers sub main'fcmp #(fnum_str, fnum_str) return cond_code { local($x, $y) = (&'fnorm($_[0]),&'fnorm($_[1])); if ($x eq "NaN" || $y eq "NaN") { undef; } else { ord($y) <=> ord($x) || ( local($xm,$xe,$ym,$ye) = split('E', $x."E$y"), (($xe <=> $ye) * (substr($x,0,1).'1') || &bigint'cmp($xm,$ym)) ); } } # square root by Newtons method. sub main'fsqrt { #(fnum_str[, scale]) return fnum_str local($x, $scale) = (&'fnorm($_[0]), $_[1]); if ($x eq 'NaN' || $x =~ /^-/) { 'NaN'; } elsif ($x eq '+0E+0') { '+0E+0'; } else { local($xm, $xe) = split('E',$x); $scale = $div_scale if (!$scale); $scale = length($xm)-1 if ($scale < length($xm)-1); local($gs, $guess) = (1, sprintf("1E%+d", (length($xm)+$xe-1)/2)); while ($gs < 2*$scale) { $guess = &'fmul(&'fadd($guess,&'fdiv($x,$guess,$gs*2)),".5"); $gs *= 2; } &'fround($guess, $scale); } } 1;
Save