New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
% does not work as documented for non-integer operand #1862
Comments
From @jimavThis is a bug report for perl from avera@hal.com, % perl -we 'printf "%f\n", (1.5 % 8)' The documentation says The largest multiple of 8 which is not greater than 1.5 is 0, The docs do not say anything about truncating the result to an integer. Is this a perl bug or a doc bug? -Jim Avera (jima@hal.com) Site configuration information for perl 5.00502: Configured by avera at Mon Jan 18 16:36:45 PST 1999. Summary of my perl5 (5.0 patchlevel 5 subversion 2) configuration: Locally applied patches: @INC for perl 5.00502: Environment for perl 5.00502: |
From @tamiasOn Wed, Apr 19, 2000 at 04:20:10PM -0700, Jim Avera wrote:
Doc bug. Modulus is, by definition, an integer operation, and the operands Ronald |
From [Unknown Contact. See original ticket]Ronald J Kimball writes:
For some value of "integer" only. And not for the value used in other The reason for the current semantic is backward compatibility only. Ilya |
From [Unknown Contact. See original ticket]
How do you treat 0 as a multiple? 1 will suit more likely. May be 1.499999999 (or even 1.5)?
It goes into integers when it says about multiples. Note that you also Good luck, |
From @jimavRonald J Kimball <rjk@linguist.dartmouth.edu> wrote: What is the meaning (or intent) of the documentations' remark "Note than when That is, if 'use integer' has some effect, what is the effect of -Jim. |
From @tamiasOn Thu, Apr 20, 2000 at 09:28:45AM -0700, Jim Avera wrote:
With 'use integer', % uses the C compiler's modulus operator directly. Ronald |
From [Unknown Contact. See original ticket]Jim Avera <avera@hal.com> wrote
Err... what it says? It's acting as a qualification on the definition
It does what it's said elsewhere in the documentation to do: Binary "%" computes the modulus of two numbers. Given Looks quite complete to me. It isn't very sensible quoting single sentences from the documentation Mike Guy |
From [Unknown Contact. See original ticket]Jim Avera <avera@hal.com> wrote
Eh? You're quoting out of context (and making the mistake of retyping Binary "%" computes the modulus of two numbers. Given Looks clear enough to me. Of course, the operator is left totally undefined if the operands are Mike Guy |
From @ysthIn article <20000419235456.A775265@linguist.dartmouth.edu>,
Not in my universe. A self-consistent definition of real number The Single UNIX (R) Specification, Version 2 fmod - floating-point remainder value function SYNOPSIS #include <math.h> double fmod(double x, double y); DESCRIPTION The fmod() function returns the floating-point remainder An application wishing to check for error situations should set errno RETURN VALUE The fmod() function returns the value x - i * y for some integer i If x or y is NaN, NaN is returned and errno may be set to [EDOM]. If y is 0, NaN is returned and errno is set to [EDOM], or 0 is If x is +/-Inf, either 0 is returned and errno is set to [EDOM], or If y is non-zero, fmod(+/-Inf,y) returns the value of x. If x is not If the result underflows, 0 is returned and errno may be set to ERRORS The fmod() function may fail if: [EDOM] One or both of the arguments is NaN, or y is 0, or x is +/-Inf. [ERANGE] The result underflows. No other errors will occur. EXAMPLES None. APPLICATION USAGE Portable applications should not call fmod() with y equal to 0, FUTURE DIRECTIONS None. SEE ALSO isnan(), <math.h>. DERIVATION Derived from Issue 1 of the SVID. UNIX (R) is a registered Trademark of The Open Group. |
From p5p@spam.wizbit.beClarifications were added in the docs for operands that are floating |
p5p@spam.wizbit.be - Status changed from 'stalled' to 'resolved' |
Migrated from rt.perl.org#3127 (status was 'resolved')
Searchable as RT3127$
The text was updated successfully, but these errors were encountered: