[#87847] undefined symbol: mjit_init_p — Leam Hall <leamhall@...>

I pulled Ruby trunk on 3 Jul and am now getting errors similar to the

10 messages 2018/07/07

[#88088] [Ruby trunk Misc#14937] [PATCH] thread_pthread: lazy-spawn timer-thread only on contention — normalperson@...

Issue #14937 has been reported by normalperson (Eric Wong).

9 messages 2018/07/24

[ruby-core:88047] Re: [Ruby trunk Feature#14924] // floor division operator

From: Thibault Jouan <[email protected]>
Date: 2018-07-22 18:35:13 UTC
List: ruby-core #88047
> Out of curiosity what are you doing that needs integer division? :)

  For example in my window manager I have some rules to determine how
windows should be sized and positioned (tiling).

~~~ ruby
# how many windows with 484px width would fit in a given screen?
windows_count =3D screen.width / 484
# what height to use for multiple windows in a "column"?
window_height =3D column.height / column.windows.size
~~~
(this is not my actual code, I changed it slightly for clarity)

  In another case, I wanted to overlay some CSV values from telemetry
data on videos. My values are within -1024..1024, and I want to
overlay a "bar chart" that is 720px high for example, so I had code
similar to this:

~~~ ruby
(telemetry_value + 1024) * 720 / 2048
~~~

  Last example, I use ruby to generate "templates" for my keyboards
(to draw and cut holes for switches/keys). I was worried about Float
approximation (maybe wrongly), and preferred to calculate
everything with integers representing 1/10 millimeter (the most
precise measurement I work with is only 0.5=A0mm).

~~~ ruby
class Key < Struct.new :x, :y, :u, :direction
  def urect
    Rect.new(
      x * U + CASE_PADDING[3],
      y * U + CASE_PADDING[0],
      U * (direction =3D=3D :horizontal ? u : 1),
      U * (direction =3D=3D :vertical ? u : 1),
      :blue
    )
  end

  def switch
    cx, cy =3D urect.center
    Rect.new(
      cx - SWITCH_SIZE / 2,
      cy - SWITCH_SIZE / 2,
      SWITCH_SIZE,
      SWITCH_SIZE,
      :red
    )
  end
end

class Rect < Struct.new :x, :y, :width, :height, :color
  def center
    [x + (width / 2), y + (height / 2)]
  end
end
~~~
(https://raw.githubusercontent.com/tjouan/keyboards/master/lib/keyboards/la=
yout.rb
for the rest of the code, sorry for ugliness and that github is the
only place I have it public for now)

  So in most cases, it was about coordinates=A0: I can't split a pixel
for example. But I also remember using integer division at work for
financial amounts, I cannot split a "cent" either and can't rely on
approximations in such case.


> Still I think that 99% of people expect that when you divide 3 / 2 you ge=
t 1.5 (it's like that in every calculators in the world).
> =

> 3 / 2 =3D=3D 1 is against the principle of least surprise, but hey I unde=
rstand that we can't change that anymore in Ruby. :)

  Yes I have exaggerated in saying the opposite, sorry=A0:-) I
understand that for math and scientific usage it's very different. My
background is mostly C and Ruby, and my "calculator" is almost always
`bc' program so I might be biased here.

-- =

Thibault Jouan

Unsubscribe: <mailto:[email protected]?subject=3Dunsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next