text:
Yes, of course I'm an adult!
I think we've all done this as a kid: some websites require a minimum age of 18, so we just subtract a few years from the year of birth and voilà, we 'are' 18+.
In addition, for most rides at amusement parks the minimum height to enter is 1.40 meters (here in The Netherlands it as at least). Of course this can be cheated less easily than age, but you could wear shoes with thick heels, put your hair up, wear a hat, stand on your toes, etc.
Input:
Your program/function accepts a positive integer or decimal.
Output:

Is the input an integer >= 18? Simply print the input.
Is the input an integer 0-17? Print 18.
Is the input a decimal >= 1.4? Simply print the input.
Is the input a decimal 0.0-1.4? Print 1.4.

Challenge rules:

Assume the input will always be in the range of 0-122 (oldest woman ever was 122) or 0.0-2.72 (tallest man ever was 2.72).
You are allowed to take the input as a String, object, or anything else you prefer.
The decimal inputs will never have more than three decimal places after the decimal point.
2 or 2. both aren't valid outputs for 2.0. You are free to output 2.00 or 2.000 instead of 2.0 however.
Just like the input the output will never have more than three decimal places after the point.

General rules:

This is code-golf, so shortest answer in bytes wins.
Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.
Standard rules apply for your answer, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters, full programs. Your call.
Default Loopholes are forbidden.
If possible, please add a link with a test for your code.
Also, please add an explanation if necessary.

Test cases:
0      ->  18
1      ->  18
2      ->  18
12     ->  18
18     ->  18
43     ->  43
115    ->  115
122    ->  122

0.0    ->  1.4
1.04   ->  1.4
1.225  ->  1.4
1.399  ->  1.4
1.4    ->  1.4
1.74   ->  1.74
2.0    ->  2.0
2.72   ->  2.72

Can we assume that the input is free of leading zeros?

@TobySpeight Yes, no leading zeros.

0.0-2.72 (tallest man ever was 2.72). - You aren't 0.0 when you're born...

@JohanKarlsson I know, thought about adding a minimum, but I decided to just let it start at 0 and 0.0. :) The added tallest man ever was 2.72 and oldest woman ever was 122 was just added as informational facts for those interested.

According to meta, you can overload a function for different types of input. link

"[...] so we just add a few years to the year of birth [...]" Shouldn't you subtract a few years from the year of birth?

@wythagoras Sharp. I'll edit it.

Convex, 9 bytes
_1ÛI1.4?»

Try it online!

Python 2.7, 34 bytes
lambda x:max(x,[18,1.4]['.'in`x`])

What does this return for 2.0?

@Adám max(2.0,[18,1.4][True]) == max(2.0,1.4) == 2.0

Doesn't it remove the decimal?

Nope, it doesn’t. Why don’t you try it yourself? :)

Because I don't have Python installed, and http://tryitonline.net/ doesn't include Python.

@Adám I use https://repl.it or https://ideone.com for Python. View any Python answer I've ever posted, and it probably has a link to one of those two.

@matsjoyce That returns 18 when passed 1.0

@Lynn Whoops, sorry. I was looking at the JS answer and missed that the code was labeled "wrong".

I'm not familiar with python. Can someone explain what's going on?

nevermind, got it. so basically true or false maps to 0 or 1 index in that array and then applies max on the two numbers.

05AB1E, 13 11 bytes
Uses CP-1252 encoding.
ÐîQ18*14T/M

Explanation
Ð             # triplicate input
 î            # round up
  Q           # check for equality
   18*        # multiply 18 by this (18 if input is int, else 0)
      14T/    # push 14 / 10
          M   # take max of stack (input and 1.4 or 18)

Try it online

You're kinda slow. Still took you 1.5 minutes. ;P (read: Damn, that was fast.) It's pretty straightforward of course.

@KevinCruijssen: Yeah, the implementation is quite fast in a lang not requiring many key-presses :P

@EriktheGolfer: Better? If not feel free to edit it. I've been experimenting with a few different ways of formatting and haven't decided on a strictly best one. Suggestions welcome.

@Emigna I just added two missing crucial spaces.

Is the input a decimal 0-1.4? Print 1.4. I just ran this and it returned 18. http://05ab1e.tryitonline.net/

@FrancescoCasula: yes, .ï does not work in the version that's on TIO. But in the offline compiler it does (and did before this challenge was posted). That is why I didn't add a TIO link. There are however at least one other 13 bytes solution that do work on TIO, but this was the first I thought of.

@FrancescoCasula: I found a shorter solution which does work on TIO :)

JavaScript (ES6), 27 31
Input taken as a string. To check if the input value has decimals, it's appended to itself: if there is no decimal point the result is still a valid number, else it's not. To recognize a valid number (including 0), I use division as in javascript 1/n is numeric and not 0 for any numeric n  (eventually the value is Infinity for n==0), else it's NaN
x=>x<(y=1/(x+x)?18:1.4)?y:x

Test

f=
x=>x<(y=1/(x+x)?18:1.4)?y:x

;[
 ['0', '18' ],['1', '18' ],['2', '18' ],['12', '18' ],['18', '18' ],['43', '43' ],['115', '115'], ['122', '122' ]
,['0.0', '1.4'],['1.0', '1.4'],['1.04', '1.4'],['1.225', '1.4'],['1.399', '1.4'],['1.4', '1.4'],['1.74', '1.74'],['2.0', '2.0'],['2.72', '2.72']
].forEach(t=>{
  var i=t[0],k=t[1],r=f(i)
  console.log(i,k,r,k==r?'OK':'KO')
})

My prev (wrong) solution:
Taking input as a number, you can use remainder operator % to check if the number is integer.
x=>x<(y=x%1?1.4:18)?y:x

or
x=>Math.max(x,x%1?1.4:18)

But this does not work as the challenge request to discriminate between, say, 2 and 2.0 and that's the same number. So it's not possibile to get the input as a number

Result for 2.0 should be 2.0, not 18.

indeed. 2.0%1 and 1.0%1 will result in 0

'javascript(es6) is verbose', you only see that at codegolf

@Neil on second thought you're probably right

By my reckoning your solution is now as long as the verbose /./.test(x) but maybe x[1]<'0' is shorter?

@neil ... boring. The x+0-x seemed clever, it's a pity it fails with '0'. Thanks for the hint

1/(x+x) - now that's imaginative!

Java 8, 90 61 57 bytes
i->(i+"").contains(".")?(float)i<1.4?1.4:i:(int)i<18?18:i

-4 bytes returning Object instead of String; and some additional bytes converting Java 7 to 8.
-4 byte taking the input as Object instead of String as well.
Explanation:
Try it here.
i->                      // Method with Object as both parameter and return-type
  (i+"").contains(".")?  //  If the input as String contains a dot:
   (float)i<1.4?         //   If the input is a float below 1.4:
    1.4                  //    Return double 1.4
   :                     //   Else:
    i                    //    Return the input-float as is
  :(int)i<18?            //  Else if the input is an integer below 18:
   18                    //   Return integer 18
  :                      //  Else:
   i                     //   Return the input-integer as is

Is it necessary to put brackets around the if/else operator?

@RomanGräf Yes; the ternary has lower precedence than +, which means that if you removed the parentheses, it would turn into (""+i.contains(...)) ?

-26! Note that my version only checks if it has decimals following it, so 1.0 would result in 18. Thus this isn't really an improvement on this, which is why I made it it's own answer.

PHP, 40 Bytes
modified by @user59178 Thank You
<?=max(is_int(0+$i=$argv[1])?18:1.4,$i);

PHP, 42 Bytes first Version
<?=max(strpos($i=$argv[1],".")?1.4:18,$i);

is_int($i=$argv[1]+0) is 2 bytes shorter than strpos($i=$argv[1],".") and can serve the same purpose if you swap the 1.4 and the 18

@user59178 I could use is_numeric on a string but not is_int

that's why there's the +0, to convert it to a numeric type.

@user59178 Try 1.0+0 the result is 18 and should be 1.4

It works correctly for me (tried both php 5.5 and 7.0 on windows). Note that it has opposite true/false conditions to the strpos($i=$argv[1],".") version, did you remember to swap the outputs of the ternary?

Actually, on closer reading, it needs to be <?=max(is_int(0+$i=$argv[1])?18:1.4,$i); rather than <?=max(is_int($i=$argv[1]+0)?18:1.4,$i); to avoid outputting 2 when given 2.0.

@user59178 sorry it was too early to think. I'd forgot the swap.

Mine is 5 bytes shorter, but somehow this one keeps getting the votes.

@aross Nice version of advertisement. Your version works for the given test cases. I have expand my version to work with test cases like 11.0

@JörgHülsermann well that was unexpected... It says in the challenge that the range for length is 0.0-2.72, not anything above 10.0, so my answer is perfectly valid.

@aross Don't worry. Sometimes it is better to concentrate giving a better solution as required else shorten the code until it exists no longer way

@JörgHülsermann It's codegolf

Pyth, 14 bytes
eS,@,18h.4}\.`

Try it online.

Perl, 29 27 bytes
Includes +2 for -lp
Give input on STDIN
adult.pl <<< 1.24

adult.pl:
#!/usr/bin/perl -lp
$_>($a=/\./?1.4:18)or*_=a

If you don't mind an extra newline if you really were a full adult then leaving out the l option for 26 bytes works too

EXCEL: 26 31 29 Bytes
=MAX(A1;IF(MOD(A1;1);1,4;18))

Formula can go anywhere except A1, the input cell.
Fixed errors, and replaced with Emigna's suggestion.
Thanks to Alexandru for saving me some bytes using truths

Also, Isn't it better to define a name n for the input cell? It can be anywhere in the document then and it's also 2 bytes shorter.

@Emigna I could, but at that point it gets a bit cheat-y I feel. 1 byte per name is nothing to scrounge at, and If I keep this format, people can copy and paste with ease.

I don't see how that's any different than using a 1-letter input variable in a lambda in python for example. But it's your call :)

Hi! How do you calculate the bytes? Save the file with the formula with the default name or somehow else?

You can remove the '=0' and switch the results: 1.4 first, 18 second
Also, as you have coma as decimal separator, this might not work for most people.

@AlexandruPupsa thanks! I edited it in.

Java, 79 70  bytes
int f(int x){return x<18?18:x;}
float f(float x){return x<1.4?1.4f:x;}

Defines two methods with overloading, which use the conditional operator.
Call it like f(5) or f(1.4f).

Hi. x<18?18:x and x<1.4f?1.4f:x are shorter than the Math.max. I think you might find tips for golfing in Java interesting to read through. :)

Yes, of course they are. How could I forgot them...

I love this! Why code the logic yourself when you can offload that to the compiler!

Brachylog, 14 bytes
#$:18ot|:1.4ot

Try it online!
Explanation
    #$             Input is an integer
      :18o         Sort the list [Input, 18]
          t        Take the last element
|              Or
    :1.4o          Sort the list [Input, 1.4]
         t         Take the last element

GNU sed, 40 + 1 = 41 bytes
(score +1 for use of -r flag to interpreter)

s/^.$|^1[^9]$/18/
/^0|1\.[0-3]/s/.*/1.4/

Annotated:
#!/bin/sed -rf

# First, anything that's a single digit or is '1' followed by a
# digit other than '9' is replaced with '18'.
s/^.$|^1[^9]$/18/

# Now, any line beginning with '0' or containing '1.0' to '1.3' is
# replaced with '1.4'.
/^0|1\.[0-3]/s/.*/1.4/

We take advantage of the constraints on input, so don't have to test the start of string when we see '1.' - we know there's only one digit before the decimal point.
Test result:
$ ./94832.sed <<END
> 0
> 1
> 2
> 12
> 18
> 43
> 122
>
> 0.0
> 1.04
> 1.225
> 1.399
> 1.4
> 1.74
> 2.0
> 2.72
> END
18
18
18
18
18
43
122

1.4
1.4
1.4
1.4
1.4
1.74
2.0
2.72

Haskell, 50 bytes
x#y=show$max x$read y
f s|elem '.'s=1.4#s|1<2=18#s

Usage example: f "1.0" -> "1.6".
Haskell's strict type requires usage of strings as input and output. Howevers, read, max and show are polymorphic and handle all numeric types.

I thought I'd be clever and do it without the guards, but that ended up making it slightly longer instead :( My version: (#)x=map(show.max x.fst).reads;f s=head$18#s++1.4#s

@Cubic: Nice use of reads. With a slight modification it's one byte shorter than mine. Please post it as a separate answer. x#y=show.max x.fst<$>reads y;f s=head$18#s++1.4#s.

Really cool idea saving the parens with infix fmap!

Emacs Lisp, 37 bytes
(lambda(x)(max(if(floatp x)1.4 18)x))

Guesses from the "datatype" whether the integer or float version should be used. (floatp returns t for 1.0, but not for 1.) The parameter is a number as integer or float, i.e. it should satisfy numberp.

Haskell, 49 bytes
x#y=show.max x.fst<$>reads y;f s=head$18#s++1.4#s

Basically, this first attempts to read the input as an integer and then as a double if that fails. Then proceeds to compare it to the respective comparison baseline.

CJam, 18 14 bytes
Saved 4 bytes thanks to Martin Ender.
q~_`'.&1.4I?e>

