[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Error trying to update powerpc64 Jessie machine.



On 06/28/2018 04:40 PM, John Paul Adrian Glaubitz wrote:
On 06/28/2018 10:35 PM, Dennis Clarke wrote:
It is perfectly possible to install the last supported 64-bit release and then dist-upgrade to sid and everything seems to run just fine. I am having no troubles ( nothing fascinating other than some datatype weirdness ) on a PowerMac G5 :

There was never an officially supported 64-bit PowerPC release for big-endian,
just little-endian (ppc64el).

nix$ uname -a
Linux nix 4.17.2-genunix #1 SMP Fri Jun 22 23:42:51 GMT 2018 ppc64 GNU/Linux
nix$

This is just the kernel. Your userland is still 32-bit, I assume:

dpkg --print-architecture

root@nix:~# dpkg --print-architecture
ppc64


big endian also :

nix$ gcc --version
gcc (genunix Sat May 12 22:02:47 UTC 2018) 8.1.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

nix$ gcc -mcpu=970 -mno-altivec -g -m64 -std=c99 -pedantic-errors -o sinl sinl.c -lm
nix$ ./sinl
Our pi constant was
   3.1415926535897932384626433832795028841971693993751L

---------+---------+---------+---------+---------+


pi   at 0x7fffe8ed5920 : 40 09 21 fb 54 44 2d 18 3c a1 a6 26 33 14 5c 06



sizeof(long double) = 16
      pi may be +3.14159265358979323846264338327948122706
sinl(pi) may be +0.00000000000000000000000000000002165713
    approx_pi = +3.14159265358979323846264338327948122706
     ld_error = +0.00000000000000000000000000000000000000

 lets do eight slices around the circle :
theta = -3.14159265358979323846264338327948122706 sinl(theta) = -0.00000000000000000000000000000002165713 theta = -2.35619449019234492884698253745959859435 sinl(theta) = -0.70710678118654752440084436210485929590 theta = -1.57079632679489661923132169163974061353 sinl(theta) = -1.00000000000000000000000000000000000000 theta = -0.78539816339744830961566084581987030677 sinl(theta) = -0.70710678118654752440084436210484696995 theta = +0.00000000000000000000000000000000000000 sinl(theta) = +0.00000000000000000000000000000000000000 theta = +0.78539816339744830961566084581988263272 sinl(theta) = +0.70710678118654752440084436210484696995 theta = +1.57079632679489661923132169163974061353 sinl(theta) = +1.00000000000000000000000000000000000000 theta = +2.35619449019234492884698253745959859435 sinl(theta) = +0.70710678118654752440084436210487162185
nix$

However the in memory data for pi is wrong because of the IBM long
double format which seems to be two doubles slammed together as opposed
to real actual binary128 datatype.  However that is a lost struggle.

Dennis

----------
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <math.h>

/* how many slices of pi are we going to use? */
#define N_WIDTH 8

int main ( int argc, char* argv[] ){

    int j;
    long double theta, neg_pi, pi, pi2, approx_pi, ld_error;

    /* 128-bit floating point has at most 38 digits
     *  of reasonable precision. We should be able to
     *  load in a constant value for pi using :
     *
     *      3.1415926535 8979323846 2643383279
     *        5028841971 6939937510
     *
     * The result should be a 16-byte big endian machines
     * representation in memory thus :
     *
     *    40 00 92 1f b5 44 42 d1 8469 89 8c c5 17 01 b8
     *
     * We can try to load in some constants and hope we get
     * a fully reasonable in memory value.
     */

    printf ( "Our pi constant was \n" );
    printf ( "   3.1415926535897932384626433832795028841971693993751L" );
    printf ( "\n\n" );
    printf ( "---------+---------+---------+---------+---------+\n" );
    pi = 3.1415926535897932384626433832795028841971693993751L;

    printf("\n\npi   at %p : ", &pi);
    for ( j=0; j<sizeof(long double); j++ )
        printf("%02x ", ((unsigned char *)&pi)[j] );
    printf("\n\n" );

    neg_pi = -3.1415926535897932384626433832795028841971693993751L;
    pi2 = 6.2831853071795864769252867665590057683943387987502L;

    printf ( "\n\nsizeof(long double) = %2i\n", sizeof(long double) );
    printf ( "      pi may be %+40.38Lf\n", pi );
    printf ( "sinl(pi) may be %+40.38Lf\n", sinl(pi) );

    approx_pi = (long double) 4.0 * atanl( (long double) 1.0 );
    printf ( "    approx_pi = %+40.38Lf\n", approx_pi );
    ld_error = 3.1415926535897932384626433832795028841971693993751L
                - approx_pi;

    printf ( "     ld_error = %+40.38Lf\n\n", ld_error );

    printf ( " lets do eight slices around the circle : \n" );
    for ( j=0 ; j < N_WIDTH; j++ ) {

        theta = neg_pi + ( pi2 * ( (long double) j ) )
                  /
                ( ( (long double) N_WIDTH ) );

        fprintf ( stdout, "theta = %+40.38Lf", theta );
        fprintf ( stdout, "    sinl(theta) = %+40.38Lf\n", sinl(theta) );

    }

    return EXIT_SUCCESS;

}

however gmp and mpfr addresses all the above wonderfully.


Reply to: