4 Fixed INFINITY cases
source | link

05AB1E, 9696 104 bytes (non-competing)

3èI4èmU8.$`m©I7èI2è.n*I6èI1è.nI2è.n+Vнi0ë5èi1ë2ô1èßi¦2£`mIнI5è.n*I6è.nI7ènDI7èDi\1›·<žm*ë.nD_i₄n}®›ëXYQiнI5è›ëXY›

Marked as non-competing, because POSITIVE_INFINITY and NEGATIVE_INFINITY in the nested logarithm part of the Java/Ruby answers would result both in 0.0 in 05AB1E. The code contains a work-around to map 0.0 to 1000 (see D_i₄}) for the POSITIVE_INFINITY case (i.e. input [3,2,2,1,1,2,5,1,1,1]). But it now fails for input with NEGATIVE_INFINITY (i.e. [2,4,1,1,1,3,3,1,1,1]) which also get mapped to 1000.. Will see if I can come up with a fix, but it's non-competing for now. +8 bytes as work-around, because \$\log_1(x)\$ should result in POSITIVE_INFINITY for \$x\gt1\$ and NEGATIVE_INFINITY for \$x\lt1\$, but results in 0.0 for both cases instead in 05AB1E (i.e. test cases [3,2,2,1,1,2,5,1,1,1] (POSITIVE_INFINITE case) and [2,4,1,1,1,3,3,1,1,1] (NEGATIVE_INFINITY case).

Try it onlineTry it online or verify all test casesverify all test cases.

3èI4èm         # Calculate d**e
      U        # And pop and store it in variable `X`
8.$`m          # Calculate i**j
     ©         # Store it in variable `®` (without popping)
I7èI2è.n       # Calculate c_log(h)
 *             # Multiply it with i**j that was still on the stack: i**j * c_log(h)
I6èI1è.nI2è.n  # Calculate c_log(b_log(g))
 +             # And sum them together: i**j * c_log(h) + c_log(b_log(g))
  V            # Pop and store the result in variable `Y`

нi             # If `a` is 1:
 0             #  Push 0 (falsey)
ë5èi           # Else-if `f` is 1:
 1             #  Push 1 (truthy)
ë2ô1èßi        # Else-if the lowest value of [b[c,c]d] is 1:
 ¦2£`m         #  Calculate b**c
 IнI5è.n       #  Calculate f_log(a)
  *            #  Multiply them together: b**c * f_log(a)
   I6è.n       #  Calculate g_log(^): g_log(b**c * f_log(a))
 D       I7è.n      #  CalculateDuplicate h_log(^):it
 h_log(g_log(b**c *I7è f_log(a)))         #  Push h
 D_i }   Di        #  IfDuplicate it'sit 0as well, and if h is exactly 1:
       \       #   PushDiscard 1000the insteadduplicated h
       1›      #  # Check if the calculated g_log(NOTE:b**c What* f_log(a)) is larger than 1
               #   (which results in POSITIVE_INFINITE/NEGATIVE_INFINITY0 infor the
falsey and 1 for truthy)
         ·<    #   Ruby/JavaDouble answersit, wouldand resultdecrease init 0.0by in1 05AB1E.(it Thisbecomes work-around
1 for falsey; 1 for truthy)
          # žm* # if-statement fixes theMultiply POSITIVE_INFINITYthat case,by but9876543210 it's(to nowmimic notPOSITIVE/NEGATIVE workingINFINITY)
      ë        #  Else:
       .n      #   forCalculate NEGATIVE_INFINITYh_log(g_log(b**c test* casesf_log(a))) instead
  ®›    }        #  After the if-else:
       ®›      #  Check whether the top of the stack is larger than variable `®`
ëXYQi          # Else-if variables `X` and `Y` are equal:
     нI5è›     #  Check whether `a` is larger than `f`
ë              # Else:
 XY›           #  Check whether `X` is larger than `Y`
               # (after which the top of the stack is output implicitly as result)

05AB1E, 96 bytes (non-competing)

3èI4èmU8.$`m©I7èI2è.n*I6èI1è.nI2è.n+Vнi0ë5èi1ë2ô1èßi¦2£`mIнI5è.n*I6è.nI7è.nD_i₄}®›ëXYQiнI5è›ëXY›

