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: Peter Bex
Subject: Re: Chicken 5 compilation, coerced inexact literal number warning. What am I missing here?
Date: Wed, 7 Apr 2021 08:20:49 +0200
User-agent: Mutt/1.10.1 (2018-07-13)

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

Attachment: signature.asc
Description: PGP signature


reply via email to

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