[issue8002] on OSX the file creation date not available in os.stat

2010-03-07 Thread Floris van Manen

Floris van Manen  added the comment:

On Mar 7, 2010, at 13:08, Ronald Oussoren wrote:

> IMO it adding this support is not worth the effort or the additional code 
> complexity.

I do agree.
We have to look forwards ...

F

--

___
Python tracker 
<http://bugs.python.org/issue8002>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34645] math and numpy yield different results (nan)

2018-09-12 Thread Floris van Manen


New submission from Floris van Manen :

when using numpy defined values i get nan results.
when using math defined values, no nan errors occur.

check2 bb [5.0, 2.285379077161093, nan, nan, 2.285379077161092]

check2 cc [5.0, 2.285379077161093, 4.341186402706317, 4.341186402706317, 
2.285379077161092]

how to get identical results?

--
files: nan-test.py
messages: 325139
nosy: klankschap
priority: normal
severity: normal
status: open
title: math and numpy yield different results  (nan)
type: behavior
versions: Python 3.6
Added file: https://bugs.python.org/file47799/nan-test.py

___
Python tracker 
<https://bugs.python.org/issue34645>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34645] math and numpy yield different results (nan)

2018-09-12 Thread Floris van Manen


Floris van Manen  added the comment:

Well, the thing is that i pass two (apparent) identical values into the same 
function, and get two different results.
Apparent as in one value generated via np.linspace() and one directly retrieved 
from a list.

> On 12 Sep 2018, at 18:12, Steven D'Aprano  wrote:
> 
> 
> Steven D'Aprano  added the comment:
> 
> Oops, sorry, I mistyped. I said:
> 
>So there's a problem. You're trying to raise a negative number
>to a positive value
> 
> 
> I meant to say a *fractional* value. Sorry for the confusion.
> 
> --
> 
> ___
> Python tracker 
> <https://bugs.python.org/issue34645>
> ___

--

___
Python tracker 
<https://bugs.python.org/issue34645>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34645] math and numpy yield different results (nan)

2018-09-12 Thread Floris van Manen


Floris van Manen  added the comment:

Well, the thing is that i pass two (apparent) identical values into the same 
function, and get two different results.
Apparent as in one value generated via np.linspace() and one directly retrieved 
from a list.
If i pass the np variable into to function, it will generate an NAN error.
If i pass the non np variable into the function, it will work.

.F

> On 12 Sep 2018, at 18:10, Steven D'Aprano  wrote:
> 
> 
> Steven D'Aprano  added the comment:
> 
> Your code gives runtime warnings of invalid values. You should fix that. If 
> your values are invalid, there's probably a bug in your code.
> 
> RuntimeWarning: invalid value encountered in double_scalars
> 
> Your code is also very complex. You ought to simplify the example so that it 
> is easier to understand, all the business with linspace and duplicated code 
> just adds complexity and makes it hard to understand.
> 
> I simplified your code to this:
> 
> import numpy as np
> n=2.758
> n2 = 2.0 / n
> ct = np.cos(2 * np.pi * 2.0 / 5)
> print("numpy", ct, abs(ct ** n2) * 5.0)
> 
> 
> which gives this output:
> 
> __main__:1: RuntimeWarning: invalid value encountered in double_scalars
> ('numpy', -0.80901699437494734, nan)
> 
> So there's a problem. You're trying to raise a negative number to a positive 
> value, and numpy doesn't like it and returns a NAN.
> 
> But using the standard math library, raising a negative number to a positive 
> value gives you a complex number:
> 
> ct = math.cos(2 * math.pi * 2.0 / 5)
> print(ct**n2)
> print("math", ct, abs(ct ** n2) * 5.0)
> 
> 
> which gives this output:
> 
> (-0.5572617094280153+0.6517928032447587j)
> math -0.8090169943749473 4.287698890886272
> 
> So the behaviour is correct and this is not a bug in either math nor numpy. 
> They're just doing different things.
> 
> --
> nosy: +steven.daprano
> resolution:  -> not a bug
> stage:  -> resolved
> status: open -> closed
> 
> ___
> Python tracker 
> <https://bugs.python.org/issue34645>
> ___

