Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

6
LINES

< > BotCompany Repo | #1005860 // toFloat

JavaX fragment (include)

static float toFloat(O o) {
  if (o == null) ret 0f;
  if (o instanceof Number) ret ((Number) o).floatValue();
  if (o instanceof Boolean) ret ((Boolean) o).booleanValue() ? 1f : 0f;
  fail("Not convertible to float: " + _getClass(o));
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1005860
Snippet name: toFloat
Eternal ID of this version: #1005860/1
Text MD5: 6383afbe3c15a1fa6d91eb7f262b7361
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-12-11 08:13:03
Source code size: 242 bytes / 6 lines
Pitched / IR pitched: No / No
Views / Downloads: 477 / 517
Referenced in: [show references]