chicken-users
[Top][All Lists]
Advanced

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

Re: Chicken 5 compilation, coerced inexact literal number warning. What


From: Matt Welland
Subject: Re: Chicken 5 compilation, coerced inexact literal number warning. What am I missing here?
Date: Wed, 7 Apr 2021 22:42:39 -0700

Thanks Peter. That helped. I'm not certain but I think it was where I had put hostinfo egg from chicken 4 into a subdir and was including it. There is a .h file in hostinfo and I didn't catch the error message. Presumably that somehow put the compiler into fixnum mode. Now on to the next porting challenge :)



On Tue, Apr 6, 2021 at 11:20 PM Peter Bex <peter@more-magic.net> wrote:
On Tue, Apr 06, 2021 at 09:37:32PM -0700, Matt Welland wrote:
> This one I sort of understand but it does seem annoying:
>
> Warning: coerced inexact literal number `9e+99' to fixnum
> 8999999999999999948859130765266355329578537025198862586562510896759102769772101980841694466750283776

I don't get this, unless I use -fixnum-arithmetic.  The message
is a bit misleading because that number is (obviously) not a fixnum.
However, if I compile it and I get that warning, it errors out with

  Error: [internal compiler error] bad immediate (prepare)

This makes sense because that's not a fixnum.  Maybe something we
could "fix" by making the number overflow, or something.

> but the following I don't understand:
>
> This line:
> (define megatest-version 1.6584)
>
> generates this warning:
> Warning: literal is out of range - will be truncated to integer: 1.6584

I don't get that unless I compile with -fixnum-arithmetic.

> But a small test program works fine:
>
> $ cat testit.scm
> (module testit
> *
> (import scheme)
> (define abc 1.2345)
> )
>
> (import testit)
> (print (/ abc 2))
> $ csc testit.scm
> $ ./testit
> 0.61725

If I compile that as "csc -fixnum-arithmetic testit.scm" I get the
same warning and it prints zero.  If I compile it without flags,
I get the expected output, like you.

Cheers,
Peter


--
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]