Problem with the math library functions

Hi,
I encountered a problem related to some functions provided by math library on sun. I narrowed it down to the following test program:
========================================================
#include<stdio.h>
#include<math.h>
void pow_res()
double x = 10.0;
double y = 2.5;
printf("pow(%.2e, %.2e):%.20e\n", x, y, pow(10.0, 2.5));
void cos_res()
double x = -6.433230338433114370e-02;
printf("x:%.20e cos(x):%.20e\n", x, cos(x));
int main()
pow_res();
cos_res();
return 0;
========================================================
The above test program has to be linked with any math library. It is �libm� for amd64/linux, but for sparc we have choice between �libm� and �libmopt�. I am compiling above program with "cc <test_program.c> <-lm/-lmopt>" command.
On sparc, if the above test program is getting linked with �-lm" then it gives same results for the �cos� on both amd64 and sparc, but gives different results (16th decimal digit onward) for �pow�. If it is getting linked with �-lmopt� then it gives same result for the �pow� on both the platforms, but gives different results for �cos�. Linux results match with the amd64 results.
The �Numerical Computation Guide� provided by SUN (ftp://docs-pdf.sun.com/802-5692/802-5692.pdf page 40, table 2.10 ) says that you can trust only 15-17 decimal digits for double calculation. But here the requirement is to match the sparc results exactly with the amd64/linux or at least match the result till 20th decimal digit. I guess it is something to do with the FPU setting either through compiler options or code. I tried many different compiler options, like -fast, different combinations of compiler options provided by -fast macro, but nothing helped.
Following is the system configuration:
Amd64:
gcc version: 3.3.6
OS: RedHat Enterprise Linux 3.0 U7 (Linux 2.4.21-40.ELsmp x86_64)
Sparc:
cc version: Sun C 5.8 Patch 121015-01
OS: SunOS 5.9 Generic_118558-21 sun4u sparc SUNW,Sun-Fire-280R
It will be great if somebody can explain the problem and the solution to get rid of it.
Many thanks,
Sunil

Transcendental functions are not specified to be correctly rounded in the same
sense as +-*/.     So it's entirely possible, and often observed, that libraries of equal
quality deliver slightly different results.
To simplify, suppose one wanted to compute x = 4*atan(1.0)
which happens to be the
transcendental number pi which is roughly, in hex and in decimali:
.C90F DAA2 2168 C234 C... * 2^4 or 3.141592653589793239...
But binary floating-point arithmetic can only represent certain rational numbers of
the form of an integer of at most 53 significant bits times a power of two. The
nearest double-precision number to pi is
.C90F DAA2 2168 C * 2^4 or roughly 3.141592653589793116...
This particular number has a large but finite decimal expansion. And if you
do printf with %e.20 you will get the 20 decimal digits of that double-precision
number's expansion, not the 20 decimal digits of pi, which only agrees to the
15 significant decimals 3.141592653589793 and differs afterward.
In the case of pow(10.0,2.5), (which happens to be sqrt(1.0e5))
the correct result in hex looks something like
.9E1D 276F D4BA C410 C... * 2^9 or roughly 3.162277660168379332...E+2
in hex notation, while the closest double precision number is
.9E1D 276F D4BA C8 * 2^9 or roughly 3.162277660168379612...E+2
but it's only slightly closer than the next closest double precision number
.9E1D 276F D4BA c0 *2^9 or roughly 3.162277660168379043...E+2
Either answer is a good answer, and math libraries might that only aspire to
deliver results that are close to correctly rounded might deliver either, depending
on which approximation algorithm is used, which might depend on what's fastest
on a particular processor.
So why don't math libraries deliver correctly rounded results instead of almost?
Because the slight extra increase in accuracy doesn't do much good for most
people, and the major decrease in performance is noticeable by lots of people.
The main payoff of correctly rounded transcendental functions is that they
promote uniform numerical results across platforms, which is worth something
to some people but not much to many people.
So for those who find it worthwhile, there are correctly rounded transcendental
function libraries available. Sun's development version is available at
http://www.sun.com/download/products.xml?id=41797765
Another solution for some people is to change double variables and functions
to long double, using powl and cosl in the examples. That increases the
accuracy to almost 20 digits on x86 and over 30 digits on SPARC, and while
the same issues eventually arise, most users would never encounter them.
The SPARC long double implementation is in software rather than hardware,
and so entails a major performance reduction compared to double.
The Numerical Computation Guide at docs.sun.com discusses many of these
issues at greater length.

Similar Messages

  • Problem with the "now playing"-function after timer sleep-mode

    At first: sorry for my english.
    I have the following problem with the Nano 6G: I set the timer of my iPod Nano to shut it down after a while of playing. When I turn it back on afterwards, the now-playing-button does not show the song that it played at last. Instead of that the nano is automatically set to shuffle mode which was not activated before and the now-playing-button will show any other song randomly.
    This does not happen when I switch it to sleep-mode with the button on the top, only when the sleepmode ist activated by the timer.
    Does anyone notice the same issue with his nano? How can I bring my nano to play the same song after the sleepmode, that it played before?

    Hey Ipaqman, that strange behavior of the Nano 6G annoys me for exactly the same reason: audiobook in bed + sleeptimer = losing the place. As You say, the 5G works better with that and I also hope that Apple takes notice of that issue and will solve it.
    Until that I got myself a "workaround". I create a new playlist on the device, with just the single audiobook in it, that is actually in use. This helps me finding back into it, as long as "now playing" will not work correctly with the sleeptimer.

  • I was told at the apple store to open a new I-Tunes library and transfer the music from the old library to the new.  He thinks there is a problem with the old library as it keeps corrupting the i-pod.  Any ideas on how???

    Was told by the person at the APple store today to open new library on I-tunes - he felt the current library has something wrong and that opening a new library and transferring the music to there would perhaps prevent the ipod from becoming corrupt.   Any ideas how to do this???

    Need more info, if you want better response.
    What do you mean by corrupting the iPod?
    What is wrong with your iPod?
    Which version of iTunes are you using?
    What is the iPod software  version as shown in the iTunes summary page?
    Have a nice day!

  • Sync problem with the audio library

    Hi,
    I'm having problems with iMovie. The libraries of sound effects and itunes are always blank. I have several songs on itunes, but they are not found by imovie.
    When I browse the directories of the application, I see several files sound effects, but they are not displayed within the program.
    The problem started after I upgrade from version 9 to version 10.
    I already excluded and reinstalled the app, but the problem continues.
    Any idea to solve this problem?
    thank you

    'onglet' - great, my favorite when visiting restaurants in France!
    Anyway, I think you have to activate Advanced tools first:
    http://help.apple.com/logicpro/mac/10/#lgcp5cbf192f
    Have a nice day!

  • How can i open itunes if there is a problem with the itunes library file?

    Hi to everybody,
    it's my first time in itunes and after installing it I moved the folder in music. Then i was questioned about something on sharing or account, I can't remember, and i choised not to share anymore. After that every time i try to open my itunes there's an error message appearing that says he has not the possibility of open or write the library file. i've already tried to reinstall the program but the problem isn't fixed. my platforme is windows7. thanx for any help

    Contact iTunes customer support.

  • Problems with the key word function

    Have recently acquired Lightroom.   I uploaded my photos into Lightroom and have pretty much key worded all of them. I have had something happen which I am not sure why and hope you all can enlighten me.  I did a search for Flower and my flower photos showed up along with a bunch of other photos. These other photos did not have the key word flower yet they appeared in the group. Any idea why?  Thanks in advance.
    Mike

    Thanks for responding.  I did try your suggestion and only those photos with flower appeared.  I just solved my problem though I don’t know why it happens.  When I selected text at the top of the window, I left the other fields alone.  This time I changed any searchable field to Keys words and that caused only the key worded photos to appear.  I till don’t understand why leaving “any searchable field” the way it is would cause this.  I could understand if all the photos then appeared but they don’t only a few.
    Anyway thanks for responding, I appreciate it.  I wonder if anyone else has experienced this?
    Mike Crosa

  • Problems with the Search/Find function in Reader 10.1.6

    I gave in a keyword in a 430 pages dokument (photoshopelements6_help.pdf) and got many search results for different keywords (in bold) but not for my keyword!!

    Then it's more than likely a scanned image of text rather than actual text. Unsearchable.
    thedge000 wrote:
    I did some additional checking and found the unsearchable document does not contain fonts under File > Properties> Fonts.

  • Problem with the navigation library with states in modules

    Hello,
    The application I'm working on is based on a shell which contain a "contentNavigator" where several states are defined :
    <code>
    <fx:Declarations>
            <parsley:Configure />
        </fx:Declarations>
        <fx:Metadata>
            [Waypoint(mode="states",name="shell")]
        </fx:Metadata>
        <s:states>
            <s:State name="dashboardModule" />
            <s:State name="registrationModule" />
            <s:State name="marketingModule" />
        </s:states>
        <components:ModulePad id="dashboard" includeIn="dashboardModule"  url="../../dashboard/bin-debug/dashboardModule.swf" />
        <components:ModulePad id="registration" includeIn="registrationModule"  url="../../registration/bin-debug/registrationModule.swf" />
    </code>
    Each ModulePad is a custom component that manage the loading/unloading of a spark module. The navigation in each spark module is based on the same principle, for example in the registrationModule :
    <code>
        <fx:Declarations>
            <parsley:ContextBuilder config="RegistrationContext" />
            <parsley:Configure />
        </fx:Declarations>
        <fx:Metadata>
            [Waypoint(mode="states",name="shell.registrationModule")]
        </fx:Metadata>
        <s:states>
            <s:State name="registration" />
            <s:State name="tracking" />
        </s:states>
        <presentation:Registration includeIn="registration" width="1000" top="130" left="40" bottom="30"/>
        <presentation:RegistrationTracking includeIn="tracking" width="1000" top="130" left="40" bottom="30"/>
    </code>
    At the beginning the navigation is working properly : when a NavigationEvent ("shell.registrationModule.tracking") is dispatched the registrationModule is loaded and when the loading is done the state is set to "tracking".
    Then if a NavigationEvent ("shell.dashboardModule.dashboard") is dispatched the registrationModule is automatically unloaded and the dashboardModule is loaded. But then if a NavigationEvent ("shell.registrationModule.tracking") is dispatched again, the state is set to "registration" (the default one) instead of "tracking" like the first time.
    The event log show that a (com.adobe.cairngorm.navigation.core.NavigationDispatcher shell.registrationModule.tracking:exit) is triggered just after the load of the registrationModule.
    Is this a bug or am i making a mistake in the implementation of the navigation ?
    Thanks for you help.

    Here is the log of the navigation events if it can help :
    com.adobe.cairngorm.navigation.core.NavigationDispatcher shell:firstEnter
    com.adobe.cairngorm.navigation.core.NavigationDispatcher shell:everyEnter
    com.adobe.cairngorm.navigation.core.NavigationDispatcher waypointChange shell
    com.adobe.cairngorm.navigation.core.NavigationDispatcher shell
    com.adobe.cairngorm.navigation.core.NavigationDispatcher shell.dashboardModule:firstEnter
    com.adobe.cairngorm.navigation.core.NavigationDispatcher shell.dashboardModule:everyEnter
    [SWF] Users:vincentjuge:Documents:Adobe Flash Builder 4.5:ThalamusDashboard:bin-debug:DashboardModule.swf - 1 052 130 octets après la décompression
    com.adobe.cairngorm.navigation.core.NavigationDispatcher waypointChange shell.dashboardModule
    com.adobe.cairngorm.navigation.core.NavigationDispatcher shell.dashboardModule.dashboard:firstEnter
    com.adobe.cairngorm.navigation.core.NavigationDispatcher shell.dashboardModule.dashboard:everyEnter
    com.adobe.cairngorm.navigation.core.NavigationDispatcher shell.dashboardModule.dashboard:exit
    com.adobe.cairngorm.navigation.core.NavigationDispatcher shell.dashboardModule:exit
    com.adobe.cairngorm.navigation.core.NavigationDispatcher waypointChange shell
    com.adobe.cairngorm.navigation.core.NavigationDispatcher shell
    com.adobe.cairngorm.navigation.core.NavigationDispatcher shell.registrationModule:firstEnter
    com.adobe.cairngorm.navigation.core.NavigationDispatcher shell.registrationModule:everyEnter
    [SWF] Users:vincentjuge:Documents:Adobe Flash Builder 4.5:ThalamusRegistration:bin-debug:RegistrationModule.swf - 1 108 823 octets après la décompression
    com.adobe.cairngorm.navigation.core.NavigationDispatcher waypointChange shell.registrationModule
    com.adobe.cairngorm.navigation.core.NavigationDispatcher shell.registrationModule.tracking:firstEnter
    com.adobe.cairngorm.navigation.core.NavigationDispatcher shell.registrationModule.tracking:everyEnter
    com.adobe.cairngorm.navigation.core.NavigationDispatcher shell.registrationModule.tracking:exit
    com.adobe.cairngorm.navigation.core.NavigationDispatcher shell.registrationModule:exit
    com.adobe.cairngorm.navigation.core.NavigationDispatcher waypointChange shell
    com.adobe.cairngorm.navigation.core.NavigationDispatcher shell.dashboardModule.dashboard:enter
    com.adobe.cairngorm.navigation.core.NavigationDispatcher shell.dashboardModule.dashboard:everyEnter
    com.adobe.cairngorm.navigation.core.NavigationDispatcher shell
    com.adobe.cairngorm.navigation.core.NavigationDispatcher shell.dashboardModule:enter
    com.adobe.cairngorm.navigation.core.NavigationDispatcher shell.dashboardModule:everyEnter
    [SWF] Users:vincentjuge:Documents:Adobe Flash Builder 4.5:ThalamusDashboard:bin-debug:DashboardModule.swf - 1 052 130 octets après la décompression
    com.adobe.cairngorm.navigation.core.NavigationDispatcher shell.dashboardModule.dashboard:exit
    com.adobe.cairngorm.navigation.core.NavigationDispatcher shell.dashboardModule:exit
    com.adobe.cairngorm.navigation.core.NavigationDispatcher waypointChange shell
    com.adobe.cairngorm.navigation.core.NavigationDispatcher shell.registrationModule.tracking:enter
    com.adobe.cairngorm.navigation.core.NavigationDispatcher shell.registrationModule.tracking:everyEnter
    com.adobe.cairngorm.navigation.core.NavigationDispatcher shell
    com.adobe.cairngorm.navigation.core.NavigationDispatcher shell.registrationModule:enter
    com.adobe.cairngorm.navigation.core.NavigationDispatcher shell.registrationModule:everyEnter
    [SWF] Users:vincentjuge:Documents:Adobe Flash Builder 4.5:ThalamusRegistration:bin-debug:RegistrationModule.swf - 1 108 823 octets après la décompression
    com.adobe.cairngorm.navigation.core.NavigationDispatcher shell.registrationModule.tracking:exit
    com.adobe.cairngorm.navigation.core.NavigationDispatcher shell.registrationModule
    com.adobe.cairngorm.navigation.core.NavigationDispatcher shell.registrationModule.registration:firstEnter
    com.adobe.cairngorm.navigation.core.NavigationDispatcher shell.registrationModule.registration:everyEnter
    [Décharger SWF] Users:vincentjuge:Documents:Adobe Flash Builder 4.5:ThalamusDashboard:bin-debug:DashboardModule.swf
    [Décharger SWF] Users:vincentjuge:Documents:Adobe Flash Builder 4.5:Thalamus:bin-debug:Thalamus.swf

  • Can i use DLL file created by Fortran with the call libary function node

    Can i use a DLL created by Fortran (Compaq Visual Fortran) with the call library function node in labview. If yes how do i create the DLL file if i have the Fortran code.
    Thanks

    Yes! Maybe these old post will help:
    http://forums.ni.com/ni/board/message?board.id=170&message.id=88786
    http://forums.ni.com/ni/board/message?board.id=170&message.id=109150
    Good luck!
    Message Edited by altenbach on 03-21-2006 02:35 PM
    LabVIEW Champion . Do more with less code and in less time .

  • Problems using the reset password function on mac osx server.

    Hey ,
    Having problems with the reset password functions on the OSX server. When I try to do through the command line it asks for the old password of the user. So how do I fix the problem? Do I have to log in onto the ldap server as the admin and reset from there or is there an easy fix to make the reset password function work. When I try the reset password function the server is not taking the input when I click on change password. So any helpful suggestions are welcome. Verson OSX lion 10.7.5
    Thanks in Advance,

    Excuse me for misunderstanding your post.  You explicitly stated in your post
    ashdatla wrote:
    through the command line
    and wrote that it asks for the old password.  Server.app is not accessed through the command line, and it does not ask for the old password of the user.
    You might like to try Workgroup Manager instead.

  • HT2688 Working on a single computer with multiple users, I have set things up to allow each user to view and listen to the others' music libraries under the "Shared Library" function.  Can you then connect an iPod touch and copy music from a shared librar

    Working on a single computer with multiple users, I have set things up to allow each user to view and listen to the others' music libraries under the "Shared Library" function.  Can you then connect an iPod touch and copy music from a shared library?

    Was your wife logged into the libray at the time you tried to log in? I have had a similar problem and it was because another user was logged into the library when I attempted to. I got the permission denied banner.

  • I 've a problem with the print function of Itunes

    helo , i 've a problem with the print function of Itunes.
    When i'm trying to create a pdf file of my entire library, i've got a partial file of it.
    instead of the entire library (37000 songs - 209GByte) the pdf file contains only 18000 songs (1GB - pdf file).
    Is there any problem with the pdf creation in Itunes ?
    best regards
    Marco
    i mac 20"   Mac OS X (10.4.9)  

    Please read https://forums.adobe.com/thread/1499014
    -try some steps such as changing browsers and turning off your firewall
    -also flush your browser cache so you are starting with a fresh browser
    http://myleniumerrors.com/installation-and-licensing-problems/creative-cloud-error-codes-w ip/
    http://helpx.adobe.com/creative-cloud/kb/failed-install-creative-cloud-desktop.html
    or
    A chat session where an agent may remotely look inside your computer may help
    Creative Cloud chat support (all Creative Cloud customer service issues)
    http://helpx.adobe.com/x-productkb/global/service-ccm.html

  • Problems with the function DBMS_XMLSCHEMA.copyEvolve

    I´m having problems with the evolution of xml-schema.
    First the function DBMS_XMLSCHEMA.copyEvolve works correctly, but since one week I get only errors. Strangely is the fact that I use the same files (xml-schema, xslt and xml instances) and the same SQL-Code. Even if I delete all tables, directories, ... with the drop instruction and create them again, I get only error messages. It is also strangely that the function DBMS_XMLSCHEMA.copyEvolve not works if the old and new xml-schema are identical and no XSLT-Stylesheet is handed over. Can by the function DBMS_XMLSCHEMA.copyEvolve something going wrong in the database ? Do I must recreate the database, and how can I do that by the XE? But that can not be a good solution.
    Has anybody a idea what can I do?
    Here is my error report:
    Error starting at line 1 in command:
    BEGIN
    DBMS_XMLSCHEMA.copyEvolve(
    schemaURLs => xdb$string_list_t('http://localhost:8080/internal/xmlschema/testschema.xsd'),
    newSchemas => XMLSequenceType(XDBURIType('/public/testschema_evolution.xsd').getXML()),
    transforms => XMLSequenceType(XDBURIType('/public/MapTotestschema_evolution.xslt').getXML()));
    END;
    Error report:
    ORA-30944: Fehler beim Rollback für XML-Schema "http://localhost:8080/internal/xmlschema/testschema.xsd" Tabelle "MYUSER"."XMLSCHEMATABELLE" Spalte ""
    ORA-02304: Ungültiges Objektidentifizierungsliteral
    ORA-30942: Fehler bei XML Schema Evolution für Schema "http://localhost:8080/internal/xmlschema/testschema.xsd" Tabelle <n/a> Spalte ""
    ORA-31088: Objekt "MYUSER"."BIN$QNQjNoYiRfC4KlQtnfUpMw==$0" hängt von Schema ab
    ORA-06512: in "XDB.DBMS_XMLSCHEMA_INT", Zeile 113
    ORA-06512: in "XDB.DBMS_XMLSCHEMA", Zeile 210
    ORA-06512: in Zeile 2
    Thanks David

    Can you try doing the following before running copyEvolve
    SQL> purge recyclebin
      2  /
    Recyclebin purged.
    SQL> alter session set recyclebin =  off
      2  /
    Session altered.
    SQL>and see if it works as expected.

  • The file .docx cannot be opened because there are problems with the contents in sharepoint document library

    I created a site and  created a document libarary and assigned a word document as a content type . I have written a workflow to create a new document . The workflow is working fine and all the document is getting created and values are getting stored
    in it .
    As per my requirement I am saving the above site as site template .
    After that I am creating a new site based on the above site template , Its getting created and I started the workflow , its working fine and the document is also getting created .
    The problem is I am getting error while opening the word document
    Error - The file filename.docx cannot be opened because there are problems with the contents .
    Details - No error details availble .
    Indresh

    What are you doing within the txt document?  Is it general text and string based items, or have you something more elaborate going on?
    An older discussion here elaborates a bit more on the dotx vs docx side of things.
    http://social.msdn.microsoft.com/Forums/en-US/de1b5ff9-ea6d-460c-a707-8c28acd4906f/error-opening-office-open-xml-file-when-using-sd-workflow-to-create-item-in-document-library?forum=sharepointcustomizationlegacy
    Steven Andrews
    SharePoint Business Analyst: LiveNation Entertainment
    Blog: baron72.wordpress.com
    Twitter: Follow @backpackerd00d
    My Wiki Articles:
    CodePlex Corner Series
    Please remember to mark your question as "answered" if this solves (or helps) your problem.

  • My apple Tv will not airplay, this is the 3rd one i have exchanged and my devices airplay just fine elsewhere, could there be a problem with the wifi even though all of the other functions are working fine?

    My apple Tv will not airplay, this is the 3rd one i have exchanged and my devices airplay just fine elsewhere, could there be a problem with the wifi even though all of the other functions are working fine?

    Hello there, AntRambo.
    The following Knowledge Base articles may provides some steps to go over for troubleshooting your issue:
    iOS and OS X: Recommended settings for Wi-Fi routers and access points
    http://support.apple.com/kb/HT4199
    And also the following:
    iOS: Troubleshooting AirPlay and AirPlay Mirroring
    http://support.apple.com/kb/TS4215
    Particularly but not exclusively of note:
    If the AirPlay icon doesn't appear
    Ensure that you have followed the steps in using AirPlay and AirPlay Mirroring.
    If you are still unable to see the AirPlay icon  , try one of the following steps:
    If trying to AirPlay, or AirPlay mirror, to your Apple TV, ensure that AirPlay is enabled on your Apple TV as well. You can enable or disable AirPlay on Apple TV in the AirPlay menu: Settings > AirPlay.
    Check Internet or network connectivity on all affected devices. Some content requires an Internet connection to authorize content playback. AirPlay capabilities may be limited if your network is not connected to the Internet.
    If attempting to use AirPlay from a third-party app or a website from your Safari app on your iOS device, confirm that the app or website is AirPlay compatible (refer to the developers of the app or website for additional information).
    Thanks for reaching out to Apple Support Communities.
    Cheers,
    Pedro

Maybe you are looking for

  • Updating photoshop CC

    I have photoshop CC. There are new features such as the the camera raw filter and camera shake. How do I get these features?? Dick

  • IBook G4 freezing, and nothing much more

    I’m hoping for some creative help with a very troubling problem I’m having with my G4 iBook. Bought in 2004, this 14-inch iBook is running Tiger (though it came with Panther) and has 768 MB of RAM, a 60 gig hard drive, and a 1.07 GHz processor. It ha

  • SALES ORDER: Total of a Field from the Grid in a User-Defined Field in ORDR

    Hello! I created a User-Defined Field called "U_Soma" in table ORDR (Marketing Documents / Title). I need this U_Soma field Totalize the content of another User-Difined Field called "U_TotalPorUM" created in table RDR1 (Marketing Documents / Rows). I

  • Cannot reject/delete sales order line item due to del.date in 2210

    Hi all, not sure if anyone else had this issue already.... Situation : Sales order line item entered with delivery date in 2210.    We would like to correct this order but can't.... every time SAP issues error : Error determining posting period (info

  • Solaris 10 X86 11/06 Hangs on GUI Login Screen

    1) Solaris X86 11/06 installed on a Intel Core 2 Duo,S975XBX 10GB Partitioned for Solaris 20GB Partitioned for Linux 2) menu.lst edited to add support for Linux (To ensure linux boot options are not missed. ) Thanks to the article http://www.sun.com/