Floats and %d
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Floats and %d
- From: Rena <hyperhacker@...>
- Date: 2015年7月14日 20:58:57 -0400
This is something I've been stubbing my toe on a lot lately and it's
rather annoying:
Lua 5.3.1 Copyright (C) 1994-2015 Lua.org, PUC-Rio
; print(string.format('%d', 1.1))
stdin:1: bad argument #2 to 'format' (number has no integer representation)
stack traceback:
[C]: in function 'string.format'
stdin:1: in main chunk
[C]: in ?
;
In previous versions - and in C - it would just silently truncate the
number (drop the fractional part). Why was this changed?
--
Sent from my Game Boy.