Marked as non-competing, because POSITIVE_INFINITY and NEGATIVE_INFINITY in the nested logarithm part of the Java/Ruby answers would result both in 0.0 in 05AB1E. The code contains a work-around to map 0.0 to 1000 (see D_i₄}) for the POSITIVE_INFINITY case (i.e. input [3,2,2,1,1,2,5,1,1,1]). But it now fails for input with NEGATIVE_INFINITY (i.e. [2,4,1,1,1,3,3,1,1,1]) which also get mapped to 1000.. Will see if I can come up with a fix, but it's non-competing for now.

Try it online or verify all test cases.

3èI4èm         # Calculate d**e
      U        # And pop and store it in variable `X`
8.$`m          # Calculate i**j
     ©         # Store it in variable `®` (without popping)
I7èI2è.n       # Calculate c_log(h)
 *             # Multiply it with i**j that was still on the stack: i**j * c_log(h)
I6èI1è.nI2è.n  # Calculate c_log(b_log(g))
 +             # And sum them together: i**j * c_log(h) + c_log(b_log(g))
  V            # Pop and store the result in variable `Y`

нi             # If `a` is 1:
 0             #  Push 0 (falsey)
ë5èi           # Else-if `f` is 1:
 1             #  Push 1 (truthy)
ë2ô1èßi        # Else-if the lowest value of [b,c] is 1:
 ¦2£`m         #  Calculate b**c
 IнI5è.n       #  Calculate f_log(a)
  *            #  Multiply them together: b**c * f_log(a)
   I6è.n       #  Calculate g_log(^): g_log(b**c * f_log(a))
        I7è.n  #  Calculate h_log(^): h_log(g_log(b**c * f_log(a)))
 D_i }         #  If it's 0:
              #   Push 1000 instead
               #  (NOTE: What results in POSITIVE_INFINITE/NEGATIVE_INFINITY in the
               #   Ruby/Java answers, would result in 0.0 in 05AB1E. This work-around
               #   if-statement fixes the POSITIVE_INFINITY case, but it's now not working
               #   for NEGATIVE_INFINITY test cases)
  ®›           #  Check whether the top of the stack is larger than variable `®`
ëXYQi          # Else-if variables `X` and `Y` are equal:
     нI5è›     #  Check whether `a` is larger than `f`
ë              # Else:
 XY›           #  Check whether `X` is larger than `Y`
               # (after which the top of the stack is output implicitly as result)

05AB1E, 96 104 bytes

3èI4èmU8.$`m©I7èI2è.n*I6èI1è.nI2è.n+Vнi0ë5èi1ë2ô1èßi¦2£`mIнI5è.n*I6è.nDI7èDi\1›·<žm*ë.n}®›ëXYQiнI5è›ëXY›

+8 bytes as work-around, because \$\log_1(x)\$ should result in POSITIVE_INFINITY for \$x\gt1\$ and NEGATIVE_INFINITY for \$x\lt1\$, but results in 0.0 for both cases instead in 05AB1E (i.e. test cases [3,2,2,1,1,2,5,1,1,1] (POSITIVE_INFINITE case) and [2,4,1,1,1,3,3,1,1,1] (NEGATIVE_INFINITY case).

Try it online or verify all test cases.

3èI4èm         # Calculate d**e
      U        # And pop and store it in variable `X`
8.$`m          # Calculate i**j
     ©         # Store it in variable `®` (without popping)
I7èI2è.n       # Calculate c_log(h)
 *             # Multiply it with i**j that was still on the stack: i**j * c_log(h)
I6èI1è.nI2è.n  # Calculate c_log(b_log(g))
 +             # And sum them together: i**j * c_log(h) + c_log(b_log(g))
  V            # Pop and store the result in variable `Y`

нi             # If `a` is 1:
 0             #  Push 0 (falsey)
ë5èi           # Else-if `f` is 1:
 1             #  Push 1 (truthy)
ë2ô1èßi        # Else-if the lowest value of [c,d] is 1:
 ¦2£`m         #  Calculate b**c
 IнI5è.n       #  Calculate f_log(a)
  *            #  Multiply them together: b**c * f_log(a)
   I6è.n       #  Calculate g_log(^): g_log(b**c * f_log(a))
 D             #  Duplicate it
  I7è          #  Push h
     Di        #  Duplicate it as well, and if h is exactly 1:
       \       #   Discard the duplicated h
       1›      #   Check if the calculated g_log(b**c * f_log(a)) is larger than 1
               #   (which results in 0 for falsey and 1 for truthy)
         ·<    #   Double it, and decrease it by 1 (it becomes -1 for falsey; 1 for truthy)
           žm* #   Multiply that by 9876543210 (to mimic POSITIVE/NEGATIVE INFINITY)
      ë        #  Else:
       .n      #   Calculate h_log(g_log(b**c * f_log(a))) instead
      }        #  After the if-else:
       ®›      #  Check whether the top of the stack is larger than variable `®`
ëXYQi          # Else-if variables `X` and `Y` are equal:
     нI5è›     #  Check whether `a` is larger than `f`
ë              # Else:
 XY›           #  Check whether `X` is larger than `Y`
               # (after which the top of the stack is output implicitly as result)
3 Marked as non-competing due to NEGATIVE_INFINITY test case
source | link

05AB1E, 96 bytes (non-competing)

Marked as non-competing, because POSITIVE_INFINITY and NEGATIVE_INFINITY in the nested logarithm part of the Java/Ruby answers would result both in 0.0 in 05AB1E. The code contains a work-around to map 0.0 to 1000 (see D_i₄}) for the POSITIVE_INFINITY case (i.e. input [3,2,2,1,1,2,5,1,1,1]). But it now fails for input with NEGATIVE_INFINITY (i.e. [2,4,1,1,1,3,3,1,1,1]) which also get mapped to 1000.. Will see if I can come up with a fix, but it's non-competing for now.

Input as a list of ten integers: [a,b,c,d,e,f,g,h,i,j].

Try it online or verify all test casesverify all test cases.

3èI4èm         # Calculate d**e
      U        # And pop and store it in variable `X`
8.$`m          # Calculate i**j
     ©         # Store it in variable `®` (without popping)
I7èI2è.n       # Calculate c_log(h)
 *             # Multiply it with i**j that was still on the stack: i**j * c_log(h)
I6èI1è.nI2è.n  # Calculate c_log(b_log(g))
 +             # And sum them together: i**j * c_log(h) + c_log(b_log(g))
  V            # Pop and store the result in variable `Y`

нi             # If `a` is 1:
 0             #  Push 0 (falsey)
ë5èi           # Else-if `f` is 1:
 1             #  Push 1 (truthy)
ë2ô1èßi        # Else-if the lowest value of [b,c] is 1:
 ¦2£`m         #  Calculate b**c
 IнI5è.n       #  Calculate f_log(a)
  *            #  Multiply them together: b**c * f_log(a)
   I6è.n       #  Calculate g_log(^): g_log(b**c * f_log(a))
        I7è.n  #  Calculate h_log(^): h_log(g_log(b**c * f_log(a)))
 D_i }         #  If it's 0:
    ₄          #   Push 1000 instead
               #  (NOTE: What results in 0 in 05AB1E would resultPOSITIVE_INFINITE/NEGATIVE_INFINITY in POSITIVE_INFINITY inthe
               #  the Ruby/Java answers, whichwould isresult whyin this0.0 in 05AB1E. This work-around
               #   if-statement isfixes herethe POSITIVE_INFINITY case, but it's now not working
               #   for NEGATIVE_INFINITY test cases)
  ®›           #  Check whether the top of the stack is larger than variable `®`
ëXYQi          # Else-if variables `X` and `Y` are equal:
     нI5è›     #  Check whether `a` is larger than `f`
ë              # Else:
 XY›           #  Check whether `X` is larger than `Y`
               # (after which the top of the stack is output implicitly as result)

05AB1E, 96 bytes

Input as a list of ten integers: [a,b,c,d,e,f,g,h,i,j].

Try it online or verify all test cases.

3èI4èm         # Calculate d**e
      U        # And pop and store it in variable `X`
