Deutsch   English   Français   Italiano  
<647eed0f$0$7665$426a34cc@news.free.fr>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!cleanfeed3-b.proxad.net!nnrp1-1.free.fr!not-for-mail
Date: Tue, 6 Jun 2023 10:23:43 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.11.0
Subject: =?UTF-8?B?UmU6IFLDqXNvdWRyZSBjZXR0ZSDDqWdhbGl0w6k=?=
Newsgroups: fr.sci.maths
References: <zF0ezWzZVwyFPc1y2dkU7tlBpJg@jntp>
 <u5lh8p$65g$1@shakotay.alphanet.ch> <647e4d83$0$3196$426a74cc@news.free.fr>
 <u5mih6$bic$1@shakotay.alphanet.ch>
Content-Language: fr
From: Michel Talon <talon@niobe.lpthe.jussieu.fr>
In-Reply-To: <u5mih6$bic$1@shakotay.alphanet.ch>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Lines: 58
Message-ID: <647eed0f$0$7665$426a34cc@news.free.fr>
Organization: Guest of ProXad - France
NNTP-Posting-Date: 06 Jun 2023 10:23:44 CEST
NNTP-Posting-Host: 88.161.173.7
X-Trace: 1686039824 news-4.free.fr 7665 88.161.173.7:31339
X-Complaints-To: abuse@proxad.net
Bytes: 2396

Le 06/06/2023 à 08:08, robby a écrit :
>> Tu veux dire 10 doit diviser x,
> 
> yep.
> 
>> et encore c'est pas garanti.
> 
> qu'est-ce que j'ai raté ? il peut y avoir un diviseur commun à X et X-1 ?
> 

a divise b*c  implique a divise c si a est premier à b, en particulier 
si a est premier et ne divise pas b.  Avec 10=2*5 tu es refait car
2 peut diviser b et 5 diviser c mais 10 ne divise ni b ni c.

En ce qui concerne python c'est un langage qui n'est pas fait pour 
traiter correctement les rationnels, sauf à utiliser un module 
supplémentaire. Par exemple on peut obtenir les surprises suivantes:

 >>> 2/3
0
 >>> 2./3
0.6666666666666666
 >>>

Contrairement à Common Lisp qui gère nativement les rationnels (et 
maxima aussi). Par exemple en lisp:

* (+ 1/35  1/14)
1/10

Noter qu'on peut introduire la fraction 1/35 en tant que telle. On peut 
aussi détailler le quotient:

* (+ (/ 1 35)  (/ 1 14))
1/10

et la contagion flottante:

* (+ (/ 1 35.0)  (/ 1 14))
0.1

On n'obtient pas de résultat à la con genre 2/3 -> 0 il faut une 
conversion explicite:

* (float (/ 2 3) 1.0d0)
0.6666666666666666d0

* (floor (/ 2 3))
0
2/3

Ici floor produit la partie entière et le reste, noter que le reste 
garde sa précision complète.


-- 
Michel Talon