From:

Date:

March 7, 2001 07:22Subject:

Re: [ID 20010305.005] "use integer" doesn't make rand() return integersMessage ID:

3AA65237.6FEEB559@rowman.comabigail@foad.org wrote: > > On Tue, Mar 06, 2001 at 02:08:02PM -0500, John Peacock wrote: > > Since 'use integer' strictly affects mathematic operations, not > > mathematic functions, I think this is not a good enhancement. > > Could you please, from a mathematical viewpoint, tell me what the > difference is between an operator and a function? Even from a CS > standpoint, the only differences are syntactical details, only relevant > to parsing tables, and largely artificial. > > Abigail It is not a matter of mathematics, it is a matter of which underlying math library Perl is going to apply. use integer; my $float=1.434; my $int = 12; $int += 4.5; # $int is now 16, not 16.5 $int += $float; # $int is now 17 $float += 1; # $float is now 2 (an integer) $float = sin(30);# $float is now -0.988031624092862 (not an integer) print $int, "\t", $float, "\n"; sin, tan, rand, etc are mathematic functions contained within the underlying floating point math library. "use integer" has no impact on them, nor IMHO should it. The math operations +, -, *, / are affected by "use integer" because the value is cast to an integer and the integer math functions are used. That is the point of "use integer" after all. There is really no point in extending it to rand (and certainly no point in applying it to sin, tan, etc). John PeacockThread Previous | Thread Next

- [ID 20010305.005] "use integer" doesn't make rand() return integers by fanf
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by rspier
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by John L. Allen
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by John Peacock
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by rspier
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by John Peacock
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by rspier
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by Walt Mankowski
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by abigail
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by John L. Allen
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by John Peacock
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by Philip Newton
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by Tony Finch
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by Philip Newton
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by rspier
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by John Peacock
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by Philip Newton
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by abigail
**Re: [ID 20010305.005] "use integer" doesn't make rand() return integers**by John Peacock- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by abigail
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by John Peacock
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by abigail
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by Ronald J Kimball
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by Bryan C . Warnock
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by abigail
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by Bryan C . Warnock
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by Nicholas Clark
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by Bryan C . Warnock
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by abigail
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by Bryan C . Warnock
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by John Peacock
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by John Peacock

nntp.perl.org: Perl Programming lists via nntp and http.

Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About