[NTG-context] integer displayed as .0 float in Lua-5.3

Pablo Rodriguez oinos at gmx.es
Thu Aug 9 21:20:54 CEST 2018


On 08/09/2018 08:12 PM, Wolfgang Schuster wrote:
> Use tonumber.

Many thanks for your reply, Wolfgang.

The issue is in Lua itself:

  print(5+"5")

In versions prior to 5.3, result is "10".

>From version 5.3, result is "10.0",

I would say this might be a bug. According to the “Lua 5.3 Reference
Manual" (https://www.lua.org/manual/5.3/manual.html#3.1):

  A numeric constant with a radix point or an exponent denotes a
  float; otherwise, if its value fits in an integer, it denotes an
  integer.

Well, "10.0" contains the radix point, but with no arithmetical relevance.

My background is in humanities and I don’t understand the exponent for
being a float ("10²" contains an exponent
[https://www.m-w.com/dictionary/exponent], but I would say is an integer
in all possible worlds [or all the worlds I know ]).

Could anyone explain me what am I missing here or confirm whether this
is a bug?

Many thanks for your help,

Pablo
-- 
http://www.ousia.tk


More information about the ntg-context mailing list