Implicit type conversion: Difference between revisions
Content added Content deleted
m (added whitespace before the TOC, added a Task (bold) header.) |
|||
Line 648: | Line 648: | ||
@() pluralize |
@() pluralize |
||
%() hashify</pre> |
%() hashify</pre> |
||
=={{header|Phix}}== |
|||
If a numerical operation on floating points results in an exact integer, that is how it is stored, eg 1.5+1.5<br> |
|||
Likewise a numerical operation on integers can need to be stored in a float, eg 1/3 or #123456*#123456.<br> |
|||
If a string character (or slice) is replaced with any value that will not fit in a byte, it is automatically |
|||
converted to a dword_sequence, eg |
|||
<lang Phix>sequence s = "this" |
|||
s[3] = PI -- s is now {'t','h',3.1415926,'s'}</lang> |
|||
Phix does not, or at least tries very hard not to "drop bits" or "clock round". 1/3 is 0.333333 not 0, 0-1 is |
|||
-1 not +#FFFFFFFF, in all cases, with a plain english fatal run-time error should a type check occur. |
|||
=={{header|Python}}== |
=={{header|Python}}== |