jsoftware / jsource

J engine source mirror
Other
650 stars 90 forks source link

Improve Format 8!:n (1/2) #60

Open tangentstorm opened 2 years ago

tangentstorm commented 2 years ago

The dyad Numbers (".) understands Inf and NaN:

   11 ". '42 4.2 4e2 _4E-2 INF +inf -Inf NAN +NaN -NaN NULL nil'
42 4.2 400 _0.04 _ _ __ _. _. _. 11 11

but it's close inversion via Format (8!:n) is impossible:

   (8!:0) 42 4.2 _4e_2 _ __ _.
+--+---+-----+-+--+--+
|42|4.2|-0.04|_|__|_.|
+--+---+-----+-+--+--+
   'd<nan>' (8!:0) 42 4.2 _4e_2 _ __ _.
+-----+----+-----+---+---+---+
|42.00|4.20|-0.04|nan|nan|nan|
+-----+----+-----+---+---+---+

Is it possible to extend it to get:

   SOMETHING (8!:0) 42 4.2 _4e_2 _ __ _.
+-----+----+-----+---+----+---+
|42.00|4.20|-0.04|inf|-inf|nan|
+-----+----+-----+---+----+---+

-- @jip Igor Zhuravlov 07:29, 23 June 2021 (UTC)

jip commented 2 years ago

Cross-reference: [JWiki] System/Interpreter/Requests, Igor Zhuravlov, Wed Jun 23 07:29 UTC 2021.