https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=242067

--- Comment #6 from Dennis Clarke <dcla...@blastwave.org> ---

Merely a follow up here to indicate this problem has been around since
at least r350568 : 

root@callisto:/home/dclarke/foo # uname -apKU
FreeBSD callisto 13.0-CURRENT FreeBSD 13.0-CURRENT r350568 QEMU  riscv riscv64
1300038 1300038
root@callisto:/home/dclarke/foo # 
root@callisto:/home/dclarke/foo # cat pi.c

/*************************************************
 * The Open Group Base Specifications Issue 6
 * IEEE Std 1003.1, 2004 Edition
 *************************************************/
#define _XOPEN_SOURCE 600

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

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

    long double pi128 = 3.1415926535897932384626433832795028841971693993751L;
    double pi64 = M_PI;

    printf (" the sizeof(pi128) is %i\n", sizeof(pi128) );
    printf (" the sizeof(pi64) is %i\n", sizeof(pi64) );

    printf ("pi128 may be %44.38Lg\n", pi128 );
    printf ("pi64 may be %18.16g\n", pi64 );

    return ( EXIT_SUCCESS );

}

root@callisto:/home/dclarke/foo # 
root@callisto:/home/dclarke/foo # cat  pi.s
        .file   "pi.c"
        .option nopic
        .text
        .section        .rodata
        .align  3
.LC2:
        .string " the sizeof(pi128) is %i\n"
        .align  3
.LC3:
        .string " the sizeof(pi64) is %i\n"
        .align  3
.LC4:
        .string "pi128 may be %44.38Lg\n"
        .align  3
.LC5:
        .string "pi64 may be %44.38Lg\n"
        .text
        .align  1
        .globl  main
        .type   main, @function
main:
        addi    sp,sp,-64
        sd      ra,56(sp)
        sd      s0,48(sp)
        addi    s0,sp,64
        mv      a5,a0
        sd      a1,-64(s0)
        sw      a5,-52(s0)
        lui     a5,%hi(.LC0)
        ld      a4,%lo(.LC0)(a5)
        sd      a4,-32(s0)
        ld      a5,%lo(.LC0+8)(a5)
        sd      a5,-24(s0)
        lui     a5,%hi(.LC1)
        fld     fa5,%lo(.LC1)(a5)
        fsd     fa5,-40(s0)
        li      a1,16
        lui     a5,%hi(.LC2)
        addi    a0,a5,%lo(.LC2)
        call    printf
        li      a1,8
        lui     a5,%hi(.LC3)
        addi    a0,a5,%lo(.LC3)
        call    printf
        ld      a2,-32(s0)
        ld      a3,-24(s0)
        lui     a5,%hi(.LC4)
        addi    a0,a5,%lo(.LC4)
        call    printf
        ld      a1,-40(s0)
        lui     a5,%hi(.LC5)
        addi    a0,a5,%lo(.LC5)
        call    printf
        li      a5,0
        mv      a0,a5
        ld      ra,56(sp)
        ld      s0,48(sp)
        addi    sp,sp,64
        jr      ra
        .size   main, .-main
        .section        .rodata
        .align  4
.LC0:
        .word   3306619320
        .word   2221509004
        .word   3041149649
        .word   1073779231
        .align  3
.LC1:
        .word   1413754136
        .word   1074340347
        .ident  "GCC: (GNU) 8.2.0"
root@callisto:/home/dclarke/foo # 
root@callisto:/home/dclarke/foo # 
root@callisto:/home/dclarke/foo # ./pi
 the sizeof(pi128) is 16
 the sizeof(pi64) is 8
pi128 may be      2.0000076293945362811600603241536472604
pi64 may be  3.141592653589793
root@callisto:/home/dclarke/foo # 

root@callisto:/home/dclarke/foo # echo "16o 1074340347p 1413754136pq" | dc
400921FB
54442D18
root@callisto:/home/dclarke/foo # echo "16o 1073779231p 3041149649p 2221509004p
3306619320pq"  | dc 
4000921F
B54442D1
8469898C
C51701B8
root@callisto:/home/dclarke/foo # 

So that is perfect in memory and wrong in output. 


-- 
Dennis Clarke
RISC-V/SPARC/PPC/ARM/CISC
UNIX and Linux spoken
GreyBeard and suspenders optional

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
freebsd-bugs@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"

Reply via email to