Bug in tables/csv's makenum

28 views
Skip to first unread message

Jorrit Kirsten

unread,
Jun 3, 2025, 5:46:33 AM6/3/25
to forum
Hi everyone,

I have experienced unexpected behaviour when using makenum from tables/csv on boxed values and I assume it is a bug:

   ]data_0 =. '1-2' ; '1 - 2' ; 'ABC'
┌───┬─────┬───┐
│1-2│1 - 2│ABC│
└───┴─────┴───┘

NB. When applying makenum the first box (index 0) remains being a literal and the second becomes unexpectedly becomes a float.
NB. The '-' in the second box (index 1) is interpreted as _ (infinity), not even as minus:

   ]data_1 =. makenum data_0
┌───┬─────┬───┐
│1-2│1 _ 2│ABC│
└───┴─────┴───┘
   (,: datatype&.>) data_1
┌───────┬────────┬───────┐
│1-2    │1 _ 2   │ABC    │
├───────┼────────┼───────┤
│literal│floating│literal│
└───────┴────────┴───────┘
   1{:: makenum '1-2' ; '1 - 2' ; 'ABC'
1 _ 2

NB. Aside: Note that 1 {:: data_1 has the type floating, since _ has floating type, which may be unexpected for users expecting that an integer type might also support infinity values, but this does not seem to be supported by (m)any (?) programming languages and there does not seem to be a standard for integer arithmetic like there is for floating point arithmetic (IEEE Standard for Floating-Point Arithmetic (IEEE 754)):

   datatype _
floating

Jorrit

Clifford Reiter

unread,
Jun 3, 2025, 8:30:28 AM6/3/25
to fo...@jsoftware.com
makenum uses dyadic ". which may not be what you want.
Especially "More Information"

To unsubscribe from this group and stop receiving emails from it, send an email to forum+un...@jsoftware.com.

Jorrit Kirsten

unread,
Jun 4, 2025, 6:04:05 PM6/4/25
to forum, Clifford Reiter
Thank you very much for this clarification!
I had neither read the documentation nor the implementation and had not expected this semantics.

Jorrit
Reply all
Reply to author
Forward
0 new messages