--

___
Python tracker 
<https://bugs.python.org/issue34645>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34645] math and numpy yield different results (nan)

2018-09-12 Thread Floris van Manen

Floris van Manen  added the comment:

I know it has nothing todo with linspace.
But there seems to be a link to using numpy generated variables and not using 
them.
>From a naive point of view i’d expect the same results.
But it does not.
There is two functions, and two variables.
And from the four combinations, only one gives a non NAN error.

> On 12 Sep 2018, at 20:19, Steven D'Aprano  wrote:
> 
> 
> Steven D'Aprano  added the comment:
> 
>> Well, the thing is that i pass two (apparent) identical values into the same 
>> function,
> 
> Even if they have the same *numeric* value, they aren't the same kind of
> value, and they aren't the same function.
> 
> One is  and the other is . When you
> call ** (exponentiation), that calls two different methods. One raises
> a warning and returns NAN, the other converts to complex.
> 
> This has nothing to do with linspace. See my simplifed example code
> which doesn't use it.
> 
> --
> 
> ___
> Python tracker 
> <https://bugs.python.org/issue34645>
> ___

--

___
Python tracker 
<https://bugs.python.org/issue34645>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17020] random.random() generating values >= 1.0

2013-01-23 Thread Floris van Manen

New submission from Floris van Manen:

I recently noticed that the standard random() function generates values >= 1.0

As processes are called from an event scheduler, each process has its own 
Random() instance.

self.random = random.Random(seed)
self.randomState = self.random.getstate()



keeping track of multiple objects:

self.random.setstate(self.randomState)
self.random.jumpahead(1)
self.randomState = self.random.getstate()


Also gammavariate() generates errors as it too makes use of the _random() call

A workaround is to check each response of random() for values >= 1.0

--
assignee: ronaldoussoren
components: Macintosh
messages: 180480
nosy: klankschap, ronaldoussoren
priority: normal
severity: normal
status: open
title: random.random() generating values >= 1.0
type: compile error
versions: Python 2.7

___
Python tracker 
<http://bugs.python.org/issue17020>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17020] random.random() generating values >= 1.0

2013-01-23 Thread Floris van Manen

Floris van Manen added the comment:

On 23 Jan 2013, at 19:18, R. David Murray wrote:

> 
> R. David Murray added the comment:
> 
> That indeed looks likely.  Fortunately there will be a new release of 2.7 
> including that fix soon.
> 
> Floris, do you have any way to test against 2.7 tip?

using 2.7.3 as well as pypy (based on 2.7.3) via macport.
pypy version suffers from the same issue.

i'm not (yet) familiar how to get the tip from 2.7.3
hint?

.F

--

___
Python tracker 
<http://bugs.python.org/issue17020>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17020] random.random() generating values >= 1.0

2013-01-23 Thread Floris van Manen

Floris van Manen added the comment:

indeed, looks like the same.
.F

On 23 Jan 2013, at 19:09, Peter Otten wrote:

> 
> Peter Otten added the comment:
> 
> This could be a duplicate of issue14591.
> 
> --
> nosy: +peter.otten
> 
> ___
> Python tracker 
> <http://bugs.python.org/issue17020>
> ___

--

___
Python tracker 
<http://bugs.python.org/issue17020>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17020] random.random() generating values >= 1.0

2013-01-24 Thread Floris van Manen

Floris van Manen added the comment:

It is in the combination with jumpahead(), getstate(), setstate() that you'll 
experience random() to produce values >= 1.0

.F

On 25 Jan 2013, at 06:24, Raymond Hettinger wrote:

