PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.c > Multi precision floating point
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Multi precision floating point

Réponse
 
LinkBack Outils de la discussion
Vieux 28/11/2007, 16h24   #1
mathieu.dutour@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Multi precision floating point

Dear all,

I want to do multiprecision floating point, i.e. I want
to go beyond single precision, double precision and have
quadruple precision, octuple precision and the like,
and possibly with high speed.

What would be the possible alternatives?
Thanks for any

Mathieu
  Réponse avec citation
Vieux 28/11/2007, 16h27   #2
jacob navia
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Multi precision floating point

mathieu.dutour@gmail.com wrote:
> Dear all,
>
> I want to do multiprecision floating point, i.e. I want
> to go beyond single precision, double precision and have
> quadruple precision, octuple precision and the like,
> and possibly with high speed.
>
> What would be the possible alternatives?
> Thanks for any
>
> Mathieu


lcc-win proposes qfloat precision (352 bits, 107 digits)
and bignums, that can be arbitrarily big.

--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
  Réponse avec citation
Vieux 28/11/2007, 16h33   #3
Marc Boyer
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Multi precision floating point

On 2007-11-28, mathieu.dutour@gmail.com <mathieu.dutour@gmail.com> wrote:
> I want to do multiprecision floating point, i.e. I want
> to go beyond single precision, double precision and have
> quadruple precision, octuple precision and the like,
> and possibly with high speed.
>
> What would be the possible alternatives?


http://en.wikipedia.org/wiki/Arbitra...ion_arithmetic


  Réponse avec citation
Vieux 28/11/2007, 17h00   #4
Philip Potter
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Multi precision floating point

jacob navia wrote:
> mathieu.dutour@gmail.com wrote:
>> Dear all,
>>
>> I want to do multiprecision floating point, i.e. I want
>> to go beyond single precision, double precision and have
>> quadruple precision, octuple precision and the like,
>> and possibly with high speed.
>>
>> What would be the possible alternatives?
>> Thanks for any
>>
>> Mathieu

>
> lcc-win proposes qfloat precision (352 bits, 107 digits)
> and bignums, that can be arbitrarily big.


A whole three minutes to advertise your compiler, jacob? You're getting
slow.

To the OP: jacob's compiler does indeed provide this feature. If you
simply want to use 352-bit floating point, and only ever envisage using
your code on a platform which jacob implements his compiler on, and are
happy with sticking with one compiler for the lifetime of your project,
then by all means go ahead.

If, on the other hand, you want to write multiple-precision
floating-point as a learning exercise, or you forsee ever needing to use
your code on an implementation other than jacob's, or you simply want to
keep the choice of switching vendors, then it is perfectly possible to
write multiple-precision floating-point in Standard C.

Philip
  Réponse avec citation
Vieux 28/11/2007, 17h07   #5
jacob navia
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Multi precision floating point

Philip Potter wrote:
> jacob navia wrote:
>> mathieu.dutour@gmail.com wrote:
>>> Dear all,
>>>
>>> I want to do multiprecision floating point, i.e. I want
>>> to go beyond single precision, double precision and have
>>> quadruple precision, octuple precision and the like,
>>> and possibly with high speed.
>>>
>>> What would be the possible alternatives?
>>> Thanks for any
>>>
>>> Mathieu

>>
>> lcc-win proposes qfloat precision (352 bits, 107 digits)
>> and bignums, that can be arbitrarily big.

>
> A whole three minutes to advertise your compiler, jacob? You're getting
> slow.
>
> To the OP: jacob's compiler does indeed provide this feature. If you
> simply want to use 352-bit floating point, and only ever envisage using
> your code on a platform which jacob implements his compiler on, and are
> happy with sticking with one compiler for the lifetime of your project,
> then by all means go ahead.
>
> If, on the other hand, you want to write multiple-precision
> floating-point as a learning exercise, or you forsee ever needing to use
> your code on an implementation other than jacob's, or you simply want to
> keep the choice of switching vendors, then it is perfectly possible to
> write multiple-precision floating-point in Standard C.
>
> Philip


If you are interested in portability of your code
you do

#ifdef __LCC__
typedef qfloat FLOAT_TYPE;
#else
typedef long double FLOAT_TYPE;
#endif

and you see that all your float types are declared accordingly.

Within lcc-win qfloat are just another floating point type:

qfloat a = 122333223332323.778887787766656544e7987Q;

Note the "Q" at the end.

In other libraries, the initialization of big numbers is done using
strings, and not at the global level. You may want to do that if you
use another library.

From all the other libraries, most do not fit well within C due to the
standard language lack of operator overloading.

lcc-win offers operator overloading, and it allows integrating
a large number of libraries within it to do what you want.






--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
  Réponse avec citation