8.$`m          # Calculate i**j
     ©         # Store it in variable `®` (without popping)
I7èI2è.n       # Calculate c_log(h)
 *             # Multiply it with i**j that was still on the stack: i**j * c_log(h)
I6èI1è.nI2è.n  # Calculate c_log(b_log(g))
 +             # And sum them together: i**j * c_log(h) + c_log(b_log(g))
  V            # Pop and store the result in variable `Y`

нi             # If `a` is 1:
 0             #  Push 0 (falsey)
ë5èi           # Else-if `f` is 1:
 1             #  Push 1 (truthy)
ë2ô1èßi        # Else-if the lowest value of [b,c] is 1:
 ¦2£`m         #  Calculate b**c
 IнI5è.n       #  Calculate f_log(a)
  *            #  Multiply them together: b**c * f_log(a)
   I6è.n       #  Calculate g_log(^): g_log(b**c * f_log(a))
        I7è.n  #  Calculate h_log(^): h_log(g_log(b**c * f_log(a)))
 D_i }         #  If it's 0:
    ₄          #   Push 1000 instead
               #  (NOTE: What results in 0 in 05AB1E would result in POSITIVE_INFINITY in
               #  the Ruby/Java answers, which is why this work-around if-statement is here)
  ®›           #  Check whether the top of the stack is larger than variable `®`
ëXYQi          # Else-if variables `X` and `Y` are equal:
     нI5è›     #  Check whether `a` is larger than `f`
ë              # Else:
 XY›           #  Check whether `X` is larger than `Y`
               # (after which the top of the stack is output implicitly as result)

05AB1E, 96 bytes (non-competing)

Marked as non-competing, because POSITIVE_INFINITY and NEGATIVE_INFINITY in the nested logarithm part of the Java/Ruby answers would result both in 0.0 in 05AB1E. The code contains a work-around to map 0.0 to 1000 (see D_i₄}) for the POSITIVE_INFINITY case (i.e. input [3,2,2,1,1,2,5,1,1,1]). But it now fails for input with NEGATIVE_INFINITY (i.e. [2,4,1,1,1,3,3,1,1,1]) which also get mapped to 1000.. Will see if I can come up with a fix, but it's non-competing for now.

Input as a list of ten integers: [a,b,c,d,e,f,g,h,i,j].

Try it online or verify all test cases.

3èI4èm         # Calculate d**e
      U        # And pop and store it in variable `X`
8.$`m          # Calculate i**j
     ©         # Store it in variable `®` (without popping)
I7èI2è.n       # Calculate c_log(h)
 *             # Multiply it with i**j that was still on the stack: i**j * c_log(h)
I6èI1è.nI2è.n  # Calculate c_log(b_log(g))
 +             # And sum them together: i**j * c_log(h) + c_log(b_log(g))
  V            # Pop and store the result in variable `Y`

нi             # If `a` is 1:
 0             #  Push 0 (falsey)
ë5èi           # Else-if `f` is 1:
 1             #  Push 1 (truthy)
ë2ô1èßi        # Else-if the lowest value of [b,c] is 1:
 ¦2£`m         #  Calculate b**c
 IнI5è.n       #  Calculate f_log(a)
  *            #  Multiply them together: b**c * f_log(a)
   I6è.n       #  Calculate g_log(^): g_log(b**c * f_log(a))
        I7è.n  #  Calculate h_log(^): h_log(g_log(b**c * f_log(a)))
 D_i }         #  If it's 0:
    ₄          #   Push 1000 instead
               #  (NOTE: What results in POSITIVE_INFINITE/NEGATIVE_INFINITY in the
               #   Ruby/Java answers, would result in 0.0 in 05AB1E. This work-around
               #   if-statement fixes the POSITIVE_INFINITY case, but it's now not working
               #   for NEGATIVE_INFINITY test cases)
  ®›           #  Check whether the top of the stack is larger than variable `®`
ëXYQi          # Else-if variables `X` and `Y` are equal:
     нI5è›     #  Check whether `a` is larger than `f`
ë              # Else:
 XY›           #  Check whether `X` is larger than `Y`
               # (after which the top of the stack is output implicitly as result)
2 added 193 characters in body
source | link
3èI4èm         # Calculate d**e
      U        # And pop and store it in variable `X`
8.$`m          # Calculate i**j
     ©         # Store it in variable `®` (without popping)
I7èI2è.n       # Calculate c_log(h)
 *             # Multiply it with i**j that was still on the stack: i**j * c_log(h)
I6èI1è.nI2è.n  # Calculate c_log(b_log(g))
 +             # And sum them together: i**j * c_log(h) + c_log(b_log(g))
  V            # Pop and store the result in variable `Y`

нi             # If `a` is 1:
 0             #  Push 0 (falsey)
ë5èi           # Else-if `f` is 1:
 1             #  Push 1 (truthy)
ë2ô1èßi        # Else-if the lowest value of [b,c] is 1:
 ¦2£`m         #  Calculate b**c
 IнI5è.n       #  Calculate f_log(a)
  *            #  Multiply them together: b**c * f_log(a)
   I6è.n       #  Calculate g_log(^): g_log(b**c * f_log(a))
        I7è.n  #  Calculate h_log(^): h_log(g_log(b**c * f_log(a)))
 D_i }         #  If it's 0:
    ₄          #   Push 1000 instead
               #  (NOTE: What results in 0 in 05AB1E would result in POSITIVE_INFINITY in
               #  the Ruby/Java answers, which is why this work-around if-statement is here)
  ®›           #  Check whether the top of the stack is larger than variable `®`
ëXYQi          # Else-if variables `X` and `Y` are equal:
     нI5è›     #  Check whether `a` is larger than `f`
ë              # Else:
 XY›           #  Check whether `X` is larger than `Y`
               # (after which the top of the stack is output implicitly as result)
3èI4èm         # Calculate d**e
      U        # And pop and store it in variable `X`
8.$`m          # Calculate i**j
     ©         # Store it in variable `®` (without popping)
I7èI2è.n       # Calculate c_log(h)
 *             # Multiply it with i**j that was still on the stack: i**j * c_log(h)
I6èI1è.nI2è.n  # Calculate c_log(b_log(g))
 +             # And sum them together: i**j * c_log(h) + c_log(b_log(g))
  V            # Pop and store the result in variable `Y`

нi             # If `a` is 1:
 0             #  Push 0 (falsey)
ë5èi           # Else-if `f` is 1:
 1             #  Push 1 (truthy)
ë2ô1èßi        # Else-if the lowest value of [b,c] is 1:
 ¦2£`m         #  Calculate b**c
 IнI5è.n       #  Calculate f_log(a)
  *            #  Multiply them together: b**c * f_log(a)
   I6è.n       #  Calculate g_log(^): g_log(b**c * f_log(a))
        I7è.n  #  Calculate h_log(^): h_log(g_log(b**c * f_log(a)))
 D_i }         #  If it's 0:
    ₄          #   Push 1000 instead
  ®›           #  Check whether the top of the stack is larger than variable `®`
ëXYQi          # Else-if variables `X` and `Y` are equal:
     нI5è›     #  Check whether `a` is larger than `f`
ë              # Else:
 XY›           #  Check whether `X` is larger than `Y`
               # (after which the top of the stack is output implicitly as result)
3èI4èm         # Calculate d**e
      U        # And pop and store it in variable `X`
8.$`m          # Calculate i**j
     ©         # Store it in variable `®` (without popping)
I7èI2è.n       # Calculate c_log(h)
 *             # Multiply it with i**j that was still on the stack: i**j * c_log(h)
I6èI1è.nI2è.n  # Calculate c_log(b_log(g))
 +             # And sum them together: i**j * c_log(h) + c_log(b_log(g))
  V            # Pop and store the result in variable `Y`

нi             # If `a` is 1:
 0             #  Push 0 (falsey)
ë5èi           # Else-if `f` is 1:
 1             #  Push 1 (truthy)
ë2ô1èßi        # Else-if the lowest value of [b,c] is 1:
 ¦2£`m         #  Calculate b**c
 IнI5è.n       #  Calculate f_log(a)
  *            #  Multiply them together: b**c * f_log(a)
   I6è.n       #  Calculate g_log(^): g_log(b**c * f_log(a))
        I7è.n  #  Calculate h_log(^): h_log(g_log(b**c * f_log(a)))
 D_i }         #  If it's 0:
    ₄          #   Push 1000 instead
               #  (NOTE: What results in 0 in 05AB1E would result in POSITIVE_INFINITY in
               #  the Ruby/Java answers, which is why this work-around if-statement is here)
  ®›           #  Check whether the top of the stack is larger than variable `®`
ëXYQi          # Else-if variables `X` and `Y` are equal:
     нI5è›     #  Check whether `a` is larger than `f`
ë              # Else:
 XY›           #  Check whether `X` is larger than `Y`
               # (after which the top of the stack is output implicitly as result)
1
source | link