> 
> Raymond Hettinger added the comment:
> 
> Can you show how you determined that you got a value >= 1.0 or provide a seed 
> that reproduces the problem?
> 
> I'm not seeing an issue on the 2.7.3 64-bit Mac build:
> 
>>>> from itertools import starmap, repeat
>>>> from random import random, seed
>>>> seed(56019413053459019451450201)
>>>> for i in range(20):
>   print max(starmap(random, repeat((), 1000)))
> 
>   
> 0.99787916
> 0.99859769
> 0.99809486
> 0.9968575
> 0.99886565
> 0.1274
> 0.99886922
> 0.99874948
> 0.99987989
> 0.99751067
> 0.9353
> 0.99935037
> 0.99919091
> 0.99664265
> 0.99951016
> 0.8665
> 0.99919618
> 0.99786864
> 0.99874042
> 0.99967453
> 
> --
> nosy: +rhettinger
> 
> ___
> Python tracker 
> <http://bugs.python.org/issue17020>
> ___

--

___
Python tracker 
<http://bugs.python.org/issue17020>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17020] random.random() generating values >= 1.0

2013-01-25 Thread Floris van Manen

Floris van Manen added the comment:

On 25 Jan 2013, at 11:07, Stefan Krah wrote:

> 
> Stefan Krah added the comment:
> 
>> It is in the combination with jumpahead(), getstate(), setstate() that 
>> you'll experience random() to produce values >= 1.0
> 
> Let me reiterate what David said: Can you post a self-contained program
> that exhibits the issue?

My program is sort of complex in the meaning of multiple processes interleaving 
and interacting via a priorityqueue.
Each individual steps through multiple classes which all should stay 
independent.
No simple short snippet.
>From what i understand is that issue14591 was able to reproduce the same 
>feature as it seems related to the jumpahead()  malfunctioning.

.F

--

___
Python tracker 
<http://bugs.python.org/issue17020>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17020] random.random() generating values >= 1.0

2013-01-25 Thread Floris van Manen

Floris van Manen added the comment:

On 25 Jan 2013, at 19:35, Stefan Krah wrote:

> 
> Stefan Krah added the comment:
> 
> Floris van Manen  wrote:
>> From what i understand is that issue14591 was able to reproduce the same 
>> feature as it seems related to the jumpahead()  malfunctioning.
> 
> I'm also quite sure that it's the same issue. It would be nice to have
> confirmation though. If you have the opportunity to compile the tip of
> the 2.7 branch (where #14591 is fixed), get one of these:
> 
> http://hg.python.org/cpython/archive/864b9836dae6.tar.gz
> http://hg.python.org/cpython/archive/864b9836dae6.zip
> 

Did compile that version and it launches.
To test with my code i do not want to have it interfere with my current version.
I remember it is possible to setup n isolated environment with pip en 
virtualenv.
But i never did this so far.
Any hints / links to (simple) script explanation that could do the job?
Or is there an even simpler way?

.F

--

___
Python tracker 
<http://bugs.python.org/issue17020>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17020] random.random() generating values >= 1.0

2013-01-25 Thread Floris van Manen

Floris van Manen added the comment:

On 25 Jan 2013, at 22:27, Stefan Krah wrote:

> Then always call python with the full path. If your app is a simple
> script, then:
> 
> /tmp/usr/bin/python app.py

ok.
and how do i add extra packages to that new python version ?
e.g. i need to install
pyyam and openpyxll

(sorry for the inconvenience)
.F

--

___
Python tracker 
<http://bugs.python.org/issue17020>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17020] random.random() generating values >= 1.0

2013-01-25 Thread Floris van Manen

Floris van Manen added the comment:

On 25 Jan 2013, at 22:27, Stefan Krah wrote:

> Then always call python with the full path. If your app is a simple
> script, t

ok, managed to install the extra packages and run the app.
Seems to work correctly now, no more random() >= 1.0

(thanks!)
.F

--

___
Python tracker 
<http://bugs.python.org/issue17020>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com