473,804 Members | 3,453 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Scientific Calculation with long double

Hello:
Currently, I am trying to solve a problem that requires the
calculation of Airy functions for big arguments. Because Airy
functions diverge rapidly for positive values, the results of the
calculation quickly produces overflow (or underflow depending on which
Airy function is used) for values of the argument greater than about
100 when using double. Because of this, I need to find a routine that
calculates Airy function producing results of type long double. Can
anyone make any suggestions??? I have tried GNU's GSL library, which
works with long doubles in most functions, but unfortunately, it
doesn't work with long doubles for special functions. Thanks...
Nov 13 '05 #1
2 5436
In <a7************ **************@ posting.google. com> an***********@h otmail.com (Miguel Morales) writes:
Currently, I am trying to solve a problem that requires the
calculation of Airy functions for big arguments. Because Airy
functions diverge rapidly for positive values, the results of the
calculation quickly produces overflow (or underflow depending on which
Airy function is used) for values of the argument greater than about
100 when using double. Because of this, I need to find a routine that
calculates Airy function producing results of type long double. Can
anyone make any suggestions??? I have tried GNU's GSL library, which
works with long doubles in most functions, but unfortunately, it
doesn't work with long doubles for special functions. Thanks...


Why not do the obvious: take your current implementation and replace
double by long double in a consistent manner?

You may also want to check whether long double provides an extended range
on your platform. Many implementations treat double and long double
identically (same range and same precision).

One word of caution: most of the time, throwing more precision/range
at a problem is not the right solution, unless you know what you're
doing.

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Nov 13 '05 #2
Dan Pop wrote:

In <a7************ **************@ posting.google. com> an***********@h otmail.com (Miguel Morales) writes:
Currently, I am trying to solve a problem that requires the
calculation of Airy functions for big arguments. Because Airy
functions diverge rapidly for positive values, the results of the
calculation quickly produces overflow (or underflow depending on which
Airy function is used) for values of the argument greater than about
100 when using double. Because of this, I need to find a routine that
calculates Airy function producing results of type long double. Can
anyone make any suggestions??? I have tried GNU's GSL library, which
works with long doubles in most functions, but unfortunately, it
doesn't work with long doubles for special functions. Thanks...


Why not do the obvious: take your current implementation and replace
double by long double in a consistent manner?

You may also want to check whether long double provides an extended range
on your platform. Many implementations treat double and long double
identically (same range and same precision).

One word of caution: most of the time, throwing more precision/range
at a problem is not the right solution, unless you know what you're
doing.

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de


I suggest getting a library of high-precision fp subroutines. There are several
on the Web in various languages. See, e.g. D.M. Smith, "Using multiple-precision
arithmetic" in Computing in Science & Engineering, July-Aug. 2003. Smith uses
FORTRAN, but there are C libraries available.

--
Julian V. Noble
Professor Emeritus of Physics
jv*@lessspamfor mother.virginia .edu
^^^^^^^^^^^^^^^ ^^^
http://galileo.phys.virginia.edu/~jvn/

"God is not willing to do everything, and thereby take away that
share of glory that rightfully belongs to ourselves."

-- N. Machiavelli, "The Prince".
Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1314
by: Miguel Morales | last post by:
Hello: Currently, I am trying to solve a problem that requires the calculation of Airy functions for big arguments. Because Airy functions diverge rapidly for positive values, the results of the calculation quickly produces overflow (or underflow depending on which Airy function is used) for values of the argument greater than about 100 when using double. Because of this, I need to find a routine that calculates Airy function producing...
1
8867
by: Nick | last post by:
Well, the project I am working on has now come to a screeching halt! I have been developing a program that heavily utilizes ADO.NET record sets. To generate reports, I convert the recordset to XML, and then apply an XSLT to transform the XML into HTML. This works great (or did) until today. I just found out that the "number-format" command in XSLT can't handle scientific notation! So when I try to format these numbers I just get "NaN" on...
5
2592
by: Jeff | last post by:
Dim lngWeights as long, lngBuckets as Long Const STDWEIGHTS = 12 lngBuckets = 1000 lngWeights = lngBuckets * STDWEIGHTS This causes an Overflow error. For lower values it works. Obviously the result of 36000 is more than an Integer can take, but not a Long?? Yes, I did double-check my code.
14
9823
by: wane | last post by:
Hello, I have heard that one should avoid using float and double in monetary calculation because of the lack of preciseness. What is a good alternative? Thanks
2
7281
by: Ryan Liu | last post by:
In C#, for a large float (9 digitals), how can I disable Scientific notation. When it auto convert to Scientific notation, I lost accuracy. Thanks a lot! Ryan
9
6674
by: Joe Attardi | last post by:
Hi all, Math is not my strongest area so forgive me if I use some of the wrong terminology. It seems that scientific notation is immune to rounding errors. For example: (4.98 * 100) + 5.51 // returns 503.51000000000005, rounding error! 4.98e2 + 5.51 // returns 503.51, correct!
8
3247
by: GB | last post by:
Hello, How to calculate value for the following formula (I need C# code): res = (((m+1)(m+2)...(m+(k-1)))/1.2...(k-1)) or more generalized formula is: k-1 __ | | (m+i)
3
5069
by: PengYu.UT | last post by:
Hi, I setprecision to be 100 for both cases. I'm wondering why the number of digits are different. Also, for a double number, I think any digits that are longer than 15 (or 16) are not meaningful, because it exceed the double number's precision limit. Even if I setprecision to be 100, shall it truncate the number to be of 15(or 16) digits?
3
3558
by: mattmao | last post by:
Okay, I was asked by a friend about the result of this limit: http://bbs.newwise.com/attdata/forumid_14/20070922_fe7f77c81050413a20fbDWYOGm7zeRj3.jpg Not n->zero but n-> + infinite I really know nothing about advanced math, so I wrote a C program to help me: (BTW, I guess the result would be ln2.) #include <stdio.h>
0
9576
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10567
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10323
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9138
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7613
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6847
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3809
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2983
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.