Skip to content

Unfortunate interactions between inexact numbers and the image library #262

@blerner

Description

@blerner

From the original emails:

I have a computed ::Number value which is a float between 0 and 1. How do I get an integer to dynamically construct an RGB value?

import image as I
import image-structs as C

I.circle(20, "solid",C.color(240,1,240,1))  # ==>magenta circle

I.circle(20, "solid",C.color(240.2,1,240,1))  # ==>black circle

And

The code below will work, using num-exact to force the number to be exact. But I'm not happy with two things here that will get fixed:

  • truncate/floor/ceiling should produce exact results
  • one of color or circle should have given you an error message, not produced bogus answers
I.circle(20, "solid",C.color(240,1,num-exact(num-truncate(240.1)),1))  # ==>magenta circle

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions