Round away from zeroRound towards zeroCalculate the cube root of a numberCount the unique fractions with only integersBlock-diagonal matrix from columnsRound to n Sig FigsCreate a pyramidal matrixRound the stringConvert Between Percentages and DecimalRound like a ZeroGet the best of two ArraysRound towards zero

Spare the Dying during Rage Beyond Death

Can there be plants on the dark side of a tidally locked world?

My boss says "This will help us better view the utilization of your services." Does this mean my job is ending in this organisation?

Can a country avoid prosecution for crimes against humanity by denying it happened?

IEEE Registration Authority mac prefix

First Number to Contain Each Letter

Round away from zero

If I have an accident, should I file a claim with my car insurance company?

Did the US Climate Reference Network Show No New Warming Since 2005 in the US?

Do mortgage points get applied directly to the principal?

What does "se jouer" mean here?

Is the Levitate spell supposed to basically disable a melee-based enemy?

Do I need to get a noble in order to win Splendor?

How do I stop making people jump at home and at work?

What is the significance of 104% for throttle power and rotor speed?

When making yogurt, why doesn't bad bacteria grow as well?

Are treasury bonds more liquid than USD?

Tiny image scraper for xkcd.com

Why do we need explainable AI?

Is it rude to ask my opponent to resign an online game when they have a lost endgame?

Why did the VIC-II and SID use 6 µm technology in the era of 3 µm and 1.5 µm?

How to encode a class with 24,000 categories?

Adding transparency to ink drawing

Which is the best password hashing algorithm in .NET Core?



Round away from zero


Round towards zeroCalculate the cube root of a numberCount the unique fractions with only integersBlock-diagonal matrix from columnsRound to n Sig FigsCreate a pyramidal matrixRound the stringConvert Between Percentages and DecimalRound like a ZeroGet the best of two ArraysRound towards zero






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








14












$begingroup$


Round away from zero



Inspired by Round towards zero.



Given a number input via any reasonable method, round the number "away from zero" - positive numbers round up, and negative numbers round down.



You can output a floating-point number with the decimal point (e.g. 42.0) if desired. (Or even have some test cases output floating-point and some output integer, if it makes your answer shorter.)



Standard loopholes are not allowed, etc etc.



Test cases



-99.9 => -100
-33.5 => -34
-7 => -7
-1.1 => -2
0 => 0
2.3 => 3
8 => 8
99.9 => 100
42.0 => 42
-39.0 => -39


Sandbox Link










share|improve this question











$endgroup$













  • $begingroup$
    if we're taking numbers in a string context, such as STDIN, do we need to support the .0 as the test cases seem to suggest?
    $endgroup$
    – Jo King
    3 hours ago

















14












$begingroup$


Round away from zero



Inspired by Round towards zero.



Given a number input via any reasonable method, round the number "away from zero" - positive numbers round up, and negative numbers round down.



You can output a floating-point number with the decimal point (e.g. 42.0) if desired. (Or even have some test cases output floating-point and some output integer, if it makes your answer shorter.)



Standard loopholes are not allowed, etc etc.



Test cases



-99.9 => -100
-33.5 => -34
-7 => -7
-1.1 => -2
0 => 0
2.3 => 3
8 => 8
99.9 => 100
42.0 => 42
-39.0 => -39


Sandbox Link










share|improve this question











$endgroup$













  • $begingroup$
    if we're taking numbers in a string context, such as STDIN, do we need to support the .0 as the test cases seem to suggest?
    $endgroup$
    – Jo King
    3 hours ago













14












14








14





$begingroup$


Round away from zero



Inspired by Round towards zero.



Given a number input via any reasonable method, round the number "away from zero" - positive numbers round up, and negative numbers round down.



You can output a floating-point number with the decimal point (e.g. 42.0) if desired. (Or even have some test cases output floating-point and some output integer, if it makes your answer shorter.)



Standard loopholes are not allowed, etc etc.



Test cases



-99.9 => -100
-33.5 => -34
-7 => -7
-1.1 => -2
0 => 0
2.3 => 3
8 => 8
99.9 => 100
42.0 => 42
-39.0 => -39


Sandbox Link










share|improve this question











$endgroup$




Round away from zero



Inspired by Round towards zero.



Given a number input via any reasonable method, round the number "away from zero" - positive numbers round up, and negative numbers round down.



You can output a floating-point number with the decimal point (e.g. 42.0) if desired. (Or even have some test cases output floating-point and some output integer, if it makes your answer shorter.)



Standard loopholes are not allowed, etc etc.



Test cases



-99.9 => -100
-33.5 => -34
-7 => -7
-1.1 => -2
0 => 0
2.3 => 3
8 => 8
99.9 => 100
42.0 => 42
-39.0 => -39


Sandbox Link







code-golf number






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 7 hours ago









DJMcMayhem

42.2k12 gold badges160 silver badges330 bronze badges




42.2k12 gold badges160 silver badges330 bronze badges










asked 9 hours ago









Value InkValue Ink

9,1987 silver badges36 bronze badges




9,1987 silver badges36 bronze badges














  • $begingroup$
    if we're taking numbers in a string context, such as STDIN, do we need to support the .0 as the test cases seem to suggest?
    $endgroup$
    – Jo King
    3 hours ago
















  • $begingroup$
    if we're taking numbers in a string context, such as STDIN, do we need to support the .0 as the test cases seem to suggest?
    $endgroup$
    – Jo King
    3 hours ago















$begingroup$
if we're taking numbers in a string context, such as STDIN, do we need to support the .0 as the test cases seem to suggest?
$endgroup$
– Jo King
3 hours ago




$begingroup$
if we're taking numbers in a string context, such as STDIN, do we need to support the .0 as the test cases seem to suggest?
$endgroup$
– Jo King
3 hours ago










17 Answers
17






active

oldest

votes


















5














$begingroup$


Jelly, 4 bytes



ĊṠ¡Ḟ


A monadic Link accepting a number which yields an integer.



Try it online! Or see a test-suite.



How?



ĊṠ¡Ḟ - Link: number, N
¡ - repeat...
Ṡ - ...number of times: sign of N (repeating -1 is the same as 0 times)
Ċ - ...action: ceiling
Ḟ - floor (that)





share|improve this answer











$endgroup$














  • $begingroup$
    So how exactly does ¡ work for negative numbers? I don't think it's documented
    $endgroup$
    – caird coinheringaahing
    8 hours ago






  • 1




    $begingroup$
    It's not documented on Jelly's wiki, but ¡s repetitive nature is implemented with a for index in range(repetitions) loop in the code. range([stop=]-1) is empty since start defaults to 0 and step defaults to 1 and "For a positive step, the contents of a range r are determined by the formula r[i] = start + step*i where i >= 0 and r[i] < stop." docs
    $endgroup$
    – Jonathan Allan
    7 hours ago










  • $begingroup$
    ¡'s behavior relies on that of Python's range, and range(-1).__iter__().__next__() immediately throws StopIteration.
    $endgroup$
    – Unrelated String
    7 hours ago


















4














$begingroup$

R, 32 bytes



x=scan()
sign(x)*ceiling(abs(x))





