static Long ai_calculateDateOfDoom(long time1, double value1, long time2, double value2, double criticalMinimum) { if (value2 <= criticalMinimum) ret time2; if (value2 >= value1) null; // upward slope, no doom double time = time1+(criticalMinimum-value1)*(time2-time1)/(value2-value1); ret lround(max(min(time, Long.MAX_VALUE), time2)); }
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1023133 | 
| Snippet name: | ai_calculateDateOfDoom (extrapolate when value will reach a fixed minimum, dev.) | 
| Eternal ID of this version: | #1023133/3 | 
| Text MD5: | b21aa5c47762992087226e5e7965a9a3 | 
| Author: | stefan | 
| Category: | javax | 
| Type: | JavaX fragment (include) | 
| Public (visible to everyone): | Yes | 
| Archived (hidden from active list): | No | 
| Created/modified: | 2019-05-15 15:55:22 | 
| Source code size: | 351 bytes / 6 lines | 
| Pitched / IR pitched: | No / No | 
| Views / Downloads: | 471 / 524 | 
| Version history: | 2 change(s) | 
| Referenced in: | [show references] |