No. There is no difference between 3 and 3.0 in APL.
Is there any way to tell the difference between a number 3.0 and 3 in APL?
-
01-06-2022 - |
문제
Or 1 versus 1.0, or 2 versus 2.0...
Ideally, is there an operation that will behave differently on one than the other?
해결책 2
다른 팁
APL tries to insulate things like the actual storage type from the user. APL may or may not demote the type you've typed in, thus if you type 1.0 and expect double, you might really get boolean. This behaviour varies by implementation.
Be that as it may, some APL systems offer a function called []DR, for Data Representation. On my Dyalog APL v.10 system,
[]DR 3.0 is 83, one byte integer
[]DR 3 is 83, one byte integer
[]DR 1 is 83, one byte integer
[]DR 0 is 83, one byte integer
[]DR ~1 is 11, one bit boolean
[]DR 3.1 is 645, double floating point
Your mileage, and answers, will vary from system to system.
제휴하지 않습니다 StackOverflow