[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Cannot run picture language
From: |
Taylor R Campbell |
Subject: |
Re: Cannot run picture language |
Date: |
Sat, 16 Jan 2021 18:52:04 +0000 |
> Date: Sat, 16 Jan 2021 10:41:49 -0800
> From: Matt Birkholz <matt@birchwood-abbey.net>
>
> On Fri, 2021-01-15 at 23:12 +0800, Lingyu Zhu wrote:
> > 1 ]=> (paint g1 fovnder)
> > ;The object 65536/255, passed as the first argument to integer-
> >flonum, is not the correct type.
>
> This makes me wonder about line 69 of arith.scm:
>
> (define-standard-unary exact->inexact (lambda (x) x) int:->flonum)
>
> It seems reasonable to apply exact->inexact to a rational number yet
> the procedure uses int:->flonum which, reasonably, objects to
> arguments that are not integers so... perhaps screw with (broaden the
> domain of) int:->flonum with the following hack?
6001/arith.scm seems to be deliberately defined without rational
arithmetic. I don't know what the history behind it is, but the code
(exact->inexact (/ n-bins ...)) was probably intended to compute a
truncated integer quotient. You could probably get the intended
effect by writing (quotient n-bins ...) instead.
Perhaps this code should omit (declare (usual-integrations)) so the
compiler won't replace (/ ...) by the primitive which does support
rational arithmetic (by punting to the runtime via the `generic
trampoline').