Vieux 28/11/2007, 17h21   #6
Philip Potter
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Multi precision floating point

jacob navia wrote:
> Philip Potter wrote:
>> jacob navia wrote:
>>> mathieu.dutour@gmail.com wrote:
>>>> Dear all,
>>>>
>>>> I want to do multiprecision floating point, i.e. I want
>>>> to go beyond single precision, double precision and have
>>>> quadruple precision, octuple precision and the like,
>>>> and possibly with high speed.
>>>>
>>>> What would be the possible alternatives?
>>>> Thanks for any
>>>>
>>>> Mathieu
>>> lcc-win proposes qfloat precision (352 bits, 107 digits)
>>> and bignums, that can be arbitrarily big.

>> A whole three minutes to advertise your compiler, jacob? You're getting
>> slow.
>>
>> To the OP: jacob's compiler does indeed provide this feature. If you
>> simply want to use 352-bit floating point, and only ever envisage using
>> your code on a platform which jacob implements his compiler on, and are
>> happy with sticking with one compiler for the lifetime of your project,
>> then by all means go ahead.
>>
>> If, on the other hand, you want to write multiple-precision
>> floating-point as a learning exercise, or you forsee ever needing to use
>> your code on an implementation other than jacob's, or you simply want to
>> keep the choice of switching vendors, then it is perfectly possible to
>> write multiple-precision floating-point in Standard C.
>>
>> Philip

>
> If you are interested in portability of your code
> you do
>
> #ifdef __LCC__
> typedef qfloat FLOAT_TYPE;
> #else
> typedef long double FLOAT_TYPE;
> #endif
>
> and you see that all your float types are declared accordingly.


This only provides portability to implementations where 'long double'
has the required precision. These are remarkably few.

> Within lcc-win qfloat are just another floating point type:
>
> qfloat a = 122333223332323.778887787766656544e7987Q;
>
> Note the "Q" at the end.
>
> In other libraries, the initialization of big numbers is done using
> strings, and not at the global level. You may want to do that if you
> use another library.


That is because those are libraries, whereas qfloat is a language
extension, which adds to the C syntax - something libraries cannot do.
>
> From all the other libraries, most do not fit well within C due to the
> standard language lack of operator overloading.
>
> lcc-win offers operator overloading, and it allows integrating
> a large number of libraries within it to do what you want.


And for this reason it may be difficult to port a qfloat program to
another platform.

I have to say, I actually agree that operator overloading provides a
nicer interface for dealing with floating-point numbers (or complex, or
fixed-point, or whatever); but C doesn't allow operator overloading, so
if you want your program to be C, you must eschew it.
  Réponse avec citation
Vieux 28/11/2007, 17h34   #7
santosh
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Multi precision floating point

mathieu.dutour@gmail.com wrote:

> Dear all,
>
> I want to do multiprecision floating point, i.e. I want
> to go beyond single precision, double precision and have
> quadruple precision, octuple precision and the like,
> and possibly with high speed.
>
> What would be the possible alternatives?
> Thanks for any


If you can, think about using tested existing packages instead of
writing yet another implementation. Something like GMP is a good
candidate:

<http://gmplib.org/>

You compiler might also offer extended precision types as an extension.
Coding a MP library is not too difficult but coding a _good_ one is.
Often the low level arithmetic routines have to be done in optimised
assembler and rewritten for each target.

  Réponse avec citation
Vieux 28/11/2007, 18h07   #8
jacob navia
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Multi precision floating point

santosh wrote:
> mathieu.dutour@gmail.com wrote:
>
>> Dear all,
>>
>> I want to do multiprecision floating point, i.e. I want
>> to go beyond single precision, double precision and have
>> quadruple precision, octuple precision and the like,
>> and possibly with high speed.
>>
>> What would be the possible alternatives?
>> Thanks for any

>
> If you can, think about using tested existing packages instead of
> writing yet another implementation. Something like GMP is a good
> candidate:
>
> <http://gmplib.org/>
>
> You compiler might also offer extended precision types as an extension.
> Coding a MP library is not too difficult but coding a _good_ one is.
> Often the low level arithmetic routines have to be done in optimised
> assembler and rewritten for each target.
>


GMP is without doubt one of the best around, if not the best period.

Its big problem (from a windows user perspective) is that well...
it is very difficult to build under windows. From the site where the
above link points, there is NO mention of windows, nor how to build it
under windows. It uses a lot of machinery available under linux,
specifically m4, autoconf, and all that stuff, and supposes a
gcc makefile, and the gcc toolchain.

I have heard that some people have gotten GMP to build under MSVC, but
there is no hint from that effort in the GMP pages, and as far as I
remember, the efforts are not supported by the GMP team.


--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 18h58.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,36895 seconds with 16 queries