If number is without decimal part then X else Y

Inputs

  • number
  • decimal part of a Real number is 0
  • decimal part of a Real number is not 0

Outputs

  • result

Neuron type

Best algorithm has been found - locked

Patterns

Pattern Input Output
1.
number: 4.222
decimal part of a Real number is 0: without decimal part
decimal part of a Real number is not 0: with decimal part
result: with decimal part
2.
number: 10
decimal part of a Real number is 0: integer
decimal part of a Real number is not 0: real
result: integer
3.
number: 10.2
decimal part of a Real number is 0: 0
decimal part of a Real number is not 0: 2
result: 2
4.
number: -12.1
decimal part of a Real number is 0: 1
decimal part of a Real number is not 0: 0
result: 0

Applicable neurons

  • a = b
  • Round to an integer
  • IF a=b THEN c ELSE d
  • Decimal part of a number
  • Get before substring
  • Destroyed building (windows, walls)
  • √¯(x² - y²)
  • seconds into minutes
  • empty string
  • character u
  • Is character uppercase?

Algorithm

Test

Code made by AI:
/**
 * Round to an integer: round(x)
 *
 * @param x1 Value
 * @return {Array}
 */
function neuron620(x1)
{
return[Math.round(Number(x1))]
}

/**
 * a = b: IF a=b THEN 1 ELSE 0;
 *
 * @param x1 a
 * @param x2 b
 * @return {Array}
 */
function neuron591(x1, x2)
{
return [(x1 == x2) ? 1 : 0];
}

/**
 * IF: IF a THEN b ELSE c;
 *
 * @param x1 condition (1/0)
 * @param x2 variable for 1
 * @param x3 variable for 0
 * @return {Array}
 */
function neuron579(x1, x2, x3)
{
return [(x1) ? x2 : x3];
}

/**
 * IF a=b THEN c ELSE d: 
 * 
 * @param x1 a
 * @param x2 b
 * @param x3 c
 * @param x4 d
 * @return {Array}
 */
function neuron724(x1, x2, x3, x4)
{
  var outputs = [];
  outputs[0] = x1;
  outputs[1] = x2;
  outputs[2] = x3;
  outputs[3] = x4;

  arr = neuron591(outputs[1], outputs[0]);
  outputs[4] = arr[0];

  arr = neuron579(outputs[4], outputs[2], outputs[3]);
  outputs[5] = arr[0];

  return[outputs[5]];
}


/**
 * If number is without decimal part then X else Y: 
 * 
 * @param x1 number
 * @param x2 decimal part of a Real number is 0
 * @param x3 decimal part of a Real number is not 0
 * @return {Array}
 */
function neuron899(x1, x2, x3)
{
  var outputs = [];
  outputs[0] = x1;
  outputs[1] = x2;
  outputs[2] = x3;

  arr = neuron620(outputs[0]);
  outputs[3] = arr[0];

  arr = neuron724(outputs[0], outputs[3], outputs[1], outputs[2]);
  outputs[4] = arr[0];

  return[outputs[4]];
}


Code made by AI:

Create your family tree for free