Skip to content

Commit

Permalink
fix bug in zshape and sshape FMs code generation (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaferranti authored Sep 18, 2024
1 parent 36ebf5f commit 3da057e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "FuzzyLogic"
uuid = "271df9f8-4390-4196-9d4f-bdd0b67035b3"
authors = ["Luca Ferranti"]
version = "0.1.2"
version = "0.1.3"

[deps]
Dictionaries = "85a47980-9c8c-11e8-2b9f-f7ca1fa99fb4"
Expand Down
1 change: 1 addition & 0 deletions docs/src/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## Unreleased

- ![](https://img.shields.io/badge/bugfix-purple.svg) fix bug in Julia code generation of ZShape and SShape mf
- ![](https://img.shields.io/badge/bugfix-purple.svg) disallow implicit conversion from interval to float
- ![](https://img.shields.io/badge/new%20feature-green.svg) added semi-elliptic and singleton membership functions
- ![](https://img.shields.io/badge/new%20feature-green.svg) added `gensurf` to plot generating surface
Expand Down
4 changes: 2 additions & 2 deletions src/tojulia.jl
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ end

function to_expr(s::SShapeMF, x = :x)
:(if $x <= $(s.a)
zero(float($(typeof(x))))
zero(float(typeof($x)))
elseif $x >= $(s.b)
one(float(typeof($x)))
elseif $x >= $((s.a + s.b) / 2)
Expand All @@ -172,7 +172,7 @@ end

function to_expr(mf::ZShapeMF, x = :x)
:(if $x <= $(mf.a)
one(float($(typeof(x))))
one(float(typeof($x)))
elseif $x >= $(mf.b)
zero(float(typeof($x)))
elseif $x >= $((mf.a + mf.b) / 2)
Expand Down

2 comments on commit 3da057e

@lucaferranti
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/115447

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.3 -m "<description of version>" 3da057e680951a7f4a57607b4cb37853552f9556
git push origin v0.1.3

Please sign in to comment.