Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Le type q inclu dans Leopard?

19 réponses
Avatar
Archidemon
Bonjour!

Est-ce que le le perl qui vient avec Leopard supporte le type Q
(quadratic float)?

Voici ce que j'ai fait rouler:


#!/bin/bash
rqs () {
perl -e '
$sign = 0;
if (($numerator = $ARGV[0]) < 0) {
$numerator = -$numerator;
$sign = 1;
}
if (($denominator = $ARGV[1]) < 0) {
$denominator = -$denominator;
$sign = 1-$sign;
}
$quotient = $numerator / $denominator;
$bs = pack "d",$quotient;
$qi = unpack "Q",$bs;
$bs = pack "Q",++$qi;
$successor = unpack "d",$bs;
$bs = pack "d",$quotient;
$qi = unpack "Q",$bs;
$bs = pack "Q",--$qi;
$predecessor = unpack "d",$bs;
for ($precision = 1;;++$precision) {
$qs = sprintf "%.${precision}f",$quotient;
$ss = sprintf "%.${precision}f",$successor;
last if $qs ne $ss;
}
for (;;++$precision) {
$qs = sprintf "%.${precision}f",$quotient;
$ps = sprintf "%.${precision}f",$predecessor;
last if $qs ne $ps;
}
$quotient = -$quotient if $sign;
printf "%.${precision}f",$quotient;
' $1 $2



}


foo="$(rqs 512 918)"

****
Voici ce que j'ai obtenu:
****
Invalid type 'Q' in unpack at -e line 13.

10 réponses

1 2
Avatar
Eric Levenez
Le 04/07/09 15:31, dans
,
« Archidemon » a écrit :

Invalid type 'Q' in unpack at -e line 13.



Je n'ai pas d'erreur affichée, mais le programme ne fait rien, pas de print.

--
Éric Lévénez -- <http://www.levenez.com/>
Unix is not only an OS, it's a way of life.
Avatar
Paul Gaborit
À (at) Sat, 4 Jul 2009 06:31:05 -0700 (PDT),
Archidemon écrivait (wrote):
Est-ce que le le perl qui vient avec Leopard supporte le type Q
(quadratic float)?



Il suffit de lui demander :

% perl -V

Si vous y trouvez USE_64_BIT_INT, ça devrait marcher...

--
Paul Gaborit - <http://perso.mines-albi.fr/~gaborit/>
Avatar
Paul Gaborit
À (at) Sat, 04 Jul 2009 18:12:01 +0200,
Paul Gaborit écrivait (wrote):
À (at) Sat, 4 Jul 2009 06:31:05 -0700 (PDT),
Archidemon écrivait (wrote):
Est-ce que le le perl qui vient avec Leopard supporte le type Q
(quadratic float)?



Il suffit de lui demander :

% perl -V

Si vous y trouvez USE_64_BIT_INT, ça devrait marcher...



Ayant retrouvé l'accès à mon mac, j'ai fait le test pour
vous. Résultat :

...
Characteristics of this binary (from libperl):
Compile-time options: PERL_MALLOC_WRAP USE_FAST_STDIO
USE_LARGE_FILES USE_PERLIO
...

Pas de USE_64_BIT_INT en vue. Donc pas de 'quads' possibles.

--
Paul Gaborit - <http://perso.mines-albi.fr/~gaborit/>
Avatar
Eric Levenez
Le 04/07/09 18:38, dans , « Paul
Gaborit » a écrit :

Compile-time options: PERL_MALLOC_WRAP USE_FAST_STDIO
USE_LARGE_FILES USE_PERLIO



Mac OS X 10.5.7 :
Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
.../...
Compile-time options: MULTIPLICITY PERL_IMPLICIT_CONTEXT
PERL_MALLOC_WRAP USE_ITHREADS USE_LARGE_FILES
USE_PERLIO USE_REENTRANT_API

Autre Mac OS X en version beta :
Summary of my perl5 (revision 5 version 10 subversion 0) configuration:
.../...
Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV
PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP USE_64_BIT_ALL
USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES
USE_PERLIO USE_REENTRANT_API


--
Éric Lévénez -- <http://www.levenez.com/>
Unix is not only an OS, it's a way of life.
Avatar
Michael
> Autre Mac OS X en version beta :
Summary of my perl5 (revision 5 version 10 subversion 0) configuration:
.../...
Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV
PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP USE_64_BIT_ALL
USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES
USE_PERLIO USE_REENTRANT_API



Moralité ... un peu de patience jusqu'à Septembre :-)

--
«Si tu es prêt à sacrifier un peu de liberté pour te sentir en
sécurité, tu ne mérites ni l’une ni l’autre.»
[ Thomas Jefferson ]
Avatar
Paul Gaborit
À (at) Sat, 4 Jul 2009 23:22:04 +0200,
Michael écrivait (wrote):
Autre Mac OS X en version beta :
Summary of my perl5 (revision 5 version 10 subversion 0) configuration:
.../...
Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV
PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP USE_64_BIT_ALL
USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES
USE_PERLIO USE_REENTRANT_API



Moralité ... un peu de patience jusqu'à Septembre :-)



Pour les impatients, il est possible de compiler et d'installer sa
propre version de perl. Ou d'en prendre une toute prête ne provenant
pas de chez Apple (via fink ou macports)... Pour ces dernières, je ne
connais pas les options choisies.

--
Paul Gaborit - <http://perso.mines-albi.fr/~gaborit/>
Avatar
Eric Levenez
Le 04/07/09 23:22, dans <4a4fc7fc$0$12660$,
« Michael » a écrit :

Autre Mac OS X en version beta :
Summary of my perl5 (revision 5 version 10 subversion 0) configuration:
.../...
Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV
PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP USE_64_BIT_ALL
USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES
USE_PERLIO USE_REENTRANT_API



Moralité ... un peu de patience jusqu'à Septembre :-)



Mais ce n'est pas cela qui fera que le programme donné plus haut marchera...

--
Éric Lévénez -- <http://www.levenez.com/>
Unix is not only an OS, it's a way of life.
Avatar
Paul Gaborit
À (at) Sun, 05 Jul 2009 09:49:07 +0200,
Eric Levenez écrivait (wrote):
Mais ce n'est pas cela qui fera que le programme donné plus haut marchera...



Quel est le problème avec ce programme ? Qu'est-il censé faire ?

--
Paul Gaborit - <http://perso.mines-albi.fr/~gaborit/>
Avatar
Eric Levenez
Le 05/07/09 11:21, dans , « Paul
Gaborit » a écrit :

À (at) Sun, 05 Jul 2009 09:49:07 +0200,
Eric Levenez écrivait (wrote):
Mais ce n'est pas cela qui fera que le programme donné plus haut marchera...



Quel est le problème avec ce programme ? Qu'est-il censé faire ?



Je ne sais pas, mais comme il a un print, il devrait afficher quelque chose,
mais je n'ai rien du tout.

--
Éric Lévénez -- <http://www.levenez.com/>
Unix is not only an OS, it's a way of life.
Avatar
KingKong
snip
Quel est le problème avec ce programme ? Qu'est-il censé faire ?


snip

La fonction calcule un quotient comme java le fait. Il va falloir que
j'utilise une version en 32 bits.

Par ailleurs pour que ça marche j'ai découvert qu'il faut alors
traiter le tout en little endian sur Mac.
1 2