share|improve this answer









$endgroup$














  • $begingroup$
    31 bytes -- very nice answer!
    $endgroup$
    – Giuseppe
    8 hours ago


















4














$begingroup$


Jelly, 5 bytes



Ṡ×AĊ$


Try it online!



This ports recursive's Stax answer into Jelly




Jelly, 6 bytes



ĊḞṠ‘$?


Try it online!



I feel like there is a shorter way than this, but it works, and isn't a port of another answer.






share|improve this answer











$endgroup$














  • $begingroup$
    ĊḞ>?0 would work as your 6 does.
    $endgroup$
    – Jonathan Allan
    7 hours ago






  • 1




    $begingroup$
    AĊ×Ṡ is 4 and functionally identical to your first answer.
    $endgroup$
    – Nick Kennedy
    6 hours ago


















2














$begingroup$

JavaScript (ES6), 20 bytes





n=>n%1?n<0?~-n:-~n:n


Try it online!






share|improve this answer









$endgroup$






















    2














    $begingroup$


    Stax, 6 bytes



    å├╪∙Bß


    Run and debug it



    Procedure:



    1. Absolute value

    2. Ceiling

    3. Multiply by original sign





    share|improve this answer









    $endgroup$






















      2














      $begingroup$


      Python 3, 24 bytes





      lambda i:i-i%(1,-1)[i>0]


      Try it online!






      share|improve this answer









      $endgroup$






















        2














        $begingroup$


        Retina 0.8.2, 38 bytes



        .0+
        .
        b9+..
        0$&
        T`9d`d`.9*..
        ..*



        Try it online! Link includes test cases. Explanation:



        .0+
        .


        Delete zeroes after the decimal point, to ensure that the number is not an integer; the next two matches fail if there are no digits after the decimal point.



        b9+..
        0$&


        If the integer part is all 9s, prefix a 0 to allow the increment to overflow.



        T`9d`d`.9*..


        Increment the integer part of the number.



        ..*


        Delete the fractional part of the number.






        share|improve this answer









        $endgroup$






















          1














          $begingroup$

          Vim, 36 bytes/keystrokes



          :s/-/-<Space>
          :g/..*[1-9]/norm <C-v><C-a>lD
          :s/<Space><cr>


          Try it online! or Verify all Test Cases!






          share|improve this answer











          $endgroup$






















            1














            $begingroup$


            Runic Enchantments, 18 bytes



            i:'|A:1+µ-'fA},*@


            Try it online!



            "Adds" (away from zero) 0.999999 and floors the result. µ is the closest thing to an infinitesimal in language's operators.






            share|improve this answer











            $endgroup$










            • 1




              $begingroup$
              This outputs nothing for 0
              $endgroup$
              – Jo King
              6 hours ago







            • 1




              $begingroup$
              @JoKing Oof. Good catch. It's doing a divide by input to get the "sign" of the input value, which of course, divides by 0 when the input is 0. There's no (good) way around that right now. Will need this commit first. I'll poke Dennis (side benefit, the answer will get shorter).
              $endgroup$
              – Draco18s
              5 hours ago



















            1














            $begingroup$


            Perl 6, 18 bytes





            $_-.abs%-1*.sign


            Try it online!






            share|improve this answer









            $endgroup$






















              1














              $begingroup$

              Excel, 13 bytes



              =ROUNDUP(A1,)


              Alternative



              =EVEN(A1*2)/2





              share|improve this answer









              $endgroup$






















                0














                $begingroup$


                Brachylog, 7 bytes



                ⌋₁ℤ₁|⌉₁


                Try it online!



                or ⌉₁ℕ₁|⌋₁.



                ⌋₁ The input rounded down
                ℤ₁ is an integer less than -1
                | and the output, or, the input
                ⌉₁ rounded up is the output.





                share|improve this answer









                $endgroup$






















                  0














                  $begingroup$


                  Perl 6, 19 bytes





                  0+.sign*?/./


                  Try it online!



                  Not the shortest solution, but I'm working on it. Basically this truncates the number, then adds one away from zero if the number was not whole to begin with






                  share|improve this answer









                  $endgroup$






















                    0














                    $begingroup$


                    Java (OpenJDK 8), 43 bytes





                    a->return(int)((int)a/a<1?a>0?a+1:a-1:a);


                    Try it online!






                    share|improve this answer











                    $endgroup$










                    • 1




                      $begingroup$
                      The lambda function can be written without using an explicit return statement.
                      $endgroup$
                      – Joel
                      6 hours ago


















                    0














                    $begingroup$


                    Perl 5 -pF/./, 24 bytes





                    $_&&=$F[0]+$_*(@F-1)/abs


                    Try it online!






                    share|improve this answer









                    $endgroup$






















                      0














                      $begingroup$

                      C, 94 bytes



                      #include<math.h>
                      main()float a;scanf("%e",&a);printf("%f",(-2*signbit(a)+1)*ceil(fabs(a)));


                      I compiled with



                      gcc a.c





                      share|improve this answer








                      New contributor



                      user1475369 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                      Check out our Code of Conduct.





                      $endgroup$






















                        0














                        $begingroup$


                        J, 6 bytes



                        **>.@|


                        Try it online!



                        Just a 1 character change from my answer on the cousin question.






                        share|improve this answer









                        $endgroup$

















                          Your Answer






                          StackExchange.ifUsing("editor", function ()
                          StackExchange.using("externalEditor", function ()
                          StackExchange.using("snippets", function ()
                          StackExchange.snippets.init();
                          );
                          );
                          , "code-snippets");

                          StackExchange.ready(function()
                          var channelOptions =
                          tags: "".split(" "),
                          id: "200"
                          ;
                          initTagRenderer("".split(" "), "".split(" "), channelOptions);

                          StackExchange.using("externalEditor", function()
                          // Have to fire editor after snippets, if snippets enabled
                          if (StackExchange.settings.snippets.snippetsEnabled)
                          StackExchange.using("snippets", function()
                          createEditor();
                          );

                          else
                          createEditor();

                          );

                          function createEditor()
                          StackExchange.prepareEditor(
                          heartbeatType: 'answer',
                          autoActivateHeartbeat: false,
                          convertImagesToLinks: false,
                          noModals: true,
                          showLowRepImageUploadWarning: true,
                          reputationToPostImages: null,
                          bindNavPrevention: true,
                          postfix: "",
                          imageUploader:
                          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                          allowUrls: true
                          ,
                          onDemand: true,
                          discardSelector: ".discard-answer"
                          ,immediatelyShowMarkdownHelp:true
                          );



                          );













                          draft saved

                          draft discarded


















                          StackExchange.ready(
                          function ()
                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f191241%2fround-away-from-zero%23new-answer', 'question_page');

                          );

                          Post as a guest















                          Required, but never shown

























                          17 Answers
                          17






                          active

                          oldest

                          votes








                          17 Answers
                          17






                          active

                          oldest

                          votes









                          active

                          oldest

                          votes






                          active

                          oldest

                          votes









                          5














                          $begingroup$


                          Jelly, 4 bytes



                          ĊṠ¡Ḟ


                          A monadic Link accepting a number which yields an integer.



                          Try it online! Or see a test-suite.



                          How?



                          ĊṠ¡Ḟ - Link: number, N
                          ¡ - repeat...
                          Ṡ - ...number of times: sign of N (repeating -1 is the same as 0 times)
                          Ċ - ...action: ceiling
                          Ḟ - floor (that)





                          share|improve this answer











                          $endgroup$














                          • $begingroup$
                            So how exactly does ¡ work for negative numbers? I don't think it's documented
                            $endgroup$
                            – caird coinheringaahing
                            8 hours ago






                          • 1




                            $begingroup$
                            It's not documented on Jelly's wiki, but ¡s repetitive nature is implemented with a for index in range(repetitions) loop in the code. range([stop=]-1) is empty since start defaults to 0 and step defaults to 1 and "For a positive step, the contents of a range r are determined by the formula r[i] = start + step*i where i >= 0 and r[i] < stop." docs
                            $endgroup$
                            – Jonathan Allan
                            7 hours ago










                          • $begingroup$
                            ¡'s behavior relies on that of Python's range, and range(-1).__iter__().__next__() immediately throws StopIteration.
                            $endgroup$
                            – Unrelated String
                            7 hours ago















                          5














                          $begingroup$


                          Jelly, 4 bytes



                          ĊṠ¡Ḟ


                          A monadic Link accepting a number which yields an integer.



                          Try it online! Or see a test-suite.



                          How?



                          ĊṠ¡Ḟ - Link: number, N
                          ¡ - repeat...
                          Ṡ - ...number of times: sign of N (repeating -1 is the same as 0 times)
                          Ċ - ...action: ceiling
                          Ḟ - floor (that)





                          share|improve this answer











                          $endgroup$














                          • $begingroup$
                            So how exactly does ¡ work for negative numbers? I don't think it's documented
                            $endgroup$
                            – caird coinheringaahing
                            8 hours ago






                          • 1




                            $begingroup$
                            It's not documented on Jelly's wiki, but ¡s repetitive nature is implemented with a for index in range(repetitions) loop in the code. range([stop=]-1) is empty since start defaults to 0 and step defaults to 1 and "For a positive step, the contents of a range r are determined by the formula r[i] = start + step*i where i >= 0 and r[i] < stop." docs
                            $endgroup$
                            – Jonathan Allan
                            7 hours ago










                          • $begingroup$
                            ¡'s behavior relies on that of Python's range, and range(-1).__iter__().__next__() immediately throws StopIteration.
                            $endgroup$
                            – Unrelated String
                            7 hours ago













                          5














                          5










                          5







                          $begingroup$


                          Jelly, 4 bytes



                          ĊṠ¡Ḟ


                          A monadic Link accepting a number which yields an integer.



                          Try it online! Or see a test-suite.



                          How?



                          ĊṠ¡Ḟ - Link: number, N
                          ¡ - repeat...
                          Ṡ - ...number of times: sign of N (repeating -1 is the same as 0 times)
                          Ċ - ...action: ceiling
                          Ḟ - floor (that)





                          share|improve this answer











                          $endgroup$




                          Jelly, 4 bytes



                          ĊṠ¡Ḟ


                          A monadic Link accepting a number which yields an integer.



                          Try it online! Or see a test-suite.



                          How?



                          ĊṠ¡Ḟ - Link: number, N
                          ¡ - repeat...
                          Ṡ - ...number of times: sign of N (repeating -1 is the same as 0 times)
                          Ċ - ...action: ceiling
                          Ḟ - floor (that)






                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited 8 hours ago

























                          answered 8 hours ago









                          Jonathan AllanJonathan Allan

                          59.9k5 gold badges44 silver badges187 bronze badges




                          59.9k5 gold badges44 silver badges187 bronze badges














                          • $begingroup$
                            So how exactly does ¡ work for negative numbers? I don't think it's documented
                            $endgroup$
                            – caird coinheringaahing
                            8 hours ago






                          • 1




                            $begingroup$
                            It's not documented on Jelly's wiki, but ¡s repetitive nature is implemented with a for index in range(repetitions) loop in the code. range([stop=]-1) is empty since start defaults to 0 and step defaults to 1 and "For a positive step, the contents of a range r are determined by the formula r[i] = start + step*i where i >= 0 and r[i] < stop." docs
                            $endgroup$
                            – Jonathan Allan
                            7 hours ago










                          • $begingroup$
                            ¡'s behavior relies on that of Python's range, and range(-1).__iter__().__next__() immediately throws StopIteration.
                            $endgroup$
                            – Unrelated String
                            7 hours ago
















                          • $begingroup$
                            So how exactly does ¡ work for negative numbers? I don't think it's documented
                            $endgroup$
                            – caird coinheringaahing
                            8 hours ago






                          • 1




                            $begingroup$
                            It's not documented on Jelly's wiki, but ¡s repetitive nature is implemented with a for index in range(repetitions) loop in the code. range([stop=]-1) is empty since start defaults to 0 and step defaults to 1 and "For a positive step, the contents of a range r are determined by the formula r[i] = start + step*i where i >= 0 and r[i] < stop." docs
                            $endgroup$
                            – Jonathan Allan
                            7 hours ago










                          • $begingroup$
                            ¡'s behavior relies on that of Python's range, and range(-1).__iter__().__next__() immediately throws StopIteration.
                            $endgroup$
                            – Unrelated String
                            7 hours ago















                          $begingroup$
                          So how exactly does ¡ work for negative numbers? I don't think it's documented
                          $endgroup$
                          – caird coinheringaahing
                          8 hours ago




                          $begingroup$
                          So how exactly does ¡ work for negative numbers? I don't think it's documented
                          $endgroup$
                          – caird coinheringaahing
                          8 hours ago




                          1




                          1




                          $begingroup$
                          It's not documented on Jelly's wiki, but ¡s repetitive nature is implemented with a for index in range(repetitions) loop in the code. range([stop=]-1) is empty since start defaults to 0 and step defaults to 1 and "For a positive step, the contents of a range r are determined by the formula r[i] = start + step*i where i >= 0 and r[i] < stop." docs
                          $endgroup$
                          – Jonathan Allan
                          7 hours ago




                          $begingroup$
                          It's not documented on Jelly's wiki, but ¡s repetitive nature is implemented with a for index in range(repetitions) loop in the code. range([stop=]-1) is empty since start defaults to 0 and step defaults to 1 and "For a positive step, the contents of a range r are determined by the formula r[i] = start + step*i where i >= 0 and r[i] < stop." docs
                          $endgroup$
                          – Jonathan Allan
                          7 hours ago












                          $begingroup$
                          ¡'s behavior relies on that of Python's range, and range(-1).__iter__().__next__() immediately throws StopIteration.
                          $endgroup$
                          – Unrelated String
                          7 hours ago




                          $begingroup$
                          ¡'s behavior relies on that of Python's range, and range(-1).__iter__().__next__() immediately throws StopIteration.
                          $endgroup$
                          – Unrelated String
                          7 hours ago













                          4














                          $begingroup$

                          R, 32 bytes



                          x=scan()
                          sign(x)*ceiling(abs(x))





                          share|improve this answer









                          $endgroup$














                          • $begingroup$
                            31 bytes -- very nice answer!
                            $endgroup$
                            – Giuseppe
                            8 hours ago















                          4














                          $begingroup$

                          R, 32 bytes



                          x=scan()
                          sign(x)*ceiling(abs(x))





                          share|improve this answer









                          $endgroup$














                          • $begingroup$
                            31 bytes -- very nice answer!
                            $endgroup$
                            – Giuseppe
                            8 hours ago













                          4














                          4










                          4







                          $begingroup$

                          R, 32 bytes



                          x=scan()
                          sign(x)*ceiling(abs(x))





                          share|improve this answer









                          $endgroup$



                          R, 32 bytes



                          x=scan()
                          sign(x)*ceiling(abs(x))






                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered 8 hours ago









                          PunintendedPunintended

                          3461 silver badge4 bronze badges




                          3461 silver badge4 bronze badges














                          • $begingroup$
                            31 bytes -- very nice answer!
                            $endgroup$
                            – Giuseppe
                            8 hours ago
















                          • $begingroup$
                            31 bytes -- very nice answer!
                            $endgroup$
                            – Giuseppe
                            8 hours ago















                          $begingroup$
                          31 bytes -- very nice answer!
                          $endgroup$
                          – Giuseppe
                          8 hours ago




                          $begingroup$
                          31 bytes -- very nice answer!
                          $endgroup$
                          – Giuseppe
                          8 hours ago











                          4














                          $begingroup$


                          Jelly, 5 bytes



                          Ṡ×AĊ$


                          Try it online!



                          This ports recursive's Stax answer into Jelly




                          Jelly, 6 bytes



                          ĊḞṠ‘$?


                          Try it online!



                          I feel like there is a shorter way than this, but it works, and isn't a port of another answer.






                          share|improve this answer











                          $endgroup$














                          • $begingroup$
                            ĊḞ>?0 would work as your 6 does.
                            $endgroup$
                            – Jonathan Allan
                            7 hours ago






                          • 1




                            $begingroup$
                            AĊ×Ṡ is 4 and functionally identical to your first answer.
                            $endgroup$
                            – Nick Kennedy
                            6 hours ago















                          4














                          $begingroup$


                          Jelly, 5 bytes



                          Ṡ×AĊ$


                          Try it online!



                          This ports recursive's Stax answer into Jelly




                          Jelly, 6 bytes



                          ĊḞṠ‘$?


                          Try it online!



                          I feel like there is a shorter way than this, but it works, and isn't a port of another answer.






                          share|improve this answer











                          $endgroup$














                          • $begingroup$
                            ĊḞ>?0 would work as your 6 does.
                            $endgroup$
                            – Jonathan Allan
                            7 hours ago






                          • 1




                            $begingroup$
                            AĊ×Ṡ is 4 and functionally identical to your first answer.
                            $endgroup$
                            – Nick Kennedy
                            6 hours ago













                          4














                          4










                          4







                          $begingroup$


                          Jelly, 5 bytes



                          Ṡ×AĊ$


                          Try it online!



                          This ports recursive's Stax answer into Jelly




                          Jelly, 6 bytes



                          ĊḞṠ‘$?


                          Try it online!



                          I feel like there is a shorter way than this, but it works, and isn't a port of another answer.






                          share|improve this answer











                          $endgroup$




                          Jelly, 5 bytes



                          Ṡ×AĊ$


                          Try it online!



                          This ports recursive's Stax answer into Jelly




                          Jelly, 6 bytes



                          ĊḞṠ‘$?


                          Try it online!



                          I feel like there is a shorter way than this, but it works, and isn't a port of another answer.







                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited 8 hours ago

























                          answered 9 hours ago









                          caird coinheringaahingcaird coinheringaahing

                          7,8833 gold badges31 silver badges88 bronze badges




                          7,8833 gold badges31 silver badges88 bronze badges














                          • $begingroup$
                            ĊḞ>?0 would work as your 6 does.
                            $endgroup$
                            – Jonathan Allan
                            7 hours ago






                          • 1




                            $begingroup$
                            AĊ×Ṡ is 4 and functionally identical to your first answer.
                            $endgroup$
                            – Nick Kennedy
                            6 hours ago
















                          • $begingroup$
                            ĊḞ>?0 would work as your 6 does.
                            $endgroup$
                            – Jonathan Allan
                            7 hours ago






                          • 1




                            $begingroup$
                            AĊ×Ṡ is 4 and functionally identical to your first answer.
                            $endgroup$
                            – Nick Kennedy
                            6 hours ago















                          $begingroup$
                          ĊḞ>?0 would work as your 6 does.
                          $endgroup$
                          – Jonathan Allan
                          7 hours ago




                          $begingroup$
                          ĊḞ>?0 would work as your 6 does.
                          $endgroup$
                          – Jonathan Allan
                          7 hours ago




                          1




                          1




                          $begingroup$
                          AĊ×Ṡ is 4 and functionally identical to your first answer.
                          $endgroup$
                          – Nick Kennedy
                          6 hours ago




                          $begingroup$
                          AĊ×Ṡ is 4 and functionally identical to your first answer.
                          $endgroup$
                          – Nick Kennedy
                          6 hours ago











                          2














                          $begingroup$

                          JavaScript (ES6), 20 bytes





                          n=>n%1?n<0?~-n:-~n:n


                          Try it online!






                          share|improve this answer









                          $endgroup$



















                            2














                            $begingroup$

                            JavaScript (ES6), 20 bytes





                            n=>n%1?n<0?~-n:-~n:n


                            Try it online!






                            share|improve this answer









                            $endgroup$

















                              2














                              2










                              2







                              $begingroup$

                              JavaScript (ES6), 20 bytes





                              n=>n%1?n<0?~-n:-~n:n


                              Try it online!






                              share|improve this answer









                              $endgroup$



                              JavaScript (ES6), 20 bytes





                              n=>n%1?n<0?~-n:-~n:n


                              Try it online!







                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered 8 hours ago









                              ArnauldArnauld

                              91.8k7 gold badges108 silver badges373 bronze badges




                              91.8k7 gold badges108 silver badges373 bronze badges
























                                  2














                                  $begingroup$


                                  Stax, 6 bytes



                                  å├╪∙Bß


                                  Run and debug it



                                  Procedure:



                                  1. Absolute value

                                  2. Ceiling

                                  3. Multiply by original sign





                                  share|improve this answer









                                  $endgroup$



















                                    2














                                    $begingroup$


                                    Stax, 6 bytes



                                    å├╪∙Bß


                                    Run and debug it



                                    Procedure:



                                    1. Absolute value

                                    2. Ceiling

                                    3. Multiply by original sign





                                    share|improve this answer









                                    $endgroup$

















                                      2














                                      2










                                      2







                                      $begingroup$


                                      Stax, 6 bytes



                                      å├╪∙Bß


                                      Run and debug it



                                      Procedure:



                                      1. Absolute value

                                      2. Ceiling

                                      3. Multiply by original sign





                                      share|improve this answer









                                      $endgroup$




                                      Stax, 6 bytes



                                      å├╪∙Bß


                                      Run and debug it



                                      Procedure:



                                      1. Absolute value

                                      2. Ceiling

                                      3. Multiply by original sign






                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered 8 hours ago









                                      recursiverecursive

                                      8,14615 silver badges32 bronze badges




                                      8,14615 silver badges32 bronze badges
























                                          2














                                          $begingroup$


                                          Python 3, 24 bytes





                                          lambda i:i-i%(1,-1)[i>0]


                                          Try it online!






                                          share|improve this answer









                                          $endgroup$



















                                            2














                                            $begingroup$


                                            Python 3, 24 bytes





                                            lambda i:i-i%(1,-1)[i>0]


                                            Try it online!






                                            share|improve this answer









                                            $endgroup$

















                                              2














                                              2










                                              2







                                              $begingroup$


                                              Python 3, 24 bytes





                                              lambda i:i-i%(1,-1)[i>0]


                                              Try it online!






                                              share|improve this answer









                                              $endgroup$




                                              Python 3, 24 bytes





                                              lambda i:i-i%(1,-1)[i>0]


                                              Try it online!







                                              share|improve this answer












                                              share|improve this answer



                                              share|improve this answer










                                              answered 8 hours ago









                                              JitseJitse

                                              1,4804 silver badges21 bronze badges




                                              1,4804 silver badges21 bronze badges
























                                                  2














                                                  $begingroup$


                                                  Retina 0.8.2, 38 bytes



                                                  .0+
                                                  .
                                                  b9+..
                                                  0$&
                                                  T`9d`d`.9*..
                                                  ..*



                                                  Try it online! Link includes test cases. Explanation:



                                                  .0+
                                                  .


                                                  Delete zeroes after the decimal point, to ensure that the number is not an integer; the next two matches fail if there are no digits after the decimal point.



                                                  b9+..
                                                  0$&


                                                  If the integer part is all 9s, prefix a 0 to allow the increment to overflow.



                                                  T`9d`d`.9*..


                                                  Increment the integer part of the number.



                                                  ..*


                                                  Delete the fractional part of the number.






                                                  share|improve this answer









                                                  $endgroup$



















                                                    2














                                                    $begingroup$


                                                    Retina 0.8.2, 38 bytes



                                                    .0+
                                                    .
                                                    b9+..
                                                    0$&
                                                    T`9d`d`.9*..
                                                    ..*



                                                    Try it online! Link includes test cases. Explanation:



                                                    .0+
                                                    .


                                                    Delete zeroes after the decimal point, to ensure that the number is not an integer; the next two matches fail if there are no digits after the decimal point.



                                                    b9+..
                                                    0$&


                                                    If the integer part is all 9s, prefix a 0 to allow the increment to overflow.



                                                    T`9d`d`.9*..


                                                    Increment the integer part of the number.



                                                    ..*


                                                    Delete the fractional part of the number.






                                                    share|improve this answer









                                                    $endgroup$

















                                                      2














                                                      2










                                                      2







                                                      $begingroup$


                                                      Retina 0.8.2, 38 bytes



                                                      .0+
                                                      .
                                                      b9+..
                                                      0$&
                                                      T`9d`d`.9*..
                                                      ..*



                                                      Try it online! Link includes test cases. Explanation:



                                                      .0+
                                                      .


                                                      Delete zeroes after the decimal point, to ensure that the number is not an integer; the next two matches fail if there are no digits after the decimal point.



                                                      b9+..
                                                      0$&


                                                      If the integer part is all 9s, prefix a 0 to allow the increment to overflow.



                                                      T`9d`d`.9*..


                                                      Increment the integer part of the number.



                                                      ..*


                                                      Delete the fractional part of the number.






                                                      share|improve this answer









                                                      $endgroup$




                                                      Retina 0.8.2, 38 bytes



                                                      .0+
                                                      .
                                                      b9+..
                                                      0$&
                                                      T`9d`d`.9*..
                                                      ..*



                                                      Try it online! Link includes test cases. Explanation:



                                                      .0+
                                                      .


                                                      Delete zeroes after the decimal point, to ensure that the number is not an integer; the next two matches fail if there are no digits after the decimal point.



                                                      b9+..
                                                      0$&


                                                      If the integer part is all 9s, prefix a 0 to allow the increment to overflow.



                                                      T`9d`d`.9*..


                                                      Increment the integer part of the number.



                                                      ..*


                                                      Delete the fractional part of the number.







                                                      share|improve this answer












                                                      share|improve this answer



                                                      share|improve this answer










                                                      answered 7 hours ago









                                                      NeilNeil

                                                      88.3k8 gold badges46 silver badges186 bronze badges




                                                      88.3k8 gold badges46 silver badges186 bronze badges
























                                                          1














                                                          $begingroup$

                                                          Vim, 36 bytes/keystrokes



                                                          :s/-/-<Space>
                                                          :g/..*[1-9]/norm <C-v><C-a>lD
                                                          :s/<Space><cr>


                                                          Try it online! or Verify all Test Cases!






                                                          share|improve this answer











                                                          $endgroup$



















                                                            1














                                                            $begingroup$

                                                            Vim, 36 bytes/keystrokes



                                                            :s/-/-<Space>
                                                            :g/..*[1-9]/norm <C-v><C-a>lD
                                                            :s/<Space><cr>


                                                            Try it online! or Verify all Test Cases!






                                                            share|improve this answer











                                                            $endgroup$

















                                                              1














                                                              1










                                                              1







                                                              $begingroup$

                                                              Vim, 36 bytes/keystrokes



                                                              :s/-/-<Space>
                                                              :g/..*[1-9]/norm <C-v><C-a>lD
                                                              :s/<Space><cr>


                                                              Try it online! or Verify all Test Cases!






                                                              share|improve this answer











                                                              $endgroup$



                                                              Vim, 36 bytes/keystrokes



                                                              :s/-/-<Space>
                                                              :g/..*[1-9]/norm <C-v><C-a>lD
                                                              :s/<Space><cr>


                                                              Try it online! or Verify all Test Cases!







                                                              share|improve this answer














                                                              share|improve this answer



                                                              share|improve this answer








                                                              edited 8 hours ago

























                                                              answered 8 hours ago









                                                              DJMcMayhemDJMcMayhem

                                                              42.2k12 gold badges160 silver badges330 bronze badges




                                                              42.2k12 gold badges160 silver badges330 bronze badges
























                                                                  1














                                                                  $begingroup$


                                                                  Runic Enchantments, 18 bytes



                                                                  i:'|A:1+µ-'fA},*@


                                                                  Try it online!



                                                                  "Adds" (away from zero) 0.999999 and floors the result. µ is the closest thing to an infinitesimal in language's operators.






                                                                  share|improve this answer











                                                                  $endgroup$










                                                                  • 1




                                                                    $begingroup$
                                                                    This outputs nothing for 0
                                                                    $endgroup$
                                                                    – Jo King
                                                                    6 hours ago







                                                                  • 1




                                                                    $begingroup$
                                                                    @JoKing Oof. Good catch. It's doing a divide by input to get the "sign" of the input value, which of course, divides by 0 when the input is 0. There's no (good) way around that right now. Will need this commit first. I'll poke Dennis (side benefit, the answer will get shorter).
                                                                    $endgroup$
                                                                    – Draco18s
                                                                    5 hours ago
















                                                                  1














                                                                  $begingroup$


                                                                  Runic Enchantments, 18 bytes



                                                                  i:'|A:1+µ-'fA},*@


                                                                  Try it online!



                                                                  "Adds" (away from zero) 0.999999 and floors the result. µ is the closest thing to an infinitesimal in language's operators.






                                                                  share|improve this answer











                                                                  $endgroup$










                                                                  • 1




                                                                    $begingroup$
                                                                    This outputs nothing for 0
                                                                    $endgroup$
                                                                    – Jo King
                                                                    6 hours ago







                                                                  • 1




                                                                    $begingroup$
                                                                    @JoKing Oof. Good catch. It's doing a divide by input to get the "sign" of the input value, which of course, divides by 0 when the input is 0. There's no (good) way around that right now. Will need this commit first. I'll poke Dennis (side benefit, the answer will get shorter).
                                                                    $endgroup$
                                                                    – Draco18s
                                                                    5 hours ago














                                                                  1














                                                                  1










                                                                  1







                                                                  $begingroup$


                                                                  Runic Enchantments, 18 bytes



                                                                  i:'|A:1+µ-'fA},*@


                                                                  Try it online!



                                                                  "Adds" (away from zero) 0.999999 and floors the result. µ is the closest thing to an infinitesimal in language's operators.






                                                                  share|improve this answer











                                                                  $endgroup$




                                                                  Runic Enchantments, 18 bytes



                                                                  i:'|A:1+µ-'fA},*@


                                                                  Try it online!



                                                                  "Adds" (away from zero) 0.999999 and floors the result. µ is the closest thing to an infinitesimal in language's operators.







                                                                  share|improve this answer














                                                                  share|improve this answer



                                                                  share|improve this answer








                                                                  edited 8 hours ago

























                                                                  answered 8 hours ago









                                                                  Draco18sDraco18s

                                                                  2,1837 silver badges21 bronze badges




                                                                  2,1837 silver badges21 bronze badges










                                                                  • 1




                                                                    $begingroup$
                                                                    This outputs nothing for 0
                                                                    $endgroup$
                                                                    – Jo King
                                                                    6 hours ago







                                                                  • 1




                                                                    $begingroup$
                                                                    @JoKing Oof. Good catch. It's doing a divide by input to get the "sign" of the input value, which of course, divides by 0 when the input is 0. There's no (good) way around that right now. Will need this commit first. I'll poke Dennis (side benefit, the answer will get shorter).
                                                                    $endgroup$
                                                                    – Draco18s
                                                                    5 hours ago













                                                                  • 1




                                                                    $begingroup$
                                                                    This outputs nothing for 0
                                                                    $endgroup$
                                                                    – Jo King
                                                                    6 hours ago







                                                                  • 1




                                                                    $begingroup$
                                                                    @JoKing Oof. Good catch. It's doing a divide by input to get the "sign" of the input value, which of course, divides by 0 when the input is 0. There's no (good) way around that right now. Will need this commit first. I'll poke Dennis (side benefit, the answer will get shorter).
                                                                    $endgroup$
                                                                    – Draco18s
                                                                    5 hours ago








                                                                  1




                                                                  1




                                                                  $begingroup$
                                                                  This outputs nothing for 0
                                                                  $endgroup$
                                                                  – Jo King
                                                                  6 hours ago





                                                                  $begingroup$
                                                                  This outputs nothing for 0
                                                                  $endgroup$
                                                                  – Jo King
                                                                  6 hours ago





                                                                  1




                                                                  1




                                                                  $begingroup$
                                                                  @JoKing Oof. Good catch. It's doing a divide by input to get the "sign" of the input value, which of course, divides by 0 when the input is 0. There's no (good) way around that right now. Will need this commit first. I'll poke Dennis (side benefit, the answer will get shorter).
                                                                  $endgroup$
                                                                  – Draco18s
                                                                  5 hours ago





                                                                  $begingroup$
                                                                  @JoKing Oof. Good catch. It's doing a divide by input to get the "sign" of the input value, which of course, divides by 0 when the input is 0. There's no (good) way around that right now. Will need this commit first. I'll poke Dennis (side benefit, the answer will get shorter).
                                                                  $endgroup$
                                                                  – Draco18s
                                                                  5 hours ago












                                                                  1














                                                                  $begingroup$


                                                                  Perl 6, 18 bytes





                                                                  $_-.abs%-1*.sign


                                                                  Try it online!






                                                                  share|improve this answer









                                                                  $endgroup$



















                                                                    1














                                                                    $begingroup$


                                                                    Perl 6, 18 bytes





                                                                    $_-.abs%-1*.sign


                                                                    Try it online!






                                                                    share|improve this answer









                                                                    $endgroup$

















                                                                      1














                                                                      1










                                                                      1







                                                                      $begingroup$


                                                                      Perl 6, 18 bytes





                                                                      $_-.abs%-1*.sign


                                                                      Try it online!






                                                                      share|improve this answer









                                                                      $endgroup$




                                                                      Perl 6, 18 bytes





                                                                      $_-.abs%-1*.sign


                                                                      Try it online!







                                                                      share|improve this answer












                                                                      share|improve this answer



                                                                      share|improve this answer










                                                                      answered 6 hours ago









                                                                      nwellnhofnwellnhof

                                                                      8,1701 gold badge12 silver badges29 bronze badges




                                                                      8,1701 gold badge12 silver badges29 bronze badges
























                                                                          1














                                                                          $begingroup$

                                                                          Excel, 13 bytes



                                                                          =ROUNDUP(A1,)


                                                                          Alternative



                                                                          =EVEN(A1*2)/2





                                                                          share|improve this answer









                                                                          $endgroup$



















                                                                            1














                                                                            $begingroup$

                                                                            Excel, 13 bytes



                                                                            =ROUNDUP(A1,)


                                                                            Alternative



                                                                            =EVEN(A1*2)/2





                                                                            share|improve this answer









                                                                            $endgroup$

















                                                                              1














                                                                              1










                                                                              1







                                                                              $begingroup$

                                                                              Excel, 13 bytes



                                                                              =ROUNDUP(A1,)


                                                                              Alternative



                                                                              =EVEN(A1*2)/2





                                                                              share|improve this answer









                                                                              $endgroup$



                                                                              Excel, 13 bytes



                                                                              =ROUNDUP(A1,)


                                                                              Alternative



                                                                              =EVEN(A1*2)/2






                                                                              share|improve this answer












                                                                              share|improve this answer



                                                                              share|improve this answer










                                                                              answered 4 hours ago









                                                                              nwellnhofnwellnhof

                                                                              8,1701 gold badge12 silver badges29 bronze badges




                                                                              8,1701 gold badge12 silver badges29 bronze badges
























                                                                                  0














                                                                                  $begingroup$


                                                                                  Brachylog, 7 bytes



                                                                                  ⌋₁ℤ₁|⌉₁


                                                                                  Try it online!



                                                                                  or ⌉₁ℕ₁|⌋₁.



                                                                                  ⌋₁ The input rounded down
                                                                                  ℤ₁ is an integer less than -1
                                                                                  | and the output, or, the input
                                                                                  ⌉₁ rounded up is the output.





                                                                                  share|improve this answer









                                                                                  $endgroup$



















                                                                                    0














                                                                                    $begingroup$


                                                                                    Brachylog, 7 bytes



                                                                                    ⌋₁ℤ₁|⌉₁


                                                                                    Try it online!



                                                                                    or ⌉₁ℕ₁|⌋₁.



                                                                                    ⌋₁ The input rounded down
                                                                                    ℤ₁ is an integer less than -1
                                                                                    | and the output, or, the input
                                                                                    ⌉₁ rounded up is the output.





                                                                                    share|improve this answer









                                                                                    $endgroup$

















                                                                                      0














                                                                                      0










                                                                                      0







                                                                                      $begingroup$


                                                                                      Brachylog, 7 bytes



                                                                                      ⌋₁ℤ₁|⌉₁


                                                                                      Try it online!



                                                                                      or ⌉₁ℕ₁|⌋₁.



                                                                                      ⌋₁ The input rounded down
                                                                                      ℤ₁ is an integer less than -1
                                                                                      | and the output, or, the input
                                                                                      ⌉₁ rounded up is the output.





                                                                                      share|improve this answer









                                                                                      $endgroup$




                                                                                      Brachylog, 7 bytes



                                                                                      ⌋₁ℤ₁|⌉₁


                                                                                      Try it online!



                                                                                      or ⌉₁ℕ₁|⌋₁.



                                                                                      ⌋₁ The input rounded down
                                                                                      ℤ₁ is an integer less than -1
                                                                                      | and the output, or, the input
                                                                                      ⌉₁ rounded up is the output.






                                                                                      share|improve this answer












                                                                                      share|improve this answer



                                                                                      share|improve this answer










                                                                                      answered 7 hours ago









                                                                                      Unrelated StringUnrelated String

                                                                                      3,5822 gold badges3 silver badges21 bronze badges




                                                                                      3,5822 gold badges3 silver badges21 bronze badges
























                                                                                          0














                                                                                          $begingroup$


                                                                                          Perl 6, 19 bytes





                                                                                          0+.sign*?/./


                                                                                          Try it online!



                                                                                          Not the shortest solution, but I'm working on it. Basically this truncates the number, then adds one away from zero if the number was not whole to begin with






                                                                                          share|improve this answer









                                                                                          $endgroup$



















                                                                                            0














                                                                                            $begingroup$


                                                                                            Perl 6, 19 bytes





                                                                                            0+.sign*?/./


                                                                                            Try it online!



                                                                                            Not the shortest solution, but I'm working on it. Basically this truncates the number, then adds one away from zero if the number was not whole to begin with






                                                                                            share|improve this answer









                                                                                            $endgroup$

















                                                                                              0














                                                                                              0










                                                                                              0







                                                                                              $begingroup$


                                                                                              Perl 6, 19 bytes





                                                                                              0+.sign*?/./


                                                                                              Try it online!



                                                                                              Not the shortest solution, but I'm working on it. Basically this truncates the number, then adds one away from zero if the number was not whole to begin with






                                                                                              share|improve this answer









                                                                                              $endgroup$




                                                                                              Perl 6, 19 bytes





                                                                                              0+.sign*?/./


                                                                                              Try it online!



                                                                                              Not the shortest solution, but I'm working on it. Basically this truncates the number, then adds one away from zero if the number was not whole to begin with







                                                                                              share|improve this answer












                                                                                              share|improve this answer



                                                                                              share|improve this answer










                                                                                              answered 6 hours ago









                                                                                              Jo KingJo King

                                                                                              31.1k4 gold badges72 silver badges139 bronze badges




                                                                                              31.1k4 gold badges72 silver badges139 bronze badges
























                                                                                                  0














                                                                                                  $begingroup$


                                                                                                  Java (OpenJDK 8), 43 bytes





                                                                                                  a->return(int)((int)a/a<1?a>0?a+1:a-1:a);


                                                                                                  Try it online!






                                                                                                  share|improve this answer











                                                                                                  $endgroup$










                                                                                                  • 1




                                                                                                    $begingroup$
                                                                                                    The lambda function can be written without using an explicit return statement.
                                                                                                    $endgroup$
                                                                                                    – Joel
                                                                                                    6 hours ago















                                                                                                  0














                                                                                                  $begingroup$


                                                                                                  Java (OpenJDK 8), 43 bytes





                                                                                                  a->return(int)((int)a/a<1?a>0?a+1:a-1:a);


                                                                                                  Try it online!






                                                                                                  share|improve this answer











                                                                                                  $endgroup$










                                                                                                  • 1




                                                                                                    $begingroup$
                                                                                                    The lambda function can be written without using an explicit return statement.
                                                                                                    $endgroup$
                                                                                                    – Joel
                                                                                                    6 hours ago













                                                                                                  0














                                                                                                  0










                                                                                                  0







                                                                                                  $begingroup$


                                                                                                  Java (OpenJDK 8), 43 bytes





                                                                                                  a->return(int)((int)a/a<1?a>0?a+1:a-1:a);


                                                                                                  Try it online!






                                                                                                  share|improve this answer











                                                                                                  $endgroup$




                                                                                                  Java (OpenJDK 8), 43 bytes





                                                                                                  a->return(int)((int)a/a<1?a>0?a+1:a-1:a);


                                                                                                  Try it online!







                                                                                                  share|improve this answer














                                                                                                  share|improve this answer



                                                                                                  share|improve this answer








                                                                                                  edited 6 hours ago

























                                                                                                  answered 6 hours ago









                                                                                                  X1M4LX1M4L

                                                                                                  1,0396 silver badges16 bronze badges




                                                                                                  1,0396 silver badges16 bronze badges










                                                                                                  • 1




                                                                                                    $begingroup$
                                                                                                    The lambda function can be written without using an explicit return statement.
                                                                                                    $endgroup$
                                                                                                    – Joel
                                                                                                    6 hours ago












                                                                                                  • 1




                                                                                                    $begingroup$
                                                                                                    The lambda function can be written without using an explicit return statement.
                                                                                                    $endgroup$
                                                                                                    – Joel
                                                                                                    6 hours ago







                                                                                                  1




                                                                                                  1




                                                                                                  $begingroup$
                                                                                                  The lambda function can be written without using an explicit return statement.
                                                                                                  $endgroup$
                                                                                                  – Joel
                                                                                                  6 hours ago




                                                                                                  $begingroup$
                                                                                                  The lambda function can be written without using an explicit return statement.
                                                                                                  $endgroup$
                                                                                                  – Joel
                                                                                                  6 hours ago











                                                                                                  0














                                                                                                  $begingroup$


                                                                                                  Perl 5 -pF/./, 24 bytes





                                                                                                  $_&&=$F[0]+$_*(@F-1)/abs


                                                                                                  Try it online!






                                                                                                  share|improve this answer









                                                                                                  $endgroup$



















                                                                                                    0














                                                                                                    $begingroup$


                                                                                                    Perl 5 -pF/./, 24 bytes





                                                                                                    $_&&=$F[0]+$_*(@F-1)/abs


                                                                                                    Try it online!






                                                                                                    share|improve this answer









                                                                                                    $endgroup$

















                                                                                                      0














                                                                                                      0










                                                                                                      0







                                                                                                      $begingroup$


                                                                                                      Perl 5 -pF/./, 24 bytes





                                                                                                      $_&&=$F[0]+$_*(@F-1)/abs


                                                                                                      Try it online!






                                                                                                      share|improve this answer









                                                                                                      $endgroup$




                                                                                                      Perl 5 -pF/./, 24 bytes





                                                                                                      $_&&=$F[0]+$_*(@F-1)/abs


                                                                                                      Try it online!







                                                                                                      share|improve this answer












                                                                                                      share|improve this answer



                                                                                                      share|improve this answer










                                                                                                      answered 3 hours ago









                                                                                                      XcaliXcali

                                                                                                      6,8341 gold badge7 silver badges24 bronze badges




                                                                                                      6,8341 gold badge7 silver badges24 bronze badges
























                                                                                                          0














                                                                                                          $begingroup$

                                                                                                          C, 94 bytes



                                                                                                          #include<math.h>
                                                                                                          main()float a;scanf("%e",&a);printf("%f",(-2*signbit(a)+1)*ceil(fabs(a)));


                                                                                                          I compiled with



                                                                                                          gcc a.c





                                                                                                          share|improve this answer








                                                                                                          New contributor



                                                                                                          user1475369 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                                                                          Check out our Code of Conduct.





                                                                                                          $endgroup$



















                                                                                                            0














                                                                                                            $begingroup$

                                                                                                            C, 94 bytes



                                                                                                            #include<math.h>
                                                                                                            main()float a;scanf("%e",&a);printf("%f",(-2*signbit(a)+1)*ceil(fabs(a)));


                                                                                                            I compiled with



                                                                                                            gcc a.c





                                                                                                            share|improve this answer








                                                                                                            New contributor



                                                                                                            user1475369 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                                                                            Check out our Code of Conduct.





                                                                                                            $endgroup$

















                                                                                                              0














                                                                                                              0










                                                                                                              0







                                                                                                              $begingroup$

                                                                                                              C, 94 bytes



                                                                                                              #include<math.h>
                                                                                                              main()float a;scanf("%e",&a);printf("%f",(-2*signbit(a)+1)*ceil(fabs(a)));


                                                                                                              I compiled with



                                                                                                              gcc a.c





                                                                                                              share|improve this answer








                                                                                                              New contributor



                                                                                                              user1475369 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                                                                              Check out our Code of Conduct.





                                                                                                              $endgroup$



                                                                                                              C, 94 bytes



                                                                                                              #include<math.h>
                                                                                                              main()float a;scanf("%e",&a);printf("%f",(-2*signbit(a)+1)*ceil(fabs(a)));


                                                                                                              I compiled with



                                                                                                              gcc a.c






                                                                                                              share|improve this answer








                                                                                                              New contributor



                                                                                                              user1475369 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                                                                              Check out our Code of Conduct.








                                                                                                              share|improve this answer



                                                                                                              share|improve this answer






                                                                                                              New contributor



                                                                                                              user1475369 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                                                                              Check out our Code of Conduct.








                                                                                                              answered 3 hours ago









                                                                                                              user1475369user1475369

                                                                                                              113 bronze badges




                                                                                                              113 bronze badges




                                                                                                              New contributor



                                                                                                              user1475369 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                                                                              Check out our Code of Conduct.




                                                                                                              New contributor




                                                                                                              user1475369 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                                                                              Check out our Code of Conduct.


























                                                                                                                  0














                                                                                                                  $begingroup$


                                                                                                                  J, 6 bytes



                                                                                                                  **>.@|


                                                                                                                  Try it online!



                                                                                                                  Just a 1 character change from my answer on the cousin question.






                                                                                                                  share|improve this answer









                                                                                                                  $endgroup$



















                                                                                                                    0














                                                                                                                    $begingroup$


                                                                                                                    J, 6 bytes



                                                                                                                    **>.@|


                                                                                                                    Try it online!



                                                                                                                    Just a 1 character change from my answer on the cousin question.






                                                                                                                    share|improve this answer









                                                                                                                    $endgroup$

















                                                                                                                      0














                                                                                                                      0










                                                                                                                      0







                                                                                                                      $begingroup$


                                                                                                                      J, 6 bytes



                                                                                                                      **>.@|


                                                                                                                      Try it online!



                                                                                                                      Just a 1 character change from my answer on the cousin question.






                                                                                                                      share|improve this answer









                                                                                                                      $endgroup$




                                                                                                                      J, 6 bytes



                                                                                                                      **>.@|


                                                                                                                      Try it online!



                                                                                                                      Just a 1 character change from my answer on the cousin question.







                                                                                                                      share|improve this answer












                                                                                                                      share|improve this answer



                                                                                                                      share|improve this answer










                                                                                                                      answered 2 hours ago









                                                                                                                      JonahJonah

                                                                                                                      4,6622 gold badges12 silver badges22 bronze badges




                                                                                                                      4,6622 gold badges12 silver badges22 bronze badges






























                                                                                                                          draft saved

                                                                                                                          draft discarded
















































                                                                                                                          If this is an answer to a challenge…



                                                                                                                          • …Be sure to follow the challenge specification. However, please refrain from exploiting obvious loopholes. Answers abusing any of the standard loopholes are considered invalid. If you think a specification is unclear or underspecified, comment on the question instead.


                                                                                                                          • …Try to optimize your score. For instance, answers to code-golf challenges should attempt to be as short as possible. You can always include a readable version of the code in addition to the competitive one.
                                                                                                                            Explanations of your answer make it more interesting to read and are very much encouraged.


                                                                                                                          • …Include a short header which indicates the language(s) of your code and its score, as defined by the challenge.


                                                                                                                          More generally…



                                                                                                                          • …Please make sure to answer the question and provide sufficient detail.


                                                                                                                          • …Avoid asking for help, clarification or responding to other answers (use comments instead).




                                                                                                                          draft saved


                                                                                                                          draft discarded














                                                                                                                          StackExchange.ready(
                                                                                                                          function ()
                                                                                                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f191241%2fround-away-from-zero%23new-answer', 'question_page');

                                                                                                                          );

                                                                                                                          Post as a guest















                                                                                                                          Required, but never shown





















































                                                                                                                          Required, but never shown














                                                                                                                          Required, but never shown












                                                                                                                          Required, but never shown







                                                                                                                          Required, but never shown

































                                                                                                                          Required, but never shown














                                                                                                                          Required, but never shown












                                                                                                                          Required, but never shown







                                                                                                                          Required, but never shown







                                                                                                                          Popular posts from this blog

                                                                                                                          Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

                                                                                                                          Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

                                                                                                                          199年 目錄 大件事 到箇年出世嗰人 到箇年死嗰人 節慶、風俗習慣 導覽選單