Online interpreter

IBM/Lotus Notes Formula Language, 58 49 bytes
@If(@Like(@Text(a);"%.%");@If(a<1.4;1.4;a);@If(a<18;18;a))

Computed field formula where a is an editable numeric field.
EDIT
@If(@Like(@Text(a);"%.%");@Max(1.4;a);@Max(18;a))

Alternative inspired by @Mego

Jelly, 16 15 13 12 bytes
-1 thanks to caird coinheringaahing (take input as a string).
ċ”.ị1.4,18»V

TryItOnline
Or see all test cases, also at TryItOnline
How?
ċ”.ị1.4,18»V - Main link: string, S
 ”.          - '.' character
ċ            - count (occurrences of '.' in S)
    1.4,18   - pair literals 1.4 and 18:  [1.4,  18]
   ị         - index into (1-indexed)
           V - evaluate (S) as Jelly code
          »  - maximum

This returns 18 for 2.0, sadly :(

Ah, the complexity of Jelly is superior.

@Lynn thanks, fixed at whopping cost; maybe there is a shorter way than this.

-1 byte taking input as a string

Actually, 16 bytes
;:.7τ9τ($'.íuIkM

Try it online!
Explanation:
;:.7τ9τ($'.íuIkM
;                 dupe input
 :.7τ             1.4 (.7*2) - note that :1.4 is the same length, but an additional delimiter would be needed to separate it from the following 1
     9τ           18 (9*2)
       ($'.íu     1-based index of "." in string representation of input, 0 if not found
             I    1.4 if input contains a "." else 18
              kM  maximum of remaining values on stack

I've never programmed in Actually before, but why use 9τ instead of just 18? I know it's the same byte-count so it doesn't really matter, but 18 seems more readable. Or is there a reason it won't work in the current implementation/programming language?

@KevinCruijssen 18 pushes a 1 and an 8. To push a literal 18, you'd use :18, which is longer than 9τ.

Ah of course, stack-based languages. Thanks for the explanation! +1

AWK - 29 bytes
($0<c=$0~/\./?1.4:18){$0=c}1

Usage:
awk '{c=$0~/\./?1.4:18}($0<c){$0=c}1' <<< number

Testing was performed with gawk on RHEL 6.
I tried with all the test cases, unfortunately I don't have AWK on the machine that has internet access, so copy-paste is not possible.
Is there a more compact way to do this in AWK?

C#, 58 bytes
x=>x is int?(int)x>17?x:18:(float)x<1.4?"1.4":$"{x:.0##}";

No crazy string parsing needed for C#. Input is expected to be an int or float (unfortunately C# can't cast a double to float if the double is in an object). Output will be either int or string in an object.
(almost missed the at least 1 decimal requirement, added that now)
Ungolfed:
/*Func<object, object> Lambda = */ x =>
    x is int // if parameter is an int
        ? (int)x > 17 // check if x is at least 18
            ? x // at least 18 so return x
            : 18 // less than 18 so return 18
        : (float)x < 1.4 // x is float, check if at least 1.4
            ? "1.4" // less than 1.4 so return 1.4
            : $"{x:.0##"} // at least 1.4 so return x and ensure at least 1 decimal place
;

Alternate implementation which is also 58 bytes.
x=>x is int?(int)x>17?x:18:$"{((float)x<1.4?1.4:x):.0##}";

C#, 71 bytes
object A(object i){return i is int?(int)i>18?i:18:(double)i>1.4?i:1.4;}

try it here

C#, 69 bytes
s=>s.Contains(".")?float.Parse(s)<1.4?"1.4":s:int.Parse(s)<18?"18":s;

Try it online!
Full program with test cases:
using System;

namespace YesImAnAdult
{
    class Program
    {
        static void Main(string[] args)
        {
            Func<string,string>f= s=>s.Contains(".")?float.Parse(s)<1.4?"1.4":s:int.Parse(s)<18?"18":s;

            Console.WriteLine(f("0"));  //18
            Console.WriteLine(f("1"));  //18
            Console.WriteLine(f("2"));  //18
            Console.WriteLine(f("12")); //18
            Console.WriteLine(f("18")); //18
            Console.WriteLine(f("43")); //43
            Console.WriteLine(f("122"));    //122

            Console.WriteLine(f("0.0"));    //1.4
            Console.WriteLine(f("1.04"));   //1.4
            Console.WriteLine(f("1.225"));  //1.4
            Console.WriteLine(f("1.399"));  //1.4
            Console.WriteLine(f("1.4"));    //1.4
            Console.WriteLine(f("1.74"));   //1.74
            Console.WriteLine(f("2.0"));    //2.0
            Console.WriteLine(f("2.72"));   //2.72
        }
    }
}

A pretty straightforward solution. Note that on some systems float.Parse() might return incorrect results. Pass CultureInfo.InvariantCulture as the second argument according to this answer.

Given the constraints i think you can get away with replacing s.Contains(".") with s[1]=='.'

Hmm nvm, forgot the 0 test case. so close too :(

@Phaeze: Yes, it would fail on any 1-digit input with an IndexOutOfRangeException. Otherwise you can shave a byte off with s[1]==46 ('.' has an ASCII code of 46), or an even more aggressive approach (presuming you only have digits and a '.' character at index 1): s[1]<47.

Oo I like that, will try to remember.  Thanks for turning my idiocy into a learning oppurtunity :)

Dyalog APL, 14 bytes Rendered invalid by further specifications
⎕IO←0 which is default on many systems. Takes string as argument.
⍎⌈18 1.4⊃⍨'.'∘∊

⍎⌈ max of the evaluated argument and
18 1.4⊃⍨ {18,1.4} selected by
'.'∘∊ whether the argument contains a period

C++, 68 bytes
int A(int a){return a<18?18:a;}float A(float h){return h<1.4?1.4:h;}

This answer is actually 2 functions with the same name, and the compiler works out for me which to call, so it acts as one function without me having to take in one input and decide which it is. Since input on the floating point is guaranteed to be of the same precision as the output, I can return it safely without having to truncate it either.
Ungolfed + tests
#include <iostream>

int A(int a)
{
   return a < 18 ? 18 : a;
}

float A(float h)
{
   return h < 1.4 ? 1.4 : h;
}

int main()
{
  std::cout << 0 << " " << A(0) << "\n";
  std::cout << 19 << " " << A(19) << "\n";
  std::cout << 1.1 << " " << A(1.1f) << "\n";
  std::cout << 2.2 << " " << A(2.2f) << "\n";
}

User Szali Szali suggested saving two bytes by turning the floats into autos. I've rejected the edit according to policy but feel free to edit it in yourself if you've confirmed that it works.

All that text duplication! You can save several characters by generating the two definitions via macro.

Thanks @MartinEnder.  Their edit doesn't compile in all C++ compilers, and introduces all sorts of weird cases with other types suddenly being able to be passed in, so I'm going to accept my 2 bytes in order to keep my answer a little more portable.

@Cody It's your call, but as far as PPCG is concerned languages are defined by their implementations, so answers don't need to be portable or particularly safe. As long as there's a compiler where the program works (and the required inputs work, regardless of whether invalid ones would work as well), that's completely fine.

C, 119 111 105 100
m;f(char*s){float atof(),l=atof(s);for(m=s;*s&&*s++!=46;);puts(*s?l<1.4?"1.4":m:atoi(m)>18?m:"18");}

Tested with
main(c,v)char**v;{
    f("0");
    f("1");
    f("2");
    f("12");
    f("18");
    f("44");
    f("115");
    f("122");
    f("0.0");
    f("1.04");
    f("1.225");
    f("1.339");
    f("1.4");
    f("1.74");
    f("2.0");
    f("2.72");
}

Output
18
18
18
12
18
44
115
122
1.4
1.4
1.4
1.4
1.4
1.74
2.0
2.72

This is invalid... An input of 12 should output 18

@BetaDecay you're right.  I need to add an additional & character.  Thanks for pointing that out.

C, 50 bytes:
#define A(x)(x/2+(x+1)/2-x?x<1.4?1.4:x:x<18?18:x)

The byte count includes the newline at the end of the macro definition.
Test:
#define A(x)(x/2+(x+1)/2-x?x<1.4?1.4:x:x<18?18:x)
#include <assert.h>
int main() {
  assert(A(0) == 18);
  assert(A(1) == 18);
  assert(A(2) == 18);
  assert(A(12) == 18);
  assert(A(18) == 18);
  assert(A(43) == 43);
  assert(A(115) == 115);
  assert(A(122) == 122);
  assert(A(0.0) == 1.4);
  assert(A(1.04) == 1.4);
  assert(A(1.225) == 1.4);
  assert(A(1.399) == 1.4);
  assert(A(1.4) == 1.4);
  assert(A(1.74) == 1.74);
  assert(A(2.0) == 2.0);
  assert(A(2.72) == 2.72);
}

Vyxal ḋ, 13 12 bytes
₌⌊±[18|1.4]∴

Try it Online!
Takes input as string.

Julia, 35 bytes
f(x)=max(x,1.4)
f(x::Int)=max(x,18)

Using multiple dispatch.

While it's certainly the more Julian way of solving the problem, it's not the shortest. You're better off using isa(x,Int) in a single function for Code Golf purposes. Or better yet, x!==x+0., to save an extra two bytes (x+0. will convert an integer to a float, and !== checks to see if the two are the same thing - Float and Int won't register as the same).

@GlenO You're not wrong.

Cheddar, 23 21 bytes
n->[n,n%1?1.4:18].max

Nothing super-new but I'll post it as it's pretty short.

Ruby - 34 bytes
Very straight-forward. Could possibly save 2 bytes by transforming that ternary.
->(x){x%1>0?x<1.4?1.4:x:x<18?18:x}

Does not work for 1.0.

Scala, 44 bytes
def?(x:Int)=18 max x
def?(x:Float)=1.4 max x

Defines two methods using overloading.

C#, 95 Bytes
Golfed:
string y(string p){int a;return int.TryParse(p,out a)?a>17?p:"18":double.Parse(p)<1.4?"1.4":p;}

Ungolfed:
class YesOfCourseImAnAdult
  {
    public string y(string p)
    {
      int a;
      return int.TryParse(p, out a) ? a > 17 ? p : "18"
       : double.Parse(p) < 1.4 ? "1.4" : p;
    }
  }

Test cases:
var codeGolf = new YesOfCourseImAnAdult();
Console.WriteLine(codeGolf.y("0"));
Console.WriteLine(codeGolf.y("1"));
Console.WriteLine(codeGolf.y("2"));
Console.WriteLine(codeGolf.y("12"));
Console.WriteLine(codeGolf.y("18"));
Console.WriteLine(codeGolf.y("43"));
Console.WriteLine(codeGolf.y("122"));

Console.WriteLine(codeGolf.y("0.0"));
Console.WriteLine(codeGolf.y("1.04"));
Console.WriteLine(codeGolf.y("1.225"));
Console.WriteLine(codeGolf.y("1.399"));
Console.WriteLine(codeGolf.y("1.4"));
Console.WriteLine(codeGolf.y("1.74"));
Console.WriteLine(codeGolf.y("2.0"));
Console.WriteLine(codeGolf.y("2.72"));

Output:
18
18
18
18
18
43
122

1.4
1.4
1.4
1.4
1.4
1.74
2.0
2.72

Hi, welcome to PPCG! Your current approach can be shortened a bit like this: string y(string p){int a;return int.TryParse(p,out a)?a<1?"18":p:double.Parse(p)<1.4?"1.4":p;} (removed parenthesis; >=1.4 to <1.4 by swapping the "1.4" and p; changed decimal to double so the M is gone. Also, someone else just posted a different approach in C# that is slightly shorter. You might find Tips for golfing in C# interesting to read through. Again, welcome! :)

Hi, thanks for the helpful comments! I totally forgot about those extra brackets that I had in to stop myself losing track from the Ternary-Ternary operator! I've saved 5 bytes now overall.

You can save one byte by using float.Parse instead of double.Parse. And also if you move the declaration of a into the method arguments with a default value you can drop your return statement by using expression bodied member. eg: string f(string s,int a=0)=>int.TryParse(s,out a)?a>17?s:"18":float.Parse(s)<1.4?"1.4":s;

Python 2, 49 bytes
lambda a:(a,1.4)[a<1.4]if"."in`a`else(a,18)[a<18]

Did it one byte shorter: lambda a:((a,18)[a<18],(a,1.4)[a<1.4])["."in`a`]

Thanks @Erik. I tried that and it came out exactly the same length. Guess I must have had a stray space in there ;-)

Maybe. The most suspicious place is da a:((a, because, by instinct, you write da a: ((a instead. And it is a unique place.

lambda a:(max(a,18),max(a,1.4))["."in\a`]` is considerably shorter.

Thanks @Mego. Have used this idea to update my IBM/Lotus answer. Now nicely symetrical at 49 bytes each ;-)

Thanks @daHugLenny . I didn't know you could do that. Just checked out the source and will use that in future. Wonder if there is one for my Lotus Notes answer as well? :-)

@ElPedro I don't think so, but here's the list of languages you can use syntax highlighting with if you wanna check.

Guess I may have to contribute one myself. I'll probably be the only one on here using it anyway :-)

why not just use max and min?

Batch, 102 bytes
@set/ps=
@if %s:.=%==%s% (if %s% lss 18 set s=18)else if %s:~0,1%%s:~2,1% lss 14 set s=1.4
@echo %s%

First determines whether the input is an integer by checking whether deleting all .s has any effect on the string. If it is then the value is readily compared against 18, otherwise the first and third characters are combined into a number which is compared against 14.

PHP, 36 35 34 bytes
echo max($a=$argn,$a[1]&p?1.4:18);

Checks whether the character in the second position is a digit (binary and with p). If so, use 18 as the minimum, otherwise 1.4. Then take the bigger of the 2 numbers.
Run like this:
echo 11 | php -nR 'echo max($a=$argn,$a[1]&p?1.4:18);';echo

Explanation
Here's a table of the possible results of the &"p" operation:
input  binary      &   "p"         result      chr   Truthy/falsy
"."    0010 1110   &   0111 0000   0010 0000   " "   TRUTHY
"0"    0011 0000   &   0111 0000   0011 0000   "0"   FALSY
"1"    0011 0001   &   0111 0000   0011 0000   "0"   FALSY
"2"    0011 0010   &   0111 0000   0011 0000   "0"   FALSY
"3"    0011 0011   &   0111 0000   0011 0000   "0"   FALSY
"4"    0011 0100   &   0111 0000   0011 0000   "0"   FALSY
"5"    0011 0101   &   0111 0000   0011 0000   "0"   FALSY
"6"    0011 0110   &   0111 0000   0011 0000   "0"   FALSY
"7"    0011 0111   &   0111 0000   0011 0000   "0"   FALSY
"8"    0011 1000   &   0111 0000   0011 0000   "0"   FALSY
"9"    0011 1001   &   0111 0000   0011 0000   "0"   FALSY
null   0000 0000   &   0111 0000   0000 0000   0     FALSY

When the input is 1 digit, then taking the second digit will result in null. null&"string" will also conveniently evaluate to false. So only when the second char is a . will the expression evaluate to true and 1.4 will be used as the minimum instead of 18.
Tweaks

Saved a byte by using $argn

PHP: 40 bytes
$i=is_int($i)?$i>17?$i:18:$i>1.4?$i:1.4;

psuedocode, (nested turnary) :
if (i is an integer) then
  if (i is bigger than 17) then i=18 else i=i
otherwise (its a decimal)
  if (i is bigger than 1.4) then i=i else i=1.4
end if

Welcome to PPCG! Please note that input (by default) has to be via STDIN, function arguments, or full program arguments.

Powershell : 58 Bytes
Bit longer than i'd expected, so many brackets required to have it run correctly.
.({({1.4},$i)[$i-gt1.4]},{({18},$i)[$i-gt18]})[$i-is[int]]

Input as $i
. #Execute the code.. required.
( #First block
    { #Value if-false of first block
        (
        {1.4} #Return Val
        , #Or
        $i #Return Input
        )[$i-gt1.4] #If input is greater than Val
    },{ #Next Block
    ({18},$i)[$i-gt18]} #Same with different val
)[$i-is[int]] #Decides based on if val is default int

Test Cases:
@(0,1,2,12,18,43,115,122,0.0,1.04,1.225,1.399,1.4,1.74,2.0,2.72) | % {
$i = $_
Write-Host $i`t`t -NoNewline
.({({1.4},$i)[$i-gt1.4]},{({18},$i)[$i-gt18]})[$i-is[int]]
}

returns :
0       18
1       18
2       18
12      18
18      18
43      43
115     115
122     122
0       1.4
1.04    1.4
1.225   1.4
1.399   1.4
1.4     1.4
1.74    1.74
2(.0)   2      (this is a value of type 'double' - the default formatting of powershell doesn't add decimals, but the returned value is of the correct type)
2.72    2.72

Proof of 2 == 2.0
$i = 2.0
$q = .({({1.4},$i)[$i-gt1.4]},{({18},$i)[$i-gt18]})[$i-is[int]]
$q.GetType().Name
Double

Assuming that the input is stored in a pre-defined variable isn't an allowed input method. You'd need to save it as a .ps1 file and do a param($i) or $i=$args[0] or similar. Additionally, with it in a file, you can remove the . and many of the curly braces -- param($i)(((1.4,$i)[$i-gt1.4]),((18,$i)[$i-gt18]))[$i-is[int]] for 62 bytes -- so only a few bytes longer than you've got currently.

Java, 95 bytes
void p(double d){if(d%1>0)System.out.print(d<1.4?1.4:d);else System.out.print(d<18?18:(int)d);}

5 worse than Kevin's answer, but it has the print statement inside the function so maybe I get some pity points for that.
If this is allowed in Java, you could also use
d->{if(d%1>0)System.out.print(d<1.4?1.4:d);else System.out.print(d<18?18:d);};

Which could be used like
Consumer<Double> func = d->{if(d%1>0)System.out.print(d<1.4?1.4:d);else System.out.print(d<18?18:d);};

Our standard is to allow any kind of functions, including lambdas.

Instead of printing, you could always just return it and specify returning a string instead of void. So get rid of the if and just return(d%1>0?d<1.4?1.4:d:d<18?18:(int)d)+""; is what, 44? then tack on the String p(double d){} with those 44 in the middle and you've got 20 more for a total of 64.

@corsiKa unfortunately the (?:) statements need to have the same return type in Java. Your code would print 18.0 instead of 18. That said, you can do
d%1>0?""+(d<1.4?1.4:d):(d<18?18:(int)d)+"".replace(".0","")
But surrounded with a print statement and method header, it becomes 96 bytes

@dpa97 Don't print. Return a string.

@corsiKa I'm pretty new to code golf, doesn't the OP want the output to be printed? Seems like returning just a string is a step short.

C++14, 52 bytes
As unnamed lambda:
[](auto t){auto l=sizeof t-4?1.4:18;return t<l?l:t;}

Assumes sizeof int==4 and sizeof double!=4 which is true on most systems. Only side effect: the returned value is always a double.
Usage:
//assign to variable
auto f=[](auto t){auto l=sizeof t-4?1.4:18;return t<l?l:t;};
f(10)
f(2.0)

//use directly
[](auto t){auto l=sizeof t-4?1.4:18;return t<l?l:t;}(10);
[](auto t){auto l=sizeof t-4?1.4:18;return t<l?l:t;}(2.0);

Brachylog v2, 11 bytes
ℤ;18⌉|;1.4⌉

Try it online!
Essentially Fatalize's answer, just a bit shorter because it's a newer version of the language with a non-ASCII codepage.
               The output is
    ⌉          the largest of
  18           eighteen
 ;             and
               the input
ℤ              which is an integer,
     |         or
               the output is
          ⌉    the largest of
       1.4     1.4
      ;        and
               the input.

Julia 1.0, 27 bytes
x->max(x,18(x≢x/1||7/90))

Try it online!
based on Lyndon White's answer and Glen O's comment
I really wanted to use multiple dispatch like Lyndon's answer but it's not the shortest

x≢x/1 checks if x is an integer: division will turn an integer into a float, and ≢(!==) checks if both arguments are completely identical (including same type)

when the condition is true, the parenthesis evaluates as true, which leaves the 18 unchanged (n*true === n)

otherwise, the parenthesis evaluates 7/90 which results in 18*7/90 === 1.4

≢ because I can (same amount of bytes as !==)

TI-Basic, 31 bytes
Prompt O,Str1
Disp max(18,O
Str1
If 1.4>expr(Ans
"1.4
Ans

Pretty self-explanatory. Only thing I would note is that in TI-Basic, whatever the last line evaluates to is implicitly displayed. If nothing is evaluated on the last line it will print Done.

GameMaker Language, 74 bytes
a=argument1;if real(a)<1.4a="1.4"show_message(string(max(argument0,18))+a)

SQL, 105 bytes
IF @v like'%.%'select MAX(p)from(values(@v),(1.400))as X(p)ELSE select MAX(p)from(values(@v),(18))as X(p)

tested on MS SQL Server 2008 R2
usage:
DECLARE @v as varchar(255) = '1.405'
IF @v like'%.%'select MAX(p)from(values(@v),(1.400))as X(p)ELSE select MAX(p)from(values(@v),(18))as X(p)

k, 20 bytes
Returns the maximum of the input, x, and 18 if x is integral or 1.4 otherwise.
{x|$[-7h=@x;18;1.4]}

Pyke, 15 bytes
,16.6*1.4+Qb]Se

Try it here!
Takes input in quotes. is_numeric returns 1 if the input doesn't contain a ., otherwise it returns 0
,16.6*          - 16.6*is_numeric(input)
      1.4+      - ^ + 1.4
          Qb]   - [^, float(input)]
             Se - sorted(^)[-1]

Racket 76 bytes
(λ(n)(cond[(integer? n)(if(>= n 18)n 18)][(number? n)(if(>= n 1.4)n 1.4)]))

Ungolfed version:
(define f
  (λ(n)
    (cond
      [(integer? n) (if(>= n 18) n 18)]
      [(number? n) (if(>= n 1.4) n 1.4)]
      )))

Testing:
(f 1.3)
(f 15)
(f 19)
(f 1.5)

Output:
1.4
18
19
1.5

Logy, 74 bytes
m[X,Y]->X>Y&X|Y;f[X]->include["@stdlib.logy"]~X==ceil[X]&m[X,18]|m[X,1.4];

Wow... Outgolfed by Java
max[X, Y] -> X > Y & X | Y;
f[X] -> include["@stdlib.logy"]
      ~ X == ceil[X] & max[X, 18] | max[X, 1.4];

Ruby, 31 bytes
->x{[x.to_s=~/\./?1.4:18,x].max}

Try it online!

C and C++ : 47 bytes
#define a(b)(sizeof b>4?b>=1.4?b:1.4:b<18?18:b)

Please let me know if this is considered a default loophole. The macro assumes that an integer literal is four bytes and a double floating point literal is greater than that.
Test using GCC 6.3.1 (C++) :
#include <iostream>

#define a(b)(sizeof b>4?b>=1.4?b:1.4:b<18?18:b)

void print_a (const auto &t) {
  std::cout << a(t) << '\n';
}

template <class T, class...P>
void print_a (const T &t, const P&...p) {
  print_a (t);
  print_a (p...);
}

int main () {

  print_a (0, 1, 2, 12, 18, 43, 115, 122, 0.0, 1.04,
   1.225, 1.399, 1.4, 1.74, 2.0, 2.72);

  return 0;
}

C++ (gcc), 49 bytes
-DK(T,u)T=f(T&x){x<u?x=u:x;}

K(int,18)K(float,1.4)

Try it online!
C++ (gcc), 56 bytes
-DK(T,u)T=f(T(x)){return+x<u?u:x;}

K(int,18)K(double,1.4)

Try it online!

Since you've included the compile flag in the byte-count, I don't see why it wouldn't be allowed. As for the 50-byte answer, it doesn't work in TIO?

@KevinCruijssen The compile flag is allowed in meta, I just didn't know if overloading is allowed

Ruby, 30 bytes
->x{[x.integer??18:1.4,x].max}

I'm very surprised that an 8-character method call seems to be the shortest way to switch modes (at least if we want to treat 1.0 as a decimal).

dc, 34 bytes
[1.4]s1[18]s8[d18>8]s*dX0=*d1.4>1p

Try it online! Note: test cases as defined in the footer do include 0.0, but dc prints 0.0 as 0, so that test case looks like the input is wrong. Also the footer just defines the main chunk as a macro and adds some printing to tidy up the test cases a bit.
Aside from the case of 0.0 as mentioned above, dc prints trailing zeroes in decimals, so we don't really have to do anything special beyond testing for a decimal point and our two less-than tests.
Because conditionals must run macros stored in registers, some bytes are spent just storing our min values - 1.4 in macro/register 1, and 18 in macro/register 8. Macro * just checks whether or not our value is less than 18, and if so runs the aforementioned macro 8 to put 18 on the stack. The main bit is dX0=*d1.4>1. This uses the X command to see how many digits are to the right of the decimal point. If it's 0, we run the aforementioned macro * to either leave the number be, or place 18 on the stack. Fortunately, since 18 is greater than 1.4, we don't really have to worry about finagling else statements or anything (if we needed the integer 1 to pass through unharmed, things would be different). So from here we just test if we're less than 1.4; if so we run macro 1 to put 1.4 on the stack, and finally we print with p.

Lua, 71 bytes
function Z(a,b)print(a+0<b and b or a)end R=io.read Z(R(),18)Z(R(),1.4)

Tested in Lua 5.1.5. TIO throws an error at a+0
Ungolfed
function print_min(input,min_value)
    print(input+0<min_value and min_value or input)
end

R=io.read
print_min(R(),18)
print_min(R(),1.4)

Explanation
a+0 is the shortest way to convert a string to a number. The syntax a+0<b and b or a is a replacement for Lua's lack of a ternary operator; equivalent to a+0<b?b:a.

C# (Visual C# Compiler), 69 67 bytes
s=>int.TryParse(s,out int n)?n<18?"18":s:float.Parse(s)<1.4?"1.4":s

Try it online!
Edit: Saved 2 bytes thanks to Kevin Cruijssen:

Changed double to float
Removed trailing semi-colon

Welcome to PPCG! The trailing semi-colon doesn't have to be counted in the byte-count for Java/C# .NET lambdas. Also, you can save 1 byte changing the double to float. Enjoy your stay! :)

Nim, 48 bytes
func a[T](x:T):T=x.max when T is int:18 else:1.4

Try it online!

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Convert pointfree to pointful
Being a Haskell hacker, I prefer pointfree notation over pointful. Unfortunately some people find pointfree notation hard to read, and I find it hard to get the correct number of parentheses when I write in pointful.
Help me convert code written in pointfree to pointful notation!
About
In pointfree notation we use points (yes, really) to feed the output of one function into another. Say, if you had a function succ that takes a number and adds 1 to it, and you wanted to make a function that adds 3 to a number, instead of doing this:
\x -> succ(succ(succ(x)))

you could do this:
succ.succ.succ

Pointfree only works with functions that take a single parameter however (in this challenge anyway), so if our function wasn't succ but rather add which take 2 numbers and adds them together, we would have to feed it arguments until there is only one left:
pointful:  \x -> add 1(add 1(add 1 x))
pointfree: add 1 . add 1 . add 1

Lastly, functions may take other functions as arguments:
Pointfree: map (f a . f b) . id
Pointful:  \x -> map (\x -> f a (f b x)) (id x)

Javascript equivalent: x => map (x => f(a,f(b,x)), id(x))

Input and expected output
f . f . f
\x -> f (f (f x))

f a . f b . f c
\x -> f a (f b (f c x))

f (f a . f b) . f c
\x -> f (\x -> f a (f b x)) (f c x)

a b c . d e . f g h i . j k l . m
\x -> a b c (d e (f g h i (j k l (m x))))

a.b(c.d)e.f g(h)(i j.k).l(m(n.o).p)
\x->a(b(\y->c(d y))e(f g h(\z->i j(k z))(l(\q->m(\w->n(o w))(p q))x)))

Rules

Your output may have more spaces or parentheses than required, as long as they are balanced
You don't have to make sure that the name of the variable you create \x isn't already used somewhere else in the code
It is your choice whether to create a function or a full program
This is codegolf, shortest code in bytes win!

You might find blunt useful, it converts between the two notations (but also factorizes the code when possible): https://blunt.herokuapp.com

In pointfree notation we use points to feed the output of one function into another That's clearly an attempt to prove that pointfree is not pointless

"Pointfree only works with functions that take a single parameter". That's not true: (+).(*3) is the same as \x y->3*x+y

@Damien I was trying to make the challenge more accessible. You can also do things like the owl: (.).(.) which converts to \i b c f -> i (b c f)

That's what I thought. Thanks for the clarification. As a huge fan of pointfree style, I had to notice that.

So for clarity for those who don't know the syntax of Haskell by heart: we should first match parentheses in the input and recurse on each top-level parenthesised expression; and then replace each . with a (, prepend a \x and append a corresponding x and as many ) as are required? Or is it more complicated than that?

@PeterTaylor No, that's it exactly

This could be an interesting challenge for Dyalog APL or J too, but they have complex rules: f g h ≡ {(f ⍵) g (h ⍵)}, and allow two arguments, : f g h ≡ {(⍺ f ⍵) g (⍺ h ⍵)}...

Is it ok if an input like (h) will be converted to (\x->h x)? In my understanding (h) could be considered as pointfree, whereas (\x->h x) is definitely pointful.

I don't know Haskell but why doesn't f.(f.).f resolve to \d->f(\k->f(k))(f d)?

@Linus \ d->f(\k->f(f d k)), but you can assume that all the dots are fed two arguments in this challenge

@Linus Oh, and it's because (.) = \f a x -> f(a(x)), so (succ.) = \a x -> succ(a(x)) and succ.succ = \x -> succ(succ(x))

Haskell, 163 142 133 bytes
p(x:r)|[a,b]<-p r=case[x]of"("->["(\\x->"++a++p b!!0,""];"."->['(':a++")",b];")"->[" x)",r];_->[x:a,b]
p r=[r,r]
f s=p('(':s++")")!!0

Try it on Ideone.
Ungolfed:
p('(':r)|(a,b)<-p r = ("(\\x->"++a++(fst(p b)),"")
p('.':r)|(a,b)<-p r = ('(':a++")",              b)
p(')':r)            = (" x)",                   r)
p(x  :r)|(a,b)<-p r = (x:a,                     b)
p _                 = ("",                     "")

f s=fst(p('(':s++")"))

Haskell, 402 289 bytes
Quite long, but I think it works..
(!)=elem
n%'('=n+1
n%')'=n-1
n%_=n
a?n=a!"."&&n<1
a#n=a!" ("&&n<1||a!")"&&n<2
q a='(':a++")"
p s o n[]=[s]
p s o n(a:b)|o a n=[t|t@(q:r)<-s:p""o(n%a)b]|0<1=p(s++[a])o(n%a)b
k=foldr((++).(++" ").f)"".p""(#)0
f t|not$any(!"(. ")t=t|l@(x:r)<-p""(?)0t=q$"\\x->"++foldr((.q).(++).k)"x"l|0<1=k t

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
Multiple-Key Sorting
Given a list of indices and zero or more lists of integers, output the lists of integers, sorted in ascending order, with the key priority from the first input.
Example
Let the keys input be [1, 0, 2], and the lists input be [[5, 3, 4], [6, 2, 1], [5, 2, 1]]. Those lists need to be sorted by their second element, then first element, then third element, in ascending order:

First, we sort by the values at index 1: [[6, 2, 1], [5, 2, 1], [5, 3, 4]]
Next, we break any ties from the first sort using the values at index 0: [[5, 2, 1], [6, 2, 1], [5, 3, 4]]
Finally, we break any remaining ties with the vlues at index 2 (this doesn't actually change anything, because there are no ties remaining).

Details

Sorting is stable: if two elements compare equal with respect to the given sort keys, they must remain in the same relative order in the output. For example, if A and B are equal under the given sort keys, and the input was [..., A, ..., B, ...], A must be placed before B in the output.
A sort key will never reference a non-existant element in one of the input lists.
No sort key will be repeated. Thus, [1, 2, 1] is not a valid list of sort keys.
Any elements not referenced by the sort keys do not factor into the sorting order. Only the initial relative order and the values of the elements referenced by the sort keys determine the output order.
You may choose whether the sort keys are zero-indexed or one-indexed.
There will be no negative values in the sort keys. If you choose to use one-indexing, there will be no zeroes in the sort keys either.
Integer values will not exceed your language's natively-representable range. If your chosen language is natively capable of arbitrary-precision integers (like Python), then any integer value can be present in the input, subject to memory constraints.

Reference Implementation (Python 2)
#!/usr/bin/env python

keys = input()
lists = input()

print sorted(lists, key=lambda l:[l[x] for x in keys])

Try it online
Test Cases
Format: keys lists -> output. All sort keys are zero-indexed.
[1, 0, 2] [[5, 3, 4], [6, 2, 1], [5, 2, 1]] -> [[5, 2, 1], [6, 2, 1], [5, 3, 4]]
[1, 2] [[5, 3, 4], [6, 2, 1], [5, 2, 1]] -> [[6, 2, 1], [5, 2, 1], [5, 3, 4]]
[0, 1] [[1, 2], [2, 1]] -> [[1, 2], [2, 1]]
[1, 0] [[1, 2], [2, 1]] -> [[2, 1], [1, 2]]
[0] [[4], [10, 11, -88], [-2, 7]] -> [[-2, 7], [4], [10, 11, -88]]
[2] [[-1, -5, 8, -1, -4, -10, -5, 4, 4, 6, -8, 4, 2], [-7, 6, 2, -8, -7, 7, -3, 3, 0, -6, 1], [-9, 8, -5, -1, -7, -8, -5, -6, 5, -6, 6]] -> [[-9, 8, -5, -1, -7, -8, -5, -6, 5, -6, 6], [-7, 6, 2, -8, -7, 7, -3, 3, 0, -6, 1], [-1, -5, 8, -1, -4, -10, -5, 4, 4, 6, -8, 4, 2]]
[2, 1] [[9, 2, -2, -10, -6], [3, -4, -2]] -> [[3, -4, -2], [9, 2, -2, -10, -6]]
[2, 4, 8] [[5, -3, 4, -6, -1, -2, -2, -4, 5], [-2, -3, 6, -4, -1, -4, -4, -5, 8, 9, 9, -3, 3, -9, -3], [2, 0, 10, -10, -1, 2, -1, 5, -1, 10, -5], [-7, -8, -6, 7, 3, 8, 6, -7, -2, 0, -6, -4, 4, -3, 2, -3]] -> [[-7, -8, -6, 7, 3, 8, 6, -7, -2, 0, -6, -4, 4, -3, 2, -3], [5, -3, 4, -6, -1, -2, -2, -4, 5], [-2, -3, 6, -4, -1, -4, -4, -5, 8, 9, 9, -3, 3, -9, -3], [2, 0, 10, -10, -1, 2, -1, 5, -1, 10, -5]]
[1, 2, 3, 4, 5] [[-7, 3, -8, 3, 5, -1, 6, -6, 9, 8], [-9, -1, -7, -9, -10, -2, -8, -10, -10, -3], [5, 3, -6, -5, -4, -4, -8, 2], [9, -4, 1, -1, -3, -2], [-6, -10, 4, -10, 6, 6, -1, 3, 0, 0], [1, -2, -7, -6, -7, -7, -1, 0, -4, 3, 3], [7, -1, -7, 2, -2, 9, 7, 5, -6, -8], [1, -5, -3, -10, -7, 9, -8, -5, -1], [-9, 4, -1, -1, 2, 4]] -> [[-6, -10, 4, -10, 6, 6, -1, 3, 0, 0], [1, -5, -3, -10, -7, 9, -8, -5, -1], [9, -4, 1, -1, -3, -2], [1, -2, -7, -6, -7, -7, -1, 0, -4, 3, 3], [-9, -1, -7, -9, -10, -2, -8, -10, -10, -3], [7, -1, -7, 2, -2, 9, 7, 5, -6, -8], [-7, 3, -8, 3, 5, -1, 6, -6, 9, 8], [5, 3, -6, -5, -4, -4, -8, 2], [-9, 4, -1, -1, 2, 4]]
[8, 7, 3, 2, 4, 9, 1] [[8, -5, 1, -6, -1, -4, 6, 10, 10, 6, 9, 5], [4, -8, 6, -10, -2, -3, 2, -6, 9, 5, 4, 10, 2, 3], [10, -1, 3, 0, -4, 1, -5, -4, -1, -7, 9, -9, -1, -5, 7, 8, 9, 6, -3], [0, -9, -7, -2, 2, -5, 7, 4, 6, -4, 1, 8, -7, 10], [5, 6, -9, 0, -1, 5, 4, 7, 5, 10, 2, 5, 7, -9]] -> [[10, -1, 3, 0, -4, 1, -5, -4, -1, -7, 9, -9, -1, -5, 7, 8, 9, 6, -3], [5, 6, -9, 0, -1, 5, 4, 7, 5, 10, 2, 5, 7, -9], [0, -9, -7, -2, 2, -5, 7, 4, 6, -4, 1, 8, -7, 10], [4, -8, 6, -10, -2, -3, 2, -6, 9, 5, 4, 10, 2, 3], [8, -5, 1, -6, -1, -4, 6, 10, 10, 6, 9, 5]]

Some of the test cases seem obnoxiously long.

@Fatalize They're meant to cover cases where there are few sort keys compared to the lengths of the lists, and cases where there are many sort keys.

@Fatalize That's why we have copy and paste. If necessary, use Retina to change the format to something you can use.

Can we assume all rows will have the same length if that's the natural data type in our language (i.e. a matrix)?

@LuisMendo No. You must be able to support jagged arrays.

Jelly, 4 bytes
⁴ị$Þ

Try it online!

Have you got a breakdown of how that works?

@JamEngulfer: It should have been specified in the answer, but: Þ is "sort with specified sort key", ⁴ị uses the second command-line argument to reorder the array (producing a sort key which works like the question asks), and $ overrides the precedence so that the program parses correctly.

-1 byte

CJam, 13 bytes
{W%{{X=}$}fX}

An unnamed block which expects the list of lists and the list of priorities on top of the stack and replaces them with the sorted list of lists.
Try it online! (As a test suite.)
Explanation
Sorting with tie breakers can be implemented by repeatedly sorting the entire list stably going from the lowest-priority key to the highest-priority key.
W%      e# Reverse priority list.
{       e# For each priority X...
  {     e#   Sort the lists by the result of this block...
    X=  e#     Extract the Xth element from the current list.
  }$
}fX

Mathematica, 22 19 bytes
SortBy[Extract/@#]&

Uses 1-based indices. This unnamed function is curried, so the calling convention is:
SortBy[Extract/@#]&[{2, 1, 3}][{{5, 3, 4}, {6, 2, 1}, {5, 2, 1}}]

Mathematica's SortBy can take a list of functions in which case the individual functions are used as successive tie-breakers, so that's just what we want. All we need to do is create a list of functions which return the corresponding list element. This can be done with Extract. Extract is normally a binary function Extract[list, index] which returns a list element. However if used unarily, then Extract[index] returns a function which retrieves the element at index from a list passed to it. In other words, the index parameter of Extract can be curried. We make use of this by mapping Extract over the list of indices we're given, which creates the list of functions we need.

Shouldn't Extract/@# be Extract/@(#+1)? The index of the input starts at 0.

@JHM "You may choose whether the sort keys are zero-indexed or one-indexed."

I stand corrected.

(Unsprisingly) elegant! But given that you're 1-indexing, shouldn't [{1, 0, 2}] be [{2, 1, 3}] in your example? Indeed, currently it seems to be sorting by first element, then head, then second element.

@GregMartin sorry, copy/paste fail.

Ruby, 35 bytes
->k,a{a.sort_by{|e|e.values_at *k}}

See it on eval.in: https://eval.in/652574

Haskell, 38 bytes
import Data.List
sortOn.flip(map.(!!))

Usage example: ( sortOn.flip(map.(!!)) ) [2,1] [[9,2,-2,-10,-6], [3,-4,-2]] -> [[3,-4,-2],[9,2,-2,-10,-6]].
Non-pointfree: f k v=sortOn(\x->map(\y->x!!y)k)v.

Python, 50 bytes
lambda l,k:sorted(l,key=lambda x:[x[y]for y in k])

This is a trivially-golfed version of the reference implementation. l is the lists parameter, and k is the sort keys parameter. l can be any iterable, so long as its elements are subscriptable by integers (like lists, tuples, or int-keyed dicts). k can be any iterable.

Brachylog, 29 bytes
tT,?hg:Tz:{:2f}o:ta
heI,?t:Im

Try it online!
Explanation
We use the fact that o - Order can be used with an additionnal predicate as input: we order the lists by using for each [Keys, a list] the list of the elements of a list which are at index a key in the order that they appear in Keys.
                          Input = [Keys, List of lists]

tT,                       Call the Keys T
   ?hg:T                  Create the list [[T], List of lists]
        z                 Zip [T] with the list of lists
         :{   }o          Order by the output of this predicate
                :ta       Keep only the last element of each sublist in the Output

           :2f            Find all outputs of the predicate below

heI,                      Take a key I
    ?t:Im                 Output is the Ith element of the sublist

CJam (12 bytes)
{{1$\f=}$\;}

Online demo. This is an anonymous block (function) which takes the arguments in the order given for the test cases and leaves the sorted value on the stack. It relies on the built-in sort $ being stable, but the official interpreter guarantees that.
Dissection
{          e# Define a block. Stack: orders values-to-sort
  {        e#   Sort by...
    1$\f=  e#     Copy orders from the stack, and map array lookup
  }$
  \;       e#   Pop the orders to leave just sorted-values
}

J, 6 bytes
]/:{&>

Keys are zero-indexed. The LHS is the list of keys and the RHS is an array of values. Since J doesn't support ragged arrays, each array must be boxed.
Usage
   f =: ]/:{&>
   < 1 0 2
┌─────┐
│1 0 2│
└─────┘
   5 3 4 ; 6 2 1 ; 5 2 1
┌─────┬─────┬─────┐
│5 3 4│6 2 1│5 2 1│
└─────┴─────┴─────┘
   (< 1 0 2) f  5 3 4 ; 6 2 1 ; 5 2 1
┌─────┬─────┬─────┐
│5 2 1│6 2 1│5 3 4│
└─────┴─────┴─────┘
   (< 1 2) f  5 3 4 ; 6 2 1 ; 5 2 1
┌─────┬─────┬─────┐
│6 2 1│5 2 1│5 3 4│
└─────┴─────┴─────┘
   (< 0) f 4 ; 10 11 _88 ; _2 7
┌────┬─┬─────────┐
│_2 7│4│10 11 _88│
└────┴─┴─────────┘

Explanation
]/:{&>  Input: keys (LHS), values (RHS)
   {&>  Select from values at each index in keys
]       Get the values
 /:     Sort up the values using the ones selected with the keys

Perl 6  23 20  19 bytes
->\a,\b{b.sort:{.[|a]}}
{$^a;$^b.sort:{.[|$a]}}
{$^b.sort: *.[|$^a]}

{$^b.sort: *[|$^a]}

PHP, 212 170 bytes
function m(&$i,$k){foreach($i as$a=>$y)for($b=-1;++$b<$a;){for($p=0;$p<count($k)&!$r=$i[$b][$x=$k[$p++]]-$i[$b+1][$x];);if($r>0){$s=$i[$b+1];$i[$b+1]=$i[$b];$i[$b]=$s;}}}

PHP has no stable sort built in anymore; picking an older version there is no way to do a recursive callback with the required specification. But nevermind: using the recursive callback iterator would cost tons; so I didn´t even check if that could do it.
The inner loop could be replaced with another foreach; that would save some bytes on the swapping. But without a check for $b<$a (or $b<count($i)), that will result in an infinite loop. And with that check, The foreach costs as much as the swapping wins.
I first did the comparison recursively; but iteration saves tons of bytes:
breakdown
// bubble sort
function m(&$i,$k)
{
    foreach($i as$a=>$y)
        for($b=-1;++$b<$a;)
        {
            // comparison:
            for($p=0;$p<count($k)                       // loop through keys
                &
                !$r=$i[$b][$x=$k[$p++]]-$i[$b+1][$x]    // while element equals its successor
            ;);
            // if element is larger than its successor, swap them
            if($r>0)
            {
                $s=$i[$b+1];$i[$b+1]=$i[$b];$i[$b]=$s;
            }
        }
}

Your whole if($r>0){$s=$i[$b+1];$i[$b+1]=$i[$b];$i[$b]=$s;} can be written as $r>0&&$i[$b+1]^=$i[$b]^=$i[$b+1]^=$i[$b];, saving you 7 bytes. This uses a XOR swap with abuse of short-circuit evaluation to emulate an if(){ ... }. The swap is only executed if and only if $r>0. This uses the same trick that is (sometimes) used with databases. Often, you will see mysqli_connect( ... ) or die('Cannot connect');.

@IsmaelMiguel XOR swap does not work for arrays. And it would save 10 bytes, because I could make it the post-condition of the $b loop. ;)

I tested the XOR swap and it worked (I didn't test with the rest of the code). I wrote 2 test cases: http://sandbox.onlinephpfunctions.com/code/4687a47934ea1baaa5a486227fc36b4833a39960 (you code) and http://sandbox.onlinephpfunctions.com/code/294e9cfb785253faa15dbddf680c71089d7d30de (XOR swap). According to https://text-compare.com/, the output is identical.

@IsmaelMiguel To test the function You should execute it: insert m($i,$k); before the var_dump and Your version will produce garbage.

:/ I didnt even noticed that I didn't execute the function... :/ But it was a cool idea!

Pyth, 5 4 bytes
@LDF

Try it online: Demonstration or Test Suite
Thanks to @Maltysen for one byte.
Explanation:
@LDFQ   Q (=input) added implicitly.
  D     sort a list of lists by
@L         the sublists generated by some indices
   FQ   executes ^ with the the input as parameter

I was really surprised that this worked. It's a really strange syntax.

I think you can save by replacing QE by F

@Maltysen Thanks. I thought that was only possible with a regular one-token method.

the rules for sugar are very adhoc and inconsistent, the best is unfortunately just to try out if a particular thing works.

JavaScript (ES6), 55 bytes
(k,l)=>k.reduceRight((l,i)=>l.sort((a,b)=>a[i]-b[i]),l)

The ECMAscript standard doesn't guarantee that the underlying sort is stable, so the following 68-byte code doesn't make that assumption:
(k,l)=>l.sort(g=(a,b,i=0)=>i<k.length?a[k[i]]-b[k[i]]||g(a,b,i+1):0)

JavaScript (ES6) 46
k=>l=>l.sort((a,b)=>k.some(i=>v=a[i]-b[i])&&v)

At each comparison during the sort, scan the key indices to find the right order
Test

f=k=>l=>l.sort((a,b)=>k.some(i=>v=a[i]-b[i])&&v)

;`[1, 0, 2] [[5, 3, 4], [6, 2, 1], [5, 2, 1]] -> [[5, 2, 1], [6, 2, 1], [5, 3, 4]]
[1, 2] [[5, 3, 4], [6, 2, 1], [5, 2, 1]] -> [[6, 2, 1], [5, 2, 1], [5, 3, 4]]
[0, 1] [[1, 2], [2, 1]] -> [[1, 2], [2, 1]]
[1, 0] [[1, 2], [2, 1]] -> [[2, 1], [1, 2]]
[0] [[4], [10, 11, -88], [-2, 7]] -> [[-2, 7], [4], [10, 11, -88]]
[2] [[-1, -5, 8, -1, -4, -10, -5, 4, 4, 6, -8, 4, 2], [-7, 6, 2, -8, -7, 7, -3, 3, 0, -6, 1], [-9, 8, -5, -1, -7, -8, -5, -6, 5, -6, 6]] -> [[-9, 8, -5, -1, -7, -8, -5, -6, 5, -6, 6], [-7, 6, 2, -8, -7, 7, -3, 3, 0, -6, 1], [-1, -5, 8, -1, -4, -10, -5, 4, 4, 6, -8, 4, 2]]
[2, 1] [[9, 2, -2, -10, -6], [3, -4, -2]] -> [[3, -4, -2], [9, 2, -2, -10, -6]]
[2, 4, 8] [[5, -3, 4, -6, -1, -2, -2, -4, 5], [-2, -3, 6, -4, -1, -4, -4, -5, 8, 9, 9, -3, 3, -9, -3], [2, 0, 10, -10, -1, 2, -1, 5, -1, 10, -5], [-7, -8, -6, 7, 3, 8, 6, -7, -2, 0, -6, -4, 4, -3, 2, -3]] -> [[-7, -8, -6, 7, 3, 8, 6, -7, -2, 0, -6, -4, 4, -3, 2, -3], [5, -3, 4, -6, -1, -2, -2, -4, 5], [-2, -3, 6, -4, -1, -4, -4, -5, 8, 9, 9, -3, 3, -9, -3], [2, 0, 10, -10, -1, 2, -1, 5, -1, 10, -5]]
[1, 2, 3, 4, 5] [[-7, 3, -8, 3, 5, -1, 6, -6, 9, 8], [-9, -1, -7, -9, -10, -2, -8, -10, -10, -3], [5, 3, -6, -5, -4, -4, -8, 2], [9, -4, 1, -1, -3, -2], [-6, -10, 4, -10, 6, 6, -1, 3, 0, 0], [1, -2, -7, -6, -7, -7, -1, 0, -4, 3, 3], [7, -1, -7, 2, -2, 9, 7, 5, -6, -8], [1, -5, -3, -10, -7, 9, -8, -5, -1], [-9, 4, -1, -1, 2, 4]] -> [[-6, -10, 4, -10, 6, 6, -1, 3, 0, 0], [1, -5, -3, -10, -7, 9, -8, -5, -1], [9, -4, 1, -1, -3, -2], [1, -2, -7, -6, -7, -7, -1, 0, -4, 3, 3], [-9, -1, -7, -9, -10, -2, -8, -10, -10, -3], [7, -1, -7, 2, -2, 9, 7, 5, -6, -8], [-7, 3, -8, 3, 5, -1, 6, -6, 9, 8], [5, 3, -6, -5, -4, -4, -8, 2], [-9, 4, -1, -1, 2, 4]]
[8, 7, 3, 2, 4, 9, 1] [[8, -5, 1, -6, -1, -4, 6, 10, 10, 6, 9, 5], [4, -8, 6, -10, -2, -3, 2, -6, 9, 5, 4, 10, 2, 3], [10, -1, 3, 0, -4, 1, -5, -4, -1, -7, 9, -9, -1, -5, 7, 8, 9, 6, -3], [0, -9, -7, -2, 2, -5, 7, 4, 6, -4, 1, 8, -7, 10], [5, 6, -9, 0, -1, 5, 4, 7, 5, 10, 2, 5, 7, -9]] -> [[10, -1, 3, 0, -4, 1, -5, -4, -1, -7, 9, -9, -1, -5, 7, 8, 9, 6, -3], [5, 6, -9, 0, -1, 5, 4, 7, 5, 10, 2, 5, 7, -9], [0, -9, -7, -2, 2, -5, 7, 4, 6, -4, 1, 8, -7, 10], [4, -8, 6, -10, -2, -3, 2, -6, 9, 5, 4, 10, 2, 3], [8, -5, 1, -6, -1, -4, 6, 10, 10, 6, 9, 5]]`
.split('\n').map(row=>{
  var [keys,list,expected]=row.split(/] -?>? ?\[/)
  keys=eval(keys+']');
  list=eval('['+list+']');
  expected=eval('['+expected);
  var result=f(keys)(list);
  var ok=result.join`|`==expected.join`|`;
  console.log(ok?'OK':'KO',keys+' '+list.join`|`+' -> ' +expected.join`|`,ok?'':result.join`|`)
})

Racket 218 bytes
(λ(il ll)(define qsl(λ(l i)(if(null? l)l(let*((h(first l))(t(rest l))(g(λ(ff)(filter(λ(x)(ff(list-ref x i)
(list-ref h i)))t))))(append(qsl(g <)i)(list h)(qsl(g >=)i))))))(for((i(reverse il)))(set! ll(qsl ll i)))ll)

Ungolfed (il=index list; ll=list of lists; qsl= quicksort for list of lists; h=head (first element); t=tail (rest or remaining elements); g=modifiable filter fn):
(define qsl
  (λ(l i)
    (if (null? l)
        l
        (let* ((h (first l))
               (t (rest  l))
               (g (λ(ff) (filter (λ(x) (ff (list-ref x i) (list-ref h i))) t))))
          (append (qsl (g <) i)
                  (list h)
                  (qsl (g >=) i)
                  )))))
(define f
  (λ(il ll)
    (for ((i (reverse il)))
      (set! ll (qsl ll i)))
    ll))

Testing:
(f (list 0 1 2) (list (list 5 3 4) (list 5 3 7) (list 6 2 1) (list 6 1 3) (list 5 2 1)))
(f [list 1 2] [list [list 5 3 4] [list 6 2 1] [list 5 2 3]])

Output:
'((5 2 1) (5 3 4) (5 3 7) (6 1 3) (6 2 1))
'((6 2 1) (5 2 3) (5 3 4))

R 40 bytes
for(i in rev(il)){dd=dd[order(dd[,i]),]}

Explanation:
List of lists is best represented as a data.frame in R:
ll2 = list(c(5,3,4), c(5,3,7), c(6,2,1), c(6,1,3), c(5,2,1))
dd = data.frame(do.call(rbind, ll2))
dd
      X1 X2 X3
    1  5  3  4
    2  5  3  7
    3  6  2  1
    4  6  1  3
    5  5  2  1

If index list is il (indexing is from 1):
il = list(1, 2, 3)

Sorting can be done with following code:
for(i in rev(il)){dd = dd[order(dd[,i]),]}

Output:
dd
  X1 X2 X3
5  5  2  1
1  5  3  4
2  5  3  7
4  6  1  3
3  6  2  1

PHP, 139 Bytes
use the new spaceship operator and usort
<?$a=$_GET[a];function c($x,$y,$i=0){$k=$_GET[k];return$x[$k[$i]]-$y[$k[$i]]?:($k[++$i]?c($x,$y,$i):0);}usort($a,c);echo json_encode($a);

Instead of $x[$k[$i]]<=>$y[$k[$i]] you can use $x[$k[$i]]-$y[$k[$i]] under a PHP Version greater 7 - 2 Bytes
version with create an own index 197 Bytes like in a real library
<?$m=min(array_map(min,$a=$_GET[a]));foreach($a as$p=>$v){$k="";foreach($s=$_GET[s]as$f){$k.=str_pad($v[$f]-$m,5,0,0);}$k.=str_pad($p,5,0,0);$r[$k]=$v;}ksort($r);echo json_encode(array_values($r));

You can try to use <?function c($x,$y,$i=0){$k=$_GET[k];return $x[$k[$i]]<=>$y[$k[$i]]?:($k[++$i]?c($x,$y,$i):0);}usort($a=$_GET[a],c);echo json_encode($a);. $_GET is a superglobal: it means that it is already a global everywhere. Remove the global$k;, move the assignment inside the function and you're done. Also, since this is using $_GET, you have to use <?. With this, you save 10 bytes. It will (hopefully) work.

@IsmaelMiguel I feel like an idiot that I'd not seen that I use the global only inside the function.

PHP sort functions use quicksort; that´s not stable. Apart from that, you can save two bytes with - instead of <=> and two with an anonyomous callback for usort.

@Titus An anonymous function can't be used because of c($x,$y,$i) at the end of the body of the function.

@JörgHülsermann Don't worry, we all make silly mistakes.

@Titus I could use $f=function()use(&$i,&$f) {echo+$i;$i++;if($i<10)$f();};$f();  the way at the moment is shorter. Why it should not be stable? Can you give me an example?

Also, I've noticed 2 things: You have a space after your return. Getting rid of it will reduce the code to 139 bytes. Also, if you use directly $_GET[a], it will get rid of that useless attribution. But that won't reduce the code.

@IsmaelMiguel I would prefer only one notice. and the other silly mistake with the space has gone

@JörgHülsermann Totally forgot about those pesky notices. Just for your curiosity, this would be <?function c($x,$y,$i=0){global$k;return$x[$k[$i]]-$y[$k[$i]]?:($k[++$i]?c($x,$y,$i):0);}usort($a,c);echo json_encode($a); in PHP 4.1, which is 122 bytes long. This assumes a default php.ini file with register_globals=On.

@IsmaelMiguel I think that global$k; is not neccessary under PHP 4.1. Is this right?

@JörgHülsermann No, the global$k is necessary since all the variables were only registered into the outmost scope. That means: they aren't superglobals anymore. Obviously, one could use $k=$_GET[k]; instead.

not stable: $_GET[k]=[1,0,2];$_GET[a]=[[5,3,4,9], [6,2,1], [5,2,1],[5,3,4,1]]; should give [[5,2,1],[6,2,1],[5,3,4,9],[5,3,4,1]] but returns [[5,2,1],[6,2,1],[5,3,4,1],[5,3,4,9]]

@Titus Yes it is not stable if I use the - instead of the <=> and could use a different version like 7 with the - I would prefer the 2 Bytes more too make it clearer

K (ngn/k), 10 bytes
{y@<y[;x]}

Try it online!

Clojure, 29 bytes
#(sort-by(fn[c](mapv c %))%2)

Nicely sort-by is stable and knows how to sort vectors, and vectors can operate as functions. ([4 6 9 7] 2) is 9 (0-based indexing).

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
0.0000000000000000001
Notice the pattern in the below sequence:
0.1, 0.01, 0.001, 0.0001, 0.00001 and so on, until reaching 0.{one hundred zeros}1

Then, continued:
0.2, 0.02, 0.002, 0.0002, 0.00002 and so on, until reaching 0.{two hundred zeros}2

Continued:
0.3, 0.03, etc, until 0.{three hundred zeros}3

Continued:
0.4, 0.04, etc, until 0.{four hundred zeros}4

Sped up a bit:
0.10, 0.010, etc.  until 0.{one thousand zeros}10

Sped up some more:
0.100, 0.0100...
You get the idea.
The input your code will receive is an integer, the number of terms, and the output is that many number of terms of the sequence.
Input and output formats are unrestricted, and separators are not required.
Trailing zeros are necessary.
Standard loopholes apply.

The outputs of some nth terms are given below:
nth term -> number
-------------------
1        -> 0.1
102      -> 0.2
303      -> 0.3
604      -> 0.4
1005     -> 0.5
1506     -> 0.6
2107     -> 0.7
2808     -> 0.8
3609     -> 0.9
4510     -> 0.10

Are the trailing zeroes necessary?

"So, for the number 100, it's 0.100, 0.0100, etc."

^ 0.100 is the same as 0.1, numerically.

Then you need to edit the challenge to make that explicitly clear. I'm fairly sure that invalidates existing answers.

interesting combination of numeric operations and string operations.

since it is not explicitly stated: are leading zeros necessary?

05AB1E, 23 bytes
Online compiler can't show all terms for high N but it works fine offline.
Lvy2°*>F„0.0N×yJ,¼¾¹Qiq

Explanation
                          # implicit input X
Lv                        # for each y in range [1 .. X]
  y2°*>F                  # for each N in range [0 .. y*100+1)
        „0.               # push the string "0."
           0N×            # push 0 repeated N times
              y           # push current y
               J,         # join and print
                 ¼¾¹Qiq   # quit the program after X terms printed

Try it online!

Haskell, 53 63 bytes
This does the same thing as the 05AB1E answer now
f=(`take`["0."++('0'<$[1..y])++show x|x<-[1..],y<-[0..x*100]])

(`take`[.......]) saves two bytes

Python 2, 73 64 bytes
I think this is pretty short. I'm not sure that I can get it any shorter now that I golfed the if-else away.
s=z=1
exec'print"0.%0*d"%(z,s);q=z>s*100;z+=1-z*q;s+=q;'*input()

Try it online
Less golfed:
n=input()
s=z=1
for i in range(n):
    print"0.%0*d"%(z,s)
    if z>s*100:z=1;s+=1
    else:z+=1

Perl 5, 57 52 bytes
(needs -E for say)
for(1..<>){say"0."."0"x$i++.$.;$.++,$i=0if$i>100*$.}

Or readably:
# $. is the input line number, use it to count the
# number at the end.
# $i counts zeroes in the middle, starts at 0 implicitly
for(1..<>){                      # get the number of terms from stdin and loop
                                 # <> implicitly increases $. (to 1)
    say "0." . "0" x $i++ . $.;  # print the number, add one zero
    $.++, $i=0 if $i > 100 * $.; # increment the number, reset number
                                 # of zeroes if we've printed enough
}

Trailing zeroes are printed since the number after the row of zeroes is just an integer concatenated as a string.
Test run:
$ perl -E 'for(1..<>){say"0."."0"x$i++.$.;$.++,$i=0if$i>100*$.}' | tail -3
4511
0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009
0.10
0.010

@TheBitByte, yes, added explicit mention of that and a sample output

You can win 2 bytes by doing map{...}1..<> instead of for(1..<>){...} ;)

Always good too see a new Perl competitor :-) Have a +1

QBIC, 73 64 bytes
:#0|{C=!q$D=@0.|[0,q*100|d=d+1?D+$LTRIM$|(C) D=D+A~d=a|_X]]q=q+1

Saved 9 bytes by removing x as upper bound in the FOR loop. Upper bound is now set as q*100. Shame that QBasic automatically adds a space in front of a printed number, that's a costly LTRIM$...
Some explanation: q is used as the current number in the loop. This starts as 1 and gets incremented every 100N turns. This number gets converted to a string and is then appended to the string 0. and the correct number of 0's. In detail:
We use q as our 'base number', this is 1 implicitly
:                Get the max number of terms from a numeric CMD line param
#0|              Define string A$ as "0"
{                DO
C=!q$            our base number is cast to the string C$
D=@0.|           define D$ as "0."
[0,q*100|        FOR each of the terms we need to do for our base number
                 (i.e. 101 for 1, 201 for 2 ...)
d=d+1            Keep track of the total # of terms
                 (i.e. 101 after the 1 cycle, 302 after the 2...)
?D+$LTRIM$|(C)   Print to screen D$ + C$, where D$ = "0.[000]"
                 and C$ is our base number (1, or 2, or - much later - 100)
                 LTRIM is in there to prevent "0.00 1"
D=D+A            Add A$ to the end of D$ ("0.00" becomes "0.000")
~d=a|_X]         Stop if we've reached the max. # of terms
]                NEXT
q=q+1            If we've done all the terms necessary with this base number
                 then raise base number.
The DO loop gets closed implicitly by QBIC.

Edit: QBIC has seen quite some development over time, and the above can now be solved in 49 bytes, 15 bytes shorter:
{D=@0.`[0,q*100|d=d+1?D+!q$┘D=D+@0`~d=a|_X]]q=q+1

JavaScript (ES6), 69
n=>[...Array(n)].map(_=>(w=l--?z:(l=++x*100,z='0.'),z+=0,w+x),l=x=0)

Unnamed function with desired length in input and returning an array of strings.
Test

f=
n=>[...Array(n)].map(_=>(w=l--?z:(l=++x*100,z='0.'),z+=0,w+x),l=x=0)

var tid=0
function exec()
{
    var n=+I.value;
    O.textContent=f(n).map((r,i)=>i+1+' '+r).join`\n`;
}

function update()
{
  clearTimeout(tid);
  tid=setTimeout(exec, 1000);
}

exec()
<input id=I value=305 type=number oninput='update()'>

PHP, 83 Bytes
for($s=1;$i++<$argv[1];){if($r>100*$s){$s++;$r=0;}echo" 0.".str_repeat(0,$r++).$s;}

@TheBitByte $s=100;$r=5;echo" 0.".str_repeat(0,$r++).$s; gives back as a string 0.00000100 In my opinion it fits the conditions. We use a string and not a float or a double

PowerShell v2+, 89 bytes
param($n)for($j=1;;$j++){for($i=0;$i-le100*$j;$i++){"0.$('0'*$i)$j";if(++$k-ge$n){exit}}}

Straight-up double-for loop. The first, for $j is infinite. The inner, for $i, loops from 0 up to 100*$j, using string concatenation and string multiplication to print out the appropriate item. It also checks total loop counter $k against input $n, and exits the program after we hit that point.

@TheBitByte Yes, because each loop the item is being constructed and left on the pipeline as a literal string, so it won't do any truncation.

GNU sed 163 157
+2 included for -rn
s,^,0.1\n,;:;P;s,\.,.0,;s,.$,,;/0{101}/{s,0\.0*(09)?,\1,
s,.9*\n,x&,;h;s,.*x(.*)\n.*,\1,;y,0123456789,1234567890,
G;s,(.*\n)(.*)x.*\n(.*),0.\2\1\3,};/\n./b

Takes input in unary based in this consensus.
Try it online!

An easy way to run this is:
 yes 1 | head -{input} | tr -d '\n' | sed -rnf zeroOne.sed

Explanation
s,^,0.1\n,                   #add 0.1 as the first line of the pattern space
:
P                            #print everything up to the first newline
s,\.,.0,                     #add a 0 after the .
s,.$,,                       #reduce the number left to print by one
/0{100}/{                    #if there is a string of 100 zero do the following
    s,0\.0*(09)?,\1,                 #get rid of all the 0s (except one if the we are adding another digit)
    s,.9*\n,x&,              #put an x before the left most number that will change
    h                        #store in hold space
    s,.*x(.*)\n.*,\1,        #remove everything except the numbers that change
    y,0123456789,1234567890, #replace numbers with the next one up
    G                        #bring the rest of the string back
    s,(.*\n)(.*)x.*\n(.*),0.\2\1\3,
                             #replace the x and numbers that changed with the new ones
}
/\n./b                   #branch back unless there isn't anything on the last line

Mathematica, 70 bytes
Take[Join@@Table["0."<>Array["0"&,k]<>ToString@m,{m,#},{k,0,100m}],#]&

Unnamed function that takes the desired length as its argument and returns a list of strings (using strings instead of numbers makes the trailing zeros easy to include).
This version is slow as hell! because if you want, for example, the first 10 terms, it actually computes the sequence all the way through the 10th segment (101 + 201 + ... + 1001 = 5510 terms) and then retains only the first 10. So already at input 303, it's computing nearly five million terms and discarding almost all of them. The 81-byte version
Take[Join@@Table["0."<>Array["0"&,k]<>ToString@m,{m,Sqrt[#/50]+1},{k,0,100m}],#]&

doesn't have this flaw, and in fact calculates nearly the fewest segments possible.

You can save 1 byte by avoiding Table: Take[Join@@("0."<>#&/@NestList["0"<>#&,ToString@#,100#]&~Array~#),#]&

dc, 71 bytes
sn1sj1si1[lj1+dddsjZ1-dkAr^/li1+si]sJ[0nK1+kA/pljA0*K=Jlnlid1+si<M]dsMx

Try it online!
Honestly, I thought taking advantage of dc's arbitrary precision would make this easy, but I'm pretty sure just printing a ton of zeroes will be golfier. It feels really suboptimal, but I still think the use of arbitrary precision is interesting.
sn1sj1si1 We're taking top-of-stack as our nth-term target, so we store it in n, initialize i and j at 1, and leave a 1 on the stack.
[lj1+dddsjZ1-dkAr^/li1+si]sJ Macro J handles what to do when we've hit the 100, 200, &c. mark. Counter j keeps track of this, so we increment it, we set our precision to the number of digits it has less one, and then we leave the first digit of it (Z1-Ar^/; divide by 10^(number of digits less one)) on the stack since this is our starting point for the next big long chain.
[0nK1+kA/pljA0*K=Jlnlid1+si<M]dsMx Our main macro. First we print a leading 0 with 0n. Then K1+k increments our precision by one place. A/ divides by ten, pushing us a place over to the right.p prints, and then the rest is housekeeping. We can test our current precision to determine whether or not we need to jump into macro J, so we multiply counter j by a hundred (note: A0 here may need to be replaced with 100 on some implementations (cygwin)) and do the comparison. We load n, our target nth term, increment our main counter, i, and then compare the two. If we haven't yet hit the target, we keep running M.

Excel VBA, 63 Bytes
Anonymous VBE immediate window function that takes input from range [A1] and outputs to the VBE immediate window
n=[A1]:While n>i*100:n=n-1-i*100:i=i+1:Wend:?"0."String(n,48)&i

Java 8, 120 bytes
n->{String r="";a:for(int i=1,j,k,c=n;;i++)for(j=0;j<=i*100;r+=i+"\n"){for(r+="0.",k=j++;k-->0;r+=0);if(c--<1)break a;}}

Explanation and TIO uses the one below however. The difference: the one above creates one big String and then returns it; the one below prints every line separately (which is much better for performance).
130 bytes:
n->{String r;a:for(int i=1,j,k,c=n;;i++)for(j=0;j<=i*100;System.out.println(r+i)){for(r="0.",k=j++;k-->0;r+=0);if(c--<1)break a;}}

Explanation:
Try it here. (Will time out or exceed output limit for test cases above 604, but locally test case 4510 works in below 2 seconds.)
n->{                  // Method with integer parameter and no return-type
  String r;           //  Row String
  a:for(int i=1,      //  Index integer `i` starting at 1
        j,k,          //  Some other index integers
        c=n           //  Counter integer starting at the input
        ;;i++)        //  Loop (1) indefinitely
      for(j=0;        //   Reset `j` to 0
          j<=i*100;   //   Loop (2) from 0 to `i*100` (inclusive)
          System.out.println(r+i)){
                      //     After every iteration: print `r+i` + new-line
        for(r="0.",   //    Reset row-String to "0."
            k=j++;    //    Reset `k` to `j`
            k-->0;    //    Loop (3) from `j` down to `0`
          r+=0        //     And append the row-String with "0"
        );            //    End of loop (3)
        if(c--<1)     //    As soon as we've outputted `n` items
          break a;    //     Break loop `a` (1)
      }               //   End of loop (2) (implicit / single-line body)
                      //  End of loop (1) (implicit / single-line body)
}                     // End of method

I notice you often post explanations with every line commented. I think this tends to be counterproductive, since comments like "initialize _ to _" and "end of _" crowd out more informative comments. Have you considered paring down the comments, or providing a high-level overview instead?

@Jakob It's mainly because Java answers are usually pretty big I think personally. If everything would fit on a single line without scrollbar, I could put the loops and ifs as a whole including closing bracket. Anyway, I'll try to leave out some things next time, like the "End of" parts, to see how it looks. Thanks for the feedback!


text:
Adding One to a number stored as an Array
I was challenged by one of my friends to solve this coding problem:
Given a non-negative number represented as an array of digits, add one to the number. The digits are stored such that the most significant digit is at the head of the list. Return the value as a new list.
This was my solution, which does not work if [9,8,7,6,5,4,3,2,1,0] is input.
public int[] plusOne(int[] digits) {
    int[] ret;
    int integervalue;
    integervalue = 0;
    String stringvalue;
    for(int i = 0; i < digits.length; i++){
        integervalue = integervalue*10 + digits[i];
    }
    integervalue++;
    stringvalue = String.valueOf(integervalue);
    ret = new int[stringvalue.length()];
    for(int i = 0; i < stringvalue.length(); i++) {
        ret[i] = stringvalue.charAt(i) - 48;
    }
    return ret;
}

My apologies if my code is confusing, awkward, hard-to-read, or if the solution is incredibly obvious. I am still a rookie in Java.

Welcome to Programming Puzzles and Code Golf! This site is for programming competitions, not for general programming questions. For those you can try Stack Overflow, but make sure to check out their Help Center first to ensure your question is on topic. Thanks!

Welcome to CodeGolf&ProgrammingPuzzles.SE! Don't be discouraged by the closing of your challenge! typically, we encourage users to post in the sandbox for a few days for critiquing. You can find thet here: http://meta.codegolf.stackexchange.com/questions/2140/sandbox-for-proposed-challenges?cb=1

@tuskiomi firstly there aren't any downvotes. Second, this question could never be on-topic for this site

@muddyfish sure. I fixed it..

FYI int will overflow for that input.

I think this could be a reasonable code golf, though "stored as an array" could be tricky to define in a language-independent way.


text:
Find the intersection point of a plane and ray
Given a ray with a point and a vector and a plane with a point and a normal vector to the plane. You have to find the intersection point of the plane and the ray..
So your job if you choose to accept is to write a shortest function that will do the job.
RULES:
The submission must be a complete program
And that's all

INPUT FORMAT:
x y z rx ry rz //gives the ray point and the ray vectors
x y z px py pz //gives the point on the plane and the vector normal to plane

OUTPUT FORMAT:
(x,y,z) //intersection point

Test Case:
2 3 4 0.577 0.577 0.577
7 1 3 1 0 0
(7,8,9)

The shortest codes in bytes win.
References: https://www.siggraph.org/education/materials/HyperGraph/raytrace/rayplane_intersection.htm  thanks orlp for the reference

then i think i should remove it.

Any specifications as to required precision? Say 3 decimal figures for example?

Do degenerate cases need to be handled? Ray parallel with the plane? Ray coincident with the plane? Any others???

Nope. Not needed to handle those..

Some test cases would be nice. Also, relevant.

A challenge like this could definitely use test cases; please add some!

It will be very helpful if the formulae involved are included in the question, else programmers will have to search for them.

@rnso i added a working function in my example. But Some one commented that my example is not a program but a function. So removed it.

@orlp this is my first question of the type. So I'm sorry to the community for my mistakes

@Lynn will add working testcases soon

I would strongly advice to stop enforcing your very specific input/output rules. They really don't add anything to the challenge.

ooh. thanks @sanchises for pointing it out.. My bad. Haven't seen those meta posts

I guess someone had ought to explain to you why nobody seemed to be inclined to follow your rules while still demanding strictness on some other parts :)

will try to follow the rules i discover on meta.

Mathematica, 20 bytes
Takes 4 lists as input. The dot product operator . has precedence over multiplication and division, so no more parentheses are needed.
#+#2(#3-#).#4/#2.#4&

Readable version:
x + v (r - x).n / v.n

where the arguments in order are x (ray point), v (ray direction), r (plane point), n (plane normal).

does it give output in desired format?

@KishanKumar If by desired format you mean with parentheses, then no. Neither is the input a bunch of numbers separated by spaces. Mathematica works in lists, which are enclosed by {} and separated by ,.

No other answer shorter than this.. So, i have accepted this answer.

Perl, 107 bytes
Tested for all test cases (i.e. not tested at all)
Run with each input number on its own line on STDIN
perl -M5.010 plane.pl
0
1
0
0
0
1
3
3
1
0
0
1
^D

plane.pl:
#!/usr/bin/perl
$$_=<>for a..l;say$a+($t=($j*($g-$a)+$k*($h-$b)+$l*($i-$c))/($j*$d+$k*$e+$l*$f))*$d,$",$b+$t*$e,$",$c+$t*$f

This kind of problem is absolutely not a good match for perlgolf. Perl lacks vector operations and uses too many $s

+1 for "for all test cases".

does it give output in desired format?

It prints the 3 coordinates on one line separated by spaces without (). Adding the (,,) takes 10 trivial bytes (just add the extra characters to the say)

Haskell, 137 157/102 bytes
Follows both input and output pattern. Program reads input from stdin. 157 bytes.
z=zipWith
main=do
[(p,r),(l,n)]<-map(splitAt 3.map read.words).lines<$>getContents
print$(\[a,b,c]->(a,b,c))$z(+)p$map(*(sum(z(*)n(z(-)l p))/sum(z(*)n r)))r

With an input file that has format [[x,y,z],[rx,ry,rz],[x,y,z],[px,py,pz]] and output of format [x,y,z] (102 bytes):
z=zipWith
main=do
[p,r,l,n]<-read<$>getContents
print$z(+)p$map(*(sum(z(*)n(z(-)l p))/sum(z(*)n r)))r

does it follow both output and input pattern...

The optional version did. I changed it to do it anyway, at the cost of 20 bytes.

well, remove the extra 20 bytes. no need to comply with my input pattern

It always complied with the input pattern - the output had different parentheses. I'll add an option that follows neither format.

Do the one that saves you most bytes..

R, 88 bytes
x=scan()
v=scan()
r=scan()
n=scan()
C=cat
C("(");C(x+v*sum((r-x)*n)/sum(v*n),sep=", ");C(")")

Adapted from the Mathematica answer. Takes the following values from stdin, x (ray point), v (ray direction), r (plane point), n (plane normal). Outputs (7, 8, 9) for the test case.

JavaScript (ES6), 157 bytes
This could probably be shorter. The test case is subject to rounding errors, but otherwise it respects the challenge.
P=prompt;[a,b,c,d,e,f,g,h,i,j,k,l]=(P()+' '+P()).split` `.map(e=>+e);alert('('+(a+(t=(j*(g-a)+k*(h-b)+l*(i-c))/(j*d+k*e+l*f))*d)+','+(b+t*e)+','+(c+t*f)+')')

JavaScript (ES6), 93 bytes
(a,b,c,A,B,C,x,y,z,X,Y,Z)=>`(${t=X*(x-a)+Y*(y-b)+Z*(z-c)/(X*A+Y*B+Z*C),[a+t*A,b+t*B,c+t*C]})`

f=
(a,b,c,A,B,C,x,y,z,X,Y,Z)=>`(${t=X*(x-a)+Y*(y-b)+Z*(z-c)/(X*A+Y*B+Z*C),[a+t*A,b+t*B,c+t*C]})`

console.log(f(2, 3, 4, 0.577350269, 0.577350269, 0.577350269, 7, 1, 3, 1, 0, 0))