Skip to content

fix bug in zshape and sshape FMs code generation #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading