|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
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. |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
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. |
|
|
|
#8 |
|
Messages: n/a
Hébergeur: |
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 |
|
![]() |
| Outils de la discussion | |
|
|