Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pystencils
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pycodegen
pystencils
Merge requests
!283
Draft: Remove too many zeros
Code
Review changes
Check out branch
Download
Patches
Plain diff
Closed
Draft: Remove too many zeros
holzer/pystencils:SmallPolish
into
master
Overview
5
Commits
3
Pipelines
3
Changes
1
Closed
Markus Holzer
requested to merge
holzer/pystencils:SmallPolish
into
master
3 years ago
Overview
5
Commits
3
Pipelines
3
Changes
1
Expand
Remove unnecessary from numbers: 1.80000000 --> 1.8
Edited
3 years ago
by
Markus Holzer
0
0
Merge request reports
Compare
master
version 2
a27c182a
3 years ago
version 1
7fcda4a9
3 years ago
master (base)
and
version 1
latest version
2178b66e
3 commits,
3 years ago
version 2
a27c182a
2 commits,
3 years ago
version 1
7fcda4a9
1 commit,
3 years ago
1 file
+
2
−
1
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
pystencils/backends/cbackend.py
+
2
−
1
Options
@@ -453,7 +453,7 @@ class CustomSympyPrinter(CCodePrinter):
def
_print_Rational
(
self
,
expr
):
"""
Evaluate all rationals i.e. print 0.25 instead of 1.0/4.0
"""
res
=
str
(
expr
.
evalf
(
17
))
return
res
return
res
.
rstrip
(
'
0
'
)
def
_print_Equality
(
self
,
expr
):
"""
Equality operator is not printable in default printer
"""
@@ -525,6 +525,7 @@ class CustomSympyPrinter(CCodePrinter):
def
_typed_number
(
self
,
number
,
dtype
):
res
=
self
.
_print
(
number
)
res
=
res
.
rstrip
(
'
0
'
)
if
dtype
.
numpy_dtype
==
np
.
float32
:
return
res
+
'
.0f
'
if
'
.
'
not
in
res
else
res
+
'
f
'
elif
dtype
.
numpy_dtype
==
np
.
float64
:
Loading