summaryrefslogtreecommitdiff
path: root/numeric.c
Commit message (Collapse)AuthorAgeFilesLines
* Add :not_characters parameter to 'use locale'Karl Williamson2012-01-211-2/+2
| | | | | This adds the parameter handling, tests, and documentation for this new feature which allows locale and Unicode to play well with each other.
* diag_listed_as galoreFather Chrysostomos2011-12-281-0/+3
| | | | | In two instances, I actually modified to code to avoid %s for a constant string, as it should be faster that way.
* Add flag to num groks to silence non-portable warningsKarl Williamson2011-07-031-3/+18
| | | | | | | Unicode inversion lists commonly will contain UV_MAX, which may trigger these warnings. Add a flag to suppress them to the numeric grok functions, which can be set by the code that is dealing with these lists
* [perl #32380] numeric.c assumes that NV_DIG+2 will be enough digitsEd Allen Smith2010-10-031-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | for all precision possible in NV numeric.c, in the Perl_my_atof2 function, makes the following assumption: /* There is no point in processing more significant digits * than the NV can hold. Note that NV_DIG is a lower-bound value, * while we need an upper-bound value. We add 2 to account for this; * since it will have been conservative on both the first and last digit. * For example a 32-bit mantissa with an exponent of 4 would have * exact values in the set * 4 * 8 * .. * 17179869172 * 17179869176 * 17179869180 * * where for the purposes of calculating NV_DIG we would have to discount * both the first and last digit, since neither can hold all values from * 0..9; but for calculating the value we must examine those two digits. */ #define MAX_SIG_DIGITS (NV_DIG+2) Digits beyond MAX_SIG_DIGITS are ignored. In some systems and/or modes (e.g., with/without using long doubles), this is not the case. One example is IRIX when using long doubles, which are not fully IEEE compliant; with it, while NV_DIG (the _minimum_ number of digits usable) is 31 for long doubles used as NVs, long doubles can have up to 34 digits of accuracy. (As well as IRIX with long doubles, other machines using a mode in which NV is not IEEE compliant (e.g., as found by the following from numeric.c: #ifdef ((defined(VMS) && !defined(__IEEE_FP)) || defined(_UNICOS)) (although UNICOS does not by default use Perl's atof in any event) or as noted in the hints files for DEC OSF with the old MIPS CC) may benefit from a change to this.) I will attach a test program, example set of problematic outputs, and experimental patch so others can explore this on their systems. (With the patch and a -Accflags='-DMAX_SIG_DIG_PLUS=3' (or -Accflags='-DMAX_SIG_DIG_PLUS=4'), the test program was successful. Different values of MAX_SIG_DIG_PLUS may need to be experimented with, especially with different other Configure/compiler flags (long doubles yes/no, optimization affecting floating point, etcetera); 3 was the maximum that did any good on IRIX with long doubles, but others may differ.) I have done some local testing (as in the normal testsuite) of the patch and different -DMAX_SIG_DIG_PLUS values, and will be doing more; it is possible that it would be best to build in the test program into, say, numconvert.t. Patching hints/irix_6.sh to use -DMAX_SIG_DIG_PLUS=3 if long doubles are in use, or a define of MAX_SIG_DIG_PLUS to 3 if defined(IRIX) and long doubles are in use, is also advisable; I have not included either in my patch because I was unsure which was recommended practice.
* Correct pod in numeric.cKarl Williamson2010-07-271-1/+1
|
* Code for allowing uppercase X/B in hexadecimal/binary numbers (#76296).Bo Lindbergh2010-07-061-4/+4
| | | | Signed-off-by: David Golden <dagolden@cpan.org>
* use cBOOL for bool castsDavid Mitchell2010-04-151-3/+3
| | | | | | | | | | | | | bool b = (bool)some_int doesn't necessarily do what you think. In some builds, bool is defined as char, and that cast's behaviour is thus undefined. So this line in mg.c: const bool was_temp = (bool)SvTEMP(sv); was actually setting was_temp to false even when the SVs_TEMP flag was set. Fix this by replacing all the (bool) casts with a new cBOOL() cast macro that (hopefully) does the right thing.
* Add Perl_ck_warner_d(), which combines Perl_ckwarn_d() and Perl_warner().Nicholas Clark2009-10-121-9/+6
| | | | | Replace ckWARN_d{,2,3,4}() && Perl_warner() with it, which trades reduced code size for 1 more function call if warnings are not enabled.
* Add Perl_ck_warner(), which combines Perl_ckwarn() and Perl_warner().Nicholas Clark2009-10-121-17/+14
| | | | | | | Replace ckWARN{,2,3,4}() && Perl_warner() with it, which trades reduced code size (about 0.2%), for 1 more function call if warnings are not enabled. However, if we're now in the L1 or L2 cache when we weren't previously, that's still going to be a speed win.
* PATCH: Large omnibus patch to clean up the JRRT quotesTom Christiansen2008-11-021-2/+4
| | | | | | Message-ID: <25940.1225611819@chthon> Date: Sun, 02 Nov 2008 01:43:39 -0600 p4raw-id: //depot/perl@34698
* Update copyright years.Nicholas Clark2008-10-251-1/+1
| | | p4raw-id: //depot/perl@34585
* assert() that every NN argument is not NULL. Otherwise we have theNicholas Clark2008-02-121-5/+31
| | | | | | | | | | | | ability to create landmines that will explode under someone in the future when they upgrade their compiler to one with better optimisation. We've already done this at least twice. (Yes, some of the assertions are after code that would already have SEGVd because it already deferences a pointer, but they are put in to make it easier to automate checking that each and every case is covered.) Add a tool, checkARGS_ASSERT.pl, to check that every case is covered. p4raw-id: //depot/perl@33291
* Fix up copyright years for files modified in 2007.Nicholas Clark2007-11-071-2/+2
| | | p4raw-id: //depot/perl@32237
* The revenge of the constsAndy Lester2007-05-031-3/+2
| | | | | Message-ID: <20070503054554.GA30975@petdance.com> p4raw-id: //depot/perl@31123
* signbit detection (was [perl #39875] -0.0 loses signedness upon numeric ↵Andy Dougherty2007-02-101-0/+32
| | | | | | | comparison) Message-ID: <Pine.LNX.4.62.0702091121400.10202@fractal.phys.lafayette.edu> p4raw-id: //depot/perl@30192
* unused context warningsAndy Lester2006-02-241-0/+4
| | | | | Message-ID: <20060221062711.GA16160@petdance.com> p4raw-id: //depot/perl@27300
* Update copyright years (including some years where we made changes butNicholas Clark2006-01-081-1/+1
| | | | | did not update) p4raw-id: //depot/perl@26732
* sprinkle dVARJarkko Hietaniemi2006-01-061-0/+2
| | | | | Message-ID: <43BE7C4D.1010302@gmail.com> p4raw-id: //depot/perl@26675
* Etta James presents: More constingAndy Lester2005-10-311-3/+3
| | | | | Message-ID: <20051031054413.GA10767@petdance.com> p4raw-id: //depot/perl@25915
* Add a new file, mathoms.c, to hold old code kept around for binarySteve Peters2005-10-281-16/+0
| | | | | | | compatability with previous versions of Perl. Change also includes various Makefile changes to compile the new file and link it into libperl. p4raw-id: //depot/perl@25866
* Make some casts explicit to keep VC++ 7 happySteve Hay2005-10-171-3/+3
| | | | | | | | Specifically, this silences the warnings from the following smoke: http://www.nntp.perl.org/group/perl.daily-build.reports/32258 (Hmm. Looks like you need to decode the base64 yourself before you can read that.) p4raw-id: //depot/perl@25779
* 5.9.x (and 5.8.x): Symbian updateJarkko Hietaniemi2005-08-181-1/+1
| | | | | Message-ID: <B356D8F434D20B40A8CEDAEC305A1F24E7A41B@esebe105.NOE.Nokia.com> p4raw-id: //depot/perl@25304
* Re: [perl #36654] Inconsistent treatment of NaNYitzchak Scott-Thoennes2005-08-171-0/+15
| | | | | | | | | | | Date: Aug 7, 2005 8:03 PM Message-ID: <20050807180308.GA2112@efn.org> Subject: Re: [perl #36654] Inconsistent treatment of NaN From: Yitzchak Scott-Thoennes <sthoenna@efn.org> Date: Wed, 10 Aug 2005 22:53:51 -0700 Message-ID: <20050811055351.GA2296@efn.org> p4raw-id: //depot/perl@25299
* Random cleanups #47Andy Lester2005-06-071-1/+1
| | | | | Message-ID: <20050606151107.GC7022@petdance.com> p4raw-id: //depot/perl@24735
* consting-eleventy.patch: More consts, plus actual bug fixAndy Lester2005-05-161-2/+1
| | | | | Message-ID: <20050516151353.GA25387@petdance.com> p4raw-id: //depot/perl@24489
* Include vim/emacs modelines in generated files to open themRafael Garcia-Suarez2005-05-111-2/+2
| | | | | | in read-only mode. Make vi modelines compatible with non-vim vi versions. p4raw-id: //depot/perl@24445
* Add editor boilerplates to all C filesRafael Garcia-Suarez2005-05-101-0/+10
| | | | | (except the generated ones) p4raw-id: //depot/perl@24440
* Symbian port of PerlJarkko Hietaniemi2005-04-211-0/+1
| | | | | Message-ID: <B356D8F434D20B40A8CEDAEC305A1F2453D653@esebe105.NOE.Nokia.com> p4raw-id: //depot/perl@24271
* Update copyrights.Rafael Garcia-Suarez2005-03-301-1/+1
| | | p4raw-id: //depot/perl@24106
* Consting part 4Andy Lester2005-03-251-8/+8
| | | | | Message-ID: <20050325204331.GA16388@petdance.com> p4raw-id: //depot/perl@24079
* Third consting batchAndy Lester2005-03-241-5/+5
| | | | | Message-Id: <2f14220e7101a03f7659dbe79a03b115@petdance.com> p4raw-id: //depot/perl@24074
* More const parmsAndy Lester2005-03-181-9/+9
| | | | | Message-ID: <20050314195954.GB7141@petdance.com> p4raw-id: //depot/perl@24042
* Add comment to the top of most .c files explaining their purposeDave Mitchell2004-07-311-0/+6
| | | p4raw-id: //depot/perl@23176
* Fix and update Perl_grok_* docs.Marcus Holland-Moritz2004-07-311-7/+29
| | | p4raw-id: //depot/perl@23173
* If it's S_, it should be STATIC.Jarkko Hietaniemi2003-04-291-1/+1
| | | p4raw-id: //depot/perl@19366
* Fix up Larry's copyright statements to my best knowledge.Jarkko Hietaniemi2003-04-161-1/+2
| | | | | | | (Lots of Perl 5 source code archaeology was involved.) Larry didn't make strangled noises when I showed him the patch, either :-) p4raw-id: //depot/perl@19242
* Big patch from Alan Burlison to make Solaris long doubles work.Jarkko Hietaniemi2003-04-151-0/+16
| | | | | | | (Also spreads more <stdlib.h> joy.) Needs backporting to metaconfig units and introducing the new symbols to non-Configure lands. p4raw-id: //depot/perl@19218
* Add an option for the grok_xxx() to silently ignore bad digits.Jarkko Hietaniemi2003-04-101-3/+3
| | | p4raw-id: //depot/perl@19184
* Reverse copyright update (#18801) for files not changed in 2003.Hugo van der Sanden2003-03-021-1/+1
| | | p4raw-id: //depot/perl@18807
* Update all copyrights to 2003, from JarkkoHugo van der Sanden2003-03-021-1/+1
| | | p4raw-id: //depot/perl@18801
* Re: [PATCH: perl #17849] (corrected) Long double bugs - sprintf.t _and_ num.tAllen Smith2002-09-081-21/+57
| | | | | | From: "Allen Smith" <easmith@beatrice.rutgers.edu> Message-Id: <10209070525.ZM1584639@puck2.rutgers.edu> p4raw-id: //depot/perl@17874
* Re: 5.8.0 sprintf (?) problem with floats?Dave Mitchell2002-08-181-70/+64
| | | | | Message-id: <20020816233107.E9388@fdgroup.com> p4raw-id: //depot/perl@17736
* Re: perl v5.8.0 17303 on VMS_VAX V7.2Hugo van der Sanden2002-06-201-13/+20
| | | | | Message-Id: <200206201351.g5KDpGI16736@crypt.compulink.co.uk> p4raw-id: //depot/perl@17324
* Re: [PATCH #2] Re: [PATCH] numeric.c:S_mulexp10 -- quit when you canHugo van der Sanden2002-06-091-1/+2
| | | | | Message-Id: <200206091352.g59Dq7Z28403@crypt.compulink.co.uk> p4raw-id: //depot/perl@17139
* Re: [PATCH] numeric.c:S_mulexp10 -- quit when you canCraig A. Berry2002-06-081-3/+2
| | | | | | | | From: "Craig A. Berry" <craigberry@mac.com> Message-Id: <a05111b02b92724737054@[172.16.52.1]> Handle also underflow on non-IEEE. p4raw-id: //depot/perl@17081
* numeric.c:S_mulexp10 -- quit when you canCraig A. Berry2002-06-071-1/+4
| | | | | | From: "Craig A. Berry" <craigberry@mac.com> Message-Id: <a05111b01b926db404884@[172.16.52.1]> p4raw-id: //depot/perl@17074
* In some (rare) platforms (such as UNICOS) using the nativeJarkko Hietaniemi2002-05-241-5/+7
| | | | | atof is still better. p4raw-id: //depot/perl@16771
* more warnings tidyupPaul Marquess2002-03-111-9/+9
| | | | | | From: "Paul Marquess" <paul_marquess@yahoo.co.uk> Message-ID: <AIEAJICLCBDNAAOLLOKLMEEGDPAA.paul_marquess@yahoo.co.uk> p4raw-id: //depot/perl@15155
* Copyright++. (Not all the toplevel *.h have one, it seems.)Jarkko Hietaniemi2002-01-231-1/+1
| | | p4raw-id: //depot/perl@14391
* Missed the =head1 additions.Jarkko Hietaniemi2002-01-031-0/+4
| | | p4raw-id: //depot/perl@14041