Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

- JMP User Community
- :
- Discussions
- :
- Is there a function for a NAND logical operator?

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Jul 15, 2020 4:01 PM
(428 views)

I'm trying to make a simple formula with a NAND operator in a script. Is there a quick way to do it or do I need to chain together a bunch of NOT and AND operators to combine into one?

1 ACCEPTED SOLUTION

Accepted Solutions

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

I just realized this a dumb question, and put a not() around my and statement.

2 REPLIES 2

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

I just realized this a dumb question, and put a not() around my and statement.

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Is there a function for a NAND logical operator?

JMP has **and**() and **all**() functions that are roughly equivalent, and **or**() and **any**() functions that are roughly equivalent. writing *and(a,b,c)* is the same as *a & b & c* . There is also a **not()** function that is the same as ! .

```
// definitions from wikipedia...
// NAND: a Boolean operator which gives the value zero if and only if
// all the operands have a value of one, and otherwise has a value of
// one (equivalent to NOT AND).
Show( !And( 1, 1, 1, 1, 0, 1, 1, 1 ) ); // 1
Show( Not( And( 1, 1, 1, 1, 1, 1, 1, 1 ) ) ); // 0
Show( !(1 & 1 & 1) ); // 0
// ALL() and AND() are similar, as are ANY() and OR()
Show( All( [1 1 1] ) ); // 1
Show( All( [1 0 1] ) ); // 0
Show( Any( [0 1 0] ) ); // 1
Show( Any( [0 0 0] ) ); // 0
// XOR: XOR gate (sometimes EOR, or EXOR and pronounced as
// Exclusive OR) is a digital logic gate that gives a true
// (1 or HIGH) output when the number of true inputs is odd.
//
// this one needs to promise only 1s and 0s for inputs
// because it is adding up the 1s to count them.
Show( Mod( Sum( 0, 0, 0, 0, 0, 0 ), 2 ) ); // 0
Show( Mod( Sum( 1, 1, 1, 1, 1, 1 ), 2 ) ); // 0
Show( Mod( Sum( 1, 1, 1, 0, 1, 1 ), 2 ) ); // 1
Show( Mod( Sum( 1, 1, 1, 1, 1, 1, 1 ), 2 ) ); // 1
Show( Mod( Sum( 1, 1, 1 ), 2 ) ); // 1
Show( Mod( Sum( 1, 0, 1 ), 2 ) ); // 0
Show( Mod( Sum( 0, 0 ), 2 ) ); // 0
Show( Mod( Sum( 0, 1 ), 2 ) ); // 1
Show( Mod( Sum( 1, 0 ), 2 ) ); // 1
Show( Mod( Sum( 1, 1 ), 2 ) ); // 0
```

Craige