• Bug#1065665: nxt-firmware: implicit type conversion from negative float

    From Andreas Weber@21:1/5 to All on Fri Mar 8 16:10:01 2024
    Package: nxt-firmware
    Version: 1.29.2-1
    Severity: important
    Tags: upstream

    Dear Maintainer, following code debug1.nxc:

    task main()
    {
    float a = -12.34;
    NumOut(0, 32, a);

    char b = a;
    NumOut(0, 24, b);

    Wait(3000);
    }

    using nbc 1.2.1.r4+dfsg-11+b1 from Debian bookworm,
    compile with
    $ nbc debug1.nxc -O=debug1.rxe
    upload with
    $ nbc -b -d debug1.rxe

    with nxt-firmware 1.29.2-1 from Debian bookworm a948539b318073287733c618ea8d31f2 nxt_firmware.bin

    outputs on LCD:
    -12.34

    0

    same with 1.29.4 from upstream.

    with NXT Enhanced Firmware, aka John Hansen Firmware, aka NBC/NXC Firmware a2a17802cde9bf610944757ab7ca6d92 lms_arm_nbcnxc_132_20120810_0021.rfw

    outputs on LCD:
    -12.34
    -12

    as expected.

    This currently makes OpenRoberta Lab pretty unusable with this firmware
    because many negative float -> char conversions occur

    Thank you, Andy

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Petter Reinholdtsen@21:1/5 to All on Fri Mar 8 18:50:01 2024
    [Andreas Weber]
    Dear Maintainer, following code debug1.nxc:

    No idea about the nxt-firmware status, but just for fun and to show
    support, I made a C edition:

    % cat > x.c <<EOF
    #include <stdio.h>
    int main(int argc, char *argv[])
    {
    float a = -12.34;
    printf("%f\n", a);

    char b = a;
    printf("%i\n", b);
    return 0;
    }
    EOF
    % gcc x.c
    % ./a.out
    -12.340000
    -12
    %

    --
    Happy hacking
    Petter Reinholdtsen

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andreas Weber@21:1/5 to All on Fri Mar 8 19:00:02 2024
    Am 08.03.24 um 18:42 schrieb Petter Reinholdtsen:
    No idea about the nxt-firmware status, but just for fun and to show
    support, I made a C edition:

    Hi Petter, thank you for the reply.

    This was fixed upstream with release 1.29.5 https://git.ni.fr.eu.org/nxt-firmware.git/commit/?id=3a3201ff808c1258bd8cea8c6ae471c446dd2ed9

    thank you and sorry for the noise.

    -- Andy

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)