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

11
LINES

< > BotCompany Repo | #1033224 // Ratio

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (5279L/29K).

srecord Ratio(double numerator, double denominator) {
  *(double numerator) { this(numerator, 1); }
  
  double get() { ret doubleRatio(numerator, denominator); }
  
  toString {
    ret numerator+"/"+denominator
      + "="
      + (denominator == 0 ? "oops" : str(get()));
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1033224
Snippet name: Ratio
Eternal ID of this version: #1033224/3
Text MD5: 336a6feda3677acc171159bfaabe873d
Transpilation MD5: d0382376611ce1312f975a19e7fcbc27
Author: stefan
Category: javax / recognition by compression
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-03-08 09:28:01
Source code size: 290 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 166 / 278
Version history: 2 change(s)
Referenced in: [show references]