Ad Space — Top Banner

Bad Argument Type

HP HP Calculator

Severity: Minor

What Does This Error Mean?

Bad Argument Type means you passed the wrong type of object to a function. For example, giving a string to a math function or a number to a string function. Check that your arguments are the correct type (number, list, matrix, string).

Affected Models

  • HP 50g
  • HP Prime
  • HP 48GX

Common Causes

  • Passing a string where a number is expected
  • Passing a real number where a complex is expected
  • Passing a list where a single value is needed
  • Mixing types in a calculation (adding a number to a string)

How to Fix It

  1. Check what type of argument the function expects.

    Press the function's help (if available) or check the manual. Most math functions expect real or complex numbers.

  2. Convert the argument to the correct type.

    String to number: use STR→ or OBJ→. Number to string: use →STR.

  3. Check the stack for unexpected object types (HP 50g RPN).

    In RPN mode, check what is on the stack before applying a function. The wrong object type on the stack causes this error.

Frequently Asked Questions

How do I check the type of an object on the stack?

On the HP 50g: TYPE function returns the type number. 0=real, 1=complex, 2=string, 5=list, etc.

Can I add a number and a string on the HP?

Not directly. You must convert one: either the number to a string (→STR) or the string to a number (STR→).