• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC SKILL
  3. Is there a function for mathematics constant PI?

Stats

  • Locked Locked
  • Replies 13
  • Subscribers 150
  • Views 36082
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Is there a function for mathematics constant PI?

richardyuan
richardyuan over 12 years ago
what's the expression for π in cadence skill?
  • Cancel

Top Replies

  • ebecheto
    ebecheto over 12 years ago +1
    I usually use: pi=acos(-1);=> 3.141593 Someone has a better idea ?
  • Andrew Beckett
    Andrew Beckett over 12 years ago +1
    defMathConstants() is what you want: > defMathConstants('MyConsts) MyConsts > MyConsts.? (SHRT_MAX SHRT_MIN INT_MAX INT_MIN DBL_MAX DBL_MIN E LOG2E LOG10E LN2 LN10 PI PI_OVER_2 PI_OVER_4 ONE_OVER_PI TWO_OVER_PI…
  • tweeks
    tweeks over 12 years ago +1
    BTW, if SKILL had defconst, I would totally use it. Many of my programs begin this way: (alias defconst defvar) (defconst pi 22/7.) ;; good enough for ancient Egypt
Parents
  • tweeks
    tweeks over 12 years ago

    richardyuan said:
    You're right. No class is instantiated when use defMathConstants. But it behaves like a instance of a class.

    Well, sure, in the sense that it has named fields you can read/write using the dot operator....  But it has no parent class, so no generic function specializers, no reader/writer slot definitions, etc.  So you could just as well say, "it behaves like an instances of a defstruct".

    Just feel not quite comfortable.

    Maybe a little fussy, hah...

    I feel the same, though it's because I'm a functional programmer. :)  It's very odd to have a built-in that stuffs properties on a symbol's property list, even if it lets you specify which symbol.  I'd prefer a stateless interface:

    getMathConstant('pi) => 3.14159.....

    Or (returning a DPL):

    getMathConstants().pi => 3.14159....

    I'm not an object-oriented fan, but I'd even prefer a singleton class with constant attributes, like you suggested.  At least that would be a stateless interface!

    Too many SKILL APIs are unnecessarily stateful.  For example, consider the awful gdm interface for copying Virtuoso cellviews requires stateful calls to create and manipulate a black-boxed "gdmSpecList" object.  You do gdmCreateSpecList() to create one, then you call gdmAddSpecToSpecList() to put things in it, and THEN (this is the nasty part) you need to do gdmNextFromSpecList() to iterate through.  It's like a port on a file: there is an invisible pointer in the gdmSpecList object that you are incrementing when you call gdmNextFromSpecList().  If you want to iterate again, you need to call gdmResetSpecList() to reset the pointer.  Why?  Why not just use normal lists of gdmSpec objects?  Why does this need to be an abstract data type?  Maybe there is a good reason -- perhaps it covers some corner case I haven't thought of.  Even if that is true, it would still be nice to have an optional stateless interface for us functional programmers.  I can roll my own, but it's just annoying.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • tweeks
    tweeks over 12 years ago

    richardyuan said:
    You're right. No class is instantiated when use defMathConstants. But it behaves like a instance of a class.

    Well, sure, in the sense that it has named fields you can read/write using the dot operator....  But it has no parent class, so no generic function specializers, no reader/writer slot definitions, etc.  So you could just as well say, "it behaves like an instances of a defstruct".

    Just feel not quite comfortable.

    Maybe a little fussy, hah...

    I feel the same, though it's because I'm a functional programmer. :)  It's very odd to have a built-in that stuffs properties on a symbol's property list, even if it lets you specify which symbol.  I'd prefer a stateless interface:

    getMathConstant('pi) => 3.14159.....

    Or (returning a DPL):

    getMathConstants().pi => 3.14159....

    I'm not an object-oriented fan, but I'd even prefer a singleton class with constant attributes, like you suggested.  At least that would be a stateless interface!

    Too many SKILL APIs are unnecessarily stateful.  For example, consider the awful gdm interface for copying Virtuoso cellviews requires stateful calls to create and manipulate a black-boxed "gdmSpecList" object.  You do gdmCreateSpecList() to create one, then you call gdmAddSpecToSpecList() to put things in it, and THEN (this is the nasty part) you need to do gdmNextFromSpecList() to iterate through.  It's like a port on a file: there is an invisible pointer in the gdmSpecList object that you are incrementing when you call gdmNextFromSpecList().  If you want to iterate again, you need to call gdmResetSpecList() to reset the pointer.  Why?  Why not just use normal lists of gdmSpec objects?  Why does this need to be an abstract data type?  Maybe there is a good reason -- perhaps it covers some corner case I haven't thought of.  Even if that is true, it would still be nice to have an optional stateless interface for us functional programmers.  I can roll my own, but it's just annoying.